From 7e730276349806e9650da8919f409124e5c03e9c Mon Sep 17 00:00:00 2001 From: khartlage Date: Fri, 27 Jun 2003 20:35:56 +0000 Subject: [PATCH 1/1] Use external tools package to run commands for apache, mysql, php --- .../launchConfigurations/ExternalToolsMainTab.java | 2 + .../launchConfigurations/ExternalToolsUtil.java | 527 +++++++++++--------- .../phpeclipse/IPreferenceConstants.java | 14 +- .../phpeclipse/PHPEclipseBasePreferencePage.java | 251 +++++++--- .../phpeclipse/PHPEclipseParserPreferencePage.java | 113 +++++ .../sourceforge/phpeclipse/PHPeclipsePlugin.java | 233 ++++----- .../phpeclipse/actions/PHPRestartApacheAction.java | 13 +- .../phpeclipse/actions/PHPStartApacheAction.java | 204 +++++---- .../phpeclipse/actions/PHPStartMySQLAction.java | 13 +- .../phpeclipse/actions/PHPStopApacheAction.java | 13 +- .../newPHPPreferencesMessages_DE.properties | 11 +- .../newPHPPreferencesMessages_FR.properties | 9 +- .../newPHPPreferencesMessages_en_GB.properties | 8 +- .../newPHPPreferencesMessages_es_ES.properties | 13 +- 14 files changed, 847 insertions(+), 577 deletions(-) create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseParserPreferencePage.java diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsMainTab.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsMainTab.java index 79cf430..1351b55 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsMainTab.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsMainTab.java @@ -123,6 +123,8 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab { locationField.setLayoutData(data); locationField.setFont(font); locationField.add( store.getString(PHPeclipsePlugin.PHP_RUN_PREF), 0); + locationField.add( store.getString(PHPeclipsePlugin.APACHE_RUN_PREF), 1); + locationField.add( store.getString(PHPeclipsePlugin.MYSQL_RUN_PREF), 2); Composite buttonComposite = new Composite(parent, SWT.NONE); layout = new GridLayout(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsUtil.java index 8598efb..dbc7e6e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsUtil.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsUtil.java @@ -13,6 +13,16 @@ import java.io.File; import java.text.MessageFormat; import java.util.Map; +import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsPlugin; +import net.sourceforge.phpdt.externaltools.internal.model.ToolMessages; +import net.sourceforge.phpdt.externaltools.internal.model.VariableContextManager; +import net.sourceforge.phpdt.externaltools.internal.registry.ExternalToolMigration; +import net.sourceforge.phpdt.externaltools.internal.registry.RefreshScopeVariable; +import net.sourceforge.phpdt.externaltools.internal.registry.RefreshScopeVariableRegistry; +import net.sourceforge.phpdt.externaltools.model.IExternalToolConstants; +import net.sourceforge.phpdt.externaltools.model.ToolUtil; +import net.sourceforge.phpdt.externaltools.variable.ExpandVariableContext; + import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; @@ -23,15 +33,9 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; -import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsPlugin; -import net.sourceforge.phpdt.externaltools.internal.model.ToolMessages; -import net.sourceforge.phpdt.externaltools.internal.model.VariableContextManager; -import net.sourceforge.phpdt.externaltools.internal.registry.ExternalToolMigration; -import net.sourceforge.phpdt.externaltools.internal.registry.RefreshScopeVariable; -import net.sourceforge.phpdt.externaltools.internal.registry.RefreshScopeVariableRegistry; -import net.sourceforge.phpdt.externaltools.model.IExternalToolConstants; -import net.sourceforge.phpdt.externaltools.model.ToolUtil; -import net.sourceforge.phpdt.externaltools.variable.ExpandVariableContext; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; /** * Utilities for external tool launch configurations. @@ -41,260 +45,291 @@ import net.sourceforge.phpdt.externaltools.variable.ExpandVariableContext; */ public class ExternalToolsUtil { - private static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$ + private static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$ + + /** + * Not to be instantiated. + */ + private ExternalToolsUtil() { + }; + + /** + * Throws a core exception with an error status object built from + * the given message, lower level exception, and error code. + * + * @param message the status message + * @param exception lower level exception associated with the + * error, or null if none + * @param code error code + */ + protected static void abort(String message, Throwable exception, int code) throws CoreException { + throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, code, message, exception)); + } + + /** + * Returns active variable context. The active variable context is used to + * expand variable expressions. If the workspace is currently being built, + * the context is associated with the project being built. Otherwise, the + * context is associated with the selected resource. + * + * @return active variable context + */ + public static ExpandVariableContext getVariableContext() { + return VariableContextManager.getDefault().getVariableContext(); + } - /** - * Not to be instantiated. - */ - private ExternalToolsUtil() { - }; + /** + * Expands and returns the location attribute of the given launch + * configuration, based on the given variable context. The location is + * verified to point to an existing file, in the local file system. + * + * @param configuration launch configuration + * @param context context used to expand variables + * @return an absolute path to a file in the local file system + * @throws CoreException if unable to retrieve the associated launch + * configuration attribute, if unable to resolve any variables, or if the + * resolved location does not point to an existing file in the local file + * system + */ + public static IPath getLocation(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { + String location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null); + if (location == null) { + abort(MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Location_not_specified_by_{0}_1"), new String[] { configuration.getName()}), null, 0); //$NON-NLS-1$ + } else { + MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ToolMessages.getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; + String expandedLocation = ToolUtil.expandFileLocation(location, context, status); + if (status.isOK()) { + if (expandedLocation == null || expandedLocation.length() == 0) { + String msg = ToolMessages.format("DefaultRunnerContext.invalidLocation", new Object[] { configuration.getName()}); //$NON-NLS-1$ + abort(msg, null, 0); + } else { + File file = new File(expandedLocation); + if (file.isFile()) { + return new Path(expandedLocation); + } else { + String msg = ToolMessages.format("DefaultRunnerContext.invalidLocation", new Object[] { configuration.getName()}); //$NON-NLS-1$ + abort(msg, null, 0); + } + } + } else { + throw new CoreException(status); + } + } + // execution will not reach here + return null; + } - /** - * Throws a core exception with an error status object built from - * the given message, lower level exception, and error code. - * - * @param message the status message - * @param exception lower level exception associated with the - * error, or null if none - * @param code error code - */ - protected static void abort(String message, Throwable exception, int code) throws CoreException { - throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, code, message, exception)); - } + /** + * Expands and returns the working directory attribute of the given launch + * configuration, based on the given variable context. Returns + * null if a working directory is not specified. If specified, + * the working is verified to point to an existing directory in the local + * file system. + * + * @param configuration launch configuration + * @param context context used to expand variables + * @return an absolute path to a direcoty in the local file system, or + * null if unspecified + * @throws CoreException if unable to retrieve the associated launch + * configuration attribute, if unable to resolve any variables, or if the + * resolved location does not point to an existing directory in the local + * file system + */ + public static IPath getWorkingDirectory(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { + String location = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) null); + if (location != null) { + MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ToolMessages.getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; + String expandedLocation = ToolUtil.expandDirectoryLocation(location, context, status); + if (status.isOK()) { + if (expandedLocation != null && expandedLocation.length() > 0) { + File path = new File(expandedLocation); + if (path.isDirectory()) { + return new Path(expandedLocation); + } else { + String msg = ToolMessages.format("DefaultRunnerContext.invalidDirectory", new Object[] { configuration.getName()}); //$NON-NLS-1$ + abort(msg, null, 0); + } + } + } else { + throw new CoreException(status); + } + } + return null; + } - /** - * Returns active variable context. The active variable context is used to - * expand variable expressions. If the workspace is currently being built, - * the context is associated with the project being built. Otherwise, the - * context is associated with the selected resource. - * - * @return active variable context - */ - public static ExpandVariableContext getVariableContext() { - return VariableContextManager.getDefault().getVariableContext(); - } + /** + * Expands and returns the arguments attribute of the given launch + * configuration, based on the given variable context. Returns + * null if arguments are not specified. + * + * @param configuration launch configuration + * @param context context used to expand variables + * @return an array of resolved arguments, or null if + * unspecified + * @throws CoreException if unable to retrieve the associated launch + * configuration attribute, or if unable to resolve any variables + */ + public static String[] getArguments(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { + String args = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null); + if (args != null) { + MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ToolMessages.getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; + String[] expandedArgs = ToolUtil.expandArguments(args, context, status); + if (status.isOK()) { + return expandedArgs; + } else { + throw new CoreException(status); + } + } + return null; + } - /** - * Expands and returns the location attribute of the given launch - * configuration, based on the given variable context. The location is - * verified to point to an existing file, in the local file system. - * - * @param configuration launch configuration - * @param context context used to expand variables - * @return an absolute path to a file in the local file system - * @throws CoreException if unable to retrieve the associated launch - * configuration attribute, if unable to resolve any variables, or if the - * resolved location does not point to an existing file in the local file - * system - */ - public static IPath getLocation(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { - String location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null); - if (location == null) { - abort(MessageFormat.format(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Location_not_specified_by_{0}_1"), new String[] { configuration.getName()}), null, 0); //$NON-NLS-1$ - } else { - MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ToolMessages.getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; - String expandedLocation = ToolUtil.expandFileLocation(location, context, status); - if (status.isOK()) { - if (expandedLocation == null || expandedLocation.length() == 0) { - String msg = ToolMessages.format("DefaultRunnerContext.invalidLocation", new Object[] { configuration.getName()}); //$NON-NLS-1$ - abort(msg, null, 0); - } else { - File file = new File(expandedLocation); - if (file.isFile()) { - return new Path(expandedLocation); - } else { - String msg = ToolMessages.format("DefaultRunnerContext.invalidLocation", new Object[] { configuration.getName()}); //$NON-NLS-1$ - abort(msg, null, 0); - } - } - } else { - throw new CoreException(status); - } - } - // execution will not reach here - return null; - } + /** + * Returns the refresh scope specified by the given launch configuration or + * null if none. + * + * @param configuration + * @return refresh scope + * @throws CoreException if unable to access the associated attribute + */ + public static String getRefreshScope(ILaunchConfiguration configuration) throws CoreException { + return configuration.getAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, (String) null); + } - /** - * Expands and returns the working directory attribute of the given launch - * configuration, based on the given variable context. Returns - * null if a working directory is not specified. If specified, - * the working is verified to point to an existing directory in the local - * file system. - * - * @param configuration launch configuration - * @param context context used to expand variables - * @return an absolute path to a direcoty in the local file system, or - * null if unspecified - * @throws CoreException if unable to retrieve the associated launch - * configuration attribute, if unable to resolve any variables, or if the - * resolved location does not point to an existing directory in the local - * file system - */ - public static IPath getWorkingDirectory(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { - String location = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) null); - if (location != null) { - MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ToolMessages.getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; - String expandedLocation = ToolUtil.expandDirectoryLocation(location, context, status); - if (status.isOK()) { - if (expandedLocation != null && expandedLocation.length() > 0) { - File path = new File(expandedLocation); - if (path.isDirectory()) { - return new Path(expandedLocation); - } else { - String msg = ToolMessages.format("DefaultRunnerContext.invalidDirectory", new Object[] { configuration.getName()}); //$NON-NLS-1$ - abort(msg, null, 0); - } - } - } else { - throw new CoreException(status); - } - } - return null; - } + /** + * Returns whether the refresh scope specified by the given launch + * configuration is recursive. + * + * @param configuration + * @return whether the refresh scope is recursive + * @throws CoreException if unable to access the associated attribute + */ + public static boolean isRefreshRecursive(ILaunchConfiguration configuration) throws CoreException { + return configuration.getAttribute(IExternalToolConstants.ATTR_REFRESH_RECURSIVE, false); + } - /** - * Expands and returns the arguments attribute of the given launch - * configuration, based on the given variable context. Returns - * null if arguments are not specified. - * - * @param configuration launch configuration - * @param context context used to expand variables - * @return an array of resolved arguments, or null if - * unspecified - * @throws CoreException if unable to retrieve the associated launch - * configuration attribute, or if unable to resolve any variables - */ - public static String[] getArguments(ILaunchConfiguration configuration, ExpandVariableContext context) throws CoreException { - String args = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null); - if (args != null) { - MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ToolMessages.getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; - String[] expandedArgs = ToolUtil.expandArguments(args, context, status); - if (status.isOK()) { - return expandedArgs; - } else { - throw new CoreException(status); - } - } - return null; - } + /** + * Refreshes the resources as specified by the given launch configuration. + * + * @param configuration launch configuration + * @param context context used to expand variables + * @param monitor progress monitor + * @throws CoreException if an exception occurrs while refreshing resources + */ + public static void refreshResources(ILaunchConfiguration configuration, ExpandVariableContext context, IProgressMonitor monitor) + throws CoreException { + String scope = getRefreshScope(configuration); + if (scope == null) + return; - /** - * Returns the refresh scope specified by the given launch configuration or - * null if none. - * - * @param configuration - * @return refresh scope - * @throws CoreException if unable to access the associated attribute - */ - public static String getRefreshScope(ILaunchConfiguration configuration) throws CoreException { - return configuration.getAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, (String) null); - } + ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(scope, 0); + if (varDef.start == -1 || varDef.end == -1 || varDef.name == null) { + String msg = ToolMessages.format("DefaultRunnerContext.invalidRefreshVarFormat", new Object[] { configuration.getName()}); //$NON-NLS-1$ + abort(msg, null, 0); + } - /** - * Returns whether the refresh scope specified by the given launch - * configuration is recursive. - * - * @param configuration - * @return whether the refresh scope is recursive - * @throws CoreException if unable to access the associated attribute - */ - public static boolean isRefreshRecursive(ILaunchConfiguration configuration) throws CoreException { - return configuration.getAttribute(IExternalToolConstants.ATTR_REFRESH_RECURSIVE, false); - } + RefreshScopeVariableRegistry registry = ExternalToolsPlugin.getDefault().getRefreshVariableRegistry(); + RefreshScopeVariable variable = registry.getRefreshVariable(varDef.name); + if (variable == null) { + String msg = ToolMessages.format("DefaultRunnerContext.noRefreshVarNamed", new Object[] { configuration.getName(), varDef.name }); //$NON-NLS-1$ + abort(msg, null, 0); + } - /** - * Refreshes the resources as specified by the given launch configuration. - * - * @param configuration launch configuration - * @param context context used to expand variables - * @param monitor progress monitor - * @throws CoreException if an exception occurrs while refreshing resources - */ - public static void refreshResources(ILaunchConfiguration configuration, ExpandVariableContext context, IProgressMonitor monitor) throws CoreException { - String scope = getRefreshScope(configuration); - if (scope == null) - return; + int depth = IResource.DEPTH_ZERO; + if (isRefreshRecursive(configuration)) + depth = IResource.DEPTH_INFINITE; - ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(scope, 0); - if (varDef.start == -1 || varDef.end == -1 || varDef.name == null) { - String msg = ToolMessages.format("DefaultRunnerContext.invalidRefreshVarFormat", new Object[] { configuration.getName()}); //$NON-NLS-1$ - abort(msg, null, 0); - } + if (monitor.isCanceled()) + return; - RefreshScopeVariableRegistry registry = ExternalToolsPlugin.getDefault().getRefreshVariableRegistry(); - RefreshScopeVariable variable = registry.getRefreshVariable(varDef.name); - if (variable == null) { - String msg = ToolMessages.format("DefaultRunnerContext.noRefreshVarNamed", new Object[] { configuration.getName(), varDef.name }); //$NON-NLS-1$ - abort(msg, null, 0); - } + IResource[] resources = variable.getExpander().getResources(varDef.name, varDef.argument, context); + if (resources == null || resources.length == 0) + return; - int depth = IResource.DEPTH_ZERO; - if (isRefreshRecursive(configuration)) - depth = IResource.DEPTH_INFINITE; + monitor.beginTask(ToolMessages.getString("DefaultRunnerContext.refreshResources"), //$NON-NLS-1$ + resources.length); - if (monitor.isCanceled()) - return; + MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Exception(s)_occurred_during_refresh._2"), null); //$NON-NLS-1$ + for (int i = 0; i < resources.length; i++) { + if (monitor.isCanceled()) + break; + if (resources[i] != null && resources[i].isAccessible()) { + try { + resources[i].refreshLocal(depth, null); + } catch (CoreException e) { + status.merge(e.getStatus()); + } + } + monitor.worked(1); + } - IResource[] resources = variable.getExpander().getResources(varDef.name, varDef.argument, context); - if (resources == null || resources.length == 0) - return; + monitor.done(); + if (!status.isOK()) { + throw new CoreException(status); + } + } - monitor.beginTask(ToolMessages.getString("DefaultRunnerContext.refreshResources"), //$NON-NLS-1$ - resources.length); + /** + * Returns whether this tool is to be run in the background.. + * + * @param configuration + * @return whether this tool is to be run in the background + * @throws CoreException if unable to access the associated attribute + */ + public static boolean isBackground(ILaunchConfiguration configuration) throws CoreException { + return configuration.getAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, false); + } - MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Exception(s)_occurred_during_refresh._2"), null); //$NON-NLS-1$ - for (int i = 0; i < resources.length; i++) { - if (monitor.isCanceled()) - break; - if (resources[i] != null && resources[i].isAccessible()) { - try { - resources[i].refreshLocal(depth, null); - } catch (CoreException e) { - status.merge(e.getStatus()); - } - } - monitor.worked(1); - } + /** + * Returns a launch configuration from the given ICommand arguments. If the + * given arguments are from an old-style external tool, an unsaved working + * copy will be created from the arguments and returned. + * + * @param commandArgs the builder ICommand arguments + * @param newName a new name for the config if the one in the command is + * invalid + * @return a launch configuration, a launch configuration working copy, or + * null if not possible. + */ + public static ILaunchConfiguration configFromBuildCommandArgs(Map commandArgs) { + String configHandle = (String) commandArgs.get(LAUNCH_CONFIG_HANDLE); + if (configHandle == null) { + // Probably an old-style external tool. Try to migrate. + return ExternalToolMigration.configFromArgumentMap(commandArgs); + } + try { + return DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(configHandle); + } catch (CoreException e) { + return null; + } + } + /** + * Executes an external progam and saves the LaunchConfiguration under external tools + * @param command external tools command name + * @param executable executable path i.e.c:\apache\apache.exe + * @param arguments arguments for this configuration + * @param background run this configuration in background mode + */ + public static void execute(String command, String executable, String arguments, boolean background) { + ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); + ILaunchConfigurationType type = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE); - monitor.done(); - if (!status.isOK()) { - throw new CoreException(status); - } - } + ILaunchConfigurationWorkingCopy wc = null; + try { + wc = type.newInstance(null, command); + } catch (CoreException e) { + //some exception handling + } + wc.setAttribute(IExternalToolConstants.ATTR_LOCATION, executable); + wc.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments); + wc.setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, background); - /** - * Returns whether this tool is to be run in the background.. - * - * @param configuration - * @return whether this tool is to be run in the background - * @throws CoreException if unable to access the associated attribute - */ - public static boolean isBackground(ILaunchConfiguration configuration) throws CoreException { - return configuration.getAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, false); - } + // saving will add the configuration to the external tools configurations + ILaunchConfiguration config; + try { + config = wc.doSave(); + config.launch(ILaunchManager.RUN_MODE, null); + } catch (CoreException e) { + } - /** - * Returns a launch configuration from the given ICommand arguments. If the - * given arguments are from an old-style external tool, an unsaved working - * copy will be created from the arguments and returned. - * - * @param commandArgs the builder ICommand arguments - * @param newName a new name for the config if the one in the command is - * invalid - * @return a launch configuration, a launch configuration working copy, or - * null if not possible. - */ - public static ILaunchConfiguration configFromBuildCommandArgs(Map commandArgs) { - String configHandle = (String) commandArgs.get(LAUNCH_CONFIG_HANDLE); - if (configHandle == null) { - // Probably an old-style external tool. Try to migrate. - return ExternalToolMigration.configFromArgumentMap(commandArgs); - } - try { - return DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(configHandle); - } catch (CoreException e) { - return null; - } - } + } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java index cc44585..356a860 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java @@ -20,10 +20,16 @@ public interface IPreferenceConstants { public static final String USE_EXTERNAL_BROWSER_PREF = "_use_external_browser"; public static final String SHOW_EXTERNAL_PREVIEW_PREF = "_show_external_preview"; public static final String EXTERNAL_BROWSER_PREF = "_external_browser"; - public static final String MYSQL_PREF = "_my_sql"; - public static final String APACHE_START_PREF = "_apache_start"; - public static final String APACHE_STOP_PREF = "_apache_stop"; - public static final String APACHE_RESTART_PREF = "_apache_restart"; + public static final String MYSQL_RUN_PREF = "_mysql_run_pref"; + public static final String MYSQL_START_BACKGROUND = "_mysql_start_background"; + public static final String MYSQL_PREF = "__mysql_start"; + public static final String APACHE_RUN_PREF = "_apache_run_pref"; + public static final String APACHE_START_BACKGROUND = "_apache_start_background"; + public static final String APACHE_START_PREF = "__apache_start"; + public static final String APACHE_STOP_BACKGROUND = "_apache_stop_background"; + public static final String APACHE_STOP_PREF = "__apache_stop"; + public static final String APACHE_RESTART_BACKGROUND = "_apache_restart_background"; + public static final String APACHE_RESTART_PREF = "__apache_restart"; public static final String SHOW_OUTPUT_IN_CONSOLE = "_show_output_in_console"; public static final String PHP_RUN_PREF = "_php_run_pref"; public static final String EXTERNAL_PARSER_PREF = "_external_parser"; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java index f46d66e..8d55567 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java @@ -1,21 +1,16 @@ package net.sourceforge.phpeclipse; -import java.util.ArrayList; - import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages; import org.eclipse.jface.preference.BooleanFieldEditor; import org.eclipse.jface.preference.DirectoryFieldEditor; +import org.eclipse.jface.preference.FileFieldEditor; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.preference.RadioGroupFieldEditor; import org.eclipse.jface.preference.StringFieldEditor; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; @@ -25,14 +20,14 @@ import org.eclipse.ui.IWorkbenchPreferencePage; public class PHPEclipseBasePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - private SelectionListener SelectionListener; - private ModifyListener ModifyListener; - private ModifyListener TextModifyListener; - - private ArrayList CheckBoxes = new ArrayList(); - private ArrayList ComboBoxes = new ArrayList(); - private ArrayList TextBoxes = new ArrayList(); - private ArrayList RadioButtons = new ArrayList(); +// private SelectionListener SelectionListener; +// private ModifyListener ModifyListener; +// private ModifyListener TextModifyListener; +// +// private ArrayList CheckBoxes = new ArrayList(); +// private ArrayList ComboBoxes = new ArrayList(); +// private ArrayList TextBoxes = new ArrayList(); +// private ArrayList RadioButtons = new ArrayList(); StringFieldEditor localHostSFE; DirectoryFieldEditor documentRootDFE; @@ -43,10 +38,16 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor StringFieldEditor apacheStopSFE; StringFieldEditor apacheRestartSFE; StringFieldEditor mySQLCommandSFE; - StringFieldEditor phpRunSFE; - RadioGroupFieldEditor chooseParser; - StringFieldEditor externalParserSFE; - BooleanFieldEditor parseOnSave; + FileFieldEditor apacheRunFFE; + FileFieldEditor mysqlRunFFE; + FileFieldEditor phpRunFFE; +// RadioGroupFieldEditor chooseParser; +// StringFieldEditor externalParserSFE; +// BooleanFieldEditor parseOnSave; + BooleanFieldEditor apacheStartBFE; + BooleanFieldEditor apacheStopBFE; + BooleanFieldEditor apacheRestartBFE; + BooleanFieldEditor mysqlStartBFE; public PHPEclipseBasePreferencePage() { super(); @@ -65,10 +66,16 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor apacheStopSFE.loadDefault(); apacheRestartSFE.loadDefault(); mySQLCommandSFE.loadDefault(); - phpRunSFE.loadDefault(); - chooseParser.loadDefault(); - externalParserSFE.loadDefault(); - parseOnSave.loadDefault(); + phpRunFFE.loadDefault(); + apacheRunFFE.loadDefault(); + mysqlRunFFE.loadDefault(); +// chooseParser.loadDefault(); +// externalParserSFE.loadDefault(); +// parseOnSave.loadDefault(); + apacheStartBFE.loadDefault(); + apacheStopBFE.loadDefault(); + apacheRestartBFE.loadDefault(); + mysqlStartBFE.loadDefault(); super.performDefaults(); } @@ -82,10 +89,16 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor apacheStopSFE.store(); apacheRestartSFE.store(); mySQLCommandSFE.store(); - phpRunSFE.store(); - chooseParser.store(); - externalParserSFE.store(); - parseOnSave.store(); + phpRunFFE.store(); + apacheRunFFE.store(); + mysqlRunFFE.store(); +// chooseParser.store(); +// externalParserSFE.store(); +// parseOnSave.store(); + apacheStartBFE.store(); + apacheStopBFE.store(); + apacheRestartBFE.store(); + mysqlStartBFE.store(); return super.performOk(); } @@ -96,26 +109,34 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite.setLayout(new GridLayout()); //Create Websettings - Composite webSettingsComposite = new Composite(composite, SWT.NONE); - webSettingsComposite.setLayout(new GridLayout()); - webSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + // Composite webSettingsComposite = new Composite(composite, SWT.NONE); + // webSettingsComposite.setLayout(new GridLayout()); + // webSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); showExternalPreviewBFE = new BooleanFieldEditor( IPreferenceConstants.SHOW_EXTERNAL_PREVIEW_PREF, PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup.showexternalpreview"), - webSettingsComposite); + composite); showExternalPreviewBFE.setPreferencePage(this); showExternalPreviewBFE.setPreferenceStore(getPreferenceStore()); showExternalPreviewBFE.load(); + // Group webSettingsGroup = new Group(webSettingsComposite, SWT.NONE); + // webSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup")); + // GridLayout gridLayout = new GridLayout(); + // // gridLayout.numColumns = 3; + // GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + // webSettingsGroup.setLayoutData(gridData); + // webSettingsGroup.setLayout(gridLayout); + + Composite webSettingsComposite = new Composite(composite, SWT.NULL); + webSettingsComposite.setLayout(new GridLayout()); + webSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Group webSettingsGroup = new Group(webSettingsComposite, SWT.NONE); webSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.websettingsGroup")); - GridLayout gridLayout = new GridLayout(); - // gridLayout.numColumns = 3; - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - webSettingsGroup.setLayoutData(gridData); - webSettingsGroup.setLayout(gridLayout); + webSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + webSettingsGroup.setLayout(new GridLayout()); // new Label(webSettingsGroup, SWT.NONE); externalBrowserBFE = @@ -165,6 +186,18 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor apacheSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup")); apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); apacheSettingsGroup.setLayout(new GridLayout()); + + apacheStartBFE = + new BooleanFieldEditor( + PHPeclipsePlugin.APACHE_START_BACKGROUND, + PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup.start_background"), + apacheSettingsGroup); + apacheStartBFE.setPreferencePage(this); + apacheStartBFE.setPreferenceStore(getPreferenceStore()); + apacheStartBFE.load(); + + new Label(apacheSettingsGroup, SWT.NONE); + new Label(apacheSettingsGroup, SWT.NONE); apacheStartSFE = new StringFieldEditor( IPreferenceConstants.APACHE_START_PREF, @@ -173,6 +206,18 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor apacheStartSFE.setPreferencePage(this); apacheStartSFE.setPreferenceStore(getPreferenceStore()); apacheStartSFE.load(); + new Label(apacheSettingsGroup, SWT.NONE); + + apacheStopBFE = + new BooleanFieldEditor( + PHPeclipsePlugin.APACHE_STOP_BACKGROUND, + PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup.stop_background"), + apacheSettingsGroup); + apacheStopBFE.setPreferencePage(this); + apacheStopBFE.setPreferenceStore(getPreferenceStore()); + apacheStopBFE.load(); + new Label(apacheSettingsGroup, SWT.NONE); + new Label(apacheSettingsGroup, SWT.NONE); apacheStopSFE = new StringFieldEditor( IPreferenceConstants.APACHE_STOP_PREF, @@ -181,6 +226,18 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor apacheStopSFE.setPreferencePage(this); apacheStopSFE.setPreferenceStore(getPreferenceStore()); apacheStopSFE.load(); + new Label(apacheSettingsGroup, SWT.NONE); + + apacheRestartBFE = + new BooleanFieldEditor( + PHPeclipsePlugin.APACHE_RESTART_BACKGROUND, + PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup.restart_background"), + apacheSettingsGroup); + apacheRestartBFE.setPreferencePage(this); + apacheRestartBFE.setPreferenceStore(getPreferenceStore()); + apacheRestartBFE.load(); + new Label(apacheSettingsGroup, SWT.NONE); + new Label(apacheSettingsGroup, SWT.NONE); apacheRestartSFE = new StringFieldEditor( IPreferenceConstants.APACHE_RESTART_PREF, @@ -189,15 +246,25 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor apacheRestartSFE.setPreferencePage(this); apacheRestartSFE.setPreferenceStore(getPreferenceStore()); apacheRestartSFE.load(); + new Label(apacheSettingsGroup, SWT.NONE); - phpRunSFE = - new StringFieldEditor( + apacheRunFFE = + new FileFieldEditor( + IPreferenceConstants.APACHE_RUN_PREF, + PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup.run"), + apacheSettingsGroup); + apacheRunFFE.setPreferencePage(this); + apacheRunFFE.setPreferenceStore(getPreferenceStore()); + apacheRunFFE.load(); + + phpRunFFE = + new FileFieldEditor( IPreferenceConstants.PHP_RUN_PREF, PHPPreferencesMessages.getString("PHPBasePreferencePage.console.php"), apacheSettingsGroup); - phpRunSFE.setPreferencePage(this); - phpRunSFE.setPreferenceStore(getPreferenceStore()); - phpRunSFE.load(); + phpRunFFE.setPreferencePage(this); + phpRunFFE.setPreferenceStore(getPreferenceStore()); + phpRunFFE.load(); //Create mySQL Composite mySQLSettingsComposite = new Composite(composite, SWT.NULL); @@ -208,6 +275,18 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor mySQLSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup")); mySQLSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mySQLSettingsGroup.setLayout(new GridLayout()); + + mysqlStartBFE = + new BooleanFieldEditor( + PHPeclipsePlugin.MYSQL_START_BACKGROUND, + PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup.start_background"), + mySQLSettingsGroup); + mysqlStartBFE.setPreferencePage(this); + mysqlStartBFE.setPreferenceStore(getPreferenceStore()); + mysqlStartBFE.load(); + new Label(mySQLSettingsGroup, SWT.NONE); + new Label(mySQLSettingsGroup, SWT.NONE); + mySQLCommandSFE = new StringFieldEditor( IPreferenceConstants.MYSQL_PREF, @@ -216,50 +295,60 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor mySQLCommandSFE.setPreferencePage(this); mySQLCommandSFE.setPreferenceStore(getPreferenceStore()); mySQLCommandSFE.load(); + new Label(mySQLSettingsGroup, SWT.NONE); - //Create parser settings composite - Composite parserSettingsComposite = new Composite(composite, SWT.NONE); - parserSettingsComposite.setLayout(new GridLayout()); - parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE); - parserSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers")); - parserSettingsGroup.setLayout(new GridLayout()); - parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + mysqlRunFFE = + new FileFieldEditor( + IPreferenceConstants.MYSQL_RUN_PREF, + PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup.run"), + mySQLSettingsGroup); + mysqlRunFFE.setPreferencePage(this); + mysqlRunFFE.setPreferenceStore(getPreferenceStore()); + mysqlRunFFE.load(); - chooseParser = - new RadioGroupFieldEditor( - IPreferenceConstants.PHP_PARSER_DEFAULT, - PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.choose"), - 1, - new String[][] { - { PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.internal"), IPreferenceConstants.PHP_INTERNAL_PARSER }, - { - PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.external"), IPreferenceConstants.PHP_EXTERNAL_PARSER } - }, parserSettingsGroup); - chooseParser.setPreferencePage(this); - chooseParser.setPreferenceStore(getPreferenceStore()); - chooseParser.load(); - //create a copmposte just for the StringEditor - makes layout simpler - Composite externalParserCompo = new Composite(parserSettingsGroup, SWT.NONE); - externalParserSFE = - new StringFieldEditor( - IPreferenceConstants.EXTERNAL_PARSER_PREF, - PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"), - externalParserCompo - /*parserSettingsGroup*/ - ); - externalParserSFE.setPreferencePage(this); - externalParserSFE.setPreferenceStore(getPreferenceStore()); - externalParserSFE.load(); +// //Create parser settings composite +// Composite parserSettingsComposite = new Composite(composite, SWT.NONE); +// parserSettingsComposite.setLayout(new GridLayout()); +// parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE); +// parserSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers")); +// parserSettingsGroup.setLayout(new GridLayout()); +// parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - parseOnSave = - new BooleanFieldEditor( - PHPeclipsePlugin.PHP_PARSE_ON_SAVE, - PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.pos"), - parserSettingsGroup); - parseOnSave.setPreferencePage(this); - parseOnSave.setPreferenceStore(getPreferenceStore()); - parseOnSave.load(); +// chooseParser = +// new RadioGroupFieldEditor( +// IPreferenceConstants.PHP_PARSER_DEFAULT, +// PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.choose"), +// 1, +// new String[][] { +// { PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.internal"), IPreferenceConstants.PHP_INTERNAL_PARSER }, +// { +// PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.external"), IPreferenceConstants.PHP_EXTERNAL_PARSER } +// }, parserSettingsGroup); +// chooseParser.setPreferencePage(this); +// chooseParser.setPreferenceStore(getPreferenceStore()); +// chooseParser.load(); +// //create a copmposte just for the StringEditor - makes layout simpler +// Composite externalParserCompo = new Composite(parserSettingsGroup, SWT.NONE); +// externalParserSFE = +// new StringFieldEditor( +// IPreferenceConstants.EXTERNAL_PARSER_PREF, +// PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"), +// externalParserCompo +// /*parserSettingsGroup*/ +// ); +// externalParserSFE.setPreferencePage(this); +// externalParserSFE.setPreferenceStore(getPreferenceStore()); +// externalParserSFE.load(); +// +// parseOnSave = +// new BooleanFieldEditor( +// PHPeclipsePlugin.PHP_PARSE_ON_SAVE, +// PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.pos"), +// parserSettingsGroup); +// parseOnSave.setPreferencePage(this); +// parseOnSave.setPreferenceStore(getPreferenceStore()); +// parseOnSave.load(); return composite; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseParserPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseParserPreferencePage.java new file mode 100644 index 0000000..45b4179 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseParserPreferencePage.java @@ -0,0 +1,113 @@ +package net.sourceforge.phpeclipse; + +import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages; + +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.preference.RadioGroupFieldEditor; +import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +public class PHPEclipseParserPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + +// private SelectionListener SelectionListener; +// private ModifyListener ModifyListener; +// private ModifyListener TextModifyListener; +// +// private ArrayList CheckBoxes = new ArrayList(); +// private ArrayList ComboBoxes = new ArrayList(); +// private ArrayList TextBoxes = new ArrayList(); +// private ArrayList RadioButtons = new ArrayList(); + + + RadioGroupFieldEditor chooseParser; + StringFieldEditor externalParserSFE; + BooleanFieldEditor parseOnSave; + + public PHPEclipseParserPreferencePage() { + super(); + setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore()); + setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$ + } + public void init(IWorkbench workbench) { + } + protected void performDefaults() { + chooseParser.loadDefault(); + externalParserSFE.loadDefault(); + parseOnSave.loadDefault(); + super.performDefaults(); + } + + public boolean performOk() { + chooseParser.store(); + externalParserSFE.store(); + parseOnSave.store(); + return super.performOk(); + } + + protected Control createContents(Composite parent) { + initializeDialogUnits(parent); + final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); + Composite composite = new Composite(parent, SWT.LEFT); + composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + composite.setLayout(new GridLayout()); + //Create Websettings + // Composite webSettingsComposite = new Composite(composite, SWT.NONE); + // webSettingsComposite.setLayout(new GridLayout()); + // webSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + //Create parser settings composite + Composite parserSettingsComposite = new Composite(composite, SWT.NONE); + parserSettingsComposite.setLayout(new GridLayout()); + parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE); + parserSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers")); + parserSettingsGroup.setLayout(new GridLayout()); + parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + chooseParser = + new RadioGroupFieldEditor( + IPreferenceConstants.PHP_PARSER_DEFAULT, + PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.choose"), + 1, + new String[][] { + { PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.internal"), IPreferenceConstants.PHP_INTERNAL_PARSER }, + { + PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.external"), IPreferenceConstants.PHP_EXTERNAL_PARSER } + }, parserSettingsGroup); + chooseParser.setPreferencePage(this); + chooseParser.setPreferenceStore(getPreferenceStore()); + chooseParser.load(); + //create a copmposte just for the StringEditor - makes layout simpler + Composite externalParserCompo = new Composite(parserSettingsGroup, SWT.NONE); + externalParserSFE = + new StringFieldEditor( + IPreferenceConstants.EXTERNAL_PARSER_PREF, + PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"), + externalParserCompo + /*parserSettingsGroup*/ + ); + externalParserSFE.setPreferencePage(this); + externalParserSFE.setPreferenceStore(getPreferenceStore()); + externalParserSFE.load(); + + parseOnSave = + new BooleanFieldEditor( + PHPeclipsePlugin.PHP_PARSE_ON_SAVE, + PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.pos"), + parserSettingsGroup); + parseOnSave.setPreferencePage(this); + parseOnSave.setPreferenceStore(getPreferenceStore()); + parseOnSave.load(); + + return composite; + } +} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index d0b9d99..7f027b7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -49,19 +49,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; /** * The main plugin class to be used in the desktop. */ -public class PHPeclipsePlugin - extends AbstractUIPlugin - implements IPreferenceConstants { - // public static final String LOCALHOST_PREF = "_localhost"; - // public static final String DOCUMENTROOT_PREF = "_documentroot"; - // public static final String USE_EXTERNAL_BROWSER_PREF = "_use_external_browser"; - // public static final String EXTERNAL_BROWSER_PREF = "_external_browser"; - // public static final String MYSQL_PREF = "_my_sql"; - // public static final String APACHE_START_PREF = "_apache_start"; - // public static final String APACHE_STOP_PREF = "_apache_stop"; - // public static final String APACHE_RESTART_PREF = "_apache_restart"; - // public static final String SHOW_OUTPUT_IN_CONSOLE = "_sho_output_in_console"; - // public static final String EXTERNAL_PARSER_PREF = "_external_parser"; +public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceConstants { /** * The id of the PHP plugin (value "net.sourceforge.phpeclipse"). @@ -72,25 +60,24 @@ public class PHPeclipsePlugin public static final String PHP_CODING_ACTION_SET_ID = PLUGIN_ID + ".ui.CodingActionSet"; //$NON-NLS-1$ public static final String PHPPARSER_NEW = "test.PHPParser"; - public static final String PHPPARSER_ORIGINAL = - "net.sourceforge.phpdt.internal.compiler.parser.Parser"; + public static final String PHPPARSER_ORIGINAL = "net.sourceforge.phpdt.internal.compiler.parser.Parser"; /** Change this if you want to switch PHP Parser. */ public static final String PHPPARSER = PHPPARSER_ORIGINAL; //The shared instance. private static PHPeclipsePlugin plugin; - + private static ExternalToolsPlugin externalTools; //Resource bundle. //private ResourceBundle resourceBundle; private ImageDescriptorRegistry fImageDescriptorRegistry; private PHPDocumentProvider fCompilationUnitDocumentProvider; - private IFile fLastEditorFile = null; - + private IFile fLastEditorFile = null; + private JavaTextTools fJavaTextTools; - + /** * The Java virtual machine that we are running on. */ @@ -146,10 +133,10 @@ public class PHPeclipsePlugin // @TODO: refactor this into a better method name ! public synchronized PHPDocumentProvider getCompilationUnitDocumentProvider() { if (fCompilationUnitDocumentProvider == null) - fCompilationUnitDocumentProvider= new PHPDocumentProvider(); + fCompilationUnitDocumentProvider = new PHPDocumentProvider(); return fCompilationUnitDocumentProvider; } - + private static void setJVM() { String osName = System.getProperty("os.name"); @@ -193,9 +180,9 @@ public class PHPeclipsePlugin return plugin; } -// public static ExternalToolsPlugin getExternalTools() { -// return externalTools; -// } + // public static ExternalToolsPlugin getExternalTools() { + // return externalTools; + // } /** * Returns the workspace instance. */ @@ -204,15 +191,16 @@ public class PHPeclipsePlugin } public static IWorkbenchPage getActivePage() { - return getDefault().internalGetActivePage(); + return getDefault().internalGetActivePage(); } private IWorkbenchPage internalGetActivePage() { - IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow(); - if (window!=null) return window.getActivePage(); - return null; + IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow(); + if (window != null) + return window.getActivePage(); + return null; } - + public static IWorkbenchWindow getActiveWorkbenchWindow() { return getDefault().getWorkbench().getActiveWorkbenchWindow(); } @@ -262,13 +250,13 @@ public class PHPeclipsePlugin static IPath getInstallLocation() { return new Path(getDefault().getDescriptor().getInstallURL().getFile()); } - + public synchronized JavaTextTools getJavaTextTools() { if (fJavaTextTools == null) - fJavaTextTools= new JavaTextTools(getPreferenceStore()); + fJavaTextTools = new JavaTextTools(getPreferenceStore()); return fJavaTextTools; } - + /** * Returns the string from the plugin's resource bundle, * or 'key' if not found. @@ -300,45 +288,36 @@ public class PHPeclipsePlugin String windowsSystem = BootLoader.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(BootLoader.WS_WIN32)) { - store.setDefault( - EXTERNAL_BROWSER_PREF, - "rundll32 url.dll,FileProtocolHandler {0}"); + store.setDefault(EXTERNAL_BROWSER_PREF, "rundll32 url.dll,FileProtocolHandler {0}"); } else { store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}"); } - store.setDefault( - DOCUMENTROOT_PREF, - getWorkspace().getRoot().getLocation().toString()); - + store.setDefault(DOCUMENTROOT_PREF, getWorkspace().getRoot().getLocation().toString()); + // if ((jvm == WINDOWS_9x) || (jvm == WINDOWS_NT)) { + // if (windowsSystem.equals(BootLoader.WS_WIN32)) { 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_PREF, - "c:\\apache\\mysql\\bin\\mysqld-nt.exe --standalone"); - store.setDefault( - APACHE_START_PREF, - "c:\\apache\\apache.exe -c \"DocumentRoot \"{0}\"\""); - store.setDefault(APACHE_STOP_PREF, "c:\\apache\\apache.exe -k shutdown"); - store.setDefault( - APACHE_RESTART_PREF, - "c:\\apache\\apache.exe -k restart"); + store.setDefault(MYSQL_RUN_PREF, "c:\\apache\\mysql\\bin\\mysqld-nt.exe"); + store.setDefault(APACHE_RUN_PREF, "c:\\apache\\apache.exe"); } else { store.setDefault(PHP_RUN_PREF, "/apache/php/php"); store.setDefault(EXTERNAL_PARSER_PREF, "/apache/php/php -l -f {0}"); - store.setDefault(MYSQL_PREF, "/apache/mysql/bin/mysqld --standalone"); - store.setDefault( - APACHE_START_PREF, - "/apache/apache -c \"DocumentRoot \"{0}\"\""); - store.setDefault(APACHE_STOP_PREF, "/apache/apache.exe -k shutdown"); - store.setDefault(APACHE_RESTART_PREF, "/apache/apache -k restart"); - + store.setDefault(MYSQL_RUN_PREF, "/apache/mysql/bin/mysqld"); + store.setDefault(APACHE_RUN_PREF, "/apache/apache"); } + store.setDefault(MYSQL_PREF, "--standalone"); + store.setDefault(APACHE_START_PREF, "-c \"DocumentRoot \"{0}\"\""); + store.setDefault(APACHE_STOP_PREF, "-k shutdown"); + store.setDefault(APACHE_RESTART_PREF, "-k restart"); + + store.setDefault(MYSQL_START_BACKGROUND, "true"); + store.setDefault(APACHE_START_BACKGROUND, "true"); + store.setDefault(APACHE_STOP_BACKGROUND, "true"); + store.setDefault(APACHE_RESTART_BACKGROUND, "true"); store.setDefault(PHP_PARSER_DEFAULT, PHP_EXTERNAL_PARSER); store.setDefault(PHP_INTERNAL_PARSER, "false"); @@ -347,78 +326,57 @@ public class PHPeclipsePlugin store.setDefault(PHP_PARSE_ON_SAVE, "true"); // show line numbers: - // store.setDefault(LINE_NUMBER_RULER, "false"); -// store.setDefault(FORMATTER_TAB_SIZE, "4"); + // 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_KEYWORD, - PHPColorProvider.KEYWORD); - PreferenceConverter.setDefault( - store, - PHP_VARIABLE, - PHPColorProvider.VARIABLE); - PreferenceConverter.setDefault( - store, - PHP_FUNCTIONNAME, - PHPColorProvider.FUNCTION_NAME); - PreferenceConverter.setDefault( - store, - PHP_CONSTANT, - PHPColorProvider.CONSTANT); + PreferenceConverter.setDefault(store, PHP_MULTILINE_COMMENT, PHPColorProvider.MULTI_LINE_COMMENT); + PreferenceConverter.setDefault(store, PHP_SINGLELINE_COMMENT, PHPColorProvider.SINGLE_LINE_COMMENT); + PreferenceConverter.setDefault(store, PHP_KEYWORD, PHPColorProvider.KEYWORD); + PreferenceConverter.setDefault(store, PHP_VARIABLE, PHPColorProvider.VARIABLE); + PreferenceConverter.setDefault(store, PHP_FUNCTIONNAME, PHPColorProvider.FUNCTION_NAME); + PreferenceConverter.setDefault(store, PHP_CONSTANT, PHPColorProvider.CONSTANT); PreferenceConverter.setDefault(store, PHP_TYPE, PHPColorProvider.TYPE); PreferenceConverter.setDefault(store, PHP_STRING, PHPColorProvider.STRING); - PreferenceConverter.setDefault( - store, - PHP_DEFAULT, - PHPColorProvider.DEFAULT); -// 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); + PreferenceConverter.setDefault(store, PHP_DEFAULT, PHPColorProvider.DEFAULT); + // 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); @@ -437,7 +395,7 @@ public class PHPeclipsePlugin PHPCore.initializeDefaultPluginPreferences(); PreferenceConstants.initializeDefaultValues(store); - + externalTools.initializeDefaultPreferences(store); } @@ -453,30 +411,29 @@ public class PHPeclipsePlugin } return display; } - + public void startup() throws CoreException { super.startup(); IAdapterManager manager = Platform.getAdapterManager(); manager.registerAdapters(new PHPElementAdapterFactory(), PHPElement.class); manager.registerAdapters(new ResourceAdapterFactory(), IResource.class); - // externalTools.startUp(); - getStandardDisplay().asyncExec( - new Runnable() { - public void run() { - //initialize the variable context manager - VariableContextManager.getDefault(); - } - }); - } + // externalTools.startUp(); + getStandardDisplay().asyncExec(new Runnable() { + public void run() { + //initialize the variable context manager + VariableContextManager.getDefault(); + } + }); + } /** * @see org.eclipse.core.runtime.Plugin#shutdown() */ public void shutdown() throws CoreException { - // externalTools.shutDown(); + // externalTools.shutDown(); ColorManager.getDefault().dispose(); } - + public void setLastEditorFile(IFile textEditor) { this.fLastEditorFile = textEditor; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPRestartApacheAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPRestartApacheAction.java index 7168c93..833373f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPRestartApacheAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPRestartApacheAction.java @@ -17,8 +17,13 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.preference.IPreferenceStore; public class PHPRestartApacheAction extends PHPStartApacheAction { - public void run(IAction action) { - final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); - execute(store.getString(PHPeclipsePlugin.APACHE_RESTART_PREF), "Restart Apache: "); - } + public void run(IAction action) { + final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); + // execute(store.getString(PHPeclipsePlugin.APACHE_RESTART_PREF), "Restart Apache: "); + execute( + "apache_restart", + store.getString(PHPeclipsePlugin.APACHE_RUN_PREF), + store.getString(PHPeclipsePlugin.APACHE_RESTART_PREF), + store.getBoolean(PHPeclipsePlugin.APACHE_RESTART_BACKGROUND)); + } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartApacheAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartApacheAction.java index 69b0b2d..5883fbe 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartApacheAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartApacheAction.java @@ -6,8 +6,8 @@ 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 + IBM Corporation - Initial implementation + Klaus Hartlage - www.eclipseproject.de **********************************************************************/ package net.sourceforge.phpeclipse.actions; @@ -15,6 +15,7 @@ import java.io.IOException; import java.io.InputStream; import java.text.MessageFormat; +import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.views.PHPConsole; @@ -34,73 +35,96 @@ public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate { documentRoot = documentRoot.replace('\\', '/'); String[] arguments = { documentRoot }; MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.APACHE_START_PREF)); - execute(form.format(arguments), "Start Apache: "); + execute( + "apache_start", + store.getString(PHPeclipsePlugin.APACHE_RUN_PREF), + form.format(arguments), + store.getBoolean(PHPeclipsePlugin.APACHE_START_BACKGROUND)); } -// public static void execute(String command, String consoleMessage) { -// // MessageDialog.openInformation(activeWindow.getShell(), "Exec command: ", command); -// try { -// PHPConsole console = PHPConsole.getInstance(); -// console.write(consoleMessage + command + "\n"); -// Runtime runtime = Runtime.getRuntime(); -// -// // runs the command -// Process p = runtime.exec(command); -// -// if (PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PHPeclipsePlugin.SHOW_OUTPUT_IN_CONSOLE) == true) { -// -// OutputThread out = new OutputThread(p.getInputStream(), console); -// OutputThread err = new OutputThread(p.getErrorStream(), console); -// out.start(); -// err.start(); -// -// } -// -// } catch (IOException e) { -// -// System.err.println("Problem"); -// e.printStackTrace(); -// -// } -// -// } - - public static String execute(String command, String consoleMessage) { - // MessageDialog.openInformation(activeWindow.getShell(), "Exec command: ", command); - try { - PHPConsole console = PHPConsole.getInstance(); - console.write(consoleMessage + command + "\n"); - Runtime runtime = Runtime.getRuntime(); - - // runs the command - Process p = runtime.exec(command); - - // gets the input stream to have the post-compile-time information - InputStream stream = p.getInputStream(); - - // get the string from Stream - String consoleOutput = PHPConsole.getStringFromStream(stream); - - // prints out the information - console.write(consoleOutput); - return consoleOutput; - - } catch (IOException e) { - - System.err.println("Problem"); - e.printStackTrace(); - + // public static void execute(String command, String consoleMessage) { + // // MessageDialog.openInformation(activeWindow.getShell(), "Exec command: ", command); + // try { + // PHPConsole console = PHPConsole.getInstance(); + // console.write(consoleMessage + command + "\n"); + // Runtime runtime = Runtime.getRuntime(); + // + // // runs the command + // Process p = runtime.exec(command); + // + // if (PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PHPeclipsePlugin.SHOW_OUTPUT_IN_CONSOLE) == true) { + // + // OutputThread out = new OutputThread(p.getInputStream(), console); + // OutputThread err = new OutputThread(p.getErrorStream(), console); + // out.start(); + // err.start(); + // + // } + // + // } catch (IOException e) { + // + // System.err.println("Problem"); + // e.printStackTrace(); + // + // } + // + // } + + /** + * Executes an external progam and saves the LaunchConfiguration under external tools + * @param command external tools command name + * @param executable executable path i.e.c:\apache\apache.exe + * @param arguments arguments for this configuration + * @param background run this configuration in background mode + */ + public static void execute(String command, String executable, String arguments, boolean background) { + PHPConsole console = PHPConsole.getInstance(); + String consoleMessage; + if (background) { + consoleMessage = "run in background mode-" + command + ": " + executable + " " + arguments; + } else { + consoleMessage = "run in foreground mode-" + command + ": " + executable + " " + arguments; } - return ""; + console.write(consoleMessage + "\n"); + + ExternalToolsUtil.execute(command, executable, arguments, background); + // MessageDialog.openInformation(activeWindow.getShell(), "Exec command: ", command); + // try { + // PHPConsole console = PHPConsole.getInstance(); + // console.write(consoleMessage + command + "\n"); + // + // ExternalToolsUtil.execute() + // Runtime runtime = Runtime.getRuntime(); + // + // // runs the command + // Process p = runtime.exec(command); + // + // // gets the input stream to have the post-compile-time information + // InputStream stream = p.getInputStream(); + // + // // get the string from Stream + // String consoleOutput = PHPConsole.getStringFromStream(stream); + // + // // prints out the information + // console.write(consoleOutput); + // return consoleOutput; + // + // } catch (IOException e) { + // + // System.err.println("Problem"); + // e.printStackTrace(); + // + // } + // return ""; } public static String getParserOutput(String command, String consoleMessage) { // MessageDialog.openInformation(activeWindow.getShell(), "Exec command: ", command); try { PHPConsole console = PHPConsole.getInstance(); - if (console!=null) { + if (console != null) { console.write(consoleMessage + command + "\n"); } - + Runtime runtime = Runtime.getRuntime(); // runs the command @@ -113,9 +137,9 @@ public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate { String consoleOutput = PHPConsole.getStringFromStream(stream); // prints out the information - if (console!=null) { + if (console != null) { console.write(consoleOutput); - } + } return consoleOutput; } catch (IOException e) { @@ -139,34 +163,34 @@ public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate { } -// static class OutputThread extends Thread { -// InputStream fInputStream; -// PHPConsole console; -// -// OutputThread(InputStream inputStream, PHPConsole console) { -// this.fInputStream = inputStream; -// this.console = console; -// } -// -// public void run() { -// try { -// BufferedReader bin = new BufferedReader(new InputStreamReader(fInputStream)); -// -// String bufferRow; -// while ((bufferRow = bin.readLine()) != null) { -// -// // prints out the information -// console.write( bufferRow ); -// -// } -// bin.close(); -// -// } catch (IOException e) { -// MessageDialog.openError(null, "Error in output", e.toString()); -// } finally { -// -// } -// } -// } + // static class OutputThread extends Thread { + // InputStream fInputStream; + // PHPConsole console; + // + // OutputThread(InputStream inputStream, PHPConsole console) { + // this.fInputStream = inputStream; + // this.console = console; + // } + // + // public void run() { + // try { + // BufferedReader bin = new BufferedReader(new InputStreamReader(fInputStream)); + // + // String bufferRow; + // while ((bufferRow = bin.readLine()) != null) { + // + // // prints out the information + // console.write( bufferRow ); + // + // } + // bin.close(); + // + // } catch (IOException e) { + // MessageDialog.openError(null, "Error in output", e.toString()); + // } finally { + // + // } + // } + // } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartMySQLAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartMySQLAction.java index b7810d7..755f607 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartMySQLAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartMySQLAction.java @@ -17,8 +17,13 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.preference.IPreferenceStore; public class PHPStartMySQLAction extends PHPStartApacheAction { - public void run(IAction action) { - final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); - execute(store.getString(PHPeclipsePlugin.MYSQL_PREF), "Start MySQL: "); - } + public void run(IAction action) { + final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); + // execute(store.getString(PHPeclipsePlugin.MYSQL_PREF), "Start MySQL: "); + execute( + "mysql_start", + store.getString(PHPeclipsePlugin.MYSQL_RUN_PREF), + store.getString(PHPeclipsePlugin.MYSQL_PREF), + store.getBoolean(PHPeclipsePlugin.MYSQL_START_BACKGROUND)); + } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStopApacheAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStopApacheAction.java index abb288d..22e9d8f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStopApacheAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStopApacheAction.java @@ -17,8 +17,13 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.preference.IPreferenceStore; public class PHPStopApacheAction extends PHPStartApacheAction { - public void run(IAction action) { - final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); - execute(store.getString(PHPeclipsePlugin.APACHE_STOP_PREF), "Stop Apache: "); - } + public void run(IAction action) { + final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); + // execute(store.getString(PHPeclipsePlugin.APACHE_STOP_PREF), "Stop Apache: "); + execute( + "apache_stop", + store.getString(PHPeclipsePlugin.APACHE_RUN_PREF), + store.getString(PHPeclipsePlugin.APACHE_STOP_PREF), + store.getBoolean(PHPeclipsePlugin.APACHE_STOP_BACKGROUND)); + } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_DE.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_DE.properties index d12ef41..d522c65 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_DE.properties +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_DE.properties @@ -32,12 +32,19 @@ PHPBasePreferencePage.websettingsGroup.browser=Externes Browser Kommando PHPBasePreferencePage.websettingsGroup.useexternal=Benutze externen Browser PHPBasePreferencePage.websettingsGroup.showexternalpreview=Vorschau beim Öffnen des Editors (nur win32) PHPBasePreferencePage.apacheGroup=Apache Einstellungen +PHPBasePreferencePage.apacheGroup.run=Apache PHPBasePreferencePage.apacheGroup.start=Start Apache +PHPBasePreferencePage.apacheGroup.start_background=Im Hintergrund ausführen? PHPBasePreferencePage.apacheGroup.stop=Stop Apache +PHPBasePreferencePage.apacheGroup.stop_background=Im Hintergrund ausführen? PHPBasePreferencePage.apacheGroup.restart=Restart Apache -PHPBasePreferencePage.console.php=PHP Datei ausführen +PHPBasePreferencePage.apacheGroup.restart_background=Im Hintergrund ausführen? +PHPBasePreferencePage.console.php=Run PHP command PHPBasePreferencePage.mySQLGroup=MySQL Einstellungen -PHPBasePreferencePage.mySQLGroup.command=MySQL Kommando +PHPBasePreferencePage.mySQLGroup.run=MySQL +PHPBasePreferencePage.mySQLGroup.start_background=Im Hintergrund ausführen? +PHPBasePreferencePage.mySQLGroup.command=Start MySQL + PHPBasePreferencePage.parsers=Parser Einstellungen PHPBasePreferencePage.parsers.pos=Parse beim Sichern PHPBasePreferencePage.parsers.external=Externer Parser diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_FR.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_FR.properties index 856e04d..9e03703 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_FR.properties +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_FR.properties @@ -32,12 +32,19 @@ PHPBasePreferencePage.websettingsGroup.browser=Commande du navigateur externe PHPBasePreferencePage.websettingsGroup.useexternal=Utiliser navigateur externe PHPBasePreferencePage.websettingsGroup.showexternalpreview=Show preview on editor load (win32 only) PHPBasePreferencePage.apacheGroup=Configuration Apache +PHPBasePreferencePage.apacheGroup.run=Apache PHPBasePreferencePage.apacheGroup.start=Lancer Apache +PHPBasePreferencePage.apacheGroup.start_background=Run in background mode PHPBasePreferencePage.apacheGroup.stop=Stopper Apache +PHPBasePreferencePage.apacheGroup.stop_background=Run in background mode PHPBasePreferencePage.apacheGroup.restart=Relancer Apache +PHPBasePreferencePage.apacheGroup.restart_background=Run in background mode PHPBasePreferencePage.console.php=Run PHP command PHPBasePreferencePage.mySQLGroup=Configuration MySQL -PHPBasePreferencePage.mySQLGroup.command=Commande MySQL +PHPBasePreferencePage.mySQLGroup.run=MySQL +PHPBasePreferencePage.mySQLGroup.start_background=Run in background mode +PHPBasePreferencePage.mySQLGroup.command=Lancer MySQL + PHPBasePreferencePage.parsers=Configuration de parsing PHPBasePreferencePage.parsers.pos=Parser à la sauvegarde PHPBasePreferencePage.parsers.external=Externe diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_en_GB.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_en_GB.properties index 65c5974..c02902b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_en_GB.properties +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_en_GB.properties @@ -32,12 +32,18 @@ PHPBasePreferencePage.websettingsGroup.browser=External browser command PHPBasePreferencePage.websettingsGroup.useexternal=Use external browser PHPBasePreferencePage.websettingsGroup.showexternalpreview=Show preview on editor load (win32 only) PHPBasePreferencePage.apacheGroup=Apache Settings +PHPBasePreferencePage.apacheGroup.run=Apache PHPBasePreferencePage.apacheGroup.start=Start Apache +PHPBasePreferencePage.apacheGroup.start_background=Run in background mode PHPBasePreferencePage.apacheGroup.stop=Stop Apache +PHPBasePreferencePage.apacheGroup.stop_background=Run in background mode PHPBasePreferencePage.apacheGroup.restart=Restart Apache +PHPBasePreferencePage.apacheGroup.restart_background=Run in background mode PHPBasePreferencePage.console.php=Run PHP command PHPBasePreferencePage.mySQLGroup=MySQL Settings -PHPBasePreferencePage.mySQLGroup.command=MySQL command +PHPBasePreferencePage.mySQLGroup.run=MySQL +PHPBasePreferencePage.mySQLGroup.start_background=Run in background mode +PHPBasePreferencePage.mySQLGroup.command=Start MySQL PHPBasePreferencePage.parsers=Parsing settings PHPBasePreferencePage.parsers.pos=Parse on save PHPBasePreferencePage.parsers.external=External diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_es_ES.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_es_ES.properties index 41442c0..a93dd07 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_es_ES.properties +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/newPHPPreferencesMessages_es_ES.properties @@ -32,12 +32,21 @@ PHPBasePreferencePage.websettingsGroup.browser=Comando navegador externo PHPBasePreferencePage.websettingsGroup.useexternal=Usar navegador externo PHPBasePreferencePage.websettingsGroup.showexternalpreview=Show preview on editor load (win32 only) PHPBasePreferencePage.apacheGroup=Configuración Apache -PHPBasePreferencePage.apacheGroup.start=Arrancar Apache +PHPBasePreferencePage.apacheGroup.run=Apache +PHPBasePreferencePage.apacheGroup.start=Arranchar Apache +PHPBasePreferencePage.apacheGroup.start_background=Run in background mode PHPBasePreferencePage.apacheGroup.stop=Parar Apache +PHPBasePreferencePage.apacheGroup.stop_background=Run in background mode PHPBasePreferencePage.apacheGroup.restart=Reiniciar Apache +PHPBasePreferencePage.apacheGroup.restart_background=Run in background mode PHPBasePreferencePage.console.php=Run PHP command PHPBasePreferencePage.mySQLGroup=Configuración MySQL -PHPBasePreferencePage.mySQLGroup.command=comando MySQL +PHPBasePreferencePage.mySQLGroup.run=MySQL +PHPBasePreferencePage.mySQLGroup.start_background=Run in background mode +PHPBasePreferencePage.mySQLGroup.command=Arranchar MySQL + +PHPBasePreferencePage.console.php=Run PHP command + PHPBasePreferencePage.parsers=Configuración Parser PHPBasePreferencePage.parsers.pos=Parsear al guardar PHPBasePreferencePage.parsers.external=Externo -- 1.7.1