misc changes
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / preferences / EditTemplateDialog.java
index 5a28e77..4c20296 100644 (file)
@@ -15,13 +15,15 @@ import net.sourceforge.phpdt.internal.corext.template.ContextTypeRegistry;
 import net.sourceforge.phpdt.internal.corext.template.Template;
 import net.sourceforge.phpdt.internal.corext.template.TemplateMessages;
 import net.sourceforge.phpdt.internal.corext.template.TemplateTranslator;
-import net.sourceforge.phpdt.internal.ui.dialog.StatusDialog;
-import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusDialog;
+import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
 import net.sourceforge.phpdt.internal.ui.text.template.TemplateVariableProcessor;
 import net.sourceforge.phpdt.internal.ui.util.SWTUtil;
+import net.sourceforge.phpdt.ui.text.JavaTextTools;
 import net.sourceforge.phpeclipse.IPreferenceConstants;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration;
+
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.GroupMarker;
@@ -35,6 +37,7 @@ import org.eclipse.jface.preference.PreferenceConverter;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.text.Document;
 import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentPartitioner;
 import org.eclipse.jface.text.ITextListener;
 import org.eclipse.jface.text.ITextOperationTarget;
 import org.eclipse.jface.text.ITextViewer;
@@ -84,8 +87,8 @@ public class EditTemplateDialog extends StatusDialog {
                private final IContentAssistProcessor fProcessor;
 
        //      SimpleJavaSourceViewerConfiguration(JavaTextTools tools, ITextEditor editor, IContentAssistProcessor processor) {
-               SimpleJavaSourceViewerConfiguration(IContentAssistProcessor processor) {        
-      super();
+               SimpleJavaSourceViewerConfiguration(JavaTextTools tools, IContentAssistProcessor processor) {   
+      super(tools, null);
                        fProcessor= processor;
                }
                
@@ -99,7 +102,7 @@ public class EditTemplateDialog extends StatusDialog {
                        ContentAssistant assistant= new ContentAssistant();
                        assistant.setContentAssistProcessor(fProcessor, IDocument.DEFAULT_CONTENT_TYPE);
                                // Register the same processor for strings and single line comments to get code completion at the start of those partitions.
-//                     assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.JAVA_STRING);
+//                     assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.PHP_STRING);
 //                     assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.JAVA_SINGLE_LINE_COMMENT);
 //                     
 //                     assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.JAVA_DOC);
@@ -107,8 +110,8 @@ public class EditTemplateDialog extends StatusDialog {
 //                     assistant.enableAutoInsert(store.getBoolean(ContentAssistPreference.AUTOINSERT));
 //                     assistant.enableAutoActivation(store.getBoolean(ContentAssistPreference.AUTOACTIVATION));
 //                     assistant.setAutoActivationDelay(store.getInt(ContentAssistPreference.AUTOACTIVATION_DELAY));
-                       assistant.setProposalPopupOrientation(assistant.PROPOSAL_OVERLAY);
-                       assistant.setContextInformationPopupOrientation(assistant.CONTEXT_INFO_ABOVE);
+                       assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
+                       assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
 //                     assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
 
                        Display display= sourceViewer.getTextWidget().getDisplay();
@@ -328,13 +331,13 @@ public class EditTemplateDialog extends StatusDialog {
 
        private SourceViewer createEditor(Composite parent) {
                SourceViewer viewer= new SourceViewer(parent, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
-       //      JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
+         JavaTextTools tools= PHPeclipsePlugin.getDefault().getJavaTextTools();
                IDocument document= new Document(fTemplate.getPattern());
-       //      IDocumentPartitioner partitioner= tools.createDocumentPartitioner();
-       //      document.setDocumentPartitioner(partitioner);
-       //      partitioner.connect(document);          
+               IDocumentPartitioner partitioner= tools.createDocumentPartitioner();
+               document.setDocumentPartitioner(partitioner);
+               partitioner.connect(document);          
        //      viewer.configure(new SimpleJavaSourceViewerConfiguration(tools, null, fProcessor));
-               viewer.configure(new SimpleJavaSourceViewerConfiguration(fProcessor));
+               viewer.configure(new SimpleJavaSourceViewerConfiguration(tools, fProcessor));
     viewer.setEditable(true);
                viewer.setDocument(document);
                
@@ -423,27 +426,27 @@ public class EditTemplateDialog extends StatusDialog {
        }
 
        private void initializeActions() {
-               TextViewerAction action= new TextViewerAction(fPatternEditor, fPatternEditor.UNDO);
+               TextViewerAction action= new TextViewerAction(fPatternEditor, SourceViewer.UNDO);
                action.setText(TemplateMessages.getString("EditTemplateDialog.undo")); //$NON-NLS-1$
                fGlobalActions.put(ITextEditorActionConstants.UNDO, action);
 
-               action= new TextViewerAction(fPatternEditor, fPatternEditor.CUT);
+               action= new TextViewerAction(fPatternEditor, SourceViewer.CUT);
                action.setText(TemplateMessages.getString("EditTemplateDialog.cut")); //$NON-NLS-1$
                fGlobalActions.put(ITextEditorActionConstants.CUT, action);
 
-               action= new TextViewerAction(fPatternEditor, fPatternEditor.COPY);
+               action= new TextViewerAction(fPatternEditor, SourceViewer.COPY);
                action.setText(TemplateMessages.getString("EditTemplateDialog.copy")); //$NON-NLS-1$
                fGlobalActions.put(ITextEditorActionConstants.COPY, action);
 
-               action= new TextViewerAction(fPatternEditor, fPatternEditor.PASTE);
+               action= new TextViewerAction(fPatternEditor, SourceViewer.PASTE);
                action.setText(TemplateMessages.getString("EditTemplateDialog.paste")); //$NON-NLS-1$
                fGlobalActions.put(ITextEditorActionConstants.PASTE, action);
 
-               action= new TextViewerAction(fPatternEditor, fPatternEditor.SELECT_ALL);
+               action= new TextViewerAction(fPatternEditor, SourceViewer.SELECT_ALL);
                action.setText(TemplateMessages.getString("EditTemplateDialog.select.all")); //$NON-NLS-1$
                fGlobalActions.put(ITextEditorActionConstants.SELECT_ALL, action);
 
-               action= new TextViewerAction(fPatternEditor, fPatternEditor.CONTENTASSIST_PROPOSALS);
+               action= new TextViewerAction(fPatternEditor, SourceViewer.CONTENTASSIST_PROPOSALS);
                action.setText(TemplateMessages.getString("EditTemplateDialog.content.assist")); //$NON-NLS-1$
                fGlobalActions.put("ContentAssistProposal", action); //$NON-NLS-1$