Refactory: fix templates.
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpeclipse / ui / WebUI.java
index 73342f7..7ae8cfb 100644 (file)
@@ -52,7 +52,7 @@ import net.sourceforge.phpeclipse.builder.ExternalEditorInput;
 import net.sourceforge.phpeclipse.builder.ExternalStorageDocumentProvider;
 import net.sourceforge.phpeclipse.builder.FileStorage;
 import net.sourceforge.phpeclipse.builder.IdentifierIndexManager;
-import net.sourceforge.phpeclipse.phpeditor.DocumentAdapter;
+import net.sourceforge.phpeclipse.DocumentAdapter;
 import net.sourceforge.phpeclipse.phpeditor.ICompilationUnitDocumentProvider;
 import net.sourceforge.phpeclipse.phpeditor.PHPDocumentProvider;
 //import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr;
@@ -131,7 +131,13 @@ public class WebUI extends AbstractUIPlugin implements IPreferenceConstants {
 
        public static final String EDITOR_ID = WebUI.PLUGIN_ID + ".PHPUnitEditor";
 
-       private static final String CUSTOM_TEMPLATES_KEY = "net.sourceforge.phpeclipse.ui.templates"; //$NON-NLS-1$
+
+       /**
+        * The key to store customized templates.
+        * 
+        * @since 3.0
+        */
+       private static final String TEMPLATES_KEY = "net.sourceforge.phpdt.ui.text.custom_templates"; //$NON-NLS-1$
 
        /**
         * The key to store customized code templates.
@@ -139,6 +145,19 @@ public class WebUI extends AbstractUIPlugin implements IPreferenceConstants {
         * @since 3.0
         */
        private static final String CODE_TEMPLATES_KEY = "net.sourceforge.phpdt.ui.text.custom_code_templates"; //$NON-NLS-1$
+
+       
+       
+       
+       
+    private static final String CUSTOM_TEMPLATES_KEY = "net.sourceforge.phpeclipse.ui.templates"; //$NON-NLS-1$
+
+       /**
+        * The key to store customized code templates.
+        * 
+        * @since 3.0
+        */
+//     private static final String CODE_TEMPLATES_KEY = "net.sourceforge.phpdt.ui.text.custom_code_templates"; //$NON-NLS-1$
        /**
         * The maximum number of allowed proposals by category
         */
@@ -309,8 +328,8 @@ public class WebUI extends AbstractUIPlugin implements IPreferenceConstants {
         */
        public TemplateStore getTemplateStore() {
                if (fStore == null) {
-                       fStore = new ContributionTemplateStore(getContextTypeRegistry(),
-                                       getDefault().getPreferenceStore(), CUSTOM_TEMPLATES_KEY);
+                       fStore = new ContributionTemplateStore(/*getContextTypeRegistry()*/getTemplateContextRegistry(),
+                                       getDefault().getPreferenceStore(), /*CUSTOM_*/TEMPLATES_KEY);
                        try {
                                fStore.load();
                        } catch (IOException e) {
@@ -669,8 +688,8 @@ public class WebUI extends AbstractUIPlugin implements IPreferenceConstants {
                if (textEditor != null) {
                        // If a line number was given, go to it
                        if (offset >= 0) {
-                               IDocument document = textEditor.getDocumentProvider()
-                                               .getDocument(textEditor.getEditorInput());
+//                             IDocument document = textEditor.getDocumentProvider()
+//                                             .getDocument(textEditor.getEditorInput());
                                textEditor.selectAndReveal(offset, length);
                        }
                }
@@ -698,6 +717,12 @@ public class WebUI extends AbstractUIPlugin implements IPreferenceConstants {
         public static void logErrorMessage(String message) {
                 log(new Status(IStatus.ERROR, getPluginId(),IJavaStatusConstants.INTERNAL_ERROR, message, null));
         }
+               public static void log(int severity, String message) {
+                       Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message,
+                                       null);
+                       log(status);
+               }
+
                public static void log(String message, Throwable t) {
                        log(error(message, t));
                }