Fix #1501248 - Parser error in new self::$_class()
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPeclipsePlugin.java
index 2a2005c..69da86c 100644 (file)
@@ -784,37 +784,8 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
                        // store.setDefault(APACHE_RESTART_BACKGROUND, "true");
                }
 
-               // store.setDefault(SHOW_OUTPUT_IN_CONSOLE, "true");
-               // store.setDefault(PHP_OBFUSCATOR_DEFAULT, "c:\\temp");
-               // if (operatingSystem.equals(Platform.OS_WIN32)) {
-               // store.setDefault(EXTERNAL_BROWSER_PREF, "rundll32
-               // url.dll,FileProtocolHandler {0}");
-               // } else if (operatingSystem.equals(Platform.OS_MACOSX)) {
-               // store.setDefault(PHP_OBFUSCATOR_DEFAULT, "/tmp");
-               // TODO How do we start Safari on Mac OS X ?
-               // store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}");
-               // } else {
-               // store.setDefault(PHP_OBFUSCATOR_DEFAULT, "/tmp");
-               // store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}");
-               // }
-
-               // store.setDefault(PHP_EXTENSION_PREFS,
-               // "php,php3,php4,php5,phtml,inc,module,class");
-
-               // store.setDefault(PHP_PARSER_DEFAULT, PHP_EXTERNAL_PARSER);
-               // store.setDefault(PHP_INTERNAL_PARSER, "false");
-               // store.setDefault(PHP_EXTERNAL_PARSER, "true");
-               // store.setDefault(PHP_PARSE_ON_SAVE, "true");
-               // show line numbers:
-               // store.setDefault(LINE_NUMBER_RULER, "false");
-               // store.setDefault(FORMATTER_TAB_SIZE, "4");
                // php syntax highlighting
                store.setDefault(PHP_USERDEF_XMLFILE, "");
-               // assume there is none chooA
-               // PreferenceConverter.setDefault(store, PHP_MULTILINE_COMMENT,
-               // PHPColorProvider.MULTI_LINE_COMMENT);
-               // PreferenceConverter.setDefault(store, PHP_SINGLELINE_COMMENT,
-               // PHPColorProvider.SINGLE_LINE_COMMENT);
                PreferenceConverter.setDefault(store, PHP_TAG, PHPColorProvider.TAG);
                PreferenceConverter.setDefault(store, PHP_KEYWORD,
                                PHPColorProvider.KEYWORD);
@@ -827,11 +798,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
                PreferenceConverter.setDefault(store, PHP_CONSTANT,
                                PHPColorProvider.CONSTANT);
                PreferenceConverter.setDefault(store, PHP_TYPE, PHPColorProvider.TYPE);
-               // PreferenceConverter.setDefault(store, PHP_STRING_DQ,
-               // PHPColorProvider.STRING_DQ);
-               // store.setDefault(PHP_STRING_BOLD_DQ, true);
-               // PreferenceConverter.setDefault(store, PHP_STRING_SQ,
-               // PHPColorProvider.STRING_SQ);
                PreferenceConverter.setDefault(store, PHP_DEFAULT,
                                PHPColorProvider.DEFAULT);
                PreferenceConverter.setDefault(store, PHPDOC_KEYWORD,
@@ -857,47 +823,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
                                new RGB(0, 0, 0));
                store.setDefault(EDITOR_PHP_BRACE_OPERATOR_BOLD, false);
                store.setDefault(EDITOR_PHP_BRACE_OPERATOR_ITALIC, false);
