2 * Copyright (c) 2002-2004 Widespace, OU and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * Igor Malinin - initial contribution
11 * $Id: DTDEditor.java,v 1.1 2004-09-02 18:28:04 jsurfer Exp $
14 package net.sourceforge.phpeclipse.xml.ui.internal.editor;
16 import org.eclipse.jface.action.IAction;
17 import org.eclipse.jface.util.PropertyChangeEvent;
18 import org.eclipse.ui.editors.text.TextEditor;
19 import org.eclipse.ui.texteditor.ContentAssistAction;
20 import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
22 import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
23 import net.sourceforge.phpeclipse.xml.ui.internal.text.DTDConfiguration;
24 import net.sourceforge.phpeclipse.xml.ui.internal.text.DTDDocumentProvider;
25 import net.sourceforge.phpeclipse.xml.ui.text.DTDTextTools;
31 * @author Igor Malinin
33 public class DTDEditor extends TextEditor {
36 setPreferenceStore(XMLPlugin.getDefault().getPreferenceStore());
40 * @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
42 protected void initializeEditor() {
43 super.initializeEditor();
45 DTDTextTools dtdTextTools = XMLPlugin.getDefault().getDTDTextTools();
47 setSourceViewerConfiguration(new DTDConfiguration(dtdTextTools));
49 setDocumentProvider(new DTDDocumentProvider());
52 protected boolean affectsTextPresentation(PropertyChangeEvent event) {
53 return XMLPlugin.getDefault().getDTDTextTools().affectsBehavior(event);
55 protected void createActions() {
56 super.createActions();
58 IAction action = new ContentAssistAction(XMLEditorMessages.getResourceBundle(),
59 "ContentAssistProposal.", this); //$NON-NLS-1$
61 .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
62 setAction("ContentAssistProposal", action); //$NON-NLS-1$
63 markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
65 // IAction action= new TextOperationAction(
66 // TemplateMessages.getResourceBundle(),
67 // "Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$
69 // ISourceViewer.CONTENTASSIST_PROPOSALS);
70 // action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
71 // setAction(TEMPLATE_PROPOSALS, action);
72 // markAsStateDependentAction(TEMPLATE_PROPOSALS, true);