--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>net.sourceforge.phpeclipse.smarty.ui</name>
+ <comment></comment>
+ <projects>
+ <project>net.sf.wdte.ui</project>
+ <project>net.sf.wdte.xml.core</project>
+ <project>net.sf.wdte.xml.ui</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+source.htmlui.jar = src/
+output.htmlui.jar = bin/
+bin.includes = plugin.xml,\
+ htmlui.jar
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="net.sourceforge.phpdt.smarty.ui"
+ name="Web Development Tools HTML UI"
+ version="0.0.1"
+ provider-name="WDTE Project"
+ class="net.sourceforge.phpdt.smarty.ui.HTMLUI">
+
+ <runtime>
+ <library name="htmlui.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+ <requires>
+ <import plugin="net.sourceforge.phpeclipse.xml.ui"/>
+ <import plugin="net.sourceforge.phpeclipse.ui"/>
+ <import plugin="net.sourceforge.phpeclipse.xml.core"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.ui.workbench.texteditor"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.text"/>
+ <import plugin="org.eclipse.ui.editors"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.filebuffers"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ </requires>
+
+
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ name="HTML Editor"
+ icon="icons/full/obj16/html.png"
+ extensions="tpl"
+ class="net.sourceforge.phpdt.smarty.ui.internal.editor.HTMLEditor"
+ id="net.sourceforge.phpdt.smarty.ui.editor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.core.filebuffers.documentSetup">
+ <participant
+ extensions="tpl"
+ class="net.sourceforge.phpdt.smarty.ui.internal.editor.HTMLDocumentSetupParticipant">
+ </participant>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors.documentProviders">
+ <provider
+ extensions="tpl"
+ class="net.sourceforge.phpdt.smarty.ui.internal.editor.HTMLDocumentProvider"
+ id="net.sourceforge.phpdt.smarty.ui.documentProvider">
+ </provider>
+ </extension>
+
+
+</plugin>
--- /dev/null
+/*
+ * Copyright (c) 2004 Christopher Lenz and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Christopher Lenz - initial API and implementation
+ *
+ * $Id: HTMLUI.java,v 1.1 2004-09-02 18:25:04 jsurfer Exp $
+ */
+
+package net.sourceforge.phpdt.smarty.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class HTMLUI extends AbstractUIPlugin {
+
+ // Class Variables ---------------------------------------------------------
+
+ /** The shared instance. */
+ private static HTMLUI plugin;
+
+ // Constructors ------------------------------------------------------------
+
+ /**
+ * The constructor.
+ */
+ public HTMLUI() {
+ plugin = this;
+ }
+
+ // Public Methods ----------------------------------------------------------
+
+ /**
+ * Returns the shared instance.
+ */
+ public static HTMLUI getDefault() {
+ return plugin;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2004 Christopher Lenz and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Christopher Lenz - initial API and implementation
+ *
+ * $Id: HTMLUIMessages.java,v 1.1 2004-09-02 18:25:05 jsurfer Exp $
+ */
+
+package net.sourceforge.phpdt.smarty.ui.internal;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Utility class that provides easy access to externalized strings.
+ */
+public final class HTMLUIMessages {
+
+ // Constants ---------------------------------------------------------------
+
+ /**
+ * Qualified name of the resource bundle containing the localized messages.
+ */
+ private static final String RESOURCE_BUNDLE =
+ "net.sourceforge.phpdt.smarty.ui.internal.HTMLUIMessages"; //$NON-NLS-1$
+
+ // Class Variables ---------------------------------------------------------
+
+ /**
+ * The resource bundle.
+ */
+ private static ResourceBundle resourceBundle =
+ ResourceBundle.getBundle(RESOURCE_BUNDLE);
+
+ // Constructors ------------------------------------------------------------
+
+ /**
+ * Hidden constructor.
+ */
+ private HTMLUIMessages() {
+ // Hidden
+ }
+
+ // Public Methods ----------------------------------------------------------
+
+ /**
+ * Returns the resource bundle.
+ *
+ * @return the resource bundle
+ */
+ public static ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ /**
+ * Returns the message identified by the specified key.
+ *
+ * @param key the message key
+ * @return the localized message, or the key enclosed by exclamation marks
+ * if no message was found for the key
+ */
+ public static String getString(String key) {
+ try {
+ return resourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!"; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Returns the message identified by the specified key, replacing a single
+ * parameter with the provided value.
+ *
+ * @param key the message key
+ * @param arg the parameter value
+ * @return the formatted string, or the key enclosed by exclamation marks
+ * if no message was found for the key
+ */
+ public static String getString(String key, String arg) {
+ return getString(key, new String[] { arg });
+ }
+
+ /**
+ * Returns the message identified by the specified key, replacing all
+ * parameters with the provided values.
+ *
+ * @param key the message key
+ * @param args the parameter values
+ * @return the formatted string, or the key enclosed by exclamation marks
+ * if no message was found for the key
+ */
+ public static String getString(String key, String[] args) {
+ return MessageFormat.format(getString(key), args);
+ }
+
+}
--- /dev/null
+#
+# Copyright (c) 2004 Christopher Lenz and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Common Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/cpl-v10.html
+#
+# Contributors:
+# Christopher Lenz - initial english resources
+#
+# $Id: HTMLUIMessages.properties,v 1.1 2004-09-02 18:25:05 jsurfer Exp $
+#
--- /dev/null
+/*
+ * Copyright (c) 2004 Christopher Lenz and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Christopher Lenz - initial API and implementation
+ *
+ * $Id: HTMLDocumentProvider.java,v 1.1 2004-09-02 18:25:05 jsurfer Exp $
+ */
+
+package net.sourceforge.phpdt.smarty.ui.internal.editor;
+
+import net.sourceforge.phpeclipse.xml.ui.internal.editor.XMLDocumentProvider;
+
+
+/**
+ * Document provider for HTML files.
+ */
+public class HTMLDocumentProvider extends XMLDocumentProvider {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2004 Christopher Lenz and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Christopher Lenz - initial implementation
+ *
+ * $Id: HTMLDocumentSetupParticipant.java,v 1.1 2004-09-02 18:25:05 jsurfer Exp $
+ */
+
+package net.sourceforge.phpdt.smarty.ui.internal.editor;
+
+import net.sourceforge.phpeclipse.xml.ui.internal.editor.XMLDocumentSetupParticipant;
+
+
+/**
+ * Document setup participant that sets up the HTML specific partitioning.
+ */
+public class HTMLDocumentSetupParticipant extends XMLDocumentSetupParticipant {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2004 Christopher Lenz and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Christopher Lenz - initial implementation
+ *
+ * $Id: HTMLEditor.java,v 1.1 2004-09-02 18:25:05 jsurfer Exp $
+ */
+
+package net.sourceforge.phpdt.smarty.ui.internal.editor;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import net.sourceforge.phpdt.smarty.ui.internal.preview.HTMLPreviewPage;
+import net.sourceforge.phpdt.smarty.ui.internal.text.HTMLConfiguration;
+import net.sourceforge.phpeclipse.ui.views.preview.IBrowserPreviewPage;
+import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
+import net.sourceforge.phpeclipse.xml.ui.internal.editor.XMLDocumentProvider;
+import net.sourceforge.phpeclipse.xml.ui.internal.editor.XMLEditor;
+import net.sourceforge.phpeclipse.xml.ui.text.XMLTextTools;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.texteditor.ContentAssistAction;
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+
+
+/**
+ * HTML editor implementation.
+ */
+public class HTMLEditor extends XMLEditor {
+
+ // Instance Variables ------------------------------------------------------
+
+ /** The associated preview page. */
+ private HTMLPreviewPage previewPage;
+
+ // XMLEditor Implementation ------------------------------------------------
+
+ /*
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorSaved()
+ */
+ protected void editorSaved() {
+ if (previewPage != null) {
+ previewPage.update();
+ }
+ }
+
+ /*
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter == IBrowserPreviewPage.class) {
+ if (previewPage == null) {
+ previewPage = createPreviewPage();
+ }
+ return previewPage;
+ }
+ return super.getAdapter(adapter);
+ }
+
+ // Private Methods ---------------------------------------------------------
+
+ /**
+ * Creates the HTML preview page.
+ */
+ private HTMLPreviewPage createPreviewPage() {
+ IEditorInput input = getEditorInput();
+ if (input instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput) input).getFile();
+ try {
+ URL location = file.getLocation().toFile().toURL();
+ return new HTMLPreviewPage(location);
+ } catch (MalformedURLException e) { }
+ }
+ return null;
+ }
+ protected void createActions() {
+ super.createActions();
+
+ IAction action = new ContentAssistAction(HTMLEditorMessages.getResourceBundle(),
+ "ContentAssistProposal.", this); //$NON-NLS-1$
+ action
+ .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ setAction("ContentAssistProposal", action); //$NON-NLS-1$
+ markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
+
+// IAction action= new TextOperationAction(
+// TemplateMessages.getResourceBundle(),
+// "Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$
+// this,
+// ISourceViewer.CONTENTASSIST_PROPOSALS);
+// action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+// setAction(TEMPLATE_PROPOSALS, action);
+// markAsStateDependentAction(TEMPLATE_PROPOSALS, true);
+ }
+ /*
+ * @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
+ */
+ protected void initializeEditor() {
+ super.initializeEditor();
+
+ XMLTextTools xmlTextTools = XMLPlugin.getDefault().getXMLTextTools();
+ setSourceViewerConfiguration(new HTMLConfiguration(xmlTextTools, this));
+ setDocumentProvider(new XMLDocumentProvider());
+ }
+}
--- /dev/null
+/**********************************************************************
+Copyright (c) 2000, 2002 IBM Corp. and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Common Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v10.html
+
+Contributors:
+ IBM Corporation - Initial implementation
+ Klaus Hartlage - www.eclipseproject.de
+**********************************************************************/
+package net.sourceforge.phpdt.smarty.ui.internal.editor;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class HTMLEditorMessages {
+
+ private static final String RESOURCE_BUNDLE= "net.sourceforge.phpdt.smarty.ui.internal.editor.HTMLEditorMessages";//$NON-NLS-1$
+
+ private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+
+ private HTMLEditorMessages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Gets a string from the resource bundle and formats it with arguments
+ */
+ public static String getFormattedString(String key, Object[] args) {
+ return MessageFormat.format(getString(key), args);
+ }
+
+ public static ResourceBundle getResourceBundle() {
+ return fgResourceBundle;
+ }
+}
--- /dev/null
+#############################################################
+#
+# (c) Copyright IBM Corp. 2000, 2001.
+# All Rights Reserved.
+#
+#############################################################
+ContentAssistProposal.label=Content Assist@Ctrl+SPACE
+ContentAssistProposal.tooltip=Content Assist
+ContentAssistProposal.image=
+ContentAssistProposal.description=Content Assist
--- /dev/null
+/*
+ * Copyright (c) 2004 Christopher Lenz and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Christopher Lenz - initial implementation
+ *
+ * $Id: HTMLPreviewPage.java,v 1.1 2004-09-02 18:25:05 jsurfer Exp $
+ */
+
+package net.sourceforge.phpdt.smarty.ui.internal.preview;
+
+import java.net.URL;
+
+import net.sourceforge.phpeclipse.ui.views.preview.IBrowserPreviewPage;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.LocationAdapter;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.Page;
+import org.eclipse.ui.texteditor.IUpdate;
+
+/**
+ * Provides a HTML preview page based on the SWT browser control.
+ */
+public class HTMLPreviewPage extends Page
+ implements IBrowserPreviewPage, IUpdate {
+
+ // Instance Variables ------------------------------------------------------
+
+ /** The browser widget. */
+ private Browser browser;
+
+ /** The URL of the resource to preview. */
+ private URL location;
+
+ // Constructors ------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param location the URL of the resource to preview
+ */
+ public HTMLPreviewPage(URL location) {
+ this.location = location;
+ }
+
+ // IPage Implementation ----------------------------------------------------
+
+ /*
+ * @see org.eclipse.ui.part.IPage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ browser = new Browser(parent, SWT.NONE);
+ browser.setLayout(new FillLayout());
+ browser.setUrl(location.toString());
+ browser.addLocationListener(new LocationAdapter() {
+ public void changing(LocationEvent event) {
+ if (event.location != null) {
+ event.doit = false;
+ }
+ }
+ });
+ }
+
+ /*
+ * @see org.eclipse.ui.part.IPage#getControl()
+ */
+ public Control getControl() {
+ return browser;
+ }
+
+ /*
+ * @see org.eclipse.ui.part.IPage#setFocus()
+ */
+ public void setFocus() {
+ browser.setFocus();
+ }
+
+ // IUpdate Implementation --------------------------------------------------
+
+ /*
+ * @see IUpdate#update()
+ */
+ public void update() {
+ browser.refresh();
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpdt.smarty.ui.internal.text;
+
+import net.sourceforge.phpeclipse.ui.WebUI;
+import net.sourceforge.phpeclipse.ui.templates.template.BasicCompletionProcessor;
+import net.sourceforge.phpeclipse.ui.templates.template.HTMLContextType;
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.templates.TemplateContextType;
+
+
+/**
+ * A completion processor for XML templates.
+ */
+public class HTMLCompletionProcessor extends BasicCompletionProcessor {
+
+ /**
+ * Return the XML context type that is supported by this plugin.
+ */
+ protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) {
+ return WebUI.getDefault().getContextTypeRegistry().getContextType(HTMLContextType.HTML_CONTEXT_TYPE);
+ }
+
+
+}
--- /dev/null
+/*
+ * Created on 25.08.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package net.sourceforge.phpdt.smarty.ui.internal.text;
+
+import java.util.Map;
+
+import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLConfiguration;
+import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLPartitionScanner;
+import net.sourceforge.phpeclipse.xml.ui.text.XMLTextTools;
+
+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.contentassist.IContentAssistant;
+import org.eclipse.jface.text.presentation.IPresentationReconciler;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * @author khartlage
+ *
+ * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
+ */
+public class HTMLConfiguration extends XMLConfiguration {
+ private SmartyTagScanner smartyTagScanner;
+ public HTMLConfiguration(XMLTextTools tools) {
+ this(tools, null);
+ }
+
+ public HTMLConfiguration(XMLTextTools tools, ITextEditor editor) {
+ super(tools, editor);
+ Map tokens = tools.getTokens();
+ smartyTagScanner = new SmartyTagScanner(tokens);
+ }
+
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ ContentAssistant assistant = new ContentAssistant();
+ assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+
+ IContentAssistProcessor processor = new HTMLCompletionProcessor();
+ assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
+ assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_TAG);
+ assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_PI);
+ assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_COMMENT);
+ assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_DECL);
+ assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_TAG);
+ assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_ATTRIBUTE);
+ assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_CDATA);
+
+ assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
+ assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
+
+ return assistant;
+ }
+ /**
+ * Returns a scanner which is configured to scan XML text.
+ *
+ * @return an XML text scanner
+ */
+ public SmartyTagScanner getSmartyScanner() {
+ return smartyTagScanner;
+ }
+ /*
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(ISourceViewer)
+ */
+ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
+ PresentationReconciler reconciler = new PresentationReconciler();
+
+ DefaultDamagerRepairer dr;
+
+ dr = new DefaultDamagerRepairer(getSmartyScanner());
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getDTDTextScanner());
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLPIScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_PI);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_PI);
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_PI);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_PI);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLCommentScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_COMMENT);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_COMMENT);
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLDeclScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_DECL);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_DECL);
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_DECL);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_DECL);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLTagScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLAttributeScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_ATTRIBUTE);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_ATTRIBUTE);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLCDATAScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_CDATA);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_CDATA);
+
+ return reconciler;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2002-2004 Widespace, OU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Igor Malinin - initial contribution
+ *
+ * $Id: SmartyTagRule.java,v 1.1 2004-09-02 18:25:04 jsurfer Exp $
+ */
+
+package net.sourceforge.phpdt.smarty.ui.internal.text;
+
+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;
+
+/**
+ * Rule detecting XML tag brackets and name.
+ *
+ * @author Igor Malinin
+ */
+public class SmartyTagRule implements IRule {
+
+ private IToken token;
+
+ public SmartyTagRule(IToken token) {
+ this.token = token;
+ }
+
+ public IToken evaluate(ICharacterScanner scanner) {
+ int ch = scanner.read();
+ if (ch == '}') {
+ return token;
+ }
+ if (ch == '/') {
+ ch = scanner.read();
+ if (ch == '}') {
+ return token;
+ }
+
+ scanner.unread();
+ scanner.unread();
+ return Token.UNDEFINED;
+ }
+ if (ch == '{') {
+ ch = scanner.read();
+ if (ch == '/') {
+ ch = scanner.read();
+ }
+ loop: while (true) {
+ switch (ch) {
+ case ICharacterScanner.EOF:
+ case 0x09:
+ case 0x0A:
+ case 0x0D:
+ case 0x20:
+ scanner.unread();
+ break loop;
+ case '}':
+ break loop;
+ }
+
+ ch = scanner.read();
+ }
+ return token;
+ }
+ scanner.unread();
+ return Token.UNDEFINED;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2002-2004 Widespace, OU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Igor Malinin - initial contribution
+ *
+ * $Id: SmartyTagScanner.java,v 1.1 2004-09-02 18:25:04 jsurfer Exp $
+ */
+
+package net.sourceforge.phpdt.smarty.ui.internal.text;
+
+import java.util.Map;
+
+import net.sourceforge.phpeclipse.xml.ui.internal.text.NameDetector;
+import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLTagRule;
+import net.sourceforge.phpeclipse.xml.ui.text.IXMLSyntaxConstants;
+
+import org.eclipse.jface.text.rules.BufferedRuleBasedScanner;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WordRule;
+
+/**
+ * @author Igor Malinin
+ */
+public class SmartyTagScanner extends BufferedRuleBasedScanner {
+
+ /**
+ * Creates a color token scanner.
+ */
+ public SmartyTagScanner(Map tokens) {
+ setDefaultReturnToken((Token) tokens.get(
+ IXMLSyntaxConstants.XML_DEFAULT));
+
+ IToken tag = (Token) tokens.get(IXMLSyntaxConstants.XML_TAG);
+ IToken smartyTag = (Token) tokens.get(IXMLSyntaxConstants.XML_SMARTY);
+ IToken attribute = (Token) tokens.get(IXMLSyntaxConstants.XML_ATT_NAME);
+
+ IRule[] rules = {
+ new XMLTagRule(tag),
+ new SmartyTagRule(smartyTag),
+ new WordRule(new NameDetector(), attribute),};
+
+ setRules(rules);
+ }
+}