-               // PreferenceConverter.setDefault(
-               // store,
-               // PHP_EDITOR_BACKGROUND,
-               // PHPColorProvider.BACKGROUND);
-               // PreferenceConverter.setDefault(
-               // store,
-               // LINKED_POSITION_COLOR,
-               // PHPColorProvider.LINKED_POSITION_COLOR);
-               // PreferenceConverter.setDefault(
-               // store,
-               // LINE_NUMBER_COLOR,
-               // PHPColorProvider.LINE_NUMBER_COLOR);
-               // // set default PHPDoc colors:
-               // PreferenceConverter.setDefault(
-               // store,
-               // PHPDOC_KEYWORD,
-               // PHPColorProvider.PHPDOC_KEYWORD);
-               // PreferenceConverter.setDefault(
-               // store,
-               // PHPDOC_LINK,
-               // PHPColorProvider.PHPDOC_LINK);
-               // PreferenceConverter.setDefault(
-               // store,
-               // PHPDOC_DEFAULT,
-               // PHPColorProvider.PHPDOC_DEFAULT);
-               // PreferenceConverter.setDefault(
-               // store,
-               // PHPDOC_TAG,
-               // PHPColorProvider.PHPDOC_TAG);
-               // store.setDefault(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, "true");
-               // PreferenceConverter.setDefault(
-               // store,
-               // PREFERENCE_COLOR_BACKGROUND,
-               // PHPColorProvider.BACKGROUND_COLOR);
-               // language stuff
-               // store.setDefault(RESOURCE_BUNDLE, LANGUAGE_DEFAULT);
-               // store.setDefault(RESOURCE_BUNDLE_EN_GB, "true");
-               // store.setDefault(RESOURCE_BUNDLE_DE, "false");
-               // store.setDefault(RESOURCE_BUNDLE_FR, "false");
-               // store.setDefault(RESOURCE_BUNDLE_ES, "false");
-               // TemplatePreferencePage.initDefaults(store);
+
                // this will initialize the static fields in the syntaxrdr class
                new PHPSyntaxRdr();
                JavaCore.initializeDefaultPluginPreferences();
@@ -1103,51 +1029,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
        }
 
        /**
-        * @see org.eclipse.ui.plugin.AbstractUIPlugin#shutdown()
-        */
-       // public void shutdown() throws CoreException {
-       // // moved down (see below):
-       // // super.shutdown();
-       // // externalTools.shutDown();
-       // ColorManager.getDefault().dispose();
-       // // save the information from the php index files if necessary
-       // Collection collection = fIndexManagerMap.values();
-       // Iterator iterator = collection.iterator();
-       // IdentifierIndexManager indexManager = null;
-       // while (iterator.hasNext()) {
-       // indexManager = (IdentifierIndexManager) iterator.next();
-       // indexManager.writeFile();
-       // }
-       // if (fImageDescriptorRegistry != null)
-       // fImageDescriptorRegistry.dispose();
-       // // unregisterAdapters();
-       // super.shutdown();
-       // if (fWorkingCopyManager != null) {
-       // fWorkingCopyManager.shutdown();
-       // fWorkingCopyManager = null;
-       // }
-       // if (fCompilationUnitDocumentProvider != null) {
-       // fCompilationUnitDocumentProvider.shutdown();
-       // fCompilationUnitDocumentProvider = null;
-       // }
-       // if (fJavaTextTools != null) {
-       // fJavaTextTools.dispose();
-       // fJavaTextTools = null;
-       // }
-       // // JavaDocLocations.shutdownJavadocLocations();
-       // //
-       // //
-       // JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener);
-       // // begin JavaCore#shutdown()
-       // //savePluginPreferences();
-       // savePluginPreferences();
-       // IWorkspace workspace = ResourcesPlugin.getWorkspace();
-       // workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaState);
-       // workspace.removeSaveParticipant(this);
-       // ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown();
-       // // end JavaCore#shutdown()
-       // }
-       /**
         * Installs backwards compatibility for the preference store.
         */
        private void installPreferenceStoreBackwardsCompatibility() {
@@ -1193,45 +1074,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
                };
                JFaceResources.getFontRegistry().addListener(
                                fFontPropertyChangeListener);
