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.3 2006-10-21 23:14:14 pombredanne Exp $
14 package net.sourceforge.phpeclipse.xml.ui.internal.editor;
16 import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
17 import net.sourceforge.phpeclipse.xml.ui.internal.text.DTDConfiguration;
18 import net.sourceforge.phpeclipse.xml.ui.internal.text.DTDDocumentProvider;
19 import net.sourceforge.phpeclipse.xml.ui.text.DTDTextTools;
21 import org.eclipse.jface.action.IAction;
22 import org.eclipse.jface.util.PropertyChangeEvent;
23 import org.eclipse.ui.editors.text.TextEditor;
24 import org.eclipse.ui.texteditor.ContentAssistAction;
25 import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
30 * @author Igor Malinin
32 public class DTDEditor extends TextEditor {
35 setPreferenceStore(XMLPlugin.getDefault().getPreferenceStore());
39 * @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
41 protected void initializeEditor() {
42 super.initializeEditor();
44 DTDTextTools dtdTextTools = XMLPlugin.getDefault().getDTDTextTools();
46 setSourceViewerConfiguration(new DTDConfiguration(dtdTextTools));
48 setDocumentProvider(new DTDDocumentProvider());
51 protected boolean affectsTextPresentation(PropertyChangeEvent event) {
52 return XMLPlugin.getDefault().getDTDTextTools().affectsBehavior(event);
55 protected void createActions() {
56 super.createActions();
58 IAction action = new ContentAssistAction(XMLEditorMessages
59 .getResourceBundle(), "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);