X-Git-Url: http://secure.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 6ae57ad..814b2e5 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; @@ -55,6 +52,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; @@ -107,7 +105,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; @@ -131,6 +128,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon //public static final String BUILDER_INDEX_ID = PLUGIN_ID + ".indexbuilder"; /** General debug flag */ + public static final boolean DEBUG = false; /** @@ -246,7 +244,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon private IBufferFactory fBufferFactory; - private PHPDocumentProvider fCompilationUnitDocumentProvider; + private ICompilationUnitDocumentProvider fCompilationUnitDocumentProvider; private JavaTextTools fJavaTextTools; @@ -272,7 +270,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon * * @since 3.0 */ - private IPropertyChangeListener fPropertyChangeListener; +// private IPropertyChangeListener fPropertyChangeListener; /** * The combined preference store. @@ -303,6 +301,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon plugin = this; setJVM(); externalTools = new ExternalToolsPlugin(); + // try { // resourceBundle = // ResourceBundle.getBundle("net.sourceforge.PHPeclipsePluginResources"); @@ -596,7 +595,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; @@ -621,10 +620,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() { @@ -689,9 +688,10 @@ 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(USE_EXTERNAL_BROWSER_PREF, "false"); +// 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"); // store.setDefault(PHP_BOOKMARK_DEFAULT, ""); @@ -702,19 +702,45 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon String windowsSystem = Platform.getWS(); if (jvm == WINDOWS_9x) { - store.setDefault(EXTERNAL_BROWSER_PREF, "command.com /c start iexplore {0}"); +// store.setDefault(EXTERNAL_BROWSER_PREF, "command.com /c start iexplore {0}"); } else if (windowsSystem.equals(Platform.WS_WIN32)) { - store.setDefault(EXTERNAL_BROWSER_PREF, "rundll32 url.dll,FileProtocolHandler {0}"); +// store.setDefault(EXTERNAL_BROWSER_PREF, "rundll32 url.dll,FileProtocolHandler {0}"); } else if (windowsSystem.equals(Platform.WS_CARBON)) { // TODO How do we start Safari on Mac OS X ? - store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}"); +// store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}"); } else { store.setDefault(PHP_OBFUSCATOR_DEFAULT, "/tmp"); - store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}"); +// store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}"); } // 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"); @@ -725,6 +751,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"); @@ -1081,28 +1108,28 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon * 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); +// 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. @@ -1117,7 +1144,7 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon */ private void uninstallPreferenceStoreBackwardsCompatibility() { JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener); - getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener); +// getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener); } /* @@ -1125,7 +1152,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 { @@ -1148,7 +1175,7 @@ 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$ + // Job processSavedState = new Job(ProjectPrefUtil.bind("savedState.jobName")) { //$NON-NLS-1$ // protected IStatus run(IProgressMonitor monitor) { // try { // // add save participant and process delta atomically @@ -1243,7 +1270,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(