-
-               /*
-                * Backwards compatibility: propagate the Java editor tab width from a
-                * pre-3.0 plug-in to the new preference key. This is done only once.
-                */
-               // final String oldTabWidthKey = PreferenceConstants.EDITOR_TAB_WIDTH;
-               // final String newTabWidthKey =
-               // AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH;
-               // String tabWidthPropagatedKey = "tabWidthPropagated"; //$NON-NLS-1$
-               // if (getPreferenceStore().contains(oldTabWidthKey) &&
-               // !getPreferenceStore().isDefault(oldTabWidthKey)) {
-               // if (!getPreferenceStore().getBoolean(tabWidthPropagatedKey))
-               // getPreferenceStore().setValue(newTabWidthKey,
-               // getPreferenceStore().getInt(oldTabWidthKey));
-               // }
-               // getPreferenceStore().setValue(tabWidthPropagatedKey, true);
-               //
-               // /*
-               // * Backwards compatibility: set the Java editor tab width in this
-               // plug-in's preference store with the old key to let older
-               // * versions access it. Since 3.0 the tab width is managed by the
-               // extended texteditor and uses a new key.
-               // */
-               // getPreferenceStore().putValue(oldTabWidthKey,
-               // getPreferenceStore().getString(newTabWidthKey));
-               // fPropertyChangeListener = new IPropertyChangeListener() {
-               // public void propertyChange(PropertyChangeEvent event) {
-               // if (newTabWidthKey.equals(event.getProperty()))
-               // getPreferenceStore().putValue(oldTabWidthKey,
-               // getPreferenceStore().getString(newTabWidthKey));
-               // }
-               // };
-               // getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);
-               /*
-                * Backward compatibility for the refactoring preference key.
-                */
-               // getPreferenceStore().setValue(
-               // PreferenceConstants.REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD,
-               // RefactoringCore.getConditionCheckingFailedSeverity());
        }
 
        /**
@@ -1256,7 +1098,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
                        modelManager.configurePluginDebugOptions();
 
                        // request state folder creation (workaround 19885)
-                       // JavaCore.getPlugin().getStateLocation();
                        getStateLocation();
                        // retrieve variable values
                        PHPeclipsePlugin.getDefault().getPluginPreferences()
@@ -1272,7 +1113,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
                                                        | IResourceChangeEvent.PRE_DELETE
                                                        | IResourceChangeEvent.PRE_CLOSE);
 
-                       // startIndexing();
                        ISavedState savedState = workspace.addSaveParticipant(
                                        PHPeclipsePlugin.this, modelManager);
 
@@ -1335,109 +1175,21 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
 
        }
 
-       // registerAdapters();
-       //
-       // // externalTools.startUp();
-       // getStandardDisplay().asyncExec(new Runnable() {
-       // public void run() {
-       // //initialize the variable context manager
-       // VariableContextManager.getDefault();
-       // }
-       // });
-       //
-       // // if (USE_WORKING_COPY_OWNERS) {
-       // WorkingCopyOwner.setPrimaryBufferProvider(new WorkingCopyOwner() {
-       // public IBuffer createBuffer(ICompilationUnit workingCopy) {
-       // ICompilationUnit original = workingCopy.getPrimary();
-       // IResource resource = original.getResource();
-       // if (resource instanceof IFile)
-       // return new DocumentAdapter(workingCopy, (IFile) resource);
-       // return DocumentAdapter.NULL;
-       // }
-       // });
-       // // }
-
-       // installPreferenceStoreBackwardsCompatibility();
-
-       // AllTypesCache.initialize();
-
-       // Initialize AST provider
-       // getASTProvider();
-       // }
-
-       // public void startup() throws CoreException {
-       // super.startup();
-       // // begin JavaCore.startup();
-       // JavaModelManager manager = JavaModelManager.getJavaModelManager();
-       // try {
-       // manager.configurePluginDebugOptions();
-       // // request state folder creation (workaround 19885)
-       // // JavaCore.getPlugin().getStateLocation();
-       // getStateLocation();
-       // // retrieve variable values
-       // //
-       // JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new
-       // // JavaModelManager.PluginPreferencesListener());
-       // getPluginPreferences().addPropertyChangeListener(
-       // new JavaModelManager.PluginPreferencesListener());
-       // // TODO temp-del
-       // // manager.loadVariablesAndContainers();
-       // final IWorkspace workspace = ResourcesPlugin.getWorkspace();
-       // workspace.addResourceChangeListener(
-       // manager.deltaState,
-       // IResourceChangeEvent.PRE_BUILD
-       // | IResourceChangeEvent.POST_BUILD
-       // | IResourceChangeEvent.POST_CHANGE
-       // | IResourceChangeEvent.PRE_DELETE
-       // | IResourceChangeEvent.PRE_CLOSE);
-       // // startIndexing();
-       // workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager);
-       // } catch (CoreException e) {
-       // } catch (RuntimeException e) {
-       // manager.shutdown();
-       // throw e;
-       // }
-       // // end JavaCore.startup();
-       // IAdapterManager platformManager = Platform.getAdapterManager();
-       // platformManager.registerAdapters(new PHPElementAdapterFactory(),
-       // PHPElement.class);
-       // platformManager.registerAdapters(new ResourceAdapterFactory(),
-       // IResource.class);
-       // // externalTools.startUp();
-       // getStandardDisplay().asyncExec(new Runnable() {
-       // public void run() {
-       // //initialize the variable context manager
-       // VariableContextManager.getDefault();
-       // }
-       // });
-       // }
-
        private void registerAdapters() {
                fJavaElementAdapterFactory = new JavaElementAdapterFactory();
-               // fMarkerAdapterFactory= new MarkerAdapterFactory();
-               // fEditorInputAdapterFactory= new EditorInputAdapterFactory();
                fResourceAdapterFactory = new ResourceAdapterFactory();
-               // fLogicalPackageAdapterFactory= new LogicalPackageAdapterFactory();
 
                IAdapterManager manager = Platform.getAdapterManager();
                manager
                                .registerAdapters(fJavaElementAdapterFactory,
                                                IJavaElement.class);
-               // manager.registerAdapters(fMarkerAdapterFactory, IMarker.class);
-               // manager.registerAdapters(fEditorInputAdapterFactory,
-               // IEditorInput.class);
                manager.registerAdapters(fResourceAdapterFactory, IResource.class);
-               // manager.registerAdapters(fLogicalPackageAdapterFactory,
-               // LogicalPackage.class);
        }
 
        private void unregisterAdapters() {
                IAdapterManager manager = Platform.getAdapterManager();
                manager.unregisterAdapters(fJavaElementAdapterFactory);
-               // manager.unregisterAdapters(fMarkerAdapterFactory);
-               // manager.unregisterAdapters(fEditorInputAdapterFactory);
                manager.unregisterAdapters(fResourceAdapterFactory);
-               // manager.unregisterAdapters(fLogicalPackageAdapterFactory);
        }
 
        /**
@@ -1592,20 +1344,9 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
         */
        public TemplateStore getTemplateStore() {
                if (fTemplateStore == null) {
-                       // boolean alreadyMigrated=
-                       // getPreferenceStore().getBoolean(TEMPLATES_MIGRATION_KEY);
-                       // if (alreadyMigrated)
                        fTemplateStore = new ContributionTemplateStore(
                                        getTemplateContextRegistry(), getPreferenceStore(),
                                        TEMPLATES_KEY);
-                       // else {
-                       // fTemplateStore= new
-                       // CompatibilityTemplateStore(getTemplateContextRegistry(),
-                       // getPreferenceStore(), TEMPLATES_KEY,
-                       // Templates.getInstance());
-                       // getPreferenceStore().setValue(TEMPLATES_MIGRATION_KEY, true);
-                       // }
-
                        try {
                                fTemplateStore.load();
                        } catch (IOException e) {
@@ -1643,31 +1384,14 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements
         */
        public TemplateStore getCodeTemplateStore() {
                if (fCodeTemplateStore == null) {
-                       // boolean alreadyMigrated=
-                       // getPreferenceStore().getBoolean(CODE_TEMPLATES_MIGRATION_KEY);
-                       // if (alreadyMigrated)
                        fCodeTemplateStore = new ContributionTemplateStore(
                                        getCodeTemplateContextRegistry(), getPreferenceStore(),
                                        CODE_TEMPLATES_KEY);
-                       // else {
-                       // fCodeTemplateStore= new
-                       // CompatibilityTemplateStore(getCodeTemplateContextRegistry(),
-                       // getPreferenceStore(),
-                       // CODE_TEMPLATES_KEY, CodeTemplates.getInstance());
-                       // getPreferenceStore().setValue(CODE_TEMPLATES_MIGRATION_KEY,
-                       // true);
-                       // }
-
                        try {
                                fCodeTemplateStore.load();
                        } catch (IOException e) {
                                log(e);
                        }
-
-                       // compatibility / bug fixing code for duplicated templates
-                       // TODO remove for 3.0
-                       // CompatibilityTemplateStore.pruneDuplicates(fCodeTemplateStore,
-                       // true);
                }
 
                return fCodeTemplateStore;