import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IConfigurationElement;
// 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);
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,
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();
PreferenceConstants.initializeDefaultValues(store);
// externalTools.initializeDefaultPreferences(store);
- MarkerAnnotationPreferences.initializeDefaultValues(store);
+ // MarkerAnnotationPreferences.initializeDefaultValues(store);
}
private IWorkbenchPage internalGetActivePage() {
}
/**
- * @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() {
};
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());
}
/**
modelManager.configurePluginDebugOptions();
// request state folder creation (workaround 19885)
- // JavaCore.getPlugin().getStateLocation();
getStateLocation();
// retrieve variable values
PHPeclipsePlugin.getDefault().getPluginPreferences()
| IResourceChangeEvent.PRE_DELETE
| IResourceChangeEvent.PRE_CLOSE);
- // startIndexing();
ISavedState savedState = workspace.addSaveParticipant(
PHPeclipsePlugin.this, modelManager);
// process deltas since last activated in indexer thread so that
// indexes are up-to-date.
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
- Job processSavedState = new Job(Util.bind("savedState.jobName")) { //$NON-NLS-1$
- protected IStatus run(IProgressMonitor monitor) {
- try {
- // add save participant and process delta atomically
- // see
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
- workspace.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor progress)
- throws CoreException {
- ISavedState savedState = workspace
- .addSaveParticipant(
- PHPeclipsePlugin.this,
- modelManager);
- if (savedState != null) {
- // the event type coming from the saved
- // state is always POST_AUTO_BUILD
- // force it to be POST_CHANGE so that the
- // delta processor can handle it
- modelManager.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE;
- savedState
- .processResourceChangeEvents(modelManager.deltaState);
- }
- }
- }, monitor);
- } catch (CoreException e) {
- return e.getStatus();
+// This causes timeout at EclipseLazyStarter
+// Job processSavedState = new Job(Util.bind("savedState.jobName")) { //$NON-NLS-1$
+// protected IStatus run(IProgressMonitor monitor) {
+// try {
+// // add save participant and process delta atomically
+// // see
+// // https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
+// workspace.run(new IWorkspaceRunnable() {
+// public void run(IProgressMonitor progress)
+// throws CoreException {
+// ISavedState savedState = workspace
+// .addSaveParticipant(
+// PHPeclipsePlugin.this,
+// modelManager);
+// if (savedState != null) {
+// // the event type coming from the saved
+// // state is always POST_AUTO_BUILD
+// // force it to be POST_CHANGE so that the
+// // delta processor can handle it
+// modelManager.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE;
+// savedState
+// .processResourceChangeEvents(modelManager.deltaState);
+// }
+// }
+// }, monitor);
+// } catch (CoreException e) {
+// return e.getStatus();
+// }
+// return Status.OK_STATUS;
+// }
+// };
+// Replace Job + IWorkspace.run() to WorkspaceJob
+ WorkspaceJob processSavedState = new WorkspaceJob(
+ Util.bind("savedState.jobName")) { //$NON-NLS-1$
+ public IStatus runInWorkspace(IProgressMonitor monitor)
+ throws CoreException {
+ ISavedState savedState = workspace.addSaveParticipant(
+ PHPeclipsePlugin.this, modelManager);
+ if (savedState != null) {
+ modelManager.deltaState.getDeltaProcessor().overridenEventType
+ = IResourceChangeEvent.POST_CHANGE;
+ savedState.processResourceChangeEvents(modelManager.deltaState);
}
return Status.OK_STATUS;
}
}
- // 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);
}
/**
*/
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) {
*/
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;