X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index 663efec..db6ef26 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -5,9 +5,6 @@ which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html - Contributors: - IBM Corporation - Initial implementation - Klaus Hartlage - www.eclipseproject.de **********************************************************************/ package net.sourceforge.phpeclipse; @@ -31,6 +28,7 @@ import net.sourceforge.phpdt.externaltools.internal.model.ColorManager; import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsPlugin; import net.sourceforge.phpdt.internal.core.BatchOperation; import net.sourceforge.phpdt.internal.core.JavaModelManager; +import net.sourceforge.phpdt.internal.core.util.Util; import net.sourceforge.phpdt.internal.corext.template.php.CodeTemplateContextType; import net.sourceforge.phpdt.internal.corext.template.php.HTMLContextType; import net.sourceforge.phpdt.internal.corext.template.php.JavaContextType; @@ -55,6 +53,7 @@ import net.sourceforge.phpeclipse.builder.FileStorage; import net.sourceforge.phpeclipse.builder.IdentifierIndexManager; import net.sourceforge.phpeclipse.phpeditor.CustomBufferFactory; import net.sourceforge.phpeclipse.phpeditor.DocumentAdapter; +import net.sourceforge.phpeclipse.phpeditor.ICompilationUnitDocumentProvider; import net.sourceforge.phpeclipse.phpeditor.PHPDocumentProvider; import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr; import net.sourceforge.phpeclipse.phpeditor.WorkingCopyManager; @@ -79,6 +78,7 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.Separator; @@ -107,7 +107,6 @@ import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry; import org.eclipse.ui.editors.text.templates.ContributionTemplateStore; import org.eclipse.ui.ide.IDE; import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.ChainedPreferenceStore; import org.eclipse.ui.texteditor.ConfigurationElementSorter; import org.eclipse.ui.texteditor.IDocumentProvider; @@ -123,7 +122,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon * The id of the PHP plugin (value "net.sourceforge.phpeclipse"). */ public static final String PLUGIN_ID = "net.sourceforge.phpeclipse"; //$NON-NLS-1$ - +IWorkspace w; /** * id of builder - matches plugin.xml (concatenate pluginid.builderid) */ @@ -247,7 +246,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon private IBufferFactory fBufferFactory; - private PHPDocumentProvider fCompilationUnitDocumentProvider; + private ICompilationUnitDocumentProvider fCompilationUnitDocumentProvider; private JavaTextTools fJavaTextTools; @@ -304,6 +303,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon plugin = this; setJVM(); externalTools = new ExternalToolsPlugin(); + // try { // resourceBundle = // ResourceBundle.getBundle("net.sourceforge.PHPeclipsePluginResources"); @@ -597,7 +597,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } // TODO: refactor this into a better method name ! - public synchronized PHPDocumentProvider getCompilationUnitDocumentProvider() { + public synchronized ICompilationUnitDocumentProvider getCompilationUnitDocumentProvider() { if (fCompilationUnitDocumentProvider == null) fCompilationUnitDocumentProvider = new PHPDocumentProvider(); return fCompilationUnitDocumentProvider; @@ -611,7 +611,10 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon * @return */ public IdentifierIndexManager getIndexManager(IProject iProject) { - String indexFilename = iProject.getLocation() + File.separator + "project.index"; + IPath path = iProject.getWorkingLocation(PHPeclipsePlugin.PLUGIN_ID); + path = path.append("project.index"); + String indexFilename = path.toString(); +// System.out.println(indexFilename); IdentifierIndexManager indexManager = (IdentifierIndexManager) fIndexManagerMap.get(indexFilename); if (indexManager == null) { indexManager = new IdentifierIndexManager(indexFilename); @@ -622,10 +625,10 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon public synchronized IWorkingCopyManager getWorkingCopyManager() { if (fWorkingCopyManager == null) { - PHPDocumentProvider provider = getCompilationUnitDocumentProvider(); - fWorkingCopyManager = new WorkingCopyManager(provider); - } - return fWorkingCopyManager; + ICompilationUnitDocumentProvider provider= getCompilationUnitDocumentProvider(); + fWorkingCopyManager= new WorkingCopyManager(provider); + } + return fWorkingCopyManager; } public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { @@ -690,8 +693,9 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // store.setDefault(PHP_LOCALHOST_PREF, "http://localhost"); // store.setDefault(PHP_DOCUMENTROOT_PREF, getWorkspace().getRoot() // .getLocation().toString()); + - // store.setDefault(SHOW_EXTERNAL_PREVIEW_PREF, "true"); +// store.setDefault(SHOW_EXTERNAL_PREVIEW_PREF, "true"); // store.setDefault(USE_EXTERNAL_BROWSER_PREF, "false"); store.setDefault(SHOW_OUTPUT_IN_CONSOLE, "true"); store.setDefault(PHP_OBFUSCATOR_DEFAULT, "c:\\temp"); @@ -716,6 +720,32 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // if ((jvm == WINDOWS_9x) || (jvm == WINDOWS_NT)) { // if (windowsSystem.equals(Platform.WS_WIN32)) { +// String workspaceLocation = getWorkspace().getRoot().getLocation().toString(); +// String baseLocation = null; +// int index = workspaceLocation.lastIndexOf('/'); +// if (index>0) { +// index = workspaceLocation.lastIndexOf('/', index-1); +// if (index>0) { +// baseLocation = workspaceLocation.substring(0,index); +// } +// } +// if (baseLocation!=null) { +// String xampp_start = baseLocation + "/xampp_start.exe"; +// String xampp_stop = baseLocation + "/xampp_stop.exe"; +// File testFile = new File(xampp_start); +// if (testFile.exists()) { +// System.out.println(xampp_start); +// System.out.println(xampp_stop); +// } else { +// xampp_start = "c:\\xampp\\xampp_start.exe"; +// xampp_stop = "c:\\xampp\\xampp_stop.exe"; +// testFile = new File(xampp_start); +// if (testFile.exists()) { +// System.out.println(xampp_start); +// System.out.println(xampp_stop); +// } +// } +// } store.setDefault(PHP_RUN_PREF, "c:\\apache\\php\\php.exe"); store.setDefault(EXTERNAL_PARSER_PREF, "c:\\apache\\php\\php -l -f {0}"); store.setDefault(MYSQL_RUN_PREF, "c:\\apache\\mysql\\bin\\mysqld-nt.exe"); @@ -726,6 +756,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon store.setDefault(MYSQL_RUN_PREF, "/apache/mysql/bin/mysqld"); store.setDefault(APACHE_RUN_PREF, "/apache/apache"); } + store.setDefault(PHP_EXTENSION_PREFS, "php,php3,php4,php5,phtml,inc,module,class"); store.setDefault(MYSQL_PREF, "--standalone"); store.setDefault(APACHE_START_PREF, "-c \"DocumentRoot \"{0}\"\""); store.setDefault(APACHE_STOP_PREF, "-k shutdown"); @@ -1126,7 +1157,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon */ public void start(BundleContext context) throws Exception { super.start(context); - + // JavaCore.start(this, context); final JavaModelManager manager = JavaModelManager.getJavaModelManager(); try { @@ -1136,9 +1167,9 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // JavaCore.getPlugin().getStateLocation(); getStateLocation(); // retrieve variable values - //JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new - // JavaModelManager.PluginPreferencesListener()); - // manager.loadVariablesAndContainers(); + PHPeclipsePlugin.getDefault().getPluginPreferences().addPropertyChangeListener(new + JavaModelManager.PluginPreferencesListener()); +// manager.loadVariablesAndContainers(); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace.addResourceChangeListener(manager.deltaState, IResourceChangeEvent.PRE_BUILD | IResourceChangeEvent.POST_BUILD @@ -1149,33 +1180,33 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // 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, 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(); + 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, 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; @@ -1244,7 +1275,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // // JavaModelManager.PluginPreferencesListener()); // getPluginPreferences().addPropertyChangeListener( // new JavaModelManager.PluginPreferencesListener()); - // // TODO khartlage temp-del + // // TODO temp-del // // manager.loadVariablesAndContainers(); // final IWorkspace workspace = ResourcesPlugin.getWorkspace(); // workspace.addResourceChangeListener(