e5de102ca40499d6af582971e767367f11e47823
[phpeclipse.git] /
1 /*
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
7  *
8  * Contributors:
9  *     Igor Malinin - initial contribution
10  *
11  * $Id: DTDEditor.java,v 1.1 2004-09-02 18:28:04 jsurfer Exp $
12  */
13
14 package net.sourceforge.phpeclipse.xml.ui.internal.editor;
15
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;
21
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;
26
27
28 /**
29  * DTD Editor.
30  * 
31  * @author Igor Malinin
32  */
33 public class DTDEditor extends TextEditor {
34
35         public DTDEditor() {
36                 setPreferenceStore(XMLPlugin.getDefault().getPreferenceStore());
37         }
38
39         /*
40          * @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
41          */
42         protected void initializeEditor() {
43                 super.initializeEditor();
44
45                 DTDTextTools dtdTextTools = XMLPlugin.getDefault().getDTDTextTools();
46
47                 setSourceViewerConfiguration(new DTDConfiguration(dtdTextTools));
48
49                 setDocumentProvider(new DTDDocumentProvider());
50         }
51
52         protected boolean affectsTextPresentation(PropertyChangeEvent event) {
53                 return XMLPlugin.getDefault().getDTDTextTools().affectsBehavior(event);
54         }
55         protected void createActions() {
56                 super.createActions();
57
58                 IAction action = new ContentAssistAction(XMLEditorMessages.getResourceBundle(),
59                 "ContentAssistProposal.", this); //$NON-NLS-1$
60             action
61                 .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
62             setAction("ContentAssistProposal", action); //$NON-NLS-1$
63             markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
64             
65 //              IAction action= new TextOperationAction(
66 //                              TemplateMessages.getResourceBundle(),
67 //                              "Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$
68 //                              this,
69 //                              ISourceViewer.CONTENTASSIST_PROPOSALS);
70 //              action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
71 //              setAction(TEMPLATE_PROPOSALS, action);
72 //              markAsStateDependentAction(TEMPLATE_PROPOSALS, true);
73         }
74 }