X-Git-Url: http://secure.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
index 440e421..109c863 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
@@ -26,6 +26,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.ISavedState;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IWorkspaceRunnable;
@@ -34,15 +35,20 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import net.sourceforge.phpdt.internal.core.util.Util;
+import org.osgi.framework.BundleContext;
public class JavaCore {
// public static HashSet OptionNames = new HashSet(20);
/**
* The plug-in identifier of the Java core support
- * (value "org.phpeclipse.phpdt.core"
).
+ * (value "net.sourceforge.phpeclipse"
)
*/
// public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.core"; //$NON-NLS-1$
public static final String PLUGIN_ID = PHPeclipsePlugin.PLUGIN_ID;
@@ -215,6 +221,13 @@ public class JavaCore {
* @see #getDefaultOptions
*/
public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"; //$NON-NLS-1$
+
+ /**
+ * Possible configurable option ID.
+ * @see #getDefaultOptions
+ */
+ public static final String COMPILER_PB_PHP_VAR_DEPRECATED = PLUGIN_ID + ".compiler.problem.phpVarDeprecatedWarning"; //$NON-NLS-1$
+
/**
* Possible configurable option ID.
* @see #getDefaultOptions
@@ -235,6 +248,7 @@ public class JavaCore {
* @see #getDefaultOptions
*/
public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"; //$NON-NLS-1$
+
/**
* Possible configurable option ID.
* @see #getDefaultOptions
@@ -2412,6 +2426,9 @@ public static void initializeDefaultPluginPreferences() {
preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1);
optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM);
+ preferences.setDefault(COMPILER_PB_PHP_VAR_DEPRECATED, WARNING);
+ optionNames.add(COMPILER_PB_PHP_VAR_DEPRECATED);
+
preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR);
optionNames.add(COMPILER_PB_UNREACHABLE_CODE);
@@ -2420,7 +2437,7 @@ public static void initializeDefaultPluginPreferences() {
preferences.setDefault(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, WARNING);
optionNames.add(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD);
-
+
preferences.setDefault(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, WARNING);
optionNames.add(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME);
@@ -3602,7 +3619,7 @@ public static void setOptions(Hashtable newOptions) {
//
// // retrieve variable values
// JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener());
-//// TODO khartlage temp-del
+//// TODO : jsurfer temp-del
//// manager.loadVariablesAndContainers();
//
// IWorkspace workspace = ResourcesPlugin.getWorkspace();
@@ -3767,4 +3784,93 @@ public static void setOptions(Hashtable newOptions) {
// }
// }
//}
+/* (non-Javadoc)
+ * Startup the JavaCore plug-in.
+ *
+ * Registers the JavaModelManager as a resource changed listener and save participant. + * Starts the background indexing, and restore saved classpath variable values. + *
+ * @throws Exception + * @see org.eclipse.core.runtime.Plugin#start(BundleContext) + */ +public static void start(final Plugin plugin, BundleContext context) throws Exception { +// super.start(context); + + final JavaModelManager manager = JavaModelManager.getJavaModelManager(); + try { + manager.configurePluginDebugOptions(); + + // request state folder creation (workaround 19885) + JavaCore.getPlugin().getStateLocation(); + + // retrieve variable values + //JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener()); +// 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(); + + // 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(JavaCore.this, manager); + ISavedState savedState = workspace.addSaveParticipant(plugin, manager); + 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 + manager.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE; + savedState.processResourceChangeEvents(manager.deltaState); + } + } + }, + monitor); + } catch (CoreException e) { + return e.getStatus(); + } + return Status.OK_STATUS; + } + }; + processSavedState.setSystem(true); + processSavedState.setPriority(Job.SHORT); // process asap + processSavedState.schedule(); + } catch (RuntimeException e) { + manager.shutdown(); + throw e; + } +} +/* (non-Javadoc) + * Shutdown the JavaCore plug-in. + *
+ * De-registers the JavaModelManager as a resource changed listener and save participant. + *
+ * @see org.eclipse.core.runtime.Plugin#stop(BundleContext) + */ +public static void stop(Plugin plugin, BundleContext context) throws Exception { + try { + plugin.savePluginPreferences(); + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaState); + workspace.removeSaveParticipant(plugin); + + JavaModelManager.getJavaModelManager().shutdown(); + } finally { + // ensure we call super.stop as the last thing +// super.stop(context); + } +} } \ No newline at end of file