Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jet.editor/src/org')
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/Activator.java82
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETDocumentReader.java79
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETEditor.java140
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETEditorHelper.java455
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETSourceViewer.java106
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextEditor.java449
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextPreviewViewer.java203
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/actions/SetContentColorerAction.java75
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETAnnotationHover.java140
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETAnnotationModel.java64
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETProblemAnnotation.java33
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/autoedit/JETTemplateAutoEditStrategy.java276
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/DoubleClickStrategy.java122
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/IJETColorConstants.java27
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETDocumentProvider.java60
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETEditorPreferenceConstants.java105
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETReconcilingStrategy.java111
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETSourceViewerConfiguration.java122
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETTokenStyleManager.java160
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETWhitespaceDetector.java20
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/NonRuleBasedDamagerRepairer.java148
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/IJETDefaultTextColorerDelegate.java21
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/java/JavaContentPartitionConfigurationDelegate.java123
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/xml/XMLContentPartitionConfigurationDelegate.java166
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/AbstractJETAssistProcessor.java27
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/AbstractXMLTagsBasedAssistProcessor.java165
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETCustomTagAssistProcessor.java110
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETDirectiveAssistProcessor.java55
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaDeclarationAssistProcessor.java86
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaExpressionAssistProcessor.java93
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaScriptletAssistProcessor.java87
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETTagAssistProcessor.java57
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETCustomTagFormattingStrategy.java44
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETDirectiveFormattingStrategy.java44
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaDeclarationFormattingStrategy.java44
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaExpressionFormattingStrategy.java44
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaScriptletFormattingStrategy.java44
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/i18n/TextEditorMessages.properties1
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlineContentProvider.java187
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlineLabelProvider.java155
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlinePage.java47
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/ITokenScannerProvider.java18
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/JETDocumentPartitionScanner.java375
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/PartitionScannerBasedDamagerRepairer.java151
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTElementScannerRule.java52
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETCommentRule.java27
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETCustomTagRule.java28
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETDirectiveRule.java27
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaDeclarationRule.java27
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaExpressionRule.java27
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaScriptletRule.java27
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETBracketRule.java76
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETCommentRule.java20
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETCustomTagRule.java88
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETDirectiveRule.java20
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaDeclarationRule.java20
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaExpressionRule.java20
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaScriptletRule.java20
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/WordListDetectorRule.java55
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETCommentScanner.java29
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETCustomTagScanner.java79
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETDefaultContentScanner.java22
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETDirectiveScanner.java71
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaCodeScanner.java251
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaDeclarationScanner.java44
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaExpressionScanner.java51
-rw-r--r--plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaScriptletScanner.java45
67 files changed, 0 insertions, 6247 deletions
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/Activator.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/Activator.java
deleted file mode 100644
index 0db1e31..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/Activator.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.jet.internal.editor";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-
- /**
- * Log an exception in Eclipse's logger with this plugin ID
- * @param e
- */
- public static void log(Exception e) {
- IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e);
- getDefault().getLog().log(status);
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETDocumentReader.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETDocumentReader.java
deleted file mode 100644
index 49388d9..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETDocumentReader.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-/**
- * @author jcheuoua
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code Generation>Code
- * and Comments
- * @version $Revision: 1.2 $
- */
-public class JETDocumentReader {
- public static final int EOF = -1;
-
- private IDocument document;
-
- private int offset;
-
- /**
- * Constructor for JETDocumentReader.
- *
- * @param document
- * IDocument
- * @param documentOffset
- * int
- */
- public JETDocumentReader(IDocument document, int documentOffset) {
- this.document = null;
- offset = -1;
- if (documentOffset > 0)
- offset = documentOffset;
- this.document = document;
- }
-
- /**
- * Method readForward.
- *
- * @return char
- */
- public char readForward() {
- try {
- if (document.getChar(offset) == '\uFFFF') {
- return '\uFFFF';
- } else {
- offset++;
- return document.getChar(offset);
- }
- } catch (BadLocationException ex) {
- return '\uFFFF';
- }
- }
-
- /**
- * Method readBackward.
- *
- * @return char
- */
- public char readBackward() {
- if (offset <= 0)
- return '\uFFFF';
- try {
- offset--;
- return document.getChar(offset);
- } catch (BadLocationException e) {
- return '\uFFFF';
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETEditor.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETEditor.java
deleted file mode 100644
index e7023e1..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETEditor.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.ide.IGotoMarker;
-import org.eclipse.ui.part.MultiPageSelectionProvider;
-import org.eclipse.ui.texteditor.IStatusField;
-import org.eclipse.ui.texteditor.ITextEditorExtension;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-
-public class JETEditor extends FormEditor implements ITextEditorExtension, IMenuListener, IGotoMarker {
-
- public static final String ID = "org.eclipse.jet.internal.editor";
- public static final String copyright = "(c) 2006 Joel Cheuoua & Contributors";
- protected IStatusLineManager contentOutlineStatusLineManager;
- protected TreeViewer contentOutlineViewer;
- protected PropertySheetPage propertySheetPage;
- protected ISelectionChangedListener selectionChangedListener;
- protected JETTextEditor jetTextEditor;
-
- public JETEditor() {
- jetTextEditor = new JETTextEditor();
- }
-
- public JETTextEditor getJetTextEditor() {
- return jetTextEditor;
- }
-
- public void addPages() {
- try {
- int pageIndex = addPage(jetTextEditor, getEditorInput());
- setPageText(pageIndex, "Edition");
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- Viewer viewer = new JETTextPreviewViewer(getContainer());
- viewer.setInput(getEditorInput());
- int pageIndex = addPage(viewer.getControl());
- setPageText(pageIndex, "Preview");
- }
-
- public Object getAdapter(Class key) {
- if (key.equals(IContentOutlinePage.class))
- return jetTextEditor.getAdapter(key);
- if (key.equals(IPropertySheetPage.class))
- return getPropertySheetPage();
- if (key.equals(IGotoMarker.class))
- return this;
- else
- return super.getAdapter(key);
- }
-
- public IPropertySheetPage getPropertySheetPage() {
- return propertySheetPage;
- }
-
- public boolean isDirty() {
- return jetTextEditor != null && jetTextEditor.isDirty();
- }
-
- public void doSave(IProgressMonitor progressMonitor) {
- if (jetTextEditor != null)
- jetTextEditor.doSave(progressMonitor);
- }
-
- public boolean isSaveAsAllowed() {
- if (jetTextEditor != null)
- return jetTextEditor.isSaveAsAllowed();
- else
- return true;
- }
-
- public void doSaveAs() {
- if (jetTextEditor != null)
- jetTextEditor.doSaveAs();
- }
-
- public void gotoMarker(IMarker marker) {
- if (jetTextEditor != null) {
- IGotoMarker gotoMarker = (IGotoMarker) jetTextEditor.getAdapter(IGotoMarker.class);
- if (gotoMarker != null)
- gotoMarker.gotoMarker(marker);
- }
- }
-
- public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
- setSite(site);
- setInput(editorInput);
- jetTextEditor.init(site, editorInput);
- setPartName(editorInput.getName());
- site.setSelectionProvider(new MultiPageSelectionProvider(this));
- }
-
- public void menuAboutToShow(IMenuManager menuManager) {
- ((IMenuListener) getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
- }
-
- public void dispose() {
- if (jetTextEditor != null)
- jetTextEditor.dispose();
- super.dispose();
- }
-
- public void setStatusField(IStatusField field, String category) {
- if (jetTextEditor != null)
- jetTextEditor.setStatusField(field, category);
- }
-
- public boolean isEditorInputReadOnly() {
- if (jetTextEditor != null)
- jetTextEditor.isEditorInputReadOnly();
- return false;
- }
-
- public void addRulerContextMenuListener(IMenuListener listener) {
- if (jetTextEditor != null)
- jetTextEditor.addRulerContextMenuListener(listener);
- }
-
- public void removeRulerContextMenuListener(IMenuListener listener) {
- if (jetTextEditor != null)
- jetTextEditor.removeRulerContextMenuListener(listener);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETEditorHelper.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETEditorHelper.java
deleted file mode 100644
index 2adf8c1..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETEditorHelper.java
+++ /dev/null
@@ -1,455 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IProblemRequestor;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.WorkingCopyOwner;
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.core.eval.IEvaluationContext;
-import org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal;
-import org.eclipse.jdt.ui.text.java.CompletionProposalCollector;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
-import org.eclipse.jet.compiler.CompileOptionsManager;
-import org.eclipse.jet.core.compiler.JETCompilerOptions;
-import org.eclipse.jet.core.parser.ProblemSeverity;
-import org.eclipse.jet.core.parser.ast.JETASTElement;
-import org.eclipse.jet.core.parser.ast.JETCompilationUnit;
-import org.eclipse.jet.core.parser.ast.JavaDeclaration;
-import org.eclipse.jet.core.parser.ast.JavaExpression;
-import org.eclipse.jet.core.parser.ast.JavaScriptlet;
-import org.eclipse.jet.core.parser.ast.Problem;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Position;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.IFileEditorInput;
-
-/**
- * Helper class for code completion and JET compilation unit processing purposespurposes
- * @author Joel
- *
- */
-public class JETEditorHelper {
- /**
- * Problem requestor for java expressions of the JET template
- * @author Joel
- *
- */
- private static final class JETJavaContentProblemRequestor implements IProblemRequestor {
-
- /**
- * The JET problems computed from the java problems
- */
- private List problems;
-
- /**
- * The problems collected from the compiled java source
- */
- private List javaProblems;
-
- /**
- * The jet source
- */
- private IDocument jetDocument;
-
- private Map mappingPositions;
-
- private JETJavaContentProblemRequestor(List problems, Map mappings, IDocument jetDocument) {
- this.problems = problems;
- mappingPositions = mappings;
- javaProblems = new ArrayList();
- this.jetDocument = jetDocument;
- }
-
- /**
- * @return
- */
- public List getProblems() {
- return problems;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.core.IProblemRequestor#acceptProblem(org.eclipse.jdt.core.compiler.IProblem)
- */
- public void acceptProblem(IProblem problem) {
- javaProblems.add(problem);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.core.IProblemRequestor#beginReporting()
- */
- public void beginReporting() {
- javaProblems.clear();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.core.IProblemRequestor#endReporting()
- */
- public void endReporting() {
- Problem problem;
- // walk through the java problems collected from the generated java source and create the
- // corresponding JET problems in the JET source using the position mappings
- for (Iterator iter = javaProblems.iterator(); iter.hasNext(); ) {
- IProblem javaProblem = (IProblem) iter.next();
-
- int javaProblemOffset = javaProblem.getSourceStart();
- int problemLength = (javaProblem.getSourceEnd() - javaProblemOffset) + 1;
-
- // Retrieve the corresponding JET AST Element and its position in the JET source
- JETASTElement astElement = getElementForJavaOffset(javaProblemOffset);
- Position pos = (Position) mappingPositions.get(astElement);
-
- // jetOffset =
- // start position of the AST element in JET Code +
- // offset till the position delimited by the javaProblemOffset
- // The offset till the position delimited by the javaProblemOffset
- // depends on the starting offset of the java content in the JET AST element.
- // This is due to the fact that the JET AST element first position does not represents the starting offset of
- // offset of its java content.
-
- int astElementJavaContentStart = pos == null ? -1 : pos.getOffset();
- int jetOffset = pos == null ? 0 : JETEditorHelper.getASTElementContentStart(astElement, jetDocument) + (javaProblemOffset - astElementJavaContentStart);
-
- // Create the problem at the specified location
- URI baseLocation = URI.create("");
- problem = new Problem(baseLocation,
- "",
- javaProblem.isWarning() ? ProblemSeverity.WARNING : ProblemSeverity.ERROR,
- -1,
- javaProblem.getMessage(),
- javaProblem.getArguments(),
- jetOffset,
- jetOffset + problemLength,
- -1,
- -1);
- // add the problem to the problems list
- problems.add(problem);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.core.IProblemRequestor#isActive()
- */
- public boolean isActive() {
- return true;
- }
-
- /**
- * Find the JET AST element that matches the given java offset in
- * the generated java template source
- * @param javaOffset
- * @return
- */
- private JETASTElement getElementForJavaOffset(int javaOffset) {
- for (Iterator iterator = mappingPositions.keySet().iterator(); iterator.hasNext();) {
- JETASTElement element = (JETASTElement) iterator.next();
- Position pos = (Position) mappingPositions.get(element);
- if (pos.getOffset() <= javaOffset && javaOffset < pos.getOffset() + pos.getLength())
- return element;
- }
- return null;
- }
- } // End class JETJavaContentProblemRequestor
-
- /**
- * @param astElement
- * @param jetDocument
- * @return
- */
- public static int getASTElementContentStart(JETASTElement astElement, IDocument jetDocument) {
- int jetStart = astElement.getStart();
- if (astElement instanceof JavaDeclaration)
- jetStart += 3;
- if ((astElement instanceof JavaExpression) || (astElement instanceof JavaScriptlet))
- try {
- String jetSnippet = jetDocument.get(jetStart, astElement.getEnd() - jetStart);
- String javaContent = (astElement instanceof JavaExpression) ? ((JavaExpression) astElement).getJavaContent()
- : ((JavaScriptlet) astElement).getJavaContent();
- int idx = jetSnippet.indexOf(javaContent);
- jetStart += idx;
- } catch (BadLocationException e) {
- Activator.log(e);
- }
- return jetStart;
- }
-
- public static boolean checkOffsetPositions(String javaSource, String jetSource, int jetOffset, int javaOffset, int checkDepth) {
- boolean result = false;
-
- String javaCheckString = javaSource.substring(javaOffset, Math.min(javaSource.length(), javaOffset + checkDepth));
- String jetCheckString = jetSource.substring(jetOffset, Math.min(jetSource.length(), jetOffset + checkDepth));
- result = javaCheckString.compareTo(jetCheckString) == 0;
- if (!result) {
- System.err.println("position matching error");
- System.err.println("JET Check String : " + jetCheckString);
- System.err.println("Java Check String : " + javaCheckString);
- }
- return result;
- }
-
- /**
- * @param jetEditor
- * @param cu
- * @param jetDocument
- * @return
- */
- public static List evaluateProblems(JETTextEditor jetEditor, IDocument jetDocument) {
- JETCompilationUnit cu = jetEditor.requestCompilationUnit();
- String packageName = cu.getOutputJavaPackage();
- String className = cu.getOutputJavaClassName();
- List problems = new ArrayList();
- if (packageName == null || className == null)
- return problems;
- Map mappingPositions = new HashMap();
- String javaSource = jetEditor.compilationHelper().getJavaCode(cu, mappingPositions);
- JETJavaContentProblemRequestor problemRequestor =
- new JETJavaContentProblemRequestor(problems,
- mappingPositions,
- jetDocument);
- try {
- ICompilationUnit compilationUnit = null;
- IJavaProject javaProject = jetEditor.getJavaProject();
- IPackageFragmentRoot roots[] = javaProject.getPackageFragmentRoots();
- for (int i = 0; i < roots.length;) {
- IPackageFragmentRoot root = roots[i];
- IPackageFragment packageFragment = root.getPackageFragment(packageName);
- if (packageFragment == null || !packageFragment.exists())
- packageFragment = root.createPackageFragment(packageName, true, new NullProgressMonitor());
- compilationUnit = packageFragment.createCompilationUnit(
- (new StringBuilder(String.valueOf(className))).append(".java").toString(),
- javaSource,
- true,
- new NullProgressMonitor());
- break;
- }
- WorkingCopyOwner owner = new WorkingCopyOwner() {};
- ICompilationUnit copy = compilationUnit.getWorkingCopy(owner, problemRequestor, null);
- copy.reconcile(0, true, owner, null);
- } catch (JavaModelException e) {
- Activator.log(e);
- }
- return problems;
- }
-
- /**
- * @param javaProject
- * @param cu
- * @param codeSnippet
- * @param offset
- * @return
- */
- public static CompletionProposalCollector collect(IJavaProject javaProject, JETCompilationUnit cu,
- String codeSnippet, int offset) {
- IEvaluationContext context;
- CompletionProposalCollector proposalCollector;
- context = javaProject.newEvaluationContext();
- List importList = new ArrayList();
- importList.addAll(cu.getImports());
- importList.add("org.eclipse.jet.JET2Context");
- importList.add("org.eclipse.jet.JET2Template");
- importList.add("org.eclipse.jet.JET2Writer");
- importList.add("org.eclipse.jet.taglib.RuntimeTagElement");
- importList.add("org.eclipse.jet.taglib.TagInfo");
- String imports[] = new String[importList.size()];
- importList.toArray(imports);
- String packageName = cu.getOutputJavaPackage();
- if (packageName == null) {
- Map options = CompileOptionsManager.getOptions(javaProject.getProject());
- if (options.isEmpty())
- options = JETCompilerOptions.getDefaultCompilerOptions();
- packageName = (String) options.get("org.eclipse.jet.compiledTemplatePackage");
- }
- context.setPackageName(packageName);
- context.setImports(imports);
- proposalCollector = new CompletionProposalCollector(javaProject);
- try {
- context.codeComplete(codeSnippet, offset, proposalCollector);
- return proposalCollector;
- } catch (JavaModelException e) {
- Activator.log(e);
- }
- return null;
- }
-
- /**
- * @param editor
- * @param viewer
- * @param completionOffset
- * @return
- */
- public static IJavaCompletionProposal[] getJavaCompletionProposal(JETTextEditor jetEditor, ITextViewer viewer,
- int completionOffset) {
- IJavaProject javaProject;
- String packageName;
- String className;
- Map mappingPositions;
- IDocument javaDocument;
- JETCompilationUnit cu = jetEditor.requestCompilationUnit();
- javaProject = jetEditor.getJavaProject();
- packageName = cu.getOutputJavaPackage();
- className = cu.getOutputJavaClassName();
- if (packageName == null) {
- Map options = CompileOptionsManager.getOptions(javaProject.getProject());
- if (options.isEmpty())
- options = JETCompilerOptions.getDefaultCompilerOptions();
- packageName = (String) options.get("org.eclipse.jet.compiledTemplatePackage");
- }
- if (className == null && (jetEditor.getEditorInput() instanceof IFileEditorInput)) {
- IFile file = ((IFileEditorInput) jetEditor.getEditorInput()).getFile();
- String inputName = file.getFullPath().removeFileExtension().lastSegment();
- String baseClassName = makeJavaClassName(inputName);
- className = baseClassName;
- }
- if (packageName == null || className == null)
- return new IJavaCompletionProposal[0];
- mappingPositions = new HashMap();
- javaDocument = new Document(jetEditor.compilationHelper().getJavaCode(cu, mappingPositions));
- IJavaCompletionProposal results[];
- ICompilationUnit compilationUnit = null;
- try {
- IPackageFragmentRoot roots[] = javaProject.getPackageFragmentRoots();
- for (int i = 0; i < roots.length;) {
- IPackageFragmentRoot root = roots[i];
- IPackageFragment packageFragment = root.getPackageFragment(packageName);
- if (packageFragment == null || !packageFragment.exists())
- packageFragment = root.createPackageFragment(packageName, true, new NullProgressMonitor());
- compilationUnit = packageFragment.createCompilationUnit((new StringBuilder(String.valueOf(className))).append(
- ".java").toString(), javaDocument.get(), true, new NullProgressMonitor());
- break;
- }
-
- CompletionProposalCollector proposalCollector = new CompletionProposalCollector(compilationUnit);
- JETASTElement astElement = jetEditor.getASTElement(completionOffset);
- Position javaPosition = (Position) mappingPositions.get(astElement);
- int jetStart = getASTElementContentStart(astElement, viewer.getDocument());
- int javaStart = javaPosition.getOffset();
- int javaCompletionOffset = javaStart + (completionOffset - jetStart);
- compilationUnit.codeComplete(javaCompletionOffset, proposalCollector);
- Point selection = viewer.getSelectedRange();
- if (selection.y > 0)
- proposalCollector.setReplacementLength(selection.y);
- IJavaCompletionProposal javaProposals[] = proposalCollector.getJavaCompletionProposals();
- IJavaCompletionProposal keywordsProposals[] = proposalCollector.getKeywordCompletionProposals();
- IJavaCompletionProposal unsortedJavaProposals[] = new IJavaCompletionProposal[javaProposals.length
- + keywordsProposals.length];
- System.arraycopy(keywordsProposals, 0, unsortedJavaProposals, 0, keywordsProposals.length);
- System.arraycopy(javaProposals, 0, unsortedJavaProposals, keywordsProposals.length, javaProposals.length);
- List sortedJavaProposals = new LinkedList();
- for (int i = 0; i < unsortedJavaProposals.length; i++) {
- IJavaCompletionProposal unsortedJavaProposal = unsortedJavaProposals[i];
- int index = 0;
- for (Iterator iterator = sortedJavaProposals.iterator(); iterator.hasNext();) {
- IJavaCompletionProposal proposal = (IJavaCompletionProposal) iterator.next();
- if (proposal.getRelevance() <= unsortedJavaProposal.getRelevance()) {
- index = sortedJavaProposals.indexOf(proposal);
- break;
- }
- }
-
- sortedJavaProposals.add(index, unsortedJavaProposal);
- }
-
- results = new IJavaCompletionProposal[sortedJavaProposals.size()];
- sortedJavaProposals.toArray(results);
- adjustResults(results, completionOffset);
- return results;
- } catch (JavaModelException e) {
- Activator.log(e);
- }
- return new IJavaCompletionProposal[0];
- }
-
- /**
- * @param javaProject
- * @param cu
- * @param codeSnippet
- * @param viewer
- * @param offset
- * @return
- */
- public static IJavaCompletionProposal[] getJavaCompletionProposal(IJavaProject javaProject, JETCompilationUnit cu,
- String codeSnippet, ITextViewer viewer, int offset) {
- CompletionProposalCollector proposalCollector = collect(javaProject, cu, codeSnippet, offset);
- if (proposalCollector != null) {
- Point selection = viewer.getSelectedRange();
- if (selection.y > 0)
- proposalCollector.setReplacementLength(selection.y);
- IJavaCompletionProposal javaProposals[] = proposalCollector.getJavaCompletionProposals();
- IJavaCompletionProposal keywordsProposals[] = proposalCollector.getKeywordCompletionProposals();
- IJavaCompletionProposal unsortedJavaProposals[] = new IJavaCompletionProposal[javaProposals.length
- + keywordsProposals.length];
- System.arraycopy(keywordsProposals, 0, unsortedJavaProposals, 0, keywordsProposals.length);
- System.arraycopy(javaProposals, 0, unsortedJavaProposals, keywordsProposals.length, javaProposals.length);
- List sortedJavaProposals = new LinkedList();
- for (int i = 0; i < unsortedJavaProposals.length; i++) {
- IJavaCompletionProposal unsortedJavaProposal = unsortedJavaProposals[i];
- int index = 0;
- for (Iterator iterator = sortedJavaProposals.iterator(); iterator.hasNext();) {
- IJavaCompletionProposal proposal = (IJavaCompletionProposal) iterator.next();
- if (proposal.getRelevance() <= unsortedJavaProposal.getRelevance()) {
- index = sortedJavaProposals.indexOf(proposal);
- break;
- }
- }
- sortedJavaProposals.add(index, unsortedJavaProposal);
- }
-
- IJavaCompletionProposal results[] = new IJavaCompletionProposal[sortedJavaProposals.size()];
- sortedJavaProposals.toArray(results);
- return results;
- } else {
- return new IJavaCompletionProposal[0];
- }
- }
-
- /**
- * @param results
- * @param offset
- */
- public static void adjustResults(IJavaCompletionProposal[] results, int offset) {
- for (int i = 0; i < results.length; i++)
- if (results[i] instanceof AbstractJavaCompletionProposal) {
- AbstractJavaCompletionProposal proposal = (AbstractJavaCompletionProposal) results[i];
- proposal.setReplacementOffset(offset);
- }
- }
-
- /**
- * @param name
- * @return
- */
- public static String makeJavaClassName(String name) {
- StringBuffer result = new StringBuffer("_jet_");
- for (int i = 0; i < name.length(); i++) {
- char c = name.charAt(i);
- if (Character.isJavaIdentifierPart(c))
- result.append(c);
- }
- return result.toString();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETSourceViewer.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETSourceViewer.java
deleted file mode 100644
index 0101961..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETSourceViewer.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.text.source.IOverviewRuler;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.projection.ProjectionViewer;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-public class JETSourceViewer extends ProjectionViewer implements IPropertyChangeListener {
-
- private IPreferenceStore preferenceStore;
- private Color foregroundColor;
- private Color backgroundColor;
- private Color selectionForegroundColor;
- private Color selectionBackgroundColor;
-
- public JETSourceViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler,
- boolean showsAnnotationOverview, int styles, IPreferenceStore store) {
- super(parent, ruler, overviewRuler, showsAnnotationOverview, styles);
- setPreferenceStore(store);
- }
-
- public void setPreferenceStore(IPreferenceStore store) {
- if (preferenceStore != null)
- preferenceStore.removePropertyChangeListener(this);
- preferenceStore = store;
- if (preferenceStore != null) {
- preferenceStore.addPropertyChangeListener(this);
- initializeViewerColors();
- }
- }
-
- private void initializeViewerColors() {
- if (preferenceStore != null) {
- StyledText styledText = getTextWidget();
- if (styledText == null || styledText.isDisposed())
- return;
- Color color = preferenceStore.getBoolean("AbstractTextEditor.Color.Foreground.SystemDefault") ? null
- : createColor(preferenceStore, "AbstractTextEditor.Color.Foreground", styledText.getDisplay());
- styledText.setForeground(color);
- if (foregroundColor != null)
- foregroundColor.dispose();
- foregroundColor = color;
- color = preferenceStore.getBoolean("AbstractTextEditor.Color.Background.SystemDefault") ? null : createColor(
- preferenceStore, "AbstractTextEditor.Color.Background", styledText.getDisplay());
- styledText.setBackground(color);
- if (backgroundColor != null)
- backgroundColor.dispose();
- backgroundColor = color;
- color = preferenceStore.getBoolean("AbstractTextEditor.Color.SelectionForeground.SystemDefault") ? null
- : createColor(preferenceStore, "AbstractTextEditor.Color.SelectionForeground", styledText.getDisplay());
- styledText.setSelectionForeground(color);
- if (selectionForegroundColor != null)
- selectionForegroundColor.dispose();
- selectionForegroundColor = color;
- color = preferenceStore.getBoolean("AbstractTextEditor.Color.SelectionBackground.SystemDefault") ? null
- : createColor(preferenceStore, "AbstractTextEditor.Color.SelectionBackground", styledText.getDisplay());
- styledText.setSelectionBackground(color);
- if (selectionBackgroundColor != null)
- selectionBackgroundColor.dispose();
- selectionBackgroundColor = color;
- }
- }
-
- private Color createColor(IPreferenceStore store, String key, Display display) {
- org.eclipse.swt.graphics.RGB rgb = null;
- if (store.contains(key)) {
- if (store.isDefault(key))
- rgb = PreferenceConverter.getDefaultColor(store, key);
- else
- rgb = PreferenceConverter.getColor(store, key);
- if (rgb != null)
- return new Color(display, rgb);
- }
- return null;
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if ("AbstractTextEditor.Color.Foreground".equals(property)
- || "AbstractTextEditor.Color.Foreground.SystemDefault".equals(property)
- || "AbstractTextEditor.Color.Background".equals(property)
- || "AbstractTextEditor.Color.Background.SystemDefault".equals(property)
- || "AbstractTextEditor.Color.SelectionForeground".equals(property)
- || "AbstractTextEditor.Color.SelectionForeground.SystemDefault".equals(property)
- || "AbstractTextEditor.Color.SelectionBackground".equals(property)
- || "AbstractTextEditor.Color.SelectionBackground.SystemDefault".equals(property))
- initializeViewerColors();
- }
-} \ No newline at end of file
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
deleted file mode 100644
index f8c5f14..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextEditor.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jet.core.parser.ast.Comment;
-import org.eclipse.jet.core.parser.ast.IncludedContent;
-import org.eclipse.jet.core.parser.ast.JETASTElement;
-import org.eclipse.jet.core.parser.ast.JETASTVisitor;
-import org.eclipse.jet.core.parser.ast.JETCompilationUnit;
-import org.eclipse.jet.core.parser.ast.JETDirective;
-import org.eclipse.jet.core.parser.ast.JavaDeclaration;
-import org.eclipse.jet.core.parser.ast.JavaExpression;
-import org.eclipse.jet.core.parser.ast.JavaScriptlet;
-import org.eclipse.jet.core.parser.ast.TextElement;
-import org.eclipse.jet.core.parser.ast.XMLBodyElement;
-import org.eclipse.jet.core.parser.ast.XMLBodyElementEnd;
-import org.eclipse.jet.core.parser.ast.XMLEmptyElement;
-import org.eclipse.jet.internal.compiler.CompilationHelper;
-import org.eclipse.jet.internal.editor.configuration.JETDocumentProvider;
-import org.eclipse.jet.internal.editor.configuration.JETEditorPreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETSourceViewerConfiguration;
-import org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager;
-import org.eclipse.jet.internal.editor.configuration.delegates.IJETDefaultTextColorerDelegate;
-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;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.projection.ProjectionSupport;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.editors.text.IEncodingSupport;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.texteditor.ContentAssistAction;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.osgi.framework.Bundle;
-
-/**
- * The editor for JET templates files
- * @author Joel
- */
-public class JETTextEditor extends TextEditor {
-
- private JETTokenStyleManager tokenStyleManager;
-
- private JETSourceViewer sourceViewer;
-
- private JETDocumentPartitionScanner partitionScanner;
-
- private ProjectionSupport projectionSupport;
-
- private IContentOutlinePage outlinePage;
-
- private JETCompilationUnit cUnit;
-
- private IProject project;
-
- private Map positions;
-
- private boolean cUnitInvalidated;
-
- private ArrayList defaultContentColorerDelegates;
-
- private IJETDefaultTextColorerDelegate currentDelegate;
-
- /**
- * Creates a new JET editor
- */
- public JETTextEditor() {
- positions = Collections.EMPTY_MAP;
- IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
- JETEditorPreferenceConstants.initializeDefaultValues(preferenceStore);
- setPreferenceStore(preferenceStore);
- tokenStyleManager = new JETTokenStyleManager(preferenceStore);
- partitionScanner = new JETDocumentPartitionScanner(this);
- setSourceViewerConfiguration(new JETSourceViewerConfiguration(this));
- setDocumentProvider(new JETDocumentProvider(this));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.editors.text.TextEditor#dispose()
- */
- public void dispose() {
- tokenStyleManager.dispose();
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
- */
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- if (input instanceof IFileEditorInput)
- project = ((IFileEditorInput) input).getFile().getProject();
- super.init(site, input);
- initDefaultContentColorerDelegetes();
- if (!defaultContentColorerDelegates.isEmpty())
- currentDelegate = (IJETDefaultTextColorerDelegate) defaultContentColorerDelegates.get(0);
- }
-
- /**
- * Set the content colorer delegate (used for syntax coloring of non JET text) to use.
- * @param delegate
- */
- public void setCurrentColorerDelegate(IJETDefaultTextColorerDelegate delegate) {
- currentDelegate = delegate;
- // notify the damager repairers so that they recompute the partitions and the tokens to colorize
- partitionScanner.updateJETTextContentDamagerRepairer();
- // reset the text display
- if (isDirty())
- getSourceViewer().getDocument().set(getSourceViewer().getDocument().get());
- else
- setInput(getEditorInput());
- }
-
- /**
- * Returns the content colorer delegate (used for syntax coloring of non JET text) in use.
- * @return the content colorer delegate
- */
- public IJETDefaultTextColorerDelegate getCurrentColorerDelegate() {
- return currentDelegate;
- }
-
- /**
- * Returns the list of all the available (registered) content colorer delegates.
- * @return
- */
- public IJETDefaultTextColorerDelegate[] getColorerDelegates() {
- IJETDefaultTextColorerDelegate results[] = new IJETDefaultTextColorerDelegate[defaultContentColorerDelegates.size()];
- defaultContentColorerDelegates.toArray(results);
- return results;
- }
-
- /**
- * Compute the list of the registered content colorer delegates.
- */
- private void initDefaultContentColorerDelegetes() {
- defaultContentColorerDelegates = new ArrayList();
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement elements[] = registry.getConfigurationElementsFor("org.eclipse.jet.internal.editor",
- "defaultContentColorerDelegates");
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
- Bundle bundle = Platform.getBundle(element.getNamespaceIdentifier());
- String delegateClass = element.getAttribute("delegateClass");
- IJETDefaultTextColorerDelegate delegate = null;
- try {
- Class clazz = bundle.loadClass(delegateClass);
- Class argTypes[] = { JETTextEditor.class };
- Constructor ctorWithTextEditor = null;
- try {
- ctorWithTextEditor = clazz.getConstructor(argTypes);
- } catch (SecurityException e) {
- Activator.log(e);
- } catch (NoSuchMethodException e) {
- Activator.log(e);
- }
- if (ctorWithTextEditor != null)
- delegate = (IJETDefaultTextColorerDelegate) ctorWithTextEditor.newInstance(new Object[] { this });
- else
- delegate = (IJETDefaultTextColorerDelegate) clazz.newInstance();
- defaultContentColorerDelegates.add(delegate);
- } catch (ClassNotFoundException e) {
- Activator.log(e);
- } catch (InstantiationException e) {
- Activator.log(e);
- } catch (IllegalAccessException e) {
- Activator.log(e);
- } catch (IllegalArgumentException e) {
- Activator.log(e);
- } catch (InvocationTargetException e) {
- Activator.log(e);
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.source.IVerticalRuler, int)
- */
- protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
- fAnnotationAccess = getAnnotationAccess();
- fOverviewRuler = createOverviewRuler(getSharedColors());
- sourceViewer = new JETSourceViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles,
- getPreferenceStore());
- getSourceViewerDecorationSupport(sourceViewer);
- projectionSupport = new ProjectionSupport(sourceViewer, getAnnotationAccess(), getSharedColors());
- projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error");
- 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());
- }
- });
- projectionSupport.install();
- return sourceViewer;
- }
-
- /**
- * Return the editor's source viewer. This method exist to make this viewer accessible to other classes.
- * @return the editor's source viewer
- */
- public ISourceViewer getEditorSourceViewer() {
- return sourceViewer;
- }
-
- /**
- * Returns the editor's preference store. This method exist to make the preference store accessible to other classes.
- * @return the editor's preference store
- */
- public IPreferenceStore getEditorPreferenceStore() {
- return super.getPreferenceStore();
- }
-
- public JETDocumentPartitionScanner getPartitionScanner() {
- return partitionScanner;
- }
-
- public JETTokenStyleManager getTokenStyleManager() {
- return tokenStyleManager;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.StatusTextEditor#handleEditorInputChanged()
- */
- protected void handleEditorInputChanged() {
- super.handleEditorInputChanged();
- handleDocumentChange(null);
- }
-
- public void handleDocumentChange(DocumentEvent e) {
- cUnitInvalidated = true;
- if (outlinePage != null && outlinePage.getControl().isVisible())
- ((JETOutlinePage) outlinePage).setInput();
- }
-
- public boolean isCUnitInvalidated() {
- return cUnitInvalidated;
- }
-
- public CompilationHelper compilationHelper() {
- CompilationHelper jetCompilationHelper = new CompilationHelper(project);
- return jetCompilationHelper;
- }
-
- /**
- * Compute and retrun the compilation unit of this document
- * @return the computed (or recomputed) compilation unit for this template
- */
- public JETCompilationUnit requestCompilationUnit() {
- if (cUnit == null || cUnitInvalidated) {
- IEditorInput editorInput = getEditorInput();
- String templatePath = editorInput.getName();
- if (editorInput instanceof IFileEditorInput)
- templatePath = ((IFileEditorInput)editorInput).getFile().getProjectRelativePath().toString();
- if (sourceViewer == null) { // sourceViewer is null ... we can parse from the file directly
- cUnit = compilationHelper().getAST(templatePath);
- } else {
- cUnit = compilationHelper().getASTFromSource(sourceViewer.getDocument().get(), templatePath);
- }
- PositionsCollector collector = new PositionsCollector();
- cUnit.accept(collector);
- positions = collector.getPositions();
- cUnitInvalidated = false;
- }
- return cUnit;
- }
-
- public JETASTElement getASTElement(int offset) {
- requestCompilationUnit();
- return getCachedASTElement(offset);
- }
-
- public JETASTElement getCachedASTElement(int offset) {
- for (Iterator iterator = positions.keySet().iterator(); iterator.hasNext();) {
- Position pos = (Position) iterator.next();
- if (pos.offset <= offset && pos.length + pos.offset > offset)
- return (JETASTElement) positions.get(pos);
- }
- return null;
- }
-
- public IJavaProject getJavaProject() {
- return JavaCore.create(project);
- }
-
- protected void createActions() {
- super.createActions();
- ResourceBundle resourceBundle = ResourceBundle.getBundle("org.eclipse.jet.internal.editor.i18n.TextEditorMessages");
- Action action = new ContentAssistAction(resourceBundle, "ContentAssistProposal.", this);
- action.setActionDefinitionId("org.eclipse.ui.edit.text.contentAssist.proposals");
- setAction("ContentAssistProposal", action);
- markAsStateDependentAction("ContentAssistProposal", true);
- }
-
- protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
- super.handlePreferenceStoreChanged(event);
- if (event.getNewValue() instanceof RGB)
- getTokenStyleManager().bindColor(event.getProperty(), (RGB) event.getNewValue());
- }
-
- public Object getAdapter(Class required) {
- if (IContentOutlinePage.class.equals(required)) {
- if (outlinePage == null)
- outlinePage = createOutlinePage();
- return outlinePage;
- }
- if (IEncodingSupport.class.equals(required))
- return fEncodingSupport;
- if (projectionSupport != null) {
- Object adapter = projectionSupport.getAdapter(getSourceViewer(), required);
- if (adapter != null)
- return adapter;
- }
- return super.getAdapter(required);
- }
-
- public void editorContextMenuAboutToShow(IMenuManager menu) {
- super.editorContextMenuAboutToShow(menu);
- addAction(menu, "settings", "setDelegateColorerActionID");
- }
-
- protected IContentOutlinePage createOutlinePage() {
- JETOutlinePage page = new JETOutlinePage(this);
- page.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleContentOutlineSelection(event.getSelection());
- }
- });
- return page;
- }
-
- protected void handleContentOutlineSelection(ISelection selection) {
- IStructuredSelection ssel = (IStructuredSelection) selection;
- Object firstElement = ssel.getFirstElement();
- if (firstElement instanceof JETASTElement) {
- JETASTElement astElement = (JETASTElement) firstElement;
- int start = astElement.getStart();
- int end = astElement.getEnd();
- int length = end - start;
- if (astElement instanceof TextElement) {
- if (astElement.getPrevElement() != null)
- start = astElement.getPrevElement().getEnd();
- else
- start = 0;
- length = ((TextElement) astElement).getText().length;
- }
- sourceViewer.setSelectedRange(start, length);
- sourceViewer.revealRange(start, length);
- }
- }
-
- private static class PositionsCollector extends JETASTVisitor {
- private Map positions;
-
- private PositionsCollector() {
- positions = new HashMap();
- }
-
- public Map getPositions() {
- return positions;
- }
-
- public boolean visit(JavaDeclaration declaration) {
- return matchOffset(declaration);
- }
-
- public boolean visit(JETDirective directive) {
- return matchOffset(directive);
- }
-
- public boolean visit(JavaExpression expression) {
- return matchOffset(expression);
- }
-
- public boolean visit(IncludedContent content) {
- // don't process include content
- return false;
- }
-
- public boolean visit(JavaScriptlet scriptlet) {
- return matchOffset(scriptlet);
- }
-
- public boolean visit(XMLEmptyElement xmlEmptyElement) {
- return matchOffset(xmlEmptyElement);
- }
-
- public boolean visit(XMLBodyElement xmlBodyElement) {
- return matchOffset(xmlBodyElement);
- }
-
- public boolean visit(XMLBodyElementEnd xmlBodyElementEnd) {
- return matchOffset(xmlBodyElementEnd);
- }
-
- public boolean visit(Comment comment) {
- return matchOffset(comment);
- }
-
- public boolean matchOffset(JETASTElement astElement) {
- int start = astElement.getStart();
- int end = astElement.getEnd();
- int length = end - start;
- positions.put(new Position(start, length), astElement);
- return true;
- }
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextPreviewViewer.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextPreviewViewer.java
deleted file mode 100644
index b36e0d5..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/JETTextPreviewViewer.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.emf.codegen.ecore.genmodel.provider.GenModelItemProviderAdapterFactory;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.dialogs.ResourceSelectionDialog;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
-import org.eclipse.ui.forms.ManagedForm;
-import org.eclipse.ui.forms.SectionPart;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-
-public class JETTextPreviewViewer extends Viewer {
-
- private SourceViewer sourceViewer;
-
- private Object fInput;
-
- private ScrolledForm sForm;
-
- private Text inputResource;
-
- private Button browseWorkspace;
-
- private Tree tree;
-
- private TreeViewer treeViewer;
-
- private ISelection selection;
-
- public JETTextPreviewViewer(Composite parent) {
- inputResource = null;
- browseWorkspace = null;
- tree = null;
- treeViewer = null;
- org.eclipse.swt.widgets.Display display = parent.getDisplay();
- FormToolkit formToolkit = new FormToolkit(display);
- sForm = formToolkit.createScrolledForm(parent);
- ManagedForm overviewForm = new ManagedForm(formToolkit, sForm);
- Composite body = sForm.getBody();
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginWidth = 10;
- layout.horizontalSpacing = 10;
- layout.verticalSpacing = 10;
- body.setLayout(layout);
- createInputArgumentsSection(overviewForm, body, formToolkit);
- createTextViewerSection(overviewForm, body, formToolkit);
- overviewForm.initialize();
- overviewForm.refresh();
- }
-
- private void createInputArgumentsSection(ManagedForm mForm, Composite body, FormToolkit formToolkit) {
- final Section section = formToolkit.createSection(body, 256);
- section.setText("Input Argument");
- Composite client = formToolkit.createComposite(section);
- GridLayout layout = new GridLayout();
- layout.marginWidth = formToolkit.getBorderStyle() == 0 ? 2 : 0;
- layout.numColumns = 2;
- client.setLayout(layout);
- inputResource = formToolkit.createText(client, "<Empty>");
- inputResource.setEditable(false);
- GridData gd = new GridData();
- gd.horizontalSpan = 1;
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = 4;
- gd.grabExcessVerticalSpace = false;
- inputResource.setLayoutData(gd);
- browseWorkspace = formToolkit.createButton(client, "Browse ...", 0);
- browseWorkspace.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ResourceSelectionDialog resSelectionDialog = new ResourceSelectionDialog(section.getShell(),
- ResourcesPlugin.getWorkspace().getRoot(), "Select a workspace resource");
- if (resSelectionDialog.open() == 0) {
- Object result[] = resSelectionDialog.getResult();
- if (result.length == 1) {
- String inputFile = ((IResource) result[0]).getFullPath().toString();
- inputResource.setText(inputFile);
- ResourceSet resourceSet = new ResourceSetImpl();
- URI uri = URI.createPlatformResourceURI(inputFile, true);
- org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(uri, true);
- if (resource != null)
- treeViewer.setInput(resourceSet);
- }
- }
- }
- });
- tree = formToolkit.createTree(client, 2052);
- gd = new GridData();
- gd.horizontalSpan = 2;
- gd.horizontalAlignment = 4;
- gd.verticalAlignment = 4;
- gd.grabExcessVerticalSpace = true;
- tree.setLayoutData(gd);
- treeViewer = new TreeViewer(tree);
- List factories = new ArrayList();
- factories.add(new ResourceItemProviderAdapterFactory());
- factories.add(new GenModelItemProviderAdapterFactory());
- factories.add(new ReflectiveItemProviderAdapterFactory());
- org.eclipse.emf.common.notify.AdapterFactory adapterFactory = new ComposedAdapterFactory(factories);
- treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
- treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
- Button button = formToolkit.createButton(client, "Apply", 0x800008);
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IFileEditorInput fileInput = (IFileEditorInput) getInput();
- IFile file = fileInput.getFile();
- JavaCore.create(file.getProject());
- }
- });
- section.setClient(client);
- gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = 4;
- gd.verticalAlignment = 1;
- section.setLayoutData(gd);
- SectionPart sectionPart = new SectionPart(section);
- mForm.addPart(sectionPart);
- }
-
- private void createTextViewerSection(ManagedForm mForm, Composite body, FormToolkit formToolkit) {
- Section section = formToolkit.createSection(body, 256);
- section.setText("Preview");
- org.eclipse.jface.preference.IPreferenceStore store = EditorsUI.getPreferenceStore();
- sourceViewer = new SourceViewer(section, null, 768);
- sourceViewer.configure(new TextSourceViewerConfiguration(store));
- sourceViewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.jdt.ui.editors.textfont"));
- sourceViewer.setEditable(false);
- section.setClient(sourceViewer.getControl());
- GridData gd = new GridData();
- gd.horizontalAlignment = 4;
- gd.verticalAlignment = 4;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- section.setLayoutData(gd);
- SectionPart sectionPart = new SectionPart(section);
- mForm.addPart(sectionPart);
- }
-
- public Control getControl() {
- return sForm;
- }
-
- public void setInput(Object input) {
- fInput = input;
- }
-
- public Object getInput() {
- return fInput;
- }
-
- public ISelection getSelection() {
- return selection;
- }
-
- public void setSelection(ISelection s, boolean reveal) {
- selection = s;
- }
-
- public void refresh() {
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/actions/SetContentColorerAction.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/actions/SetContentColorerAction.java
deleted file mode 100644
index 45f0470..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/actions/SetContentColorerAction.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.actions;
-
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jet.internal.editor.configuration.delegates.IJETDefaultTextColorerDelegate;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.ListDialog;
-
-public class SetContentColorerAction implements IEditorActionDelegate {
- private JETTextEditor editor;
-
- public SetContentColorerAction() {
- }
-
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- editor = (JETTextEditor) targetEditor;
- action.setText("Set default content colorer ...");
- }
-
- public void run(IAction action) {
- ListDialog dialog = new ListDialog(editor.getSite().getShell());
- dialog.setLabelProvider(new LabelProvider() {
- public String getText(Object element) {
- if (element instanceof IJETDefaultTextColorerDelegate)
- return ((IJETDefaultTextColorerDelegate) element).getName();
- else
- return super.getText(element);
- }
-
- public Image getImage(Object element) {
- if (element instanceof IJETDefaultTextColorerDelegate)
- return ((IJETDefaultTextColorerDelegate) element).getImage();
- else
- return super.getImage(element);
- }
- });
- dialog.setContentProvider(new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- return editor.getColorerDelegates();
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // TODO Auto-generated method stub
- }
- });
- dialog.setTitle("JET default text content colorer");
- dialog.setMessage("Select the content colorer to the default text embeded in the JET template");
- dialog.setInitialSelections(editor.getColorerDelegates());
- dialog.setInput(editor);
- int result = dialog.open();
- if (result == 0) {
- IJETDefaultTextColorerDelegate delegate = (IJETDefaultTextColorerDelegate) dialog.getResult()[0];
- editor.setCurrentColorerDelegate(delegate);
- }
- }
-
- public void selectionChanged(IAction iaction, ISelection iselection) {
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETAnnotationHover.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETAnnotationHover.java
deleted file mode 100644
index 8980eb3..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETAnnotationHover.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.annotations;
-
-import java.util.*;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.source.*;
-
-public class JETAnnotationHover implements IAnnotationHover {
-
- /**
- * Returns the distance to the ruler line.
- * @param position Position
- * @param document IDocument
- * @param line int
- * @return int
- */
- protected int compareRulerLine(Position position, IDocument document, int line) {
- if (position.getOffset() > -1 && position.getLength() > -1) {
- try {
- int javaAnnotationLine = document.getLineOfOffset(position.getOffset());
- if (line == javaAnnotationLine)
- return 1;
- if (javaAnnotationLine <= line
- && line <= document.getLineOfOffset(position.getOffset() + position.getLength()))
- return 2;
- } catch (BadLocationException x) {
- }
- }
- return 0;
- }
- /**
- * Selects a set of markers from the two lists. By default, it just returns the set of exact
- * matches.
- * @param exactMatch List
- * @param including List
- * @return List
- */
- protected List select(List exactMatch, List including) {
- return exactMatch;
- }
- /**
- * Returns one marker which includes the ruler's line of activity.
- * @param viewer ISourceViewer
- * @param line int
- * @return List
- */
- protected List getAnnotationsForLine(ISourceViewer viewer, int line) {
- IDocument document = viewer.getDocument();
- IAnnotationModel model = viewer.getAnnotationModel();
- if (model == null)
- return null;
- List exact = new ArrayList();
- List including = new ArrayList();
- Iterator e = model.getAnnotationIterator();
- HashMap messagesAtPosition = new HashMap();
- while (e.hasNext()) {
- Object o = e.next();
- if (o instanceof JETProblemAnnotation) {
- JETProblemAnnotation a = (JETProblemAnnotation) o;
- Position position = model.getPosition(a);
- if (position != null && !isDuplicateAnnotation(messagesAtPosition, position, a.getText()))
- switch (compareRulerLine(position, document, line)) {
- case 1: // '\001'
- exact.add(a);
- break;
-
- case 2: // '\002'
- including.add(a);
- break;
- }
- }
- }
- return select(exact, including);
- }
- /**
- * Method isDuplicateAnnotation.
- * @param messagesAtPosition Map
- * @param position Position
- * @param message String
- * @return boolean
- */
- private boolean isDuplicateAnnotation(Map messagesAtPosition, Position position, String message) {
- if (messagesAtPosition.containsKey(position)) {
- Object value = messagesAtPosition.get(position);
- if (message.equals(value))
- return true;
- if (value instanceof List) {
- List messages = (List) value;
- if (messages.contains(message))
- return true;
- messages.add(message);
- } else {
- ArrayList messages = new ArrayList();
- messages.add(value);
- messages.add(message);
- messagesAtPosition.put(position, messages);
- }
- } else {
- messagesAtPosition.put(position, message);
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer, int)
- */
- public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
- List annotations = getAnnotationsForLine(sourceViewer, lineNumber);
- if (annotations != null)
- if (annotations.size() == 1) {
- JETProblemAnnotation annotation = (JETProblemAnnotation) annotations.get(0);
- String message = annotation.getText();
- if (message != null && message.trim().length() > 0)
- return message;
- } else {
- List messages = new ArrayList();
- for (Iterator e = annotations.iterator(); e.hasNext();) {
- JETProblemAnnotation javaAnnotation = (JETProblemAnnotation) e.next();
- String message = javaAnnotation.getText();
- if (message != null && message.trim().length() > 0)
- messages.add(message.trim());
- }
-
- if (messages.size() == 1)
- return (String) messages.get(0);
- if (messages.size() > 1)
- return messages.toString();
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETAnnotationModel.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETAnnotationModel.java
deleted file mode 100644
index b7f347a..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETAnnotationModel.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.annotations;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
-import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
-
-public class JETAnnotationModel extends ResourceMarkerAnnotationModel {
- private boolean fireChanges;
-
- public JETAnnotationModel(IResource resource) {
- super(resource);
- fireChanges = true;
- }
-
- public synchronized boolean isFireChanges() {
- return fireChanges;
- }
-
- public synchronized void setFireChanges(boolean b) {
- fireChanges = b;
- }
-
- public synchronized void addAnnotation(Annotation annotation, Position position) {
- try {
- addAnnotation(annotation, position, fireChanges);
- } catch (BadLocationException _ex) {
- }
- }
-
- public synchronized void removeAllAnnotations() {
- super.removeAllAnnotations(fireChanges);
- }
-
- public synchronized void removeAnnotation(Annotation annotation) {
- super.removeAnnotation(annotation, fireChanges);
- }
-
- public MarkerAnnotation createMarkerAnnotation(IMarker marker) {
- return super.createMarkerAnnotation(marker);
- }
-
- public Position createPositionFromMarker(IMarker marker) {
- return super.createPositionFromMarker(marker);
- }
-
- public void fireAnnotationModelChanged() {
- fireModelChanged();
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETProblemAnnotation.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETProblemAnnotation.java
deleted file mode 100644
index 0f7ad2a..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/annotations/JETProblemAnnotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.annotations;
-
-import org.eclipse.jet.core.parser.ProblemSeverity;
-import org.eclipse.jet.core.parser.ast.Problem;
-import org.eclipse.jface.text.source.Annotation;
-
-public class JETProblemAnnotation extends Annotation {
-
- public static final String ERROR_ANNOTATION_TYPE = "org.eclipse.jet.editor.error";
-
- public static final String WARNING_ANNOTATION_TYPE = "org.eclipse.jet.editor.warning";
-
- public static final String INFO_ANNOTATION_TYPE = "org.eclipse.jet.editor.info";
-
- public JETProblemAnnotation(Problem problem) {
- if (problem.getProblemSeverity() == ProblemSeverity.ERROR)
- setType(ERROR_ANNOTATION_TYPE);
- else if (problem.getProblemSeverity() == ProblemSeverity.WARNING)
- setType(WARNING_ANNOTATION_TYPE);
- setText(problem.getMessage());
- }
-
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/autoedit/JETTemplateAutoEditStrategy.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/autoedit/JETTemplateAutoEditStrategy.java
deleted file mode 100644
index 427471c..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/autoedit/JETTemplateAutoEditStrategy.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.autoedit;
-
-import org.eclipse.jface.text.*;
-
-public class JETTemplateAutoEditStrategy extends DefaultIndentLineAutoEditStrategy {
-
- public JETTemplateAutoEditStrategy() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IAutoEditStrategy#customizeDocumentCommand(IDocument, DocumentCommand)
- */
- public void customizeDocumentCommand(IDocument d, DocumentCommand c) {
- if (c.length == 0 && c.text != null && endsWithDelimiter(d, c.text))
- smartIndentAfterNewLine(d, c);
- else if ("%>".equals(c.text)) { //$NON-NLS-1$
- smartInsertAfterBracket(d, c);
- }
- }
-
- /**
- * Returns whether or not the text ends with one of the given search strings.
- * @param d IDocument
- * @param txt String
- * @return boolean
- */
- private boolean endsWithDelimiter(IDocument d, String txt) {
- String[] delimiters = d.getLegalLineDelimiters();
- for (int i = 0; i < delimiters.length; i++) {
- if (txt.endsWith(delimiters[i]))
- return true;
- }
- return false;
- }
-
- /**
- * Returns the line number of the next bracket after end.
- * @param document - the document being parsed
- * @param line - the line to start searching back from
- * @param end - the end position to search back from
- * @param closingBracketIncrease - the number of brackets to skip
- * @return int
- * @throws BadLocationException
- */
- protected int findMatchingOpenBracket(IDocument document, int line, int end, int closingBracketIncrease)
- throws BadLocationException {
-
- int start = document.getLineOffset(line);
- int brackcount = getBracketCount(document, start, end, false) - closingBracketIncrease;
-
- // sum up the brackets counts of each line (closing brackets count negative,
- // opening positive) until we find a line the brings the count to zero
- while (brackcount < 0) {
- line--;
- if (line < 0) {
- return -1;
- }
- start = document.getLineOffset(line);
- end = start + document.getLineLength(line) - 1;
- brackcount += getBracketCount(document, start, end, false);
- }
- return line;
- }
-
- /**
- * Returns the bracket value of a section of text. Closing brackets have a value of -1 and
- * open brackets have a value of 1.
- * @param document - the document being parsed
- * @param start - the start position for the search
- * @param end - the end position for the search
- * @param ignoreCloseJspTags boolean
- * @return int
- * @throws BadLocationException
- */
- private int getBracketCount(IDocument document, int start, int end, boolean ignoreCloseJspTags)
- throws BadLocationException {
-
- int begin = start;
- int jsptagcount = 0;
- while (begin < end) {
- char curr = document.getChar(begin);
- begin++;
- switch (curr) {
- case '/':
- begin = adjustBeginOnComment(document, end, begin);
- break;
- case '*':
- if (begin < end) {
- char next = document.getChar(begin);
- if (next == '/') {
- // we have been in a comment: forget what we read before
- jsptagcount = 0;
- begin++;
- }
- }
- break;
- case '<':
- if ((begin + 1 < document.getLength()) && (document.getChar(begin + 1) == '%')) {
- jsptagcount++;
- ignoreCloseJspTags = false;
- }
- break;
- case '>':
- if (!ignoreCloseJspTags && (begin > 1) && (document.getChar(begin - 1) == '%')) {
- jsptagcount--;
- }
- break;
- case '"':
- case '\'':
- begin = getStringEnd(document, begin, end, curr);
- break;
- default:
- }
- }
- return jsptagcount;
- }
-
- private int adjustBeginOnComment(IDocument document, int end, int begin) throws BadLocationException {
- if (begin < end) {
- char next = document.getChar(begin);
- if (next == '*') {
- // a comment starts, advance to the comment end
- begin = getCommentEnd(document, begin + 1, end);
- } else if (next == '/') {
- // '//'-comment: nothing to do anymore on this line
- begin = end;
- }
- }
- return begin;
- }
-
- /**
- * Returns the end position a comment starting at pos.
- * @param document - the document being parsed
- * @param position - the start position for the search
- * @param end - the end position for the search
- * @return int
- * @throws BadLocationException
- */
- private int getCommentEnd(IDocument document, int position, int end) throws BadLocationException {
- int currentPosition = position;
- while (currentPosition < end) {
- char curr = document.getChar(currentPosition);
- currentPosition++;
- if (curr == '*') {
- if (currentPosition < end && document.getChar(currentPosition) == '/') {
- return currentPosition + 1;
- }
- }
- }
- return end;
- }
-
- /**
- * Returns the String at line with the leading whitespace removed.
- * @param document - the document being parsed
- * @param line - the line being searched
- * @return String
- * @throws BadLocationException
- */
- protected String getIndentOfLine(IDocument document, int line) throws BadLocationException {
- if (line > -1) {
- int start = document.getLineOffset(line);
- int end = start + document.getLineLength(line) - 1;
- int whiteend = findEndOfWhiteSpace(document, start, end);
- return document.get(start, whiteend - start);
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the position of the character in the document after position.
- * @param document - the document being parsed
- * @param position - the position to start searching from
- * @param end - the end of the document
- * @param character - the character you are trying to match
- * @return int
- * @throws BadLocationException
- */
- private int getStringEnd(IDocument document, int position, int end, char character) throws BadLocationException {
- int currentPosition = position;
- while (currentPosition < end) {
- char currentCharacter = document.getChar(currentPosition);
- currentPosition++;
- if (currentCharacter == '\\') {
- // ignore escaped characters
- currentPosition++;
- } else if (currentCharacter == character) {
- return currentPosition;
- }
- }
- return end;
- }
-
- /**
- * Set the indent of a new line based on the command provided in the supplied document.
- * @param document - the document being parsed
- * @param command - the command being performed
- */
- protected void smartIndentAfterNewLine(IDocument document, DocumentCommand command) {
-
- int docLength = document.getLength();
- if (command.offset == -1 || docLength == 0)
- return;
-
- try {
- int p = (command.offset == docLength ? command.offset - 1 : command.offset);
- int line = document.getLineOfOffset(p);
-
- StringBuffer buf = new StringBuffer(command.text);
- if (command.offset < docLength && document.getChar(command.offset) == '}') {
- int indLine = findMatchingOpenBracket(document, line, command.offset, 0);
- if (indLine == -1) {
- indLine = line;
- }
- buf.append(getIndentOfLine(document, indLine));
- } else {
- int start = document.getLineOffset(line);
- int whiteend = findEndOfWhiteSpace(document, start, command.offset);
- buf.append(document.get(start, whiteend - start));
- if (getBracketCount(document, start, command.offset, true) > 0) {
- buf.append('\t');
- }
- }
- command.text = buf.toString();
-
- } catch (BadLocationException excp) {
- }
- }
-
- /**
- * Set the indent of a bracket based on the command provided in the supplied document.
- * @param document - the document being parsed
- * @param command - the command being performed
- */
- protected void smartInsertAfterBracket(IDocument document, DocumentCommand command) {
- if (command.offset == -1 || document.getLength() == 0)
- return;
-
- try {
- int p = (command.offset == document.getLength() ? command.offset - 1 : command.offset);
- int line = document.getLineOfOffset(p);
- int start = document.getLineOffset(line);
- int whiteend = findEndOfWhiteSpace(document, start, command.offset);
-
- // shift only when line does not contain any text up to the closing bracket
- if (whiteend == command.offset) {
- // evaluate the line with the opening bracket that matches out closing bracket
- int indLine = findMatchingOpenBracket(document, line, command.offset, 1);
- if (indLine != -1 && indLine != line) {
- // take the indent of the found line
- StringBuffer replaceText = new StringBuffer(getIndentOfLine(document, indLine));
- // add the rest of the current line including the just added close bracket
- replaceText.append(document.get(whiteend, command.offset - whiteend));
- replaceText.append(command.text);
- // modify document command
- command.length = command.offset - start;
- command.offset = start;
- command.text = replaceText.toString();
- }
- }
- } catch (BadLocationException excp) {
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/DoubleClickStrategy.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/DoubleClickStrategy.java
deleted file mode 100644
index dd46718..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/DoubleClickStrategy.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration;
-
-import org.eclipse.jface.text.*;
-
-public class DoubleClickStrategy implements ITextDoubleClickStrategy {
- protected ITextViewer fText;
-
- public void doubleClicked(ITextViewer part) {
- int pos = part.getSelectedRange().x;
-
- if (pos < 0)
- return;
-
- fText = part;
-
- if (!selectComment(pos)) {
- selectWord(pos);
- }
- }
- protected boolean selectComment(int caretPos) {
- IDocument doc = fText.getDocument();
- int startPos, endPos;
-
- try {
- int pos = caretPos;
- char c = ' ';
-
- while (pos >= 0) {
- c = doc.getChar(pos);
- if (c == '\\') {
- pos -= 2;
- continue;
- }
- if (c == Character.LINE_SEPARATOR || c == '\"')
- break;
- --pos;
- }
-
- if (c != '\"')
- return false;
-
- startPos = pos;
-
- pos = caretPos;
- int length = doc.getLength();
- c = ' ';
-
- while (pos < length) {
- c = doc.getChar(pos);
- if (c == Character.LINE_SEPARATOR || c == '\"')
- break;
- ++pos;
- }
- if (c != '\"')
- return false;
-
- endPos = pos;
-
- int offset = startPos + 1;
- int len = endPos - offset;
- fText.setSelectedRange(offset, len);
- return true;
- } catch (BadLocationException x) {
- }
-
- return false;
- }
- protected boolean selectWord(int caretPos) {
-
- IDocument doc = fText.getDocument();
- int startPos, endPos;
-
- try {
-
- int pos = caretPos;
- char c;
-
- while (pos >= 0) {
- c = doc.getChar(pos);
- if (!Character.isJavaIdentifierPart(c))
- break;
- --pos;
- }
-
- startPos = pos;
-
- pos = caretPos;
- int length = doc.getLength();
-
- while (pos < length) {
- c = doc.getChar(pos);
- if (!Character.isJavaIdentifierPart(c))
- break;
- ++pos;
- }
-
- endPos = pos;
- selectRange(startPos, endPos);
- return true;
-
- } catch (BadLocationException x) {
- }
-
- return false;
- }
-
- private void selectRange(int startPos, int stopPos) {
- int offset = startPos + 1;
- int length = stopPos - offset;
- fText.setSelectedRange(offset, length);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/IJETColorConstants.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/IJETColorConstants.java
deleted file mode 100644
index ab8f041..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/IJETColorConstants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration;
-
-import org.eclipse.swt.graphics.RGB;
-
-public interface IJETColorConstants {
- RGB JET_CUSTOM_TAG_FG = new RGB(180, 128, 0);
- RGB JET_COMMENT_FG = new RGB(0, 155, 50);
- RGB JET_DIRECTIVE_FG = new RGB(180, 128, 0);
- RGB JET_EXPRESSION_FG = new RGB (180, 128, 0);
- RGB JET_SCRIPTLET_FG = new RGB(180, 128, 0);
-
- RGB JET_EXPRESSION_BG = new RGB(220, 230, 255);
- RGB JET_DEFAULT_BG = new RGB(230, 230, 230);
-
- RGB JET_JAVA_CODE = new RGB(128, 128, 128);
- RGB PROC_INSTR = new RGB(128, 128, 128);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETDocumentProvider.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETDocumentProvider.java
deleted file mode 100644
index 86a7053..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETDocumentProvider.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jet.internal.editor.annotations.JETAnnotationModel;
-import org.eclipse.jet.internal.editor.partition.JETDocumentPartitionScanner;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.rules.FastPartitioner;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.editors.text.FileDocumentProvider;
-
-public class JETDocumentProvider extends FileDocumentProvider {
-
- private JETTextEditor editor;
-
- public JETDocumentProvider(JETTextEditor editor) {
- this.editor = editor;
- }
-
- protected IDocument createDocument(Object element) throws CoreException {
- IDocument document = super.createDocument(element);
- JETDocumentPartitionScanner partitionScanner = editor.getPartitionScanner();
- if (document != null) {
- IDocumentPartitioner partitioner = new FastPartitioner(partitionScanner, partitionScanner.getContentTypes()) {
- public IRegion documentChanged2(DocumentEvent e) {
- editor.handleDocumentChange(e);
- return super.documentChanged2(e);
- }
- };
- partitioner.connect(document);
- document.setDocumentPartitioner(partitioner);
- }
- return document;
- }
-
- protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
- if (element instanceof IFileEditorInput) {
- IFileEditorInput input = (IFileEditorInput) element;
- return new JETAnnotationModel(input.getFile());
- } else {
- return super.createAnnotationModel(element);
- }
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETEditorPreferenceConstants.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETEditorPreferenceConstants.java
deleted file mode 100644
index f02faa9..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETEditorPreferenceConstants.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 - 2006 Joel Cheuoua & 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration;
-
-import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
-
-/**
- * Preference Constants used for the IRL Editor
- * @author lmirguet
- * @version $Revision: 1.1 $
- */
-public class JETEditorPreferenceConstants {
- public static final String JET_CUSTOM_TAG_FG_COLOR = "jet_custom_tag_foreground";
- public static final String JET_CUSTOM_TAG_BOLD = "jet_custom_tag_bold";
- public static final String JET_CUSTOM_TAG_ITALIC = "jet_custom_tag_italic";
- public static final String JET_CUSTOM_TAG_UNDERLINE = "jet_custom_tag_underline";
-
- public static final String JET_COMMENT_FG_COLOR = "jet_comment_foreground";
- public static final String JET_COMMENT_BOLD = "jet_comment_bold";
- public static final String JET_COMMENT_ITALIC = "jet_comment_italic";
- public static final String JET_COMMENT_UNDERLINE = "jet_comment_underline";
-
- public static final String JET_EXPRESSION_FG_COLOR = "jet_expression_foreground";
- public static final String JET_EXPRESSION_BOLD = "jet_expression_bold";
- public static final String JET_EXPRESSION_ITALIC = "jet_expression_italic";
- public static final String JET_EXPRESSION_UNDERLINE = "jet_expression_underline";
-
- public static final String JET_SCRIPTLET_FG_COLOR = "jet_scriptlet_foreground";
- public static final String JET_SCRIPTLET_BOLD = "jet_scriptlet_bold";
- public static final String JET_SCRIPTLET_ITALIC = "jet_scriptlet_italic";
- public static final String JET_SCRIPTLET_UNDERLINE = "jet_scriptlet_underline";
-
- public static final String JET_DIRECTIVE_FG_COLOR = "jet_directive_foreground";
- public static final String JET_DIRECTIVE_BOLD = "jet_directive_bold";
- public static final String JET_DIRECTIVE_ITALIC = "jet_directive_italic";
- public static final String JET_DIRECTIVE_UNDERLINE = "jet_directive_underline";
-
- public static final String JET_DIRECTIVE_KEYWORD_BOLD = "jet_directive_keyword_bold";
- public static final String JET_EXPRESSION_BG_COLOR = "jet_expression_background";
- public static final String JET_DEFAULT_BG_COLOR = "jet_default_background";
-
- public static final String AUTO_COMPLETE_ENABLED = "autoCompleteEnable";
- public static final String AUTO_COMPLETE_DELAY = "autoCompleteDelay";
-
- /**
- * Should not be instanciated.
- *
- */
- private JETEditorPreferenceConstants() {
- }
-
- /**
- * Initialize with the default values.
- * @param store IPreferenceStore
- */
- public static void initializeDefaultValues(IPreferenceStore store) {
-
- PreferenceConstants.initializeDefaultValues(store);
- AbstractDecoratedTextEditorPreferenceConstants.initializeDefaultValues(store);
-
- PreferenceConverter.setDefault(store, JET_COMMENT_FG_COLOR, IJETColorConstants.JET_COMMENT_FG);
- store.setDefault(JET_COMMENT_BOLD, false);
- store.setDefault(JET_COMMENT_ITALIC, true);
- store.setDefault(JET_COMMENT_UNDERLINE, false);
-
- PreferenceConverter.setDefault(store, JET_CUSTOM_TAG_FG_COLOR, IJETColorConstants.JET_CUSTOM_TAG_FG);
- store.setDefault(JET_CUSTOM_TAG_BOLD, false);
- store.setDefault(JET_CUSTOM_TAG_ITALIC, false);
- store.setDefault(JET_CUSTOM_TAG_UNDERLINE, true);
-
- PreferenceConverter.setDefault(store, JET_EXPRESSION_FG_COLOR, IJETColorConstants.JET_EXPRESSION_FG);
- store.setDefault(JET_EXPRESSION_BOLD, false);
- store.setDefault(JET_EXPRESSION_ITALIC, false);
- store.setDefault(JET_EXPRESSION_UNDERLINE, false);
-
- PreferenceConverter.setDefault(store, JET_DIRECTIVE_FG_COLOR, IJETColorConstants.JET_DIRECTIVE_FG);
- store.setDefault(JET_DIRECTIVE_BOLD, false);
- store.setDefault(JET_DIRECTIVE_KEYWORD_BOLD, true);
- store.setDefault(JET_DIRECTIVE_ITALIC, false);
- store.setDefault(JET_DIRECTIVE_UNDERLINE, false);
-
- PreferenceConverter.setDefault(store, JET_SCRIPTLET_FG_COLOR, IJETColorConstants.JET_SCRIPTLET_FG);
- store.setDefault(JET_SCRIPTLET_BOLD, false);
- store.setDefault(JET_SCRIPTLET_ITALIC, true);
- store.setDefault(JET_SCRIPTLET_UNDERLINE, false);
-
- PreferenceConverter.setDefault(store, JET_DEFAULT_BG_COLOR, IJETColorConstants.JET_DEFAULT_BG);
- PreferenceConverter.setDefault(store, JET_EXPRESSION_BG_COLOR, IJETColorConstants.JET_EXPRESSION_BG);
-
- store.setDefault(AUTO_COMPLETE_ENABLED, store.getDefaultBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION));
- store.setDefault(AUTO_COMPLETE_DELAY, store.getDefaultInt(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
- }
-
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETReconcilingStrategy.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETReconcilingStrategy.java
deleted file mode 100644
index 01c5c67..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETReconcilingStrategy.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jet.core.parser.ast.JETCompilationUnit;
-import org.eclipse.jet.core.parser.ast.Problem;
-import org.eclipse.jet.internal.editor.JETEditorHelper;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jet.internal.editor.annotations.JETAnnotationModel;
-import org.eclipse.jet.internal.editor.annotations.JETProblemAnnotation;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
-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.Annotation;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
-
-/**
- * The reconciling strategy for the JET editor
- * @author Joel
- */
-public class JETReconcilingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension {
-
- private JETTextEditor jetEditor;
-
- private ISourceViewer sourceViewer;
-
- /**
- * Main constructor
- * @param sourceViewer
- * @param jetEditor
- */
- public JETReconcilingStrategy(ISourceViewer sourceViewer, JETTextEditor jetEditor) {
- this.jetEditor = jetEditor;
- this.sourceViewer = sourceViewer;
- }
-
- /**
- * This is the single method that performs the annotation model problems evaluations and update
- */
- private void internalReconcile() {
- JETCompilationUnit cUnit = jetEditor.requestCompilationUnit();
- List cUnitProblems = cUnit.getProblems();
- List javaContentProblems = JETEditorHelper.evaluateProblems(jetEditor, sourceViewer.getDocument());
- JETAnnotationModel annotationModel = (JETAnnotationModel) sourceViewer.getAnnotationModel();
- if (annotationModel != null) {
- // avoid changes to the annotation model to be notified to the viewers until the job is done
- annotationModel.setFireChanges(false);
-
- // Remove all the previous annotations related to JET problems
- // and related to resource markers
- for (Iterator it = annotationModel.getAnnotationIterator(); it.hasNext();) {
- Annotation annotation = (Annotation) it.next();
- if ((annotation instanceof JETProblemAnnotation) || (annotation instanceof MarkerAnnotation))
- annotationModel.removeAnnotation(annotation);
- }
-
- // Problems for JET document structure
- for (Iterator iterator = cUnitProblems.iterator(); iterator.hasNext(); ) {
- Problem problem = (Problem) iterator.next();
- JETProblemAnnotation annotation = new JETProblemAnnotation(problem);
- Position position = new Position(problem.getStart(), problem.getEnd() - problem.getStart());
- annotationModel.addAnnotation(annotation, position);
- }
-
- // Problems in java contents of the JET document
- for (Iterator iterator = javaContentProblems.iterator(); iterator.hasNext(); ) {
- Problem problem = (Problem) iterator.next();
- JETProblemAnnotation annotation = new JETProblemAnnotation(problem);
- Position position = new Position(problem.getStart(), problem.getEnd() - problem.getStart());
- annotationModel.addAnnotation(annotation, position);
- }
-
- annotationModel.setFireChanges(true);
- annotationModel.fireAnnotationModelChanged();
- }
- }
-
- public void setDocument(IDocument idocument) {
- }
-
- public void initialReconcile() {
- internalReconcile();
- }
-
- public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
- internalReconcile();
- }
-
- public void reconcile(IRegion partition) {
- internalReconcile();
- }
-
- public void setProgressMonitor(IProgressMonitor iprogressmonitor) {
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETSourceViewerConfiguration.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETSourceViewerConfiguration.java
deleted file mode 100644
index 95ee783..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETSourceViewerConfiguration.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jet.internal.editor.annotations.JETAnnotationHover;
-import org.eclipse.jface.text.IAutoEditStrategy;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextDoubleClickStrategy;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.formatter.IContentFormatter;
-import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.presentation.PresentationReconciler;
-import org.eclipse.jface.text.reconciler.IReconciler;
-import org.eclipse.jface.text.reconciler.MonoReconciler;
-import org.eclipse.jface.text.source.*;
-
-public class JETSourceViewerConfiguration extends SourceViewerConfiguration {
-
- private DoubleClickStrategy doubleClickStrategy;
- private JETTextEditor editor;
-
- public JETSourceViewerConfiguration(JETTextEditor editor) {
- this.editor = editor;
- }
-
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return editor.getPartitionScanner().getContentTypes();
- }
-
- public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) {
- if (doubleClickStrategy == null)
- doubleClickStrategy = new DoubleClickStrategy();
- return doubleClickStrategy;
- }
-
- public IReconciler getReconciler(ISourceViewer sourceViewer) {
- JETReconcilingStrategy strategy = new JETReconcilingStrategy(sourceViewer, editor);
- MonoReconciler reconciler = new MonoReconciler(strategy, false);
- reconciler.setProgressMonitor(new NullProgressMonitor());
- reconciler.setDelay(500);
- return reconciler;
- }
-
- public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
- return new JETAnnotationHover();
- }
-
- public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
- IAutoEditStrategy strategies[] = editor.getPartitionScanner().getAutoEditStrategies(contentType);
- if (strategies == null)
- strategies = super.getAutoEditStrategies(sourceViewer, contentType);
- return strategies;
- }
-
- public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- ContentAssistant assistant = new ContentAssistant();
- assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
- String configuredContentTypes[] = getConfiguredContentTypes(sourceViewer);
- for (int i = 0; i < configuredContentTypes.length; i++) {
- String contentType = configuredContentTypes[i];
- org.eclipse.jface.text.contentassist.IContentAssistProcessor processor = editor.getPartitionScanner()
- .getCompletionProcessor(contentType, assistant);
- if (processor != null)
- assistant.setContentAssistProcessor(processor, contentType);
- }
-
- assistant.setContextInformationPopupOrientation(20);
- assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
- assistant.enableAutoInsert(false);
- assistant.enableAutoActivation(true);
- return assistant;
- }
-
- public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
- MultiPassContentFormatter formatter = new MultiPassContentFormatter(
- getConfiguredDocumentPartitioning(sourceViewer), IDocument.DEFAULT_CONTENT_TYPE);
- String configuredContentTypes[] = getConfiguredContentTypes(sourceViewer);
- for (int i = 0; i < configuredContentTypes.length; i++) {
- String contentType = configuredContentTypes[i];
- org.eclipse.jface.text.formatter.IFormattingStrategy strategy = editor.getPartitionScanner()
- .getFormattingStrategy(contentType);
- if (strategy != null)
- if (IDocument.DEFAULT_CONTENT_TYPE.equals(contentType))
- formatter.setMasterStrategy(strategy);
- else
- formatter.setSlaveStrategy(strategy, contentType);
- }
-
- return formatter;
- }
-
- public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- PresentationReconciler reconciler = new PresentationReconciler();
- String configuredContentTypes[] = getConfiguredContentTypes(sourceViewer);
- for (int i = 0; i < configuredContentTypes.length; i++) {
- String contentType = configuredContentTypes[i];
- org.eclipse.jface.text.presentation.IPresentationDamager damager = editor.getPartitionScanner().getDamager(
- contentType);
- org.eclipse.jface.text.presentation.IPresentationRepairer repairer = editor.getPartitionScanner().getRepairer(
- contentType);
- if (damager != null)
- reconciler.setDamager(damager, contentType);
- if (repairer != null)
- reconciler.setRepairer(repairer, contentType);
- }
-
- return reconciler;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETTokenStyleManager.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETTokenStyleManager.java
deleted file mode 100644
index 2f7f579..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETTokenStyleManager.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jdt.ui.text.IColorManager;
-import org.eclipse.jdt.ui.text.IColorManagerExtension;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.texteditor.AbstractTextEditor;
-
-public class JETTokenStyleManager implements IColorManager, IColorManagerExtension {
- private IPreferenceStore preferenceStore;
-
- protected Map colorTable = new HashMap(10);
- protected Map keyTable= new HashMap(10);
- protected Map tokenMap = new HashMap(10);
-
- public JETTokenStyleManager(IPreferenceStore store) {
- this.preferenceStore = store;
- }
- public void dispose() {
- Iterator e = colorTable.values().iterator();
- while (e.hasNext())
- ((Color) e.next()).dispose();
- }
- public Color getColor(RGB rgb) {
- Color color = (Color) colorTable.get(rgb);
- if (color == null) {
- color = new Color(Display.getCurrent(), rgb);
- colorTable.put(rgb, color);
- }
- return color;
- }
- public Color getColor(String key) {
- if (key == null)
- return null;
- RGB rgb= (RGB) keyTable.get(key);
- if (rgb == null) {
- rgb= PreferenceConverter.getColor(preferenceStore, key);
- if (rgb == null)
- return null;
- keyTable.put(key, rgb);
- }
- return getColor(rgb);
- }
-
- /*
- * @see IColorManagerExtension#bindColor(String, RGB)
- */
- public void bindColor(String key, RGB rgb) {
- Object value= keyTable.get(key);
- if (value != null)
- throw new UnsupportedOperationException();
- keyTable.put(key, rgb);
- }
-
- /*
- * @see IColorManagerExtension#unbindColor(String)
- */
- public void unbindColor(String key) {
- keyTable.remove(key);
- }
-
- public IToken getCachedToken(String id) {
- return ((IToken)tokenMap.get(id));
- }
-
- public IToken requestToken(String id,
- String fgColorKey,
- String bgColorKey,
- String boldKey,
- String italicKey,
- String strikethroughKey,
- String underlineKey) {
- if (fgColorKey != null && getColor(fgColorKey) == null) {
- RGB rgb= PreferenceConverter.getColor(preferenceStore, fgColorKey);
- unbindColor(fgColorKey);
- bindColor(fgColorKey, rgb);
- }
-
- if (bgColorKey != null && getColor(bgColorKey) == null) {
- RGB rgb= PreferenceConverter.getColor(preferenceStore, bgColorKey);
- unbindColor(bgColorKey);
- bindColor(bgColorKey, rgb);
- }
-
- Token token= ((Token)tokenMap.get(id));
- if (token == null) {
- token = new Token(createTextAttribute(fgColorKey, bgColorKey, boldKey, italicKey, strikethroughKey, underlineKey));
- tokenMap.put(id, token);
- } else {
- token.setData(createTextAttribute(fgColorKey, bgColorKey, boldKey, italicKey, strikethroughKey, underlineKey));
- }
- return token;
- }
-
- /**
- * Create a text attribute based on the given color, bold, italic, strikethrough and underline preference keys.
- *
- * @param fgColorKey the fg color preference key
- * @param bgColorKey the fg color preference key
- * @param boldKey the bold preference key
- * @param italicKey the italic preference key
- * @param strikethroughKey the strikethrough preference key
- * @param underlineKey the italic preference key
- * @return the created text attribute
- * @since 3.0
- */
- private TextAttribute createTextAttribute(String fgColorKey, String bgColorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) {
- Color fgColor= null;
- if (fgColorKey != null)
- fgColor= getColor(fgColorKey);
- Color bgColor= null;
- if (bgColorKey != null)
- bgColor= getColor(bgColorKey);
-
- int style = (boldKey != null && preferenceStore.getBoolean(boldKey))? SWT.BOLD : SWT.NORMAL;
-
- if (italicKey != null && preferenceStore.getBoolean(italicKey))
- style |= SWT.ITALIC;
-
- if (strikethroughKey != null && preferenceStore.getBoolean(strikethroughKey))
- style |= TextAttribute.STRIKETHROUGH;
-
- if (underlineKey != null && preferenceStore.getBoolean(underlineKey))
- style |= TextAttribute.UNDERLINE;
-
- return new TextAttribute(fgColor, bgColor, style);
- }
-
- public IToken requestDefaultToken() {
- return requestToken("__jet_default_return_token",
- AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- null,
- null,
- null,
- null);
-
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETWhitespaceDetector.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETWhitespaceDetector.java
deleted file mode 100644
index a5bd04a..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/JETWhitespaceDetector.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration;
-
-import org.eclipse.jface.text.rules.IWhitespaceDetector;
-
-public class JETWhitespaceDetector implements IWhitespaceDetector {
-
- public boolean isWhitespace(char c) {
- return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/NonRuleBasedDamagerRepairer.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/NonRuleBasedDamagerRepairer.java
deleted file mode 100644
index 019c755..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/NonRuleBasedDamagerRepairer.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.presentation.IPresentationDamager;
-import org.eclipse.jface.text.presentation.IPresentationRepairer;
-import org.eclipse.swt.custom.StyleRange;
-
-public class NonRuleBasedDamagerRepairer
- implements IPresentationDamager, IPresentationRepairer {
-
- /** The document this object works on */
- protected IDocument fDocument;
- /** The default text attribute if non is returned as data by the current token */
- protected TextAttribute fDefaultTextAttribute;
-
- /**
- * Constructor for NonRuleBasedDamagerRepairer.
- */
- public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) {
- Assert.isNotNull(defaultTextAttribute);
-
- fDefaultTextAttribute = defaultTextAttribute;
- }
-
- /**
- * @see IPresentationRepairer#setDocument(IDocument)
- */
- public void setDocument(IDocument document) {
- fDocument = document;
- }
-
- /**
- * Returns the end offset of the line that contains the specified offset or
- * if the offset is inside a line delimiter, the end offset of the next line.
- *
- * @param offset the offset whose line end offset must be computed
- * @return the line end offset for the given offset
- * @exception BadLocationException if offset is invalid in the current document
- */
- protected int endOfLineOf(int offset) throws BadLocationException {
-
- IRegion info = fDocument.getLineInformationOfOffset(offset);
- if (offset <= info.getOffset() + info.getLength())
- return info.getOffset() + info.getLength();
-
- int line = fDocument.getLineOfOffset(offset);
- try {
- info = fDocument.getLineInformation(line + 1);
- return info.getOffset() + info.getLength();
- } catch (BadLocationException x) {
- return fDocument.getLength();
- }
- }
-
- /**
- * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean)
- */
- public IRegion getDamageRegion(
- ITypedRegion partition,
- DocumentEvent event,
- boolean documentPartitioningChanged) {
- if (!documentPartitioningChanged) {
- try {
-
- IRegion info =
- fDocument.getLineInformationOfOffset(event.getOffset());
- int start = Math.max(partition.getOffset(), info.getOffset());
-
- int end =
- event.getOffset()
- + (event.getText() == null
- ? event.getLength()
- : event.getText().length());
-
- if (info.getOffset() <= end
- && end <= info.getOffset() + info.getLength()) {
- // optimize the case of the same line
- end = info.getOffset() + info.getLength();
- } else
- end = endOfLineOf(end);
-
- end =
- Math.min(
- partition.getOffset() + partition.getLength(),
- end);
- return new Region(start, end - start);
-
- } catch (BadLocationException x) {
- }
- }
-
- return partition;
- }
-
- /**
- * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion)
- */
- public void createPresentation(
- TextPresentation presentation,
- ITypedRegion region) {
- addRange(
- presentation,
- region.getOffset(),
- region.getLength(),
- fDefaultTextAttribute);
- }
-
- /**
- * Adds style information to the given text presentation.
- *
- * @param presentation the text presentation to be extended
- * @param offset the offset of the range to be styled
- * @param length the length of the range to be styled
- * @param attr the attribute describing the style of the range to be styled
- */
- protected void addRange(
- TextPresentation presentation,
- int offset,
- int length,
- TextAttribute attr) {
- if (attr != null)
- presentation.addStyleRange(
- new StyleRange(
- offset,
- length,
- attr.getForeground(),
- attr.getBackground(),
- attr.getStyle()));
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/IJETDefaultTextColorerDelegate.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/IJETDefaultTextColorerDelegate.java
deleted file mode 100644
index a463706..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/IJETDefaultTextColorerDelegate.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration.delegates;
-
-import org.eclipse.jet.internal.editor.partition.ITokenScannerProvider;
-import org.eclipse.jface.text.rules.IPredicateRule;
-import org.eclipse.swt.graphics.Image;
-
-public interface IJETDefaultTextColorerDelegate extends ITokenScannerProvider {
- IPredicateRule[] getPartitioningRules();
- String getName();
- Image getImage();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/java/JavaContentPartitionConfigurationDelegate.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/java/JavaContentPartitionConfigurationDelegate.java
deleted file mode 100644
index 807bb0f..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/java/JavaContentPartitionConfigurationDelegate.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration.delegates.java;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jdt.ui.ISharedImages;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jet.internal.editor.configuration.delegates.IJETDefaultTextColorerDelegate;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.rules.*;
-import org.eclipse.swt.graphics.Image;
-
-public class JavaContentPartitionConfigurationDelegate implements IJETDefaultTextColorerDelegate {
- private JETJavaSourceViewerConfiguration javaConfiguration;
-
- public JavaContentPartitionConfigurationDelegate(JETTextEditor editor) {
- javaConfiguration = new JETJavaSourceViewerConfiguration(editor);
- }
-
- public String getName() {
- return "Java Text Content Colorer";
- }
-
- public Image getImage() {
- return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_CUNIT);
- }
-
- public IPredicateRule[] getPartitioningRules() {
- org.eclipse.jface.text.rules.IToken string = new Token("__java_string");
- org.eclipse.jface.text.rules.IToken character = new Token("__java_character");
- org.eclipse.jface.text.rules.IToken javaDoc = new Token("__java_javadoc");
- org.eclipse.jface.text.rules.IToken multiLineComment = new Token("__java_multiline_comment");
- org.eclipse.jface.text.rules.IToken singleLineComment = new Token("__java_singleline_comment");
- List rules = new ArrayList();
- rules.add(new EndOfLineRule("//", singleLineComment));
- rules.add(new SingleLineRule("\"", "\"", string, '\\'));
- rules.add(new SingleLineRule("'", "'", character, '\\'));
- EmptyCommentRule wordRule = new EmptyCommentRule(multiLineComment);
- rules.add(wordRule);
- rules.add(new MultiLineRule("/**", "*/", javaDoc));
- rules.add(new MultiLineRule("/*", "*/", multiLineComment));
- IPredicateRule result[] = new IPredicateRule[rules.size()];
- rules.toArray(result);
- return result;
- }
-
- public ITokenScanner getTokenScanner(String contentType) {
- if (IDocument.DEFAULT_CONTENT_TYPE.equals(contentType))
- return javaConfiguration.getCodeScanner();
- if ("__java_javadoc".equals(contentType))
- return javaConfiguration.getJavaDocScanner();
- if ("__java_multiline_comment".equals(contentType))
- return javaConfiguration.getMultilineCommentScanner();
- if ("__java_singleline_comment".equals(contentType))
- return javaConfiguration.getSinglelineCommentScanner();
- if ("__java_string".equals(contentType))
- return javaConfiguration.getStringScanner();
- if ("__java_character".equals(contentType))
- return javaConfiguration.getStringScanner();
- else
- return javaConfiguration.getCodeScanner();
- }
-
- private class JETJavaSourceViewerConfiguration extends JavaSourceViewerConfiguration {
- public RuleBasedScanner getCodeScanner() {
- return super.getCodeScanner();
- }
- public RuleBasedScanner getMultilineCommentScanner() {
- return super.getMultilineCommentScanner();
- }
- public RuleBasedScanner getSinglelineCommentScanner() {
- return super.getSinglelineCommentScanner();
- }
- public RuleBasedScanner getStringScanner() {
- return super.getStringScanner();
- }
- public RuleBasedScanner getJavaDocScanner() {
- return super.getJavaDocScanner();
- }
- public JETJavaSourceViewerConfiguration(JETTextEditor editor) {
- super(JavaUI.getColorManager(), editor.getEditorPreferenceStore(), editor, null);
- }
- }
-
- private class EmptyCommentDetector implements IWordDetector {
- public boolean isWordStart(char c) {
- return c == '/';
- }
-
- public boolean isWordPart(char c) {
- return c == '*' || c == '/';
- }
- }
-
- private class EmptyCommentRule extends WordRule implements IPredicateRule {
- public IToken evaluate(ICharacterScanner scanner, boolean resume) {
- return evaluate(scanner);
- }
-
- public IToken getSuccessToken() {
- return fSuccessToken;
- }
-
- private IToken fSuccessToken;
-
- public EmptyCommentRule(IToken successToken) {
- super(new EmptyCommentDetector());
- fSuccessToken = successToken;
- addWord("/**/", fSuccessToken);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/xml/XMLContentPartitionConfigurationDelegate.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/xml/XMLContentPartitionConfigurationDelegate.java
deleted file mode 100644
index bb0c6af..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/configuration/delegates/xml/XMLContentPartitionConfigurationDelegate.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.configuration.delegates.xml;
-
-import org.eclipse.jdt.ui.text.IColorManager;
-import org.eclipse.jet.internal.editor.Activator;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jet.internal.editor.configuration.delegates.IJETDefaultTextColorerDelegate;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IPredicateRule;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.ITokenScanner;
-import org.eclipse.jface.text.rules.IWhitespaceDetector;
-import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.SingleLineRule;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WhitespaceRule;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-
-public class XMLContentPartitionConfigurationDelegate implements IJETDefaultTextColorerDelegate {
- public static final String XML_COMMENT = "__xml_comment";
- public static final String XML_TAG = "__xml_tag";
-
- private XMLTagScanner tagScanner;
- private XMLScanner scanner;
- private XMLScanner commentScanner;
- private IColorManager colorManager;
-
- public static interface IXMLColorConstants {
- RGB XML_COMMENT = new RGB(128, 0, 0);
- RGB PROC_INSTR = new RGB(128, 128, 128);
- RGB STRING = new RGB(0, 128, 0);
- RGB DEFAULT = new RGB(0, 0, 0);
- RGB TAG = new RGB(0, 0, 128);
- }
-
- public class TagRule extends MultiLineRule {
-
- protected boolean sequenceDetected(ICharacterScanner scanner, char sequence[], boolean eofAllowed) {
- int c = scanner.read();
- if (sequence[0] == '<') {
- if (c == 63) {
- scanner.unread();
- return false;
- }
- if (c == 33) {
- scanner.unread();
- return false;
- }
- } else if (sequence[0] == '>')
- scanner.unread();
- return super.sequenceDetected(scanner, sequence, eofAllowed);
- }
-
- public TagRule(IToken token) {
- super("<", ">", token);
- }
- }
-
- public class XMLWhitespaceDetector implements IWhitespaceDetector {
- public boolean isWhitespace(char c) {
- return c == ' ' || c == '\t' || c == '\n' || c == '\r';
- }
-
- public XMLWhitespaceDetector() {
- super();
- }
- }
-
- public class XMLScanner extends RuleBasedScanner {
-
- public XMLScanner(IColorManager manager) {
- super();
- org.eclipse.jface.text.rules.IToken procInstr = new Token(new TextAttribute(manager
- .getColor(IXMLColorConstants.PROC_INSTR)));
- IRule rules[] = new IRule[2];
- rules[0] = new SingleLineRule("<?", "?>", procInstr);
- rules[1] = new WhitespaceRule(new XMLWhitespaceDetector());
- setRules(rules);
- }
- }
-
- public class XMLTagScanner extends RuleBasedScanner {
-
- public XMLTagScanner(IColorManager manager) {
- super();
- org.eclipse.jface.text.rules.IToken string = new Token(new TextAttribute(manager
- .getColor(IXMLColorConstants.STRING)));
- IRule rules[] = new IRule[3];
- rules[0] = new SingleLineRule("\"", "\"", string, '\\');
- rules[1] = new SingleLineRule("'", "'", string, '\\');
- rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());
- setRules(rules);
- }
- }
-
- public XMLContentPartitionConfigurationDelegate(JETTextEditor editor) {
- colorManager = editor.getTokenStyleManager();
- }
-
- public String getName() {
- return "XML Text Content Colorer";
- }
-
- public Image getImage() {
- return Activator.getDefault().getWorkbench().getSharedImages().getImage("IMG_OBJ_FILE");
- }
-
- public IPredicateRule[] getPartitioningRules() {
- org.eclipse.jface.text.rules.IToken xmlComment = new Token(XML_COMMENT);
- org.eclipse.jface.text.rules.IToken tag = new Token(XML_TAG);
- IPredicateRule rules[] = new IPredicateRule[2];
- rules[0] = new MultiLineRule("<!--", "-->", xmlComment);
- rules[1] = new TagRule(tag);
- return rules;
- }
-
- public ITokenScanner getTokenScanner(String contentType) {
- if (IDocument.DEFAULT_CONTENT_TYPE.equals(contentType))
- return getXMLScanner();
- if (XML_TAG.equals(contentType))
- return getXMLTagScanner();
- if (XML_COMMENT.equals(contentType))
- return getCommentScanner();
- else
- return getXMLScanner();
- }
-
- protected XMLScanner getCommentScanner() {
- if (commentScanner == null) {
- commentScanner = new XMLScanner(colorManager);
- commentScanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager
- .getColor(IXMLColorConstants.XML_COMMENT))));
- }
- return commentScanner;
- }
-
- protected XMLScanner getXMLScanner() {
- if (scanner == null) {
- scanner = new XMLScanner(colorManager);
- scanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.DEFAULT))));
- }
- return scanner;
- }
-
- protected XMLTagScanner getXMLTagScanner() {
- if (tagScanner == null) {
- tagScanner = new XMLTagScanner(colorManager);
- tagScanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.TAG))));
- }
- return tagScanner;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/AbstractJETAssistProcessor.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/AbstractJETAssistProcessor.java
deleted file mode 100644
index 969069e..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/AbstractJETAssistProcessor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.contentassist;
-
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-
-public abstract class AbstractJETAssistProcessor implements IContentAssistProcessor {
- protected JETTextEditor editor;
- public AbstractJETAssistProcessor(JETTextEditor editor) {
- this.editor = editor;
- }
-
- public String getErrorMessage() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/AbstractXMLTagsBasedAssistProcessor.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/AbstractXMLTagsBasedAssistProcessor.java
deleted file mode 100644
index 85951e4..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/AbstractXMLTagsBasedAssistProcessor.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.contentassist;
-
-import java.util.*;
-
-import org.eclipse.jet.internal.editor.JETDocumentReader;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.CompletionProposal;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-
-public abstract class AbstractXMLTagsBasedAssistProcessor extends AbstractJETAssistProcessor {
-
- private TreeSet keywordSet;
- private TreeSet innerKeywordSet;
- private TreeMap innerMap;
-
- public AbstractXMLTagsBasedAssistProcessor(JETTextEditor editor) {
- super(editor);
- keywordSet = new TreeSet();
- innerKeywordSet = new TreeSet();
- innerMap = new TreeMap();
- String tagAttrs[][] = getTagAttributes();
- for (int i = 0; i < tagAttrs.length; i++)
- keywordSet.add(tagAttrs[i][0]);
-
- for (int i = 0; i < tagAttrs.length; i++) {
- TreeSet innerSet = new TreeSet();
- for (int j = 1; j < tagAttrs[i].length; j++) {
- innerSet.add(tagAttrs[i][j]);
- innerKeywordSet.add(tagAttrs[i][j]);
- }
-
- innerMap.put(tagAttrs[i][0], innerSet);
- }
-
- }
-
- public abstract String[] getRootTags();
-
- public abstract String[][] getTagAttributes();
-
- public String[] getAllKeywords() {
- return (String[]) keywordSet.toArray(new String[keywordSet.size()]);
- }
-
- public String[] getAllInnerKeywords() {
- return (String[]) innerKeywordSet.toArray(new String[innerKeywordSet.size()]);
- }
-
- public String[] getInnerKeywordsFor(String key) {
- TreeSet set = (TreeSet) (TreeSet) innerMap.get(key);
- if (set == null && key.length() == 0)
- return getRootTags();
- else if (set != null)
- return (String[]) set.toArray(new String[set.size()]);
- return new String[0];
- }
-
- private boolean prefixMatches(String prefix, String word) {
- prefix = prefix.toLowerCase();
- return word.startsWith(prefix);
- }
-
- public String[] getAllWordsWithPrefix(String prefix) {
- String all[] = getAllKeywords();
- return getMatched(prefix, all);
- }
-
- private String[] getMatched(String prefix, String all[]) {
- ArrayList matched = new ArrayList(10);
- for (int i = 0; i < all.length; i++)
- if (prefixMatches(prefix, all[i]))
- matched.add(all[i]);
-
- return (String[]) matched.toArray(new String[matched.size()]);
- }
-
- public String[] getTagsWithPrefix(String prefix) {
- return getMatched(prefix, getRootTags());
- }
-
- public String[] getNonTagsKeywordsWithPrefix(String key, String prefix) {
- return getMatched(prefix, getInnerKeywordsFor(key));
- }
-
- protected String[] getAllWords(char c, JETDocumentReader reader) {
- ArrayList all = new ArrayList(20);
- char currChar = c;
- currChar = trimBlanksBackward(reader, currChar);
- for (boolean done = false; !done;) {
- Stack stack = new Stack();
- for (; currChar != '\uFFFF' && !Character.isWhitespace(currChar); currChar = reader.readBackward())
- stack.push(new Character(currChar));
-
- String s;
- for (s = new String(); !stack.empty(); s = (new StringBuilder(String.valueOf(s))).append(
- ((Character) stack.pop()).toString()).toString())
- ;
- int jspPt = s.indexOf("<%@");
- if (jspPt >= 0) {
- s = s.substring(jspPt + 3);
- done = true;
- }
- all.add(s);
- currChar = trimBlanksBackward(reader, currChar);
- if (currChar == '\uFFFF' || currChar == '@')
- done = true;
- }
-
- return (String[]) all.toArray(new String[all.size()]);
- }
-
- private char trimBlanksBackward(JETDocumentReader reader, char currChar) {
- for (; currChar != '\uFFFF' && Character.isWhitespace(currChar); currChar = reader.readBackward())
- ;
- return currChar;
- }
-
- protected abstract char getRootTagPrevChar();
-
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- org.eclipse.jface.text.IDocument doc = viewer.getDocument();
- JETDocumentReader reader = new JETDocumentReader(doc, offset);
- char c = reader.readBackward();
- ICompletionProposal result[] = (ICompletionProposal[]) null;
- String allWords[] = getAllWords(c, reader);
- if (Character.isSpaceChar(c)) {
- String nonTagWords[] = getInnerKeywordsFor(allWords[allWords.length - 1]);
- result = new ICompletionProposal[nonTagWords.length];
- for (int i = 0; i < nonTagWords.length; i++)
- result[i] = new CompletionProposal(nonTagWords[i], offset, 0, nonTagWords[i].length());
-
- } else if (c == getRootTagPrevChar()) {
- String words[] = getRootTags();
- result = new ICompletionProposal[words.length];
- for (int i = 0; i < words.length; i++)
- result[i] = new CompletionProposal(words[i].substring(allWords[0].length()), offset, 0, words[i].length()
- - allWords[0].length(), null, words[i], null, null);
-
- } else if (Character.isLetter(c)) {
- String words[];
- if (allWords.length > 1)
- words = getNonTagsKeywordsWithPrefix(allWords[allWords.length - 1], allWords[0]);
- else
- words = getTagsWithPrefix(allWords[0]);
- result = new ICompletionProposal[words.length];
- for (int i = 0; i < words.length; i++)
- result[i] = new CompletionProposal(words[i].substring(allWords[0].length()), offset, 0, words[i].length()
- - allWords[0].length(), null, words[i], null, null);
-
- }
- return result;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETCustomTagAssistProcessor.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETCustomTagAssistProcessor.java
deleted file mode 100644
index 869dc5a..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETCustomTagAssistProcessor.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.contentassist;
-
-import java.util.*;
-
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jet.taglib.*;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-
-public class JETCustomTagAssistProcessor extends AbstractXMLTagsBasedAssistProcessor {
-
- private String rootTags[];
- private String tagAttributes[][];
-
- public JETCustomTagAssistProcessor(JETTextEditor editor) {
- super(editor);
- }
-
- public String[] getRootTags() {
- if (rootTags == null) {
- Collection tagNames = new ArrayList();
- String tagLibIds[] = TagLibraryManager.getInstance().getKnownLibraryIds();
- for (int i = 0; i < tagLibIds.length; i++) {
- String id = tagLibIds[i];
- TagLibrary tagLib = TagLibraryManager.getInstance().getTagLibrary(id, true);
- String names[] = tagLib.getTagNames();
- for (int j = 0; j < names.length; j++) {
- String name = names[j];
- tagNames.add((new StringBuilder(String.valueOf(tagLib.getDefaultPrefix()))).append(":").append(name)
- .toString());
- }
-
- }
-
- rootTags = new String[tagNames.size()];
- tagNames.toArray(rootTags);
- }
- return rootTags;
- }
-
- public String[][] getTagAttributes() {
- if (tagAttributes == null) {
- Map tagAttributesMap = new HashMap();
- String tagLibIds[] = TagLibraryManager.getInstance().getKnownLibraryIds();
- for (int i = 0; i < tagLibIds.length; i++) {
- String id = tagLibIds[i];
- TagLibrary tagLib = TagLibraryManager.getInstance().getTagLibrary(id, true);
- String names[] = tagLib.getTagNames();
- for (int j = 0; j < names.length; j++) {
- String name = names[j];
- TagDefinition tagDef = tagLib.getTagDefinition(name);
- Collection tagAttributeDefinitions = tagDef.getAttributeDefinitions();
- String attributeNames[] = new String[tagAttributeDefinitions.size() + 1];
- attributeNames[0] = (new StringBuilder(String.valueOf(tagLib.getDefaultPrefix()))).append(":").append(name)
- .toString();
- int cpt = 1;
- for (Iterator iterator = tagAttributeDefinitions.iterator(); iterator.hasNext();) {
- TagAttributeDefinition tagAttributeDef = (TagAttributeDefinition) iterator.next();
- attributeNames[cpt++] = tagAttributeDef.getName();
- }
-
- tagAttributesMap.put((new StringBuilder(String.valueOf(tagLib.getDefaultPrefix()))).append(":").append(name)
- .toString(), attributeNames);
- }
-
- }
-
- int cpt = 0;
- tagAttributes = new String[tagAttributesMap.size()][];
- for (Iterator iterator = tagAttributesMap.keySet().iterator(); iterator.hasNext();) {
- String tagName = (String) iterator.next();
- String attributeNames[] = (String[]) tagAttributesMap.get(tagName);
- tagAttributes[cpt++] = attributeNames;
- }
-
- }
- return tagAttributes;
- }
-
- protected char getRootTagPrevChar() {
- return '<';
- }
-
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
-
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
-
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETDirectiveAssistProcessor.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETDirectiveAssistProcessor.java
deleted file mode 100644
index 3b48a71..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETDirectiveAssistProcessor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.contentassist;
-
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-
-public class JETDirectiveAssistProcessor extends AbstractXMLTagsBasedAssistProcessor {
- private static String rootTags[] = { "jet", "taglib", "include", "start", "end" };
- private static String tagAttributes[][] = { { "jet", "package", "class", "imports", "startTag", "endTag" },
- { "taglib", "id", "prefix" }, { "include", "file" }, { "start", "id" }, { "end", "id" } };
-
- public JETDirectiveAssistProcessor(JETTextEditor editor) {
- super(editor);
- }
-
- public String[] getRootTags() {
- return rootTags;
- }
-
- public String[][] getTagAttributes() {
- return tagAttributes;
- }
-
- protected char getRootTagPrevChar() {
- return '@';
- }
-
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
-
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
-
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaDeclarationAssistProcessor.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaDeclarationAssistProcessor.java
deleted file mode 100644
index 845e288..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaDeclarationAssistProcessor.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.contentassist;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
-import org.eclipse.jet.core.parser.ast.JETCompilationUnit;
-import org.eclipse.jet.core.parser.ast.JavaDeclaration;
-import org.eclipse.jet.internal.editor.JETEditorHelper;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-
-public class JETJavaDeclarationAssistProcessor extends AbstractJETAssistProcessor {
- private char completionProposalAutoActivationCharacters[];
-
- public JETJavaDeclarationAssistProcessor(JETTextEditor editor) {
- super(editor);
- completionProposalAutoActivationCharacters = editor.getEditorPreferenceStore().getString(
- "content_assist_autoactivation_triggers_java").toCharArray();
- }
-
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- JETCompilationUnit cu = editor.requestCompilationUnit();
- JavaDeclaration declaration = (JavaDeclaration) editor.getASTElement(offset);
-
- // locate the java content first offset start in the JET document.
- // a java element is of the form <% {java content} %>
- // in order to have an exact matching between the completion offset in the JET document and the
- // completion offset of the java content, we should perform the offset matching with the java content start
- // not with the element offset start (the "<%" char offset start)
- int javaContentStart = declaration.getJavaStart();
-
- IJavaProject javaProject = editor.getJavaProject();
- if (javaProject != null) {
- Map mappingPositions = new HashMap();
- String javaSource = editor.compilationHelper().getJavaCode(cu, mappingPositions);
- int javaStartOffset = ((Position)mappingPositions.get(declaration)).offset;
- int javaOffset = javaStartOffset + (offset - javaContentStart);
-
- // check that the positions matches
- JETEditorHelper.checkOffsetPositions(javaSource, viewer.getDocument().get(), javaContentStart, javaStartOffset, declaration.getJavaEnd() - javaContentStart);
-
- IJavaCompletionProposal javaCompletionProposals[] = JETEditorHelper
- .getJavaCompletionProposal(javaProject, cu, javaSource, viewer, javaOffset);
- JETEditorHelper.adjustResults(javaCompletionProposals, offset);
- return javaCompletionProposals;
- } else {
- return null;
- }
- }
-
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
-
- public char[] getCompletionProposalAutoActivationCharacters() {
- return completionProposalAutoActivationCharacters;
- }
-
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-
- public String getErrorMessage() {
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaExpressionAssistProcessor.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaExpressionAssistProcessor.java
deleted file mode 100644
index fbfc977..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaExpressionAssistProcessor.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.contentassist;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
-import org.eclipse.jet.core.parser.ast.JETCompilationUnit;
-import org.eclipse.jet.core.parser.ast.JavaExpression;
-import org.eclipse.jet.internal.editor.JETEditorHelper;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-
-public class JETJavaExpressionAssistProcessor extends AbstractJETAssistProcessor {
- private char completionProposalAutoActivationCharacters[];
-
- /**
- * @param editor
- */
- public JETJavaExpressionAssistProcessor(JETTextEditor editor) {
- super(editor);
- completionProposalAutoActivationCharacters = editor.getEditorPreferenceStore().getString(
- "content_assist_autoactivation_triggers_java").toCharArray();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- JETCompilationUnit cu = editor.requestCompilationUnit();
- JavaExpression expression = (JavaExpression) editor.getASTElement(offset);
-
- // locate the java content first offset start in the JET document.
- // a java element is of the form <% {java content} %>
- // in order to have an exact matching between the completion offset in the JET document and the
- // completion offset of the java content, we should perform the offset matching with the java content start
- // not with the element offset start (the "<%" char offset start)
- int javaContentStart = expression.getJavaStart();
-
- IJavaProject javaProject = editor.getJavaProject();
- if (javaProject != null) {
- // fetch the java content generated for all the AST elements till the current expression
- Map mappingPositions = new HashMap();
- String javaSource = editor.compilationHelper().getJavaCode(cu, mappingPositions);
- int javaStartOffset = ((Position)mappingPositions.get(expression)).offset;
- // check that the positions matches
- JETEditorHelper.checkOffsetPositions(javaSource, viewer.getDocument().get(), javaContentStart, javaStartOffset, expression.getJavaEnd() - javaContentStart);
-
- // calculate where the cursor would be (offset) within the javaSource...
- int javaCursorOffset = javaStartOffset + (offset - javaContentStart);
- IJavaCompletionProposal javaCompletionProposals[] = JETEditorHelper
- .getJavaCompletionProposal(javaProject, cu, javaSource, viewer, javaCursorOffset);
- JETEditorHelper.adjustResults(javaCompletionProposals, offset);
- return javaCompletionProposals;
- } else {
- return null;
- }
- }
-
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
-
- public char[] getCompletionProposalAutoActivationCharacters() {
- return completionProposalAutoActivationCharacters;
- }
-
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-
- public String getErrorMessage() {
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaScriptletAssistProcessor.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaScriptletAssistProcessor.java
deleted file mode 100644
index c25e71d..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETJavaScriptletAssistProcessor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.contentassist;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
-import org.eclipse.jet.core.parser.ast.JETCompilationUnit;
-import org.eclipse.jet.core.parser.ast.JavaScriptlet;
-import org.eclipse.jet.internal.editor.JETEditorHelper;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-
-public class JETJavaScriptletAssistProcessor extends AbstractJETAssistProcessor {
- private char completionProposalAutoActivationCharacters[];
-
- public JETJavaScriptletAssistProcessor(JETTextEditor editor) {
- super(editor);
- completionProposalAutoActivationCharacters = editor.getEditorPreferenceStore().getString(
- "content_assist_autoactivation_triggers_java").toCharArray();
- }
-
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- JETCompilationUnit cu = editor.requestCompilationUnit();
- JavaScriptlet scriptlet = (JavaScriptlet) editor.getASTElement(offset);
-
- // locate the java content first offset start in the JET document.
- // a java element is of the form <% {java content} %>
- // in order to have an exact matching between the completion offset in the JET document and the
- // completion offset of the java content, we should perform the offset matching with the java content start
- // not with the element offset start (the "<%" char offset start)
- int javaContentStart = scriptlet.getJavaStart();
-
- IJavaProject javaProject = editor.getJavaProject();
- if (javaProject != null) {
- // fetch the java content generated for all the AST elements till the current expression
- Map mappingPositions = new HashMap();
- String javaSource = editor.compilationHelper().getJavaCode(cu, mappingPositions);
- int javaStartOffset = ((Position)mappingPositions.get(scriptlet)).offset;
- // check that the positions matches
- JETEditorHelper.checkOffsetPositions(javaSource, viewer.getDocument().get(), javaContentStart, javaStartOffset, scriptlet.getJavaEnd() - javaContentStart);
-
- // calculate where the cursor would be (offset) within the javaSource...
- int javaCursorOffset = javaStartOffset + (offset - javaContentStart);
- IJavaCompletionProposal javaCompletionProposals[] = JETEditorHelper
- .getJavaCompletionProposal(javaProject, cu, javaSource, viewer, javaCursorOffset);
- JETEditorHelper.adjustResults(javaCompletionProposals, offset);
- return javaCompletionProposals;
- } else {
- return null;
- }
- }
-
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
-
- public char[] getCompletionProposalAutoActivationCharacters() {
- return completionProposalAutoActivationCharacters;
- }
-
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-
- public String getErrorMessage() {
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETTagAssistProcessor.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETTagAssistProcessor.java
deleted file mode 100644
index 4c12527..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/contentassist/JETTagAssistProcessor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.contentassist;
-
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-
-
-public class JETTagAssistProcessor extends AbstractJETAssistProcessor {
-
- public JETTagAssistProcessor(JETTextEditor editor) {
- super(editor);
- // TODO Auto-generated constructor stub
- }
-
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public char[] getCompletionProposalAutoActivationCharacters() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public char[] getContextInformationAutoActivationCharacters() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public IContextInformationValidator getContextInformationValidator() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getErrorMessage() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETCustomTagFormattingStrategy.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETCustomTagFormattingStrategy.java
deleted file mode 100644
index 4f41e0d..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETCustomTagFormattingStrategy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.formatter;
-
-import org.eclipse.jface.text.formatter.IFormattingContext;
-import org.eclipse.jface.text.formatter.IFormattingStrategy;
-import org.eclipse.jface.text.formatter.IFormattingStrategyExtension;
-
-public class JETCustomTagFormattingStrategy implements IFormattingStrategy, IFormattingStrategyExtension {
-
- public String format(String content, boolean isLineStart, String indentation, int[] positions) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void formatterStarts(String initialIndentation) {
- // TODO Auto-generated method stub
-
- }
-
- public void formatterStops() {
- // TODO Auto-generated method stub
-
- }
-
- public void format() {
- // TODO Auto-generated method stub
-
- }
-
- public void formatterStarts(IFormattingContext context) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETDirectiveFormattingStrategy.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETDirectiveFormattingStrategy.java
deleted file mode 100644
index 05df61a..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETDirectiveFormattingStrategy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.formatter;
-
-import org.eclipse.jface.text.formatter.IFormattingContext;
-import org.eclipse.jface.text.formatter.IFormattingStrategy;
-import org.eclipse.jface.text.formatter.IFormattingStrategyExtension;
-
-public class JETDirectiveFormattingStrategy implements IFormattingStrategy, IFormattingStrategyExtension {
-
- public String format(String content, boolean isLineStart, String indentation, int[] positions) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void formatterStarts(String initialIndentation) {
- // TODO Auto-generated method stub
-
- }
-
- public void formatterStops() {
- // TODO Auto-generated method stub
-
- }
-
- public void format() {
- // TODO Auto-generated method stub
-
- }
-
- public void formatterStarts(IFormattingContext context) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaDeclarationFormattingStrategy.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaDeclarationFormattingStrategy.java
deleted file mode 100644
index 6bb8011..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaDeclarationFormattingStrategy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.formatter;
-
-import org.eclipse.jface.text.formatter.IFormattingContext;
-import org.eclipse.jface.text.formatter.IFormattingStrategy;
-import org.eclipse.jface.text.formatter.IFormattingStrategyExtension;
-
-public class JETJavaDeclarationFormattingStrategy implements IFormattingStrategy, IFormattingStrategyExtension {
-
- public String format(String content, boolean isLineStart, String indentation, int[] positions) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void formatterStarts(String initialIndentation) {
- // TODO Auto-generated method stub
-
- }
-
- public void formatterStops() {
- // TODO Auto-generated method stub
-
- }
-
- public void format() {
- // TODO Auto-generated method stub
-
- }
-
- public void formatterStarts(IFormattingContext context) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaExpressionFormattingStrategy.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaExpressionFormattingStrategy.java
deleted file mode 100644
index 7f7a128..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaExpressionFormattingStrategy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.formatter;
-
-import org.eclipse.jface.text.formatter.IFormattingContext;
-import org.eclipse.jface.text.formatter.IFormattingStrategy;
-import org.eclipse.jface.text.formatter.IFormattingStrategyExtension;
-
-public class JETJavaExpressionFormattingStrategy implements IFormattingStrategy, IFormattingStrategyExtension {
-
- public String format(String content, boolean isLineStart, String indentation, int[] positions) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void formatterStarts(String initialIndentation) {
- // TODO Auto-generated method stub
-
- }
-
- public void formatterStops() {
- // TODO Auto-generated method stub
-
- }
-
- public void format() {
- // TODO Auto-generated method stub
-
- }
-
- public void formatterStarts(IFormattingContext context) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaScriptletFormattingStrategy.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaScriptletFormattingStrategy.java
deleted file mode 100644
index 81ef27b..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/formatter/JETJavaScriptletFormattingStrategy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.formatter;
-
-import org.eclipse.jface.text.formatter.IFormattingContext;
-import org.eclipse.jface.text.formatter.IFormattingStrategy;
-import org.eclipse.jface.text.formatter.IFormattingStrategyExtension;
-
-public class JETJavaScriptletFormattingStrategy implements IFormattingStrategy, IFormattingStrategyExtension {
-
- public String format(String content, boolean isLineStart, String indentation, int[] positions) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void formatterStarts(String initialIndentation) {
- // TODO Auto-generated method stub
-
- }
-
- public void formatterStops() {
- // TODO Auto-generated method stub
-
- }
-
- public void format() {
- // TODO Auto-generated method stub
-
- }
-
- public void formatterStarts(IFormattingContext context) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/i18n/TextEditorMessages.properties b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/i18n/TextEditorMessages.properties
deleted file mode 100644
index 7deaa82..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/i18n/TextEditorMessages.properties
+++ /dev/null
@@ -1 +0,0 @@
-ContentAssistProposal.label = Content Assist \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlineContentProvider.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlineContentProvider.java
deleted file mode 100644
index 08e62cd..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlineContentProvider.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.outline;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.jet.core.parser.ast.JETASTElement;
-import org.eclipse.jet.core.parser.ast.JETCompilationUnit;
-import org.eclipse.jet.core.parser.ast.TextElement;
-import org.eclipse.jet.core.parser.ast.XMLBodyElement;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class JETOutlineContentProvider implements ITreeContentProvider {
- private ImportsContainerInput importContainerInput;
- private CompilationUnitContainerInput astContainerInput;
- private OutputPackageInput outputPackageInput;
- private JETCompilationUnit cu;
- private OutputClassInput outputClassInput;
- private JETTextEditor editor;
-
- public class OutputClassInput {
- private JETCompilationUnit compilationUnit;
- public OutputClassInput(JETCompilationUnit cu) {
- this.compilationUnit = cu;
- }
- public JETCompilationUnit getCompilationUnit() {
- return compilationUnit;
- }
- }
-
- public class OutputPackageInput {
- private JETCompilationUnit compilationUnit;
- public OutputPackageInput(JETCompilationUnit cu) {
- this.compilationUnit = cu;
- }
- public JETCompilationUnit getCompilationUnit() {
- return compilationUnit;
- }
- }
-
- public class ImportInput {
- private ImportsContainerInput container;
- private String imp;
- public ImportInput(ImportsContainerInput container, String imp) {
- this.container = container;
- this.imp = imp;
- }
- public ImportsContainerInput getImportsContainerInput() {
- return container;
- }
- public String toString() {
- return imp;
- }
- }
-
- public class ImportsContainerInput {
- private JETCompilationUnit compilationUnit;
- private Collection importInputs;
- public ImportsContainerInput(JETCompilationUnit cu) {
- this.compilationUnit = cu;
- importInputs = new ArrayList();
- for (Iterator iterator = cu.getImports().iterator(); iterator.hasNext();) {
- String imp = (String) iterator.next();
- importInputs.add(new ImportInput(this, imp));
- }
- }
- public JETCompilationUnit getCompilationUnit() {
- return compilationUnit;
- }
- public Collection getImportImputs() {
- return importInputs;
- }
- }
-
- public class CompilationUnitContainerInput {
- private Collection bodyElements;
-
- private JETCompilationUnit compilationUnit;
-
- public CompilationUnitContainerInput(JETCompilationUnit cu) {
- this.bodyElements = new ArrayList();
- this.compilationUnit = cu;
- for (Iterator iterator = cu.getBodyElements().iterator(); iterator.hasNext();) {
- JETASTElement elt = (JETASTElement) iterator.next();
- if (isFiltered(elt))
- continue;
- bodyElements.add(elt);
- }
- }
-
- public Collection getFilteredASTElements() {
- return bodyElements;
- }
-
- public JETCompilationUnit getCompilationUnit() {
- return compilationUnit;
- }
-
- private boolean isFiltered(JETASTElement elt) {
- if (elt instanceof TextElement) {
- String text = new String(((TextElement) elt).getText());
- text = text.replace('\r', ' ');
- text = text.replace('\n', ' ');
- text = text.replace('\t', ' ');
- text = text.trim();
- return text.length() == 0;
- }
- return false;
- }
- }
-
- public JETOutlineContentProvider(JETTextEditor editor) {
- this.editor = editor;
- }
-
- public void dispose() {
- // TODO Auto-generated method stub
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- cu = (JETCompilationUnit) newInput;
- }
-
- public Object[] getElements(Object inputElement) {
- Collection results = new ArrayList();
- if (inputElement instanceof JETCompilationUnit) {
- JETCompilationUnit cu = (JETCompilationUnit) inputElement;
- results.add(outputPackageInput = new OutputPackageInput(cu));
- results.add(importContainerInput = new ImportsContainerInput(cu));
- results.add(astContainerInput = new CompilationUnitContainerInput(cu));
- results.addAll(Arrays.asList(cu.getTagLibraryReferences()));
- }
- return results.toArray();
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement == outputPackageInput) {
- return new Object[] { outputClassInput = new OutputClassInput(cu) };
- }
- if (parentElement == importContainerInput) {
- return importContainerInput.getImportImputs().toArray();
- }
- if (parentElement == astContainerInput) {
- return astContainerInput.bodyElements.toArray();
- }
- if (parentElement instanceof XMLBodyElement) {
- XMLBodyElement astElement = (XMLBodyElement) parentElement;
- return astElement.getBodyElements().toArray();
- }
- return null;
- }
-
- public Object getParent(Object element) {
- if (element == outputPackageInput || element == importContainerInput || element == astContainerInput)
- return cu;
- if (element == outputClassInput)
- return outputPackageInput;
- if (element instanceof ImportInput)
- return ((ImportInput) element).getImportsContainerInput();
- if (element instanceof JETASTElement) {
- if (((JETASTElement) element).getParent() == cu)
- return astContainerInput;
- return ((JETASTElement) element).getParent();
- }
- if (importContainerInput.getCompilationUnit().getImports().contains(element))
- return importContainerInput;
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return (element instanceof XMLBodyElement) || (element == outputPackageInput) || (element == importContainerInput)
- || (element == astContainerInput);
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlineLabelProvider.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlineLabelProvider.java
deleted file mode 100644
index bd9b7d8..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlineLabelProvider.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.outline;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jet.compiler.CompileOptionsManager;
-import org.eclipse.jet.core.compiler.JETCompilerOptions;
-import org.eclipse.jet.core.parser.ast.Comment;
-import org.eclipse.jet.core.parser.ast.JETDirective;
-import org.eclipse.jet.core.parser.ast.JavaDeclaration;
-import org.eclipse.jet.core.parser.ast.JavaExpression;
-import org.eclipse.jet.core.parser.ast.JavaScriptlet;
-import org.eclipse.jet.core.parser.ast.TextElement;
-import org.eclipse.jet.core.parser.ast.XMLElement;
-import org.eclipse.jet.internal.editor.Activator;
-import org.eclipse.jet.internal.editor.JETEditorHelper;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jet.taglib.TagLibraryReference;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.ISharedImages;
-
-public class JETOutlineLabelProvider extends LabelProvider {
- private JETTextEditor editor;
-
- public JETOutlineLabelProvider(JETTextEditor editor) {
- this.editor = editor;
- }
-
- public Image getImage(Object element) {
- if (element instanceof Comment) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_JAVADOCTAG);
- } else if (element instanceof JavaDeclaration) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_PUBLIC);
- } else if (element instanceof JavaExpression) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_DEFAULT);
- } else if (element instanceof JavaScriptlet) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_PUBLIC);
- } else if (element instanceof JETDirective) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_PROTECTED);
- } else if (element instanceof TextElement) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_IMPDECL);
- } else if (element instanceof XMLElement) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_PROTECTED);
- } else if (element instanceof JETOutlineContentProvider.ImportsContainerInput) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_IMPCONT);
- } else if (element instanceof JETOutlineContentProvider.ImportInput) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_IMPDECL);
- } else if (element instanceof JETOutlineContentProvider.CompilationUnitContainerInput) {
- return Activator.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
- } else if (element instanceof JETOutlineContentProvider.OutputPackageInput) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_PACKDECL);
- } else if (element instanceof JETOutlineContentProvider.OutputClassInput) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_CUNIT);
- } else if (element instanceof TagLibraryReference) {
- return JavaUI.getSharedImages().getImage(org.eclipse.jdt.ui.ISharedImages.IMG_OBJS_ANNOTATION);
- }
- return super.getImage(element);
- }
-
- public String getText(Object element) {
- if (element instanceof Comment)
- return getShortText(((Comment) element).getCommentText());
- if (element instanceof JavaDeclaration)
- return (new StringBuilder("<%!")).append(getShortText(((JavaDeclaration) element).getJavaContent())).append("%>")
- .toString();
- if (element instanceof JavaExpression)
- return (new StringBuilder("<%=")).append(getShortText(((JavaExpression) element).getJavaContent())).append("%>")
- .toString();
- if (element instanceof JavaScriptlet)
- return (new StringBuilder("<%")).append(getShortText(((JavaScriptlet) element).getJavaContent())).append("%>")
- .toString();
- if (element instanceof JETDirective)
- return (new StringBuilder("<%@")).append(((JETDirective) element).getName()).append(" ").append(
- getAttributesText((JETDirective) element)).append("%>").toString();
- if (element instanceof TextElement)
- return getShortText(new String(((TextElement) element).getText()));
- if (element instanceof XMLElement)
- return (new StringBuilder("<")).append(((XMLElement) element).getName()).append(" ").append(
- getAttributesText((XMLElement) element)).append(">").toString();
- if (element instanceof JETOutlineContentProvider.ImportsContainerInput)
- return "import declarations";
- if (element instanceof JETOutlineContentProvider.CompilationUnitContainerInput)
- return "Template AST";
- if (element instanceof JETOutlineContentProvider.OutputPackageInput) {
- String packageName = ((JETOutlineContentProvider.OutputPackageInput) element).getCompilationUnit()
- .getOutputJavaPackage();
- if (packageName == null) {
- Map options = CompileOptionsManager.getOptions(editor.getJavaProject().getProject());
- if (options.isEmpty())
- options = JETCompilerOptions.getDefaultCompilerOptions();
- packageName = (String) options.get("org.eclipse.jet.compiledTemplatePackage");
- }
- return packageName;
- }
- if (element instanceof JETOutlineContentProvider.OutputClassInput) {
- String className = ((JETOutlineContentProvider.OutputClassInput) element).getCompilationUnit()
- .getOutputJavaClassName();
- if (className == null && (editor.getEditorInput() instanceof IFileEditorInput)) {
- IFile file = ((IFileEditorInput) editor.getEditorInput()).getFile();
- String inputName = file.getFullPath().removeFileExtension().lastSegment();
- String baseClassName = JETEditorHelper.makeJavaClassName(inputName);
- className = baseClassName;
- }
- return className;
- }
- if (element instanceof TagLibraryReference)
- return ((TagLibraryReference) element).getTagLibraryId();
- else
- return super.getText(element);
- }
-
- private String getShortText(String text) {
- if (text.length() > 25)
- text = text.substring(0, 25) + "...";
- return text;
- }
-
- private String getAttributesText(XMLElement element) {
- Map attributes = element.getAttributes();
- StringBuffer textBuffer = new StringBuffer(attributes.size() * 5);
- for (Iterator iterator = attributes.keySet().iterator(); iterator.hasNext();) {
- String attrName = (String) iterator.next();
- String attrValue = (String) attributes.get(attrName);
- textBuffer.append(attrName).append("=\"").append(attrValue).append("\"");
- textBuffer.append(' ');
- }
- return textBuffer.toString();
- }
-
- private String getAttributesText(JETDirective directive) {
- Map attributes = directive.getAttributes();
- StringBuffer textBuffer = new StringBuffer(attributes.size() * 5);
- for (Iterator iterator = attributes.keySet().iterator(); iterator.hasNext();) {
- String attrName = (String) iterator.next();
- String attrValue = (String) attributes.get(attrName);
- textBuffer.append(attrName).append("=\"").append(attrValue).append("\"");
- textBuffer.append(' ');
- }
- return textBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlinePage.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlinePage.java
deleted file mode 100644
index d46ee26..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/outline/JETOutlinePage.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.outline;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jet.core.parser.ast.JETCompilationUnit;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-
-public class JETOutlinePage extends ContentOutlinePage implements IAdaptable {
- private JETTextEditor editor;
-
- private TreeViewer contentOutlineViewer;
-
- public JETOutlinePage(JETTextEditor editor) {
- this.editor = editor;
- }
-
- public void createControl(Composite parent) {
- super.createControl(parent);
- contentOutlineViewer = getTreeViewer();
- contentOutlineViewer.addSelectionChangedListener(this);
- contentOutlineViewer.setContentProvider(new JETOutlineContentProvider(editor));
- contentOutlineViewer.setLabelProvider(new JETOutlineLabelProvider(editor));
- setInput();
- }
-
- public void setInput() {
- JETCompilationUnit cu = editor.requestCompilationUnit();
- contentOutlineViewer.setInput(cu);
- contentOutlineViewer.refresh();
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/ITokenScannerProvider.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/ITokenScannerProvider.java
deleted file mode 100644
index d4a7430..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/ITokenScannerProvider.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.partition;
-
-import org.eclipse.jface.text.rules.ITokenScanner;
-
-public interface ITokenScannerProvider {
-
- public abstract ITokenScanner getTokenScanner(String s);
-} \ No newline at end of file
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
deleted file mode 100644
index 6a58e72..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/JETDocumentPartitionScanner.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.partition;
-
-import java.util.*;
-import org.eclipse.jdt.internal.ui.text.java.JavaAutoIndentStrategy;
-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.jface.text.IAutoEditStrategy;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-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.*;
-
-public class JETDocumentPartitionScanner extends RuleBasedPartitionScanner {
-
- public static final String JET_COMMENT = "__jet_comment";
- public static final String JET_CUSTOM_TAG = "__jet_xml_tag";
- public static final String JET_DIRECTIVE = "__jet_directive";
- public static final String JET_JAVA_DECLARATION = "__jet_java_declaration";
- public static final String JET_JAVA_EXPRESSION = "__jet_java_expression";
- public static final String JET_JAVA_SCRIPTLET = "__jet_java_scriptlet";
-
- private Map tokenScanners;
- private Map damagerRepairers;
- private Map damagersOnly;
- private Map repairersOnly;
- private Map completionProcessors;
- private Map formattingStrategies;
- private JETTextEditor editor;
-
- private List contentTypes;
- private JETCustomTagScanner tagScanner;
- private JETDirectiveScanner directiveScanner;
- private JETJavaDeclarationScanner declarationScanner;
- private JETJavaExpressionScanner expressionScanner;
- private JETJavaScriptletScanner scriptletScanner;
- private JETCommentScanner commentScanner;
-
- private IContentAssistProcessor tagAssistProcessor;
- private IContentAssistProcessor scriptletAssistProcessor;
- private IContentAssistProcessor expressionAssistProcessor;
- private IContentAssistProcessor declarationAssistProcessor;
-
- private IContentAssistProcessor directiveAssistProcessor;
- private IFormattingStrategy tagFormattingStrategy;
- private IFormattingStrategy scriptletFormattingStrategy;
- private IFormattingStrategy expressionFormattingStrategy;
- private IFormattingStrategy declarationFormattingStrategy;
- private IFormattingStrategy directiveFormattingStrategy;
-
- private PartitionScannerBasedDamagerRepairer jetTextContentDamagerRepairer;
-
- public JETDocumentPartitionScanner(JETTextEditor editor) {
- this.editor = editor;
- List rules = new ArrayList();
- org.eclipse.jface.text.rules.IToken jetComments = new Token("__jet_comment");
- org.eclipse.jface.text.rules.IToken jetCustomTags = new Token("__jet_xml_tag");
- org.eclipse.jface.text.rules.IToken jetDirective = new Token("__jet_directive");
- org.eclipse.jface.text.rules.IToken jetJavaDeclaration = new Token("__jet_java_declaration");
- org.eclipse.jface.text.rules.IToken jetJavaExpression = new Token("__jet_java_expression");
- org.eclipse.jface.text.rules.IToken jetJavaScriptlet = new Token("__jet_java_scriptlet");
- rules.add(new ASTJETCommentRule(editor, jetComments));
- rules.add(new ASTJETCustomTagRule(editor, jetCustomTags));
- rules.add(new ASTJETDirectiveRule(editor, jetDirective));
- rules.add(new ASTJETJavaDeclarationRule(editor, jetJavaDeclaration));
- rules.add(new ASTJETJavaExpressionRule(editor, jetJavaExpression));
- rules.add(new ASTJETJavaScriptletRule(editor, jetJavaScriptlet));
- IPredicateRule result[] = new IPredicateRule[rules.size()];
- result = (IPredicateRule[]) rules.toArray(result);
- setPredicateRules(result);
- }
-
- public int getNextCharacterOffset() {
- return fOffset;
- }
-
- public String[] getContentTypes() {
- if (contentTypes == null) {
- contentTypes = new ArrayList();
- contentTypes.add(IDocument.DEFAULT_CONTENT_TYPE);
- contentTypes.add("__jet_comment");
- contentTypes.add("__jet_xml_tag");
- contentTypes.add("__jet_directive");
- contentTypes.add("__jet_java_declaration");
- contentTypes.add("__jet_java_expression");
- contentTypes.add("__jet_java_scriptlet");
- }
- String result[] = new String[contentTypes.size()];
- result = (String[]) contentTypes.toArray(result);
- return result;
- }
-
- private void initTokenScanners() {
- tokenScanners = new HashMap();
- tokenScanners.put("__jet_comment", getCommentScanner());
- tokenScanners.put("__jet_xml_tag", getCustomTagScanner());
- tokenScanners.put("__jet_directive", getDirectiveScanner());
- tokenScanners.put("__jet_java_declaration", getJavaDeclarationScanner());
- tokenScanners.put("__jet_java_expression", getJavaExpressionScanner());
- tokenScanners.put("__jet_java_scriptlet", getJavaScriptletScanner());
- }
-
- private void initCompletionProcessors(ContentAssistant assistant) {
- completionProcessors = new HashMap();
- completionProcessors.put(IDocument.DEFAULT_CONTENT_TYPE, getTextElementAssistProcessor(assistant));
- completionProcessors.put("__jet_comment", getCommentAssistProcessor(assistant));
- completionProcessors.put("__jet_xml_tag", getCustomTagAssistProcessor(assistant));
- completionProcessors.put("__jet_directive", getDirectiveAssistProcessor(assistant));
- completionProcessors.put("__jet_java_declaration", getJavaDeclarationAssistProcessor(assistant));
- completionProcessors.put("__jet_java_expression", getJavaExpressionAssistProcessor(assistant));
- completionProcessors.put("__jet_java_scriptlet", getJavaScriptletAssistProcessor(assistant));
- }
-
- private void initFormattingStrategies() {
- formattingStrategies = new HashMap();
- formattingStrategies.put(IDocument.DEFAULT_CONTENT_TYPE, getTextElementFormattingStrategy());
- formattingStrategies.put("__jet_comment", getCommentFormattingStrategy());
- formattingStrategies.put("__jet_xml_tag", getCustomTagFormattingStrategy());
- formattingStrategies.put("__jet_directive", getDirectiveFormattingStrategy());
- formattingStrategies.put("__jet_java_declaration", getJavaDeclarationFormattingStrategy());
- formattingStrategies.put("__jet_java_expression", getJavaExpressionFormattingStrategy());
- formattingStrategies.put("__jet_java_scriptlet", getJavaScriptletFormattingStrategy());
- }
-
- private void initDamagerRepairers() {
- damagerRepairers = new HashMap();
- damagerRepairers.put("__jet_comment", createDefaultDamagerRepairer("__jet_comment"));
- damagerRepairers.put("__jet_xml_tag", createDefaultDamagerRepairer("__jet_xml_tag"));
- damagerRepairers.put("__jet_directive", createDefaultDamagerRepairer("__jet_directive"));
- damagerRepairers.put("__jet_java_declaration", createDefaultDamagerRepairer("__jet_java_declaration"));
- damagerRepairers.put("__jet_java_expression", createDefaultDamagerRepairer("__jet_java_expression"));
- damagerRepairers.put("__jet_java_scriptlet", createDefaultDamagerRepairer("__jet_java_scriptlet"));
- if (createJETTextContentDamagerRepairer() != null)
- damagerRepairers.put(IDocument.DEFAULT_CONTENT_TYPE, jetTextContentDamagerRepairer);
- }
-
- private void initDamagersOnly() {
- damagersOnly = new HashMap();
- }
-
- protected void initRepairersOnly() {
- repairersOnly = new HashMap();
- }
-
- protected IFormattingStrategy getTextElementFormattingStrategy() {
- return null;
- }
-
- protected IFormattingStrategy getCommentFormattingStrategy() {
- return null;
- }
-
- protected IFormattingStrategy getCustomTagFormattingStrategy() {
- if (tagFormattingStrategy == null)
- tagFormattingStrategy = new JETCustomTagFormattingStrategy();
- return tagFormattingStrategy;
- }
-
- protected IFormattingStrategy getJavaScriptletFormattingStrategy() {
- if (scriptletFormattingStrategy == null)
- scriptletFormattingStrategy = new JETJavaScriptletFormattingStrategy();
- return scriptletFormattingStrategy;
- }
-
- protected IFormattingStrategy getJavaExpressionFormattingStrategy() {
- if (expressionFormattingStrategy == null)
- expressionFormattingStrategy = new JETJavaExpressionFormattingStrategy();
- return expressionFormattingStrategy;
- }
-
- protected IFormattingStrategy getJavaDeclarationFormattingStrategy() {
- if (declarationFormattingStrategy == null)
- declarationFormattingStrategy = new JETJavaDeclarationFormattingStrategy();
- return declarationFormattingStrategy;
- }
-
- protected IFormattingStrategy getDirectiveFormattingStrategy() {
- if (directiveFormattingStrategy == null)
- directiveFormattingStrategy = new JETDirectiveFormattingStrategy();
- return directiveFormattingStrategy;
- }
-
- protected IContentAssistProcessor getTextElementAssistProcessor(ContentAssistant assistant) {
- return null;
- }
-
- protected IContentAssistProcessor getCommentAssistProcessor(ContentAssistant assistant) {
- return null;
- }
-
- protected IContentAssistProcessor getCustomTagAssistProcessor(ContentAssistant assistant) {
- if (tagAssistProcessor == null)
- tagAssistProcessor = new JETCustomTagAssistProcessor(editor);
- return tagAssistProcessor;
- }
-
- protected IContentAssistProcessor getJavaScriptletAssistProcessor(ContentAssistant assistant) {
- if (scriptletAssistProcessor == null)
- scriptletAssistProcessor = new JETJavaScriptletAssistProcessor(editor);
- return scriptletAssistProcessor;
- }
-
- protected IContentAssistProcessor getJavaExpressionAssistProcessor(ContentAssistant assistant) {
- if (expressionAssistProcessor == null)
- expressionAssistProcessor = new JETJavaExpressionAssistProcessor(editor);
- return expressionAssistProcessor;
- }
-
- protected IContentAssistProcessor getJavaDeclarationAssistProcessor(ContentAssistant assistant) {
- if (declarationAssistProcessor == null)
- declarationAssistProcessor = new JETJavaDeclarationAssistProcessor(editor);
- return declarationAssistProcessor;
- }
-
- protected IContentAssistProcessor getDirectiveAssistProcessor(ContentAssistant assistant) {
- if (directiveAssistProcessor == null)
- directiveAssistProcessor = new JETDirectiveAssistProcessor(editor);
- return directiveAssistProcessor;
- }
-
- protected ITokenScanner getCommentScanner() {
- org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager tokenStyleManager = editor.getTokenStyleManager();
- org.eclipse.jface.preference.IPreferenceStore preferenceStore = editor.getEditorPreferenceStore();
- if (commentScanner == null)
- commentScanner = new JETCommentScanner(tokenStyleManager, preferenceStore);
- return commentScanner;
- }
-
- protected ITokenScanner getCustomTagScanner() {
- org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager tokenStyleManager = editor.getTokenStyleManager();
- org.eclipse.jface.preference.IPreferenceStore preferenceStore = editor.getEditorPreferenceStore();
- if (tagScanner == null)
- tagScanner = new JETCustomTagScanner(tokenStyleManager, preferenceStore);
- return tagScanner;
- }
-
- protected ITokenScanner getJavaScriptletScanner() {
- org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager tokenStyleManager = editor.getTokenStyleManager();
- org.eclipse.jface.preference.IPreferenceStore preferenceStore = editor.getEditorPreferenceStore();
- if (scriptletScanner == null)
- scriptletScanner = new JETJavaScriptletScanner(tokenStyleManager, preferenceStore);
- return scriptletScanner;
- }
-
- protected ITokenScanner getJavaExpressionScanner() {
- org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager tokenStyleManager = editor.getTokenStyleManager();
- org.eclipse.jface.preference.IPreferenceStore preferenceStore = editor.getEditorPreferenceStore();
- if (expressionScanner == null)
- expressionScanner = new JETJavaExpressionScanner(tokenStyleManager, preferenceStore);
- return expressionScanner;
- }
-
- protected ITokenScanner getJavaDeclarationScanner() {
- org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager tokenStyleManager = editor.getTokenStyleManager();
- org.eclipse.jface.preference.IPreferenceStore preferenceStore = editor.getEditorPreferenceStore();
- if (declarationScanner == null)
- declarationScanner = new JETJavaDeclarationScanner(tokenStyleManager, preferenceStore);
- return declarationScanner;
- }
-
- protected ITokenScanner getDirectiveScanner() {
- org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager tokenStyleManager = editor.getTokenStyleManager();
- org.eclipse.jface.preference.IPreferenceStore preferenceStore = editor.getEditorPreferenceStore();
- if (directiveScanner == null)
- directiveScanner = new JETDirectiveScanner(tokenStyleManager, preferenceStore);
- return directiveScanner;
- }
-
- public ITokenScanner getTokenScanner(String contentType) {
- if (tokenScanners == null)
- initTokenScanners();
- ITokenScanner scanner = (ITokenScanner) tokenScanners.get(contentType);
- return scanner;
- }
-
- private PartitionScannerBasedDamagerRepairer createJETTextContentDamagerRepairer() {
- if (jetTextContentDamagerRepairer == null) {
- IJETDefaultTextColorerDelegate delegate = editor.getCurrentColorerDelegate();
- if (delegate != null) {
- RuleBasedPartitionScanner partitionScanner = new RuleBasedPartitionScanner();
- partitionScanner.setPredicateRules(delegate.getPartitioningRules());
- jetTextContentDamagerRepairer = new PartitionScannerBasedDamagerRepairer(partitionScanner, delegate);
- }
- }
- return jetTextContentDamagerRepairer;
- }
-
- public void updateJETTextContentDamagerRepairer() {
- if (jetTextContentDamagerRepairer != null) {
- IJETDefaultTextColorerDelegate delegate = editor.getCurrentColorerDelegate();
- if (delegate != null) {
- RuleBasedPartitionScanner partitionScanner = new RuleBasedPartitionScanner();
- partitionScanner.setPredicateRules(delegate.getPartitioningRules());
- jetTextContentDamagerRepairer.setPartitionScanner(partitionScanner);
- jetTextContentDamagerRepairer.setTokenScannerProvider(delegate);
- }
- }
- }
-
- private DefaultDamagerRepairer createDefaultDamagerRepairer(String contentType) {
- ITokenScanner tokenScanner = getTokenScanner(contentType);
- return tokenScanner != null ? new DefaultDamagerRepairer(tokenScanner) : null;
- }
-
- public IPresentationDamager getDamager(String contentType) {
- if (damagerRepairers == null)
- initDamagerRepairers();
- IPresentationDamager damager = (IPresentationDamager) damagerRepairers.get(contentType);
- if (damager == null) {
- if (damagersOnly == null)
- initDamagersOnly();
- damager = (IPresentationDamager) damagersOnly.get(contentType);
- }
- return damager;
- }
-
- public IPresentationRepairer getRepairer(String contentType) {
- if (damagerRepairers == null)
- initDamagerRepairers();
- IPresentationRepairer repairer = (IPresentationRepairer) damagerRepairers.get(contentType);
- if (repairer == null) {
- if (repairersOnly == null)
- initRepairersOnly();
- repairer = (IPresentationRepairer) repairersOnly.get(contentType);
- }
- return repairer;
- }
-
- public IContentAssistProcessor getCompletionProcessor(String contentType, ContentAssistant assistant) {
- if (completionProcessors == null)
- initCompletionProcessors(assistant);
- IContentAssistProcessor processor = (IContentAssistProcessor) completionProcessors.get(contentType);
- return processor;
- }
-
- public IFormattingStrategy getFormattingStrategy(String contentType) {
- if (formattingStrategies == null)
- initFormattingStrategies();
- IFormattingStrategy formatter = (IFormattingStrategy) formattingStrategies.get(contentType);
- return formatter;
- }
-
- public IAutoEditStrategy[] getAutoEditStrategies(String contentType) {
- 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() });
- return result;
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/PartitionScannerBasedDamagerRepairer.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/PartitionScannerBasedDamagerRepairer.java
deleted file mode 100644
index a02e101..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/partition/PartitionScannerBasedDamagerRepairer.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.partition;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.presentation.IPresentationDamager;
-import org.eclipse.jface.text.presentation.IPresentationRepairer;
-import org.eclipse.jface.text.rules.*;
-import org.eclipse.swt.custom.StyleRange;
-
-public class PartitionScannerBasedDamagerRepairer implements IPresentationDamager, IPresentationRepairer {
-
- protected IDocument document;
- protected IPartitionTokenScanner partitionScanner;
- protected ITokenScannerProvider tokenScannerProvider;
- protected TextAttribute defaultTextAttribute;
-
- public PartitionScannerBasedDamagerRepairer(IPartitionTokenScanner scanner, ITokenScannerProvider provider) {
- Assert.isNotNull(scanner);
- Assert.isNotNull(provider);
- partitionScanner = scanner;
- tokenScannerProvider = provider;
- defaultTextAttribute = new TextAttribute(null);
- }
-
- public void setDocument(IDocument document) {
- this.document = document;
- }
-
- public void setPartitionScanner(IPartitionTokenScanner partitionScanner) {
- this.partitionScanner = partitionScanner;
- }
-
- public void setTokenScannerProvider(ITokenScannerProvider provider) {
- tokenScannerProvider = provider;
- }
-
- public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) {
- if (!documentPartitioningChanged)
- return new Region(partition.getOffset(), partition.getLength());
- else
- return partition;
- }
-
- public void createPresentation(TextPresentation presentation, ITypedRegion region) {
- partitionScanner.setRange(document, region.getOffset(), region.getLength());
- String lastContentType = null;
- int partitionScannerTokenLength = 0;
- int partitionScannerTokenOffset = region.getOffset();
- do {
- IToken partitionToken = partitionScanner.nextToken();
- if (partitionToken.isEOF()) {
- if (lastContentType != null) {
- ITokenScanner tokenScanner = tokenScannerProvider.getTokenScanner(lastContentType);
- if (tokenScanner == null)
- addRange(presentation, partitionScanner.getTokenOffset(), partitionScanner.getTokenLength(),
- defaultTextAttribute);
- else
- applyTokenScanner(presentation, partitionScannerTokenLength, partitionScannerTokenOffset, tokenScanner);
- }
- break;
- }
- String contentType = getTokenContentType(partitionToken);
- if (contentType == null)
- contentType = IDocument.DEFAULT_CONTENT_TYPE;
- if (contentType.equals(lastContentType)) {
- partitionScannerTokenLength += partitionScanner.getTokenLength();
- } else {
- if (lastContentType != null) {
- ITokenScanner tokenScanner = tokenScannerProvider.getTokenScanner(lastContentType);
- if (tokenScanner == null)
- addRange(presentation, partitionScanner.getTokenOffset(), partitionScanner.getTokenLength(),
- defaultTextAttribute);
- else
- applyTokenScanner(presentation, partitionScannerTokenLength, partitionScannerTokenOffset, tokenScanner);
- }
- lastContentType = contentType;
- partitionScannerTokenOffset = partitionScanner.getTokenOffset();
- partitionScannerTokenLength = partitionScanner.getTokenLength();
- }
- } while (true);
- }
-
- private void applyTokenScanner(TextPresentation presentation, int partitionScannerTokenLength,
- int partitionScannerTokenOffset, ITokenScanner tokenScanner) {
- int lastStart = partitionScannerTokenOffset;
- int length = 0;
- boolean firstToken = true;
- IToken lastToken = Token.UNDEFINED;
- TextAttribute lastAttribute = getTokenTextAttribute(lastToken);
- tokenScanner.setRange(document, partitionScannerTokenOffset, partitionScannerTokenLength);
- do {
- IToken token = tokenScanner.nextToken();
- if (!token.isEOF()) {
- TextAttribute attribute = getTokenTextAttribute(token);
- if (lastAttribute != null && lastAttribute.equals(attribute)) {
- length += tokenScanner.getTokenLength();
- firstToken = false;
- } else {
- if (!firstToken)
- addRange(presentation, lastStart, length, lastAttribute);
- firstToken = false;
- lastToken = token;
- lastAttribute = attribute;
- lastStart = tokenScanner.getTokenOffset();
- length = tokenScanner.getTokenLength();
- }
- } else {
- addRange(presentation, lastStart, length, lastAttribute);
- return;
- }
- } while (true);
- }
-
- protected String getTokenContentType(IToken token) {
- Object data = token.getData();
- if (data instanceof String)
- return (String) data;
- else
- return null;
- }
-
- protected TextAttribute getTokenTextAttribute(IToken token) {
- Object data = token.getData();
- if (data instanceof TextAttribute)
- return (TextAttribute) data;
- else
- return defaultTextAttribute;
- }
-
- protected void addRange(TextPresentation presentation, int offset, int length, TextAttribute attr) {
- if (attr != null) {
- int style = attr.getStyle();
- int fontStyle = style & 3;
- StyleRange styleRange = new StyleRange(offset, length, attr.getForeground(), attr.getBackground(), fontStyle);
- styleRange.strikeout = (style & 0x20000000) != 0;
- styleRange.underline = (style & 0x40000000) != 0;
- styleRange.font = attr.getFont();
- presentation.addStyleRange(styleRange);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTElementScannerRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTElementScannerRule.java
deleted file mode 100644
index aa40ef1..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTElementScannerRule.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jet.core.parser.ast.JETASTElement;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jet.internal.editor.partition.JETDocumentPartitionScanner;
-import org.eclipse.jface.text.rules.*;
-
-public abstract class ASTElementScannerRule implements IPredicateRule {
- private JETTextEditor editor;
-
- private IToken successToken;
-
- public ASTElementScannerRule(JETTextEditor editor, IToken successToken) {
- this.editor = editor;
- this.successToken = successToken;
- }
-
- public IToken getSuccessToken() {
- return successToken;
- }
-
- public IToken evaluate(ICharacterScanner scanner) {
- return evaluate(scanner, false);
- }
-
- public IToken evaluate(ICharacterScanner scanner, boolean resume) {
- JETDocumentPartitionScanner jetScanner = (JETDocumentPartitionScanner) scanner;
- int offset = jetScanner.getNextCharacterOffset();
- JETASTElement element = editor.getASTElement(offset);
- if (element != null && isAcceptedElement(element)) {
- int length = element.getEnd() - offset;
- for (int i = 0; i < length; i++)
- scanner.read();
-
- return successToken;
- } else {
- return Token.UNDEFINED;
- }
- }
-
- protected abstract boolean isAcceptedElement(JETASTElement jet2astelement);
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETCommentRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETCommentRule.java
deleted file mode 100644
index 94ac578..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETCommentRule.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jet.core.parser.ast.Comment;
-import org.eclipse.jet.core.parser.ast.JETASTElement;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.rules.IToken;
-
-public class ASTJETCommentRule extends ASTElementScannerRule {
-
- public ASTJETCommentRule(JETTextEditor editor, IToken token) {
- super(editor, token);
- }
-
- protected boolean isAcceptedElement(JETASTElement element) {
- return element instanceof Comment;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETCustomTagRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETCustomTagRule.java
deleted file mode 100644
index d415f94..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETCustomTagRule.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jet.core.parser.ast.JETASTElement;
-import org.eclipse.jet.core.parser.ast.XMLBodyElementEnd;
-import org.eclipse.jet.core.parser.ast.XMLElement;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.rules.IToken;
-
-public class ASTJETCustomTagRule extends ASTElementScannerRule {
-
- public ASTJETCustomTagRule(JETTextEditor editor, IToken token) {
- super(editor, token);
- }
-
- protected boolean isAcceptedElement(JETASTElement element) {
- return (element instanceof XMLElement) || (element instanceof XMLBodyElementEnd);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETDirectiveRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETDirectiveRule.java
deleted file mode 100644
index 92fab86..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETDirectiveRule.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jet.core.parser.ast.JETDirective;
-import org.eclipse.jet.core.parser.ast.JETASTElement;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.rules.IToken;
-
-public class ASTJETDirectiveRule extends ASTElementScannerRule {
-
- public ASTJETDirectiveRule(JETTextEditor editor, IToken token) {
- super(editor, token);
- }
-
- protected boolean isAcceptedElement(JETASTElement element) {
- return element instanceof JETDirective;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaDeclarationRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaDeclarationRule.java
deleted file mode 100644
index ffa27dc..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaDeclarationRule.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jet.core.parser.ast.JETASTElement;
-import org.eclipse.jet.core.parser.ast.JavaDeclaration;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.rules.IToken;
-
-public class ASTJETJavaDeclarationRule extends ASTElementScannerRule {
-
- public ASTJETJavaDeclarationRule(JETTextEditor editor, IToken token) {
- super(editor, token);
- }
-
- protected boolean isAcceptedElement(JETASTElement element) {
- return element instanceof JavaDeclaration;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaExpressionRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaExpressionRule.java
deleted file mode 100644
index 255c929..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaExpressionRule.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jet.core.parser.ast.JETASTElement;
-import org.eclipse.jet.core.parser.ast.JavaExpression;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.rules.IToken;
-
-public class ASTJETJavaExpressionRule extends ASTElementScannerRule {
-
- public ASTJETJavaExpressionRule(JETTextEditor editor, IToken token) {
- super(editor, token);
- }
-
- protected boolean isAcceptedElement(JETASTElement element) {
- return element instanceof JavaExpression;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaScriptletRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaScriptletRule.java
deleted file mode 100644
index 36bd08a..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/ASTJETJavaScriptletRule.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jet.core.parser.ast.JETASTElement;
-import org.eclipse.jet.core.parser.ast.JavaScriptlet;
-import org.eclipse.jet.internal.editor.JETTextEditor;
-import org.eclipse.jface.text.rules.IToken;
-
-public class ASTJETJavaScriptletRule extends ASTElementScannerRule {
-
- public ASTJETJavaScriptletRule(JETTextEditor editor, IToken token) {
- super(editor, token);
- }
-
- protected boolean isAcceptedElement(JETASTElement element) {
- return element instanceof JavaScriptlet;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETBracketRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETBracketRule.java
deleted file mode 100644
index 68d18ef..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETBracketRule.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 - 2006 Joel Cheuoua & 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.Token;
-
-/**
- * @author jcheuoua
- * @version $Revision: 1.2 $
- */
-public class JETBracketRule extends MultiLineRule {
- protected IToken token;
-
- /**
- * Constructor for JETBracketRule.
- *
- * @param token
- * IToken
- */
- public JETBracketRule(IToken token) {
- super("<%", "%>", token);
- this.token = token;
- }
-
- /**
- * Method evaluate.
- *
- * @param scanner
- * ICharacterScanner
- * @return IToken
- * @see org.eclipse.jface.text.rules.IRule#evaluate(ICharacterScanner)
- */
- public IToken evaluate(ICharacterScanner scanner) {
- char c = (char) scanner.read();
- if (c == '%') { // we're reaching the end of the token zone
- c = (char) scanner.read();
- if (c == '>') {
- return token;
- } else {
- scanner.unread();
- scanner.unread();
- return Token.UNDEFINED;
- }
- }
- if (c == '<') { // we're at the beginning of the token zone
- c = (char) scanner.read();
- if (c == '%') {
- c = (char) scanner.read();
- if (c == '!' || c == '@' || c == '=' || c == '-') {
- return token;
- } else {
- scanner.unread();
- return token;
- }
- } else {
- scanner.unread();
- scanner.unread();
- return Token.UNDEFINED;
- }
- } else {
- scanner.unread();
- return Token.UNDEFINED;
- }
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETCommentRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETCommentRule.java
deleted file mode 100644
index 2f1ee7f..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETCommentRule.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jface.text.rules.*;
-
-public class JETCommentRule extends MultiLineRule {
-
- public JETCommentRule(IToken token) {
- super("<%--", "--%>", token, '\\');
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETCustomTagRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETCustomTagRule.java
deleted file mode 100644
index fed5476..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETCustomTagRule.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.jet.taglib.TagLibrary;
-import org.eclipse.jet.taglib.TagLibraryManager;
-import org.eclipse.jface.text.rules.*;
-
-public class JETCustomTagRule extends MultiLineRule {
- private Set tagElementNames;
- public JETCustomTagRule(IToken token) {
- super("<", ">", token, '\\');
- String[] tagLibIds = TagLibraryManager.getInstance().getKnownLibraryIds();
- tagElementNames = new HashSet();
- for (int i = 0; i < tagLibIds.length; i++) {
- String id = tagLibIds[i];
- TagLibrary tagLib = TagLibraryManager.getInstance().getTagLibrary(id, true);
- String[] names = tagLib.getTagNames();
- for (int j = 0; j < names.length; j++) {
- String name = names[j];
- tagElementNames.add(tagLib.getDefaultPrefix() + ":" + name);
- }
- }
- }
-
- public IToken evaluate(ICharacterScanner scanner, boolean resume) {
- // TODO Auto-generated method stub
- return super.evaluate(scanner, resume);
- }
-
- protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
- int c = scanner.read();
- int readCount = 1;
- if (sequence[0] == '<') {
- // Cut through obvious cases
- if ((char)c == '%') {
- // processing jet instruction - abort
- scanner.unread();
- return false;
- }
- if ((char)c == '?') {
- // processing instruction - abort
- scanner.unread();
- return false;
- }
- if ((char)c == '!') {
- scanner.unread();
- // comment - abort
- return false;
- }
- StringBuffer name = new StringBuffer();
- while ((char)c == ' ') {
- c = scanner.read();
- readCount++;
- }
- if (c == ICharacterScanner.EOF) {
- for (int i = 0; i < readCount; i++) scanner.unread();
- return false;
- }
- while ((char)c != ' ' && c != ICharacterScanner.EOF && (char)c != '>') {
- name.append((char)c);
- c = scanner.read();
- readCount++;
- }
- if (tagElementNames.contains(name.toString())) {
- scanner.unread();
- return true;
- } else {
- for (int i = 0; i < readCount; i++) scanner.unread();
- return false;
- }
- } else if (sequence[0] == '>') {
- scanner.unread();
- }
- return super.sequenceDetected(scanner, sequence, eofAllowed);
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETDirectiveRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETDirectiveRule.java
deleted file mode 100644
index 2745f87..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETDirectiveRule.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jface.text.rules.*;
-
-public class JETDirectiveRule extends MultiLineRule {
-
- public JETDirectiveRule(IToken token) {
- super("<%@", "%>", token, '\\');
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaDeclarationRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaDeclarationRule.java
deleted file mode 100644
index 79595da..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaDeclarationRule.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jface.text.rules.*;
-
-public class JETJavaDeclarationRule extends MultiLineRule {
-
- public JETJavaDeclarationRule(IToken token) {
- super("<%!", "%>", token, '\\');
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaExpressionRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaExpressionRule.java
deleted file mode 100644
index 47c9d9d..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaExpressionRule.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jface.text.rules.*;
-
-public class JETJavaExpressionRule extends MultiLineRule {
-
- public JETJavaExpressionRule(IToken token) {
- super("<%=", "%>", token, '\\');
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaScriptletRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaScriptletRule.java
deleted file mode 100644
index e10ecb8..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/JETJavaScriptletRule.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import org.eclipse.jface.text.rules.*;
-
-public class JETJavaScriptletRule extends MultiLineRule {
-
- public JETJavaScriptletRule(IToken token) {
- super("<%", "%>", token, '\\');
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/WordListDetectorRule.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/WordListDetectorRule.java
deleted file mode 100644
index ef740f8..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/rules/WordListDetectorRule.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.rules;
-
-import java.util.Collection;
-
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-
-public class WordListDetectorRule implements IRule {
- private IToken success;
- private String[] words;
- public WordListDetectorRule(IToken token, String[] words) {
- this.success = token;
- this.words = words;
- }
- public WordListDetectorRule(IToken token, Collection words) {
- this.success = token;
- this.words = new String[words.size()];
- this.words = (String[]) words.toArray(this.words);
- }
- public IToken evaluate(ICharacterScanner scanner) {
- char c = (char) scanner.read();
- char initialChar = c;
- for (int i = 0; i < words.length; i++) {
- String keyword = words[i];
- int index = 0;
- while (keyword.length() > index && c == keyword.charAt(index)) {
- c = (char) scanner.read();
- index++;
- }
- if (index == keyword.length()) {// success for this keyword ... we'read until the end
- scanner.unread(); // there is one read in excess at the end
- return success;
- }
- // otherwise, unread and proceed to the next word
- for (int j = 0; j < index; j++) {
- scanner.unread();
- }
- c = initialChar;
- }
- scanner.unread();
- return Token.UNDEFINED;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETCommentScanner.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETCommentScanner.java
deleted file mode 100644
index 72ca195..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETCommentScanner.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.scanners;
-
-import org.eclipse.jet.internal.editor.configuration.JETEditorPreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-
-public class JETCommentScanner extends RuleBasedScanner {
-
- public JETCommentScanner(JETTokenStyleManager manager, IPreferenceStore preferenceStore) {
- setDefaultReturnToken(manager.requestToken("__jet_comment",
- JETEditorPreferenceConstants.JET_COMMENT_FG_COLOR,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- JETEditorPreferenceConstants.JET_COMMENT_BOLD,
- JETEditorPreferenceConstants.JET_COMMENT_ITALIC,
- null,
- null));
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETCustomTagScanner.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETCustomTagScanner.java
deleted file mode 100644
index 1db0a3b..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETCustomTagScanner.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.scanners;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETEditorPreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager;
-import org.eclipse.jet.internal.editor.rules.WordListDetectorRule;
-import org.eclipse.jet.taglib.TagLibrary;
-import org.eclipse.jet.taglib.TagLibraryManager;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.SingleLineRule;
-
-public class JETCustomTagScanner extends RuleBasedScanner {
-
- public JETCustomTagScanner(JETTokenStyleManager manager, IPreferenceStore preferenceStore) {
- IToken tagElementName = manager.requestToken("__jet_custom_tag_elementName",
- JETEditorPreferenceConstants.JET_CUSTOM_TAG_FG_COLOR,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- JETEditorPreferenceConstants.JET_CUSTOM_TAG_BOLD,
- JETEditorPreferenceConstants.JET_CUSTOM_TAG_ITALIC,
- null,
- JETEditorPreferenceConstants.JET_CUSTOM_TAG_UNDERLINE);
-
- IToken string = manager.requestToken("__jet_custom_tag_string",
- PreferenceConstants.EDITOR_STRING_COLOR,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- PreferenceConstants.EDITOR_STRING_BOLD,
- PreferenceConstants.EDITOR_STRING_ITALIC,
- null,
- PreferenceConstants.EDITOR_STRING_UNDERLINE);
-
- Collection tagNames = new ArrayList();
- String[] tagLibIds = TagLibraryManager.getInstance().getKnownLibraryIds();
- for (int i = 0; i < tagLibIds.length; i++) {
- String id = tagLibIds[i];
- TagLibrary tagLib = TagLibraryManager.getInstance().getTagLibrary(id, true);
- String[] names = tagLib.getTagNames();
- for (int j = 0; j < names.length; j++) {
- String name = names[j];
- tagNames.add(tagLib.getDefaultPrefix() + ":" + name);
- }
- }
-
- IRule[] rules = new IRule[3];
-
- // Add rule for double quotes
- rules[0] = new SingleLineRule("\"", "\"", string, '\\');
- // Add a rule for single quotes
- rules[1] = new SingleLineRule("'", "'", string, '\\');
- // Add a rule for the custom tag identifier
- rules[2] = new WordListDetectorRule(tagElementName, tagNames);
-
- setRules(rules);
-
- IToken defaultReturnToken = manager.requestToken("__jet_custom_tag",
- JETEditorPreferenceConstants.JET_CUSTOM_TAG_FG_COLOR,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- null,
- null,
- null,
- null);
- setDefaultReturnToken(defaultReturnToken);
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETDefaultContentScanner.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETDefaultContentScanner.java
deleted file mode 100644
index c79d6cd..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETDefaultContentScanner.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.scanners;
-
-import org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-
-public class JETDefaultContentScanner extends RuleBasedScanner {
-
- public JETDefaultContentScanner(JETTokenStyleManager manager, IPreferenceStore preferenceStore) {
- setDefaultReturnToken(manager.requestDefaultToken());
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETDirectiveScanner.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETDirectiveScanner.java
deleted file mode 100644
index 996b0cd..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETDirectiveScanner.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.scanners;
-
-import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETEditorPreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager;
-import org.eclipse.jet.internal.editor.rules.JETBracketRule;
-import org.eclipse.jet.internal.editor.rules.WordListDetectorRule;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.SingleLineRule;
-
-public class JETDirectiveScanner extends RuleBasedScanner {
-
- public JETDirectiveScanner(JETTokenStyleManager manager, IPreferenceStore preferenceStore) {
- IToken keyword = manager.requestToken("__jet_directive_keyword",
- JETEditorPreferenceConstants.JET_DIRECTIVE_FG_COLOR,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- JETEditorPreferenceConstants.JET_DIRECTIVE_KEYWORD_BOLD,
- JETEditorPreferenceConstants.JET_DIRECTIVE_ITALIC,
- null,
- JETEditorPreferenceConstants.JET_DIRECTIVE_UNDERLINE);
- IToken string = manager.requestToken("__jet_directive_string",
- PreferenceConstants.EDITOR_STRING_COLOR,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- PreferenceConstants.EDITOR_STRING_BOLD,
- PreferenceConstants.EDITOR_STRING_ITALIC,
- null,
- PreferenceConstants.EDITOR_STRING_UNDERLINE);
- IToken bracket = manager.requestToken("__jet_bracket",
- PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_ITALIC,
- null,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_UNDERLINE);
-
- IRule[] rules = new IRule[4];
-
- // Add rule for brackets
- rules[0] = new JETBracketRule(bracket);
- // Add rule for double quotes
- rules[1] = new SingleLineRule("\"", "\"", string, '\\');
- // Add a rule for single quotes
- rules[2] = new SingleLineRule("'", "'", string, '\\');
- // Add word rule for reserved jet directive words
- rules[3] = new WordListDetectorRule(keyword, new String[] {"jet", "taglib", "include", "start", "end"});
-
- setRules(rules);
-
- IToken defaultReturnToken = manager.requestToken("__jet_directive",
- JETEditorPreferenceConstants.JET_DIRECTIVE_FG_COLOR,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- JETEditorPreferenceConstants.JET_DIRECTIVE_BOLD,
- JETEditorPreferenceConstants.JET_DIRECTIVE_ITALIC,
- null,
- JETEditorPreferenceConstants.JET_DIRECTIVE_UNDERLINE);
- setDefaultReturnToken(defaultReturnToken);
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaCodeScanner.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaCodeScanner.java
deleted file mode 100644
index b424cdd..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaCodeScanner.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.scanners;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager;
-import org.eclipse.jface.text.rules.BufferedRuleBasedScanner;
-import org.eclipse.jface.text.rules.ICharacterScanner;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.IWordDetector;
-import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.SingleLineRule;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WordRule;
-
-
-/**
- * A Java code scanner for JET-java sections.
- */
-public class JETJavaCodeScanner extends BufferedRuleBasedScanner {
-
- /**
- * Rule to detect java operators.
- */
- private class OperatorRule implements IRule {
- private char[] JAVA_OPERATORS= { ';', '.', '=', '/', '\\', '+', '-', '*', '<', '>', ':', '?', '!', ',', '|', '&', '^', '%', '~'};
- private IToken fToken;
-
- public OperatorRule(IToken token) {
- fToken= token;
- }
-
- public boolean isOperator(char character) {
- for (int index= 0; index < JAVA_OPERATORS.length; index++) {
- if (JAVA_OPERATORS[index] == character)
- return true;
- }
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IRule#evaluate(org.eclipse.jface.text.rules.ICharacterScanner)
- */
- public IToken evaluate(ICharacterScanner scanner) {
- int character= scanner.read();
- if (isOperator((char) character)) {
- do {
- character= scanner.read();
- } while (isOperator((char) character));
- scanner.unread();
- return fToken;
- } else {
- scanner.unread();
- return Token.UNDEFINED;
- }
- }
- }
-
- /**
- * Rule to detect java brackets.
- */
- private class BracketRule implements IRule {
-
- private char[] JAVA_BRACKETS= { '(', ')', '{', '}', '[', ']' };
- private final IToken success;
-
- public BracketRule(IToken token) {
- success= token;
- }
-
- public boolean isBracket(char character) {
- for (int index= 0; index < JAVA_BRACKETS.length; index++) {
- if (JAVA_BRACKETS[index] == character)
- return true;
- }
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IRule#evaluate(org.eclipse.jface.text.rules.ICharacterScanner)
- */
- public IToken evaluate(ICharacterScanner scanner) {
- int character= scanner.read();
- if (isBracket((char) character)) {
- do {
- character= scanner.read();
- } while (isBracket((char) character));
- scanner.unread();
- return success;
- } else {
- scanner.unread();
- return Token.UNDEFINED;
- }
- }
- }
-
- private class JavaWordDetector implements IWordDetector {
- /*
- * @see IWordDetector#isWordStart
- */
- public boolean isWordStart(char c) {
- return Character.isJavaIdentifierStart(c);
- }
-
- /*
- * @see IWordDetector#isWordPart
- */
- public boolean isWordPart(char c) {
- return Character.isJavaIdentifierPart(c);
- }
- }
-
- private String[] javaKeywords= {
- "abstract", //$NON-NLS-1$
- "break", //$NON-NLS-1$
- "case", "catch", "class", "const", "continue", //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- "default", "do", //$NON-NLS-2$ //$NON-NLS-1$
- "else", "extends", //$NON-NLS-2$ //$NON-NLS-1$
- "final", "finally", "for", //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- "goto", //$NON-NLS-1$
- "if", "implements", "import", "instanceof", "interface", //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- "native", "new", //$NON-NLS-2$ //$NON-NLS-1$
- "package", "private", "protected", "public", //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- "static", "super", "switch", "synchronized", //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- "this", "throw", "throws", "transient", "try", //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- "volatile", //$NON-NLS-1$
- "while", //$NON-NLS-1$
- "assert", //$NON-NLS-1$
- "enum", //$NON-NLS-1$
- "return" //$NON-NLS-1$
- };
-
- private String[] javaTypes= { "class", "interface", "void", "boolean", "char", "byte", "short", "strictfp", "int", "long", "float", "double" }; //$NON-NLS-1$ //$NON-NLS-5$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-2$
-
- private String[] javaConstants= { "false", "null", "true" }; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
-
- private String defaultBg;
- /**
- * Creates a Java code scanner
- *
- * @param manager the color manager
- * @param store the preference store
- */
- public JETJavaCodeScanner(JETTokenStyleManager manager, String defaultBg) {
- this.defaultBg = defaultBg;
- List rules = createRules(manager);
- IRule[] result= new IRule[rules.size()];
- rules.toArray(result);
- setRules(result);
- }
-
-
- protected List createRules(JETTokenStyleManager manager) {
- List rules= new ArrayList();
-
- // Add rule for character constants.
- IToken token= manager.requestToken("__jet_java_string_" + defaultBg,
- PreferenceConstants.EDITOR_STRING_COLOR,
- defaultBg,
- PreferenceConstants.EDITOR_STRING_BOLD,
- PreferenceConstants.EDITOR_STRING_ITALIC,
- PreferenceConstants.EDITOR_STRING_STRIKETHROUGH,
- PreferenceConstants.EDITOR_STRING_UNDERLINE);
- rules.add(new SingleLineRule("'", "'", token, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
-
-
- // Add generic whitespace rule.
- //rules.add(new WhitespaceRule(new JETWhitespaceDetector()));
-
- // Add rule for multiline comments
- token= manager.requestToken("__jet_java_multi_line_comment_" + defaultBg,
- PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR,
- defaultBg,
- PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD,
- PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_ITALIC,
- PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_STRIKETHROUGH,
- PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_UNDERLINE);
- MultiLineRule multiLineCommentsRule = new MultiLineRule("/*", "*/", token, '\\');
- rules.add(multiLineCommentsRule);
-
- // Add rule for single line comments
- token= manager.requestToken("__jet_java_single_line_comment_" + defaultBg,
- PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR,
- defaultBg,
- PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD,
- PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_ITALIC,
- PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_STRIKETHROUGH,
- PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_UNDERLINE);
- SingleLineRule singleLineCommentsRule = new SingleLineRule("//", null, token);
- rules.add(singleLineCommentsRule);
-
- // Add word rule for keywords,types and constants
- JavaWordDetector wordDetector= new JavaWordDetector();
- token= manager.requestToken("__jet_java_default_" + defaultBg,
- PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR,
- defaultBg,
- PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD,
- PreferenceConstants.EDITOR_JAVA_DEFAULT_ITALIC,
- PreferenceConstants.EDITOR_JAVA_DEFAULT_STRIKETHROUGH,
- PreferenceConstants.EDITOR_JAVA_DEFAULT_UNDERLINE);
- WordRule wordRule= new WordRule(wordDetector, token);
-
- token = manager.requestToken("__jet_java_keyword_" + defaultBg,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR,
- defaultBg,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_ITALIC,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_STRIKETHROUGH,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_UNDERLINE);
- for (int i=0; i<javaKeywords.length; i++)
- wordRule.addWord(javaKeywords[i], token);
- for (int i=0; i<javaTypes.length; i++)
- wordRule.addWord(javaTypes[i], token);
- for (int i=0; i<javaConstants.length; i++)
- wordRule.addWord(javaConstants[i], token);
- rules.add(wordRule);
-
- // Add rule for operators
- token = manager.requestToken("__jet_java_operator_" + defaultBg,
- PreferenceConstants.EDITOR_JAVA_OPERATOR_COLOR,
- defaultBg,
- PreferenceConstants.EDITOR_JAVA_OPERATOR_BOLD,
- PreferenceConstants.EDITOR_JAVA_OPERATOR_ITALIC,
- PreferenceConstants.EDITOR_JAVA_OPERATOR_STRIKETHROUGH,
- PreferenceConstants.EDITOR_JAVA_OPERATOR_UNDERLINE);;
- rules.add(new OperatorRule(token));
-
- // Add rule for brackets
- token = manager.requestToken("__jet_java_bracket_" + defaultBg,
- PreferenceConstants.EDITOR_JAVA_BRACKET_COLOR,
- defaultBg,
- PreferenceConstants.EDITOR_JAVA_BRACKET_BOLD,
- PreferenceConstants.EDITOR_JAVA_BRACKET_ITALIC,
- PreferenceConstants.EDITOR_JAVA_BRACKET_STRIKETHROUGH,
- PreferenceConstants.EDITOR_JAVA_BRACKET_UNDERLINE);;
- rules.add(new BracketRule(token));
- return rules;
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaDeclarationScanner.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaDeclarationScanner.java
deleted file mode 100644
index af23128..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaDeclarationScanner.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.scanners;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETEditorPreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager;
-import org.eclipse.jet.internal.editor.rules.JETBracketRule;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.rules.IToken;
-
-public class JETJavaDeclarationScanner extends JETJavaCodeScanner {
- public JETJavaDeclarationScanner(JETTokenStyleManager manager, IPreferenceStore preferenceStore) {
- super(manager, JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR);
- setDefaultReturnToken(manager.requestDefaultToken());
- }
-
- protected List createRules(JETTokenStyleManager manager) {
- List rules = new ArrayList();
- List parentRules = super.createRules(manager);
- IToken bracket = manager.requestToken("__jet_bracket",
- PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_ITALIC,
- null,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_UNDERLINE);
- // Add rule for brackets
- rules.add(new JETBracketRule(bracket));
- rules.addAll(parentRules);
- return rules;
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaExpressionScanner.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaExpressionScanner.java
deleted file mode 100644
index d9b0369..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaExpressionScanner.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.scanners;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETEditorPreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager;
-import org.eclipse.jet.internal.editor.rules.JETBracketRule;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.rules.IToken;
-
-public class JETJavaExpressionScanner extends JETJavaCodeScanner {
-
- public JETJavaExpressionScanner(JETTokenStyleManager manager, IPreferenceStore preferenceStore) {
- super(manager, JETEditorPreferenceConstants.JET_EXPRESSION_BG_COLOR);
- setDefaultReturnToken(manager.requestToken("__jet_expression_default",
- PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR,
- JETEditorPreferenceConstants.JET_EXPRESSION_BG_COLOR,
- null,
- null,
- null,
- null));
- }
-
- protected List createRules(JETTokenStyleManager manager) {
- List rules = new ArrayList();
- List parentRules = super.createRules(manager);
- IToken bracket = manager.requestToken("__jet_expression_bracket",
- PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR,
- JETEditorPreferenceConstants.JET_EXPRESSION_BG_COLOR,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_ITALIC,
- null,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_UNDERLINE);
- // Add rule for brackets
- rules.add(new JETBracketRule(bracket));
- rules.addAll(parentRules);
- return rules;
- }
-}
diff --git a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaScriptletScanner.java b/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaScriptletScanner.java
deleted file mode 100644
index 7f711f2..0000000
--- a/plugins/org.eclipse.jet.editor/src/org/eclipse/jet/internal/editor/scanners/JETJavaScriptletScanner.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 ILOG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Joel Cheuoua - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.jet.internal.editor.scanners;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETEditorPreferenceConstants;
-import org.eclipse.jet.internal.editor.configuration.JETTokenStyleManager;
-import org.eclipse.jet.internal.editor.rules.JETBracketRule;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.rules.IToken;
-
-public class JETJavaScriptletScanner extends JETJavaCodeScanner {
-
- public JETJavaScriptletScanner(JETTokenStyleManager manager, IPreferenceStore preferenceStore) {
- super(manager, JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR);
- setDefaultReturnToken(manager.requestDefaultToken());
- }
-
- protected List createRules(JETTokenStyleManager manager) {
- List rules = new ArrayList();
- List parentRules = super.createRules(manager);
- IToken bracket = manager.requestToken("__jet_bracket",
- PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR,
- JETEditorPreferenceConstants.JET_DEFAULT_BG_COLOR,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_ITALIC,
- null,
- PreferenceConstants.EDITOR_JAVA_KEYWORD_UNDERLINE);
- // Add rule for brackets
- rules.add(new JETBracketRule(bracket));
- rules.addAll(parentRules);
- return rules;
- }
-}

Back to the top