From: axelcl Date: Fri, 25 Feb 2005 21:07:33 +0000 (+0000) Subject: Added xampp start and stop action X-Git-Url: http://git.phpeclipse.com Added xampp start and stop action --- diff --git a/net.sourceforge.phpeclipse/icons/obj16/xampp_start.gif b/net.sourceforge.phpeclipse/icons/obj16/xampp_start.gif new file mode 100644 index 0000000..f08b147 Binary files /dev/null and b/net.sourceforge.phpeclipse/icons/obj16/xampp_start.gif differ diff --git a/net.sourceforge.phpeclipse/icons/obj16/xampp_stop.gif b/net.sourceforge.phpeclipse/icons/obj16/xampp_stop.gif new file mode 100644 index 0000000..cccf4ee Binary files /dev/null and b/net.sourceforge.phpeclipse/icons/obj16/xampp_stop.gif differ diff --git a/net.sourceforge.phpeclipse/plugin.xml b/net.sourceforge.phpeclipse/plugin.xml index ef209bf..cfc949d 100644 --- a/net.sourceforge.phpeclipse/plugin.xml +++ b/net.sourceforge.phpeclipse/plugin.xml @@ -34,8 +34,8 @@ - - + + @@ -233,6 +233,15 @@ + + + + + + + + + + + null if no location was obtained from the user. + * Prompts the user for a workspace location within the workspace and sets the location as a String containing the workspace_loc + * variable or null if no location was obtained from the user. */ protected void handleWorkspaceLocationButtonSelected() { ResourceSelectionDialog dialog; - dialog = new ResourceSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Select_a_resource_22")); //$NON-NLS-1$ + dialog = new ResourceSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), + ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Select_a_resource_22")); //$NON-NLS-1$ dialog.open(); Object[] results = dialog.getResult(); if (results == null || results.length < 1) { @@ -465,13 +487,13 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab { } /** - * Prompts the user for a working directory location within the workspace - * and sets the working directory as a String containing the workspace_loc - * variable or null if no location was obtained from the user. + * Prompts the user for a working directory location within the workspace and sets the working directory as a String containing + * the workspace_loc variable or null if no location was obtained from the user. */ protected void handleWorkspaceWorkingDirectoryButtonSelected() { ContainerSelectionDialog containerDialog; - containerDialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Select_a_directory__23")); //$NON-NLS-1$ + containerDialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, + ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Select_a_directory__23")); //$NON-NLS-1$ containerDialog.open(); Object[] resource = containerDialog.getResult(); String text = null; @@ -502,6 +524,7 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab { /** * Method getSelectionAdapter. + * * @return SelectionListener */ protected SelectionListener getSelectionAdapter() { @@ -517,15 +540,18 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab { private class VariableSelectionDialog extends SelectionDialog { private ExternalToolVariableForm form; + private VariableSelectionDialog(Shell parent) { super(parent); setTitle(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Select_variable_10")); //$NON-NLS-1$ } + protected Control createDialogArea(Composite parent) { // Create the dialog area Composite composite = (Composite) super.createDialogArea(parent); ExternalToolVariable[] variables = ExternalToolsPlugin.getDefault().getArgumentVariableRegistry().getArgumentVariables(); - form = new ExternalToolVariableForm(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.&Choose_a_variable__11"), variables); //$NON-NLS-1$ + form = new ExternalToolVariableForm(ExternalToolsLaunchConfigurationMessages + .getString("ExternalToolsOptionTab.&Choose_a_variable__11"), variables); //$NON-NLS-1$ form.createContents(composite, new IGroupDialogPage() { public GridData setButtonGridData(Button button) { GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); @@ -569,4 +595,4 @@ public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab { } } -} +} \ No newline at end of file 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 6bf4a73..937347d 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 @@ -1,13 +1,13 @@ package net.sourceforge.phpdt.externaltools.launchConfigurations; /********************************************************************** -Copyright (c) 2002 IBM Corp. and others. All rights reserved. -This file is made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html -  -Contributors: -**********************************************************************/ + Copyright (c) 2002 IBM Corp. and others. All rights reserved. + This file is made available under the terms of the Common Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/cpl-v10.html + � + Contributors: + **********************************************************************/ import java.io.File; import java.text.MessageFormat; @@ -54,23 +54,23 @@ public class ExternalToolsUtil { }; /** - * Throws a core exception with an error status object built from - * the given message, lower level exception, and error code. + * 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 + * @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. + * 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 */ @@ -79,35 +79,39 @@ public class 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. + * 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 + * @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$ + 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, ExternalToolsModelMessages.getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; + MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsModelMessages + .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 = ExternalToolsModelMessages.format("DefaultRunnerContext.invalidLocation", new Object[] { configuration.getName()}); //$NON-NLS-1$ + String msg = ExternalToolsModelMessages.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 = ExternalToolsModelMessages.format("DefaultRunnerContext.invalidLocation", new Object[] { configuration.getName()}); //$NON-NLS-1$ + String msg = ExternalToolsModelMessages.format( + "DefaultRunnerContext.invalidLocation", new Object[] { configuration.getName() }); //$NON-NLS-1$ abort(msg, null, 0); } } @@ -120,25 +124,24 @@ public class ExternalToolsUtil { } /** - * 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. + * 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 + * @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, ExternalToolsModelMessages.getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; + MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsModelMessages + .getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; String expandedLocation = ToolUtil.expandDirectoryLocation(location, context, status); if (status.isOK()) { if (expandedLocation != null && expandedLocation.length() > 0) { @@ -146,7 +149,8 @@ public class ExternalToolsUtil { if (path.isDirectory()) { return new Path(expandedLocation); } else { - String msg = ExternalToolsModelMessages.format("DefaultRunnerContext.invalidDirectory", new Object[] { configuration.getName()}); //$NON-NLS-1$ + String msg = ExternalToolsModelMessages.format( + "DefaultRunnerContext.invalidDirectory", new Object[] { configuration.getName() }); //$NON-NLS-1$ abort(msg, null, 0); } } @@ -158,21 +162,22 @@ public class ExternalToolsUtil { } /** - * Expands and returns the arguments attribute of the given launch - * configuration, based on the given variable context. Returns + * 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 + * @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, ExternalToolsModelMessages.getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; + MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsModelMessages + .getString("RunExternalToolAction.runProblem"), null); //$NON-NLS-1$; String[] expandedArgs = ToolUtil.expandArguments(args, context, status); if (status.isOK()) { return expandedArgs; @@ -184,24 +189,24 @@ public class ExternalToolsUtil { } /** - * Returns the refresh scope specified by the given launch configuration or - * null if none. + * 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 + * @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); } /** - * Returns whether the refresh scope specified by the given launch - * configuration is recursive. + * 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 + * @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); @@ -210,27 +215,33 @@ public class ExternalToolsUtil { /** * 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 + * @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 { + throws CoreException { String scope = getRefreshScope(configuration); if (scope == null) return; ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(scope, 0); if (varDef.start == -1 || varDef.end == -1 || varDef.name == null) { - String msg = ExternalToolsModelMessages.format("DefaultRunnerContext.invalidRefreshVarFormat", new Object[] { configuration.getName()}); //$NON-NLS-1$ + String msg = ExternalToolsModelMessages.format( + "DefaultRunnerContext.invalidRefreshVarFormat", new Object[] { configuration.getName() }); //$NON-NLS-1$ abort(msg, null, 0); } RefreshScopeVariableRegistry registry = ExternalToolsPlugin.getDefault().getRefreshVariableRegistry(); RefreshScopeVariable variable = registry.getRefreshVariable(varDef.name); if (variable == null) { - String msg = ExternalToolsModelMessages.format("DefaultRunnerContext.noRefreshVarNamed", new Object[] { configuration.getName(), varDef.name }); //$NON-NLS-1$ + String msg = ExternalToolsModelMessages.format( + "DefaultRunnerContext.noRefreshVarNamed", new Object[] { configuration.getName(), varDef.name }); //$NON-NLS-1$ abort(msg, null, 0); } @@ -246,9 +257,10 @@ public class ExternalToolsUtil { return; monitor.beginTask(ExternalToolsModelMessages.getString("DefaultRunnerContext.refreshResources"), //$NON-NLS-1$ - resources.length); + resources.length); - MultiStatus status = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsUtil.Exception(s)_occurred_during_refresh._2"), null); //$NON-NLS-1$ + 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; @@ -273,22 +285,22 @@ public class ExternalToolsUtil { * * @param configuration * @return whether this tool is to be run in the background - * @throws CoreException if unable to access the associated attribute + * @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); } /** - * 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. + * 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. + * @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); @@ -302,14 +314,25 @@ public class ExternalToolsUtil { 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 + * 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) { + execute(command, executable, null, arguments, background); + } + + + public static void execute(String command, String executable, String workingDirectory, String arguments, boolean background) { ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE); @@ -320,7 +343,12 @@ public class ExternalToolsUtil { //some exception handling } wc.setAttribute(IExternalToolConstants.ATTR_LOCATION, executable); - wc.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments); + if (workingDirectory != null) { + wc.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, workingDirectory); + } + if (arguments != null) { + wc.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments); + } wc.setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, background); // saving will add the configuration to the external tools configurations @@ -332,4 +360,4 @@ public class ExternalToolsUtil { } } -} +} \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java index 7ba9d51..fb386ab 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/text/JavaTextTools.java @@ -50,16 +50,16 @@ import org.eclipse.jface.util.PropertyChangeEvent; *

*/ public class JavaTextTools implements IPHPPartitions { -// private static final String[] TOKENS = { -// JSPScriptScanner.JSP_DEFAULT, -// JSPScriptScanner.JSP_BRACKET }; - private final static String[] LEGAL_CONTENT_TYPES = new String[] { - PHP_PHPDOC_COMMENT, - PHP_MULTILINE_COMMENT, - PHP_SINGLELINE_COMMENT, - PHP_STRING_DQ, + // private static final String[] TOKENS = { + // JSPScriptScanner.JSP_DEFAULT, + // JSPScriptScanner.JSP_BRACKET }; + private final static String[] LEGAL_CONTENT_TYPES = new String[] { + PHP_PHPDOC_COMMENT, + PHP_MULTILINE_COMMENT, + PHP_SINGLELINE_COMMENT, + PHP_STRING_DQ, PHP_STRING_SQ }; - + private static XMLPartitionScanner HTML_PARTITION_SCANNER = null; private static FastJavaPartitionScanner PHP_PARTITION_SCANNER = null; @@ -70,15 +70,15 @@ public class JavaTextTools implements IPHPPartitions { // private final static String[] TYPES= new String[] { PHPPartitionScanner.PHP, PHPPartitionScanner.JAVA_DOC, // PHPPartitionScanner.JAVA_MULTILINE_COMMENT }; -// private final static String[] TYPES = new String[] { -// IPHPPartitions.PHP_PARTITIONING, -// IPHPPartitions.PHP_PHPDOC_COMMENT, -// // IPHPPartitions.HTML, -// // IPHPPartitions.HTML_MULTILINE_COMMENT, -// IPHPPartitions.JAVASCRIPT, -// IPHPPartitions.CSS, -// IPHPPartitions.SMARTY, -// IPHPPartitions.SMARTY_MULTILINE_COMMENT }; + // private final static String[] TYPES = new String[] { + // IPHPPartitions.PHP_PARTITIONING, + // IPHPPartitions.PHP_PHPDOC_COMMENT, + // // IPHPPartitions.HTML, + // // IPHPPartitions.HTML_MULTILINE_COMMENT, + // IPHPPartitions.JAVASCRIPT, + // IPHPPartitions.CSS, + // IPHPPartitions.SMARTY, + // IPHPPartitions.SMARTY_MULTILINE_COMMENT }; /** * This tools' preference listener. @@ -119,15 +119,16 @@ public class JavaTextTools implements IPHPPartitions { /** The SmartyDoc scanner */ private SmartyDocCodeScanner fSmartyDocScanner; - + /** The Java partitions scanner. */ - private FastJavaPartitionScanner fPartitionScanner; - + private FastJavaPartitionScanner fPartitionScanner; + /** The preference store */ private IPreferenceStore fPreferenceStore; - + /** The XML Language text tools */ private XMLTextTools xmlTextTools; + /** * The core preference store. * @@ -142,14 +143,11 @@ public class JavaTextTools implements IPHPPartitions { private PHPPartitionScanner jspPartitionScanner = null; /** The JSP script subpartitions scanner */ -// private JSPScriptScanner jspScriptScanner; - + // private JSPScriptScanner jspScriptScanner; /** The PHP plain text scanner */ -// private RuleBasedScanner jspTextScanner; - + // private RuleBasedScanner jspTextScanner; /** The PHP brackets scanner */ -// private RuleBasedScanner jspBracketScanner; - + // private RuleBasedScanner jspBracketScanner; /** * Creates a new Java text tools collection. * @@ -187,10 +185,9 @@ public class JavaTextTools implements IPHPPartitions { */ public JavaTextTools(IPreferenceStore store, Preferences coreStore, boolean autoDisposeOnDisplayDispose) { // super(store, TOKENS, ); -// REVISIT: preference store - xmlTextTools = new XMLTextTools( - XMLPlugin.getDefault().getPreferenceStore()); - + // REVISIT: preference store + xmlTextTools = new XMLTextTools(XMLPlugin.getDefault().getPreferenceStore()); + colorManager = new JavaColorManager(autoDisposeOnDisplayDispose); fPreferenceStore = store; fPreferenceStore.addPropertyChangeListener(fPreferenceListener); @@ -210,24 +207,25 @@ public class JavaTextTools implements IPHPPartitions { fSmartyScanner = new SmartyCodeScanner((JavaColorManager) colorManager, store); fSmartyDocScanner = new SmartyDocCodeScanner((JavaColorManager) colorManager, store); - fPartitionScanner= new FastJavaPartitionScanner(); + fPartitionScanner = new FastJavaPartitionScanner(); -// jspScriptScanner = new JSPScriptScanner(); + // jspScriptScanner = new JSPScriptScanner(); // fPartitionScanner = new FastJavaPartitionScanner(); // fPartitionScanner = new PHPPartitionScanner(); -// jspBracketScanner = new RuleBasedScanner(); -// jspBracketScanner.setDefaultReturnToken(new Token(JSPScriptScanner.JSP_BRACKET)); -// jspTextScanner = new RuleBasedScanner(); -// jspTextScanner.setDefaultReturnToken(new Token(JSPScriptScanner.JSP_DEFAULT)); + // jspBracketScanner = new RuleBasedScanner(); + // jspBracketScanner.setDefaultReturnToken(new Token(JSPScriptScanner.JSP_BRACKET)); + // jspTextScanner = new RuleBasedScanner(); + // jspTextScanner.setDefaultReturnToken(new Token(JSPScriptScanner.JSP_DEFAULT)); } /** - * - */ - public XMLTextTools getXMLTextTools() { - return xmlTextTools; - } + * + */ + public XMLTextTools getXMLTextTools() { + return xmlTextTools; + } + /** * Disposes all the individual tools of this tools collection. */ @@ -395,20 +393,20 @@ public class JavaTextTools implements IPHPPartitions { } else if (extension.equalsIgnoreCase(".xml")) { // xml partitioner = createXMLPartitioner(); -// } else if (extension.equalsIgnoreCase(".js")) { -// // javascript -// partitioner = createJavaScriptPartitioner(); -// } else if (extension.equalsIgnoreCase(".css")) { -// // cascading style sheets -// partitioner = createCSSPartitioner(); + // } else if (extension.equalsIgnoreCase(".js")) { + // // javascript + // partitioner = createJavaScriptPartitioner(); + // } else if (extension.equalsIgnoreCase(".css")) { + // // cascading style sheets + // partitioner = createCSSPartitioner(); } else if (extension.equalsIgnoreCase(".tpl")) { // smarty ? partitioner = createSmartyPartitioner(); -// } else if (extension.equalsIgnoreCase(".inc")) { -// // php include files ? -// partitioner = createIncludePartitioner(); + // } else if (extension.equalsIgnoreCase(".inc")) { + // // php include files ? + // partitioner = createIncludePartitioner(); } - + if (partitioner == null) { partitioner = createJSPPartitioner(); } @@ -416,7 +414,6 @@ public class JavaTextTools implements IPHPPartitions { return partitioner; } - /** * Sets up the Java document partitioner for the given document for the given partitioning. * @@ -429,18 +426,17 @@ public class JavaTextTools implements IPHPPartitions { * * @since 3.0 */ -// public void setupJavaDocumentPartitioner(IDocument document, String partitioning, Object element) { -// IDocumentPartitioner partitioner = createDocumentPartitioner(".php"); -// -// // if (document instanceof IDocumentExtension3) { -// // IDocumentExtension3 extension3= (IDocumentExtension3) document; -// // extension3.setDocumentPartitioner(partitioning, partitioner); -// // } else { -// document.setDocumentPartitioner(partitioner); -// // } -// partitioner.connect(document); -// } - + // public void setupJavaDocumentPartitioner(IDocument document, String partitioning, Object element) { + // IDocumentPartitioner partitioner = createDocumentPartitioner(".php"); + // + // // if (document instanceof IDocumentExtension3) { + // // IDocumentExtension3 extension3= (IDocumentExtension3) document; + // // extension3.setDocumentPartitioner(partitioning, partitioner); + // // } else { + // document.setDocumentPartitioner(partitioner); + // // } + // partitioner.connect(document); + // } public void setupHTMLDocumentPartitioner(IDocument document, String partitioning, Object element) { IDocumentPartitioner partitioner = createDocumentPartitioner(".html"); @@ -476,22 +472,22 @@ public class JavaTextTools implements IPHPPartitions { } /** - * Determines whether the preference change encoded by the given event - * changes the behavior of one its contained components. - * - * @param event the event to be investigated - * @return true if event causes a behavioral change - * @since 2.0 - * @deprecated As of 3.0, replaced by {@link org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration#affectsTextPresentation(PropertyChangeEvent)} - */ -// public boolean affectsBehavior(PropertyChangeEvent event) { -// return fCodeScanner.affectsBehavior(event) -// || fMultilineCommentScanner.affectsBehavior(event) -// || fSinglelineCommentScanner.affectsBehavior(event) -// || fStringScanner.affectsBehavior(event) -// || fPHPDocScanner.affectsBehavior(event); -// } - + * Determines whether the preference change encoded by the given event changes the behavior of one its contained components. + * + * @param event + * the event to be investigated + * @return true if event causes a behavioral change + * @since 2.0 + * @deprecated As of 3.0, replaced by + * {@link org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration#affectsTextPresentation(PropertyChangeEvent)} + */ + // public boolean affectsBehavior(PropertyChangeEvent event) { + // return fCodeScanner.affectsBehavior(event) + // || fMultilineCommentScanner.affectsBehavior(event) + // || fSinglelineCommentScanner.affectsBehavior(event) + // || fStringScanner.affectsBehavior(event) + // || fPHPDocScanner.affectsBehavior(event); + // } /** * Adapts the behavior of the contained components to the change encoded in the given event. * @@ -506,8 +502,8 @@ public class JavaTextTools implements IPHPPartitions { fMultilineCommentScanner.adaptToPreferenceChange(event); if (fSinglelineCommentScanner.affectsBehavior(event)) fSinglelineCommentScanner.adaptToPreferenceChange(event); -// if (fStringScanner.affectsBehavior(event)) -// fStringScanner.adaptToPreferenceChange(event); + // if (fStringScanner.affectsBehavior(event)) + // fStringScanner.adaptToPreferenceChange(event); if (fPHPDocScanner.affectsBehavior(event)) fPHPDocScanner.adaptToPreferenceChange(event); // if (fHTMLScanner.affectsBehavior(event)) @@ -516,82 +512,79 @@ public class JavaTextTools implements IPHPPartitions { fSmartyScanner.adaptToPreferenceChange(event); if (fSmartyDocScanner.affectsBehavior(event)) fSmartyDocScanner.adaptToPreferenceChange(event); -// if (XMLPlugin.getDefault().getXMLTextTools().affectsBehavior(event)) { -// XMLPlugin.getDefault().getXMLTextTools().adaptToPreferenceChange(event); -// } + // if (XMLPlugin.getDefault().getXMLTextTools().affectsBehavior(event)) { + // XMLPlugin.getDefault().getXMLTextTools().adaptToPreferenceChange(event); + // } } /** * Return a partitioner for .html files. */ public IDocumentPartitioner createHTMLPartitioner() { -// return new DefaultPartitioner(getHTMLPartitionScanner(), TYPES); + // return new DefaultPartitioner(getHTMLPartitionScanner(), TYPES); return xmlTextTools.createXMLPartitioner(); } -// private static IDocumentPartitioner createIncludePartitioner() { -// // return new DefaultPartitioner(getPHPPartitionScanner(), TYPES); -// return new DefaultPartitioner(getPHPPartitionScanner(), FastJavaPartitionScanner.PHP_PARTITION_TYPES); -// -// } + // private static IDocumentPartitioner createIncludePartitioner() { + // // return new DefaultPartitioner(getPHPPartitionScanner(), TYPES); + // return new DefaultPartitioner(getPHPPartitionScanner(), FastJavaPartitionScanner.PHP_PARTITION_TYPES); + // + // } -// private static IDocumentPartitioner createJavaScriptPartitioner() { -// return new DefaultPartitioner(getHTMLPartitionScanner(), TYPES); -// } + // private static IDocumentPartitioner createJavaScriptPartitioner() { + // return new DefaultPartitioner(getHTMLPartitionScanner(), TYPES); + // } /** - * Return a partitioner for .php files. + * Return a partitioner for .php files. */ public IDocumentPartitioner createPHPPartitioner() { // return new DefaultPartitioner(getPHPPartitionScanner(), TYPES); return new DefaultPartitioner(getPHPPartitionScanner(), LEGAL_CONTENT_TYPES); - } + } private IDocumentPartitioner createJSPPartitioner() { - return new PHPDocumentPartitioner( - getJSPPartitionScanner(), getPHPPartitionScanner()); -// return new JSPDocumentPartitioner(getJSPPartitionScanner(), jspScriptScanner); + return new PHPDocumentPartitioner(getJSPPartitionScanner(), getPHPPartitionScanner()); + // return new JSPDocumentPartitioner(getJSPPartitionScanner(), jspScriptScanner); } - + /** * */ -// public IPartitionTokenScanner getJSPScriptScanner() { -// return jspScriptScanner; -// } - + // public IPartitionTokenScanner getJSPScriptScanner() { + // return jspScriptScanner; + // } private IDocumentPartitioner createSmartyPartitioner() { return new DefaultPartitioner(getSmartyPartitionScanner(), XMLTextTools.TYPES); } private IDocumentPartitioner createXMLPartitioner() { -// return new DefaultPartitioner(getXMLPartitionScanner(), XMLTextTools.TYPES); + // return new DefaultPartitioner(getXMLPartitionScanner(), XMLTextTools.TYPES); return xmlTextTools.createXMLPartitioner(); } -// private IDocumentPartitioner createCSSPartitioner() { -// return new DefaultPartitioner(getHTMLPartitionScanner(), XMLTextTools.TYPES); -// } + // private IDocumentPartitioner createCSSPartitioner() { + // return new DefaultPartitioner(getHTMLPartitionScanner(), XMLTextTools.TYPES); + // } /** * Return a scanner for creating html partitions. */ -// private static XMLPartitionScanner getHTMLPartitionScanner() { -// // if (HTML_PARTITION_SCANNER == null) -// // HTML_PARTITION_SCANNER = new HTMLPartitionScanner(IPHPPartitions.HTML_FILE); -// // return HTML_PARTITION_SCANNER;^ -// if (HTML_PARTITION_SCANNER == null) -// HTML_PARTITION_SCANNER = new XMLPartitionScanner(false); -// return HTML_PARTITION_SCANNER; -// } - + // private static XMLPartitionScanner getHTMLPartitionScanner() { + // // if (HTML_PARTITION_SCANNER == null) + // // HTML_PARTITION_SCANNER = new HTMLPartitionScanner(IPHPPartitions.HTML_FILE); + // // return HTML_PARTITION_SCANNER;^ + // if (HTML_PARTITION_SCANNER == null) + // HTML_PARTITION_SCANNER = new XMLPartitionScanner(false); + // return HTML_PARTITION_SCANNER; + // } /** * Return a scanner for creating php partitions. - */ + */ private FastJavaPartitionScanner getPHPPartitionScanner() { -// if (PHP_PARTITION_SCANNER == null) -// PHP_PARTITION_SCANNER = new FastJavaPartitionScanner(); //new PHPPartitionScanner(IPHPPartitions.PHP_FILE); -// return PHP_PARTITION_SCANNER; + // if (PHP_PARTITION_SCANNER == null) + // PHP_PARTITION_SCANNER = new FastJavaPartitionScanner(); //new PHPPartitionScanner(IPHPPartitions.PHP_FILE); + // return PHP_PARTITION_SCANNER; return fPartitionScanner; } @@ -600,19 +593,17 @@ public class JavaTextTools implements IPHPPartitions { * * @return a JSP text scanner */ -// public RuleBasedScanner getJSPTextScanner() { -// return jspTextScanner; -// } - + // public RuleBasedScanner getJSPTextScanner() { + // return jspTextScanner; + // } /** * Returns a scanner which is configured to scan plain text in JSP. * * @return a JSP text scanner */ -// public RuleBasedScanner getJSPBracketScanner() { -// return jspBracketScanner; -// } - + // public RuleBasedScanner getJSPBracketScanner() { + // return jspBracketScanner; + // } /** * Return a scanner for creating smarty partitions. */ @@ -633,7 +624,7 @@ public class JavaTextTools implements IPHPPartitions { XML_PARTITION_SCANNER = new XMLPartitionScanner(false); return XML_PARTITION_SCANNER; } - + private PHPPartitionScanner getJSPPartitionScanner() { if (jspPartitionScanner == null) jspPartitionScanner = new PHPPartitionScanner(); @@ -641,50 +632,53 @@ public class JavaTextTools implements IPHPPartitions { } /** - * Sets up the Java document partitioner for the given document for the default partitioning. - * - * @param document the document to be set up - * @since 3.0 - */ - public void setupJavaDocumentPartitioner(IDocument document) { - setupJavaDocumentPartitioner(document, IDocumentExtension3.DEFAULT_PARTITIONING); - } - - /** - * Sets up the Java document partitioner for the given document for the given partitioning. - * - * @param document the document to be set up - * @param partitioning the document partitioning - * @since 3.0 - */ - public void setupJavaDocumentPartitioner(IDocument document, String partitioning) { - IDocumentPartitioner partitioner= createDocumentPartitioner(); - if (document instanceof IDocumentExtension3) { - IDocumentExtension3 extension3= (IDocumentExtension3) document; - extension3.setDocumentPartitioner(partitioning, partitioner); - } else { - document.setDocumentPartitioner(partitioner); - } - partitioner.connect(document); - } - - /** - * Returns this text tool's preference store. - * - * @return the preference store - * @since 3.0 - */ - protected IPreferenceStore getPreferenceStore() { - return fPreferenceStore; - } - - /** - * Returns this text tool's core preference store. - * - * @return the core preference store - * @since 3.0 - */ - protected Preferences getCorePreferenceStore() { - return fCorePreferenceStore; - } + * Sets up the Java document partitioner for the given document for the default partitioning. + * + * @param document + * the document to be set up + * @since 3.0 + */ + public void setupJavaDocumentPartitioner(IDocument document) { + setupJavaDocumentPartitioner(document, IDocumentExtension3.DEFAULT_PARTITIONING); + } + + /** + * Sets up the Java document partitioner for the given document for the given partitioning. + * + * @param document + * the document to be set up + * @param partitioning + * the document partitioning + * @since 3.0 + */ + public void setupJavaDocumentPartitioner(IDocument document, String partitioning) { + IDocumentPartitioner partitioner = createDocumentPartitioner(); + if (document instanceof IDocumentExtension3) { + IDocumentExtension3 extension3 = (IDocumentExtension3) document; + extension3.setDocumentPartitioner(partitioning, partitioner); + } else { + document.setDocumentPartitioner(partitioner); + } + partitioner.connect(document); + } + + /** + * Returns this text tool's preference store. + * + * @return the preference store + * @since 3.0 + */ + protected IPreferenceStore getPreferenceStore() { + return fPreferenceStore; + } + + /** + * Returns this text tool's core preference store. + * + * @return the core preference store + * @since 3.0 + */ + protected Preferences getCorePreferenceStore() { + return fCorePreferenceStore; + } } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java index 83a7128..30bbe4f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/IPreferenceConstants.java @@ -1,14 +1,14 @@ /********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html - -Contributors: - IBM Corporation - Initial implementation - www.phpeclipse.de -**********************************************************************/ + Copyright (c) 2000, 2002 IBM Corp. and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Common Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/cpl-v10.html + + Contributors: + IBM Corporation - Initial implementation + www.phpeclipse.de + **********************************************************************/ package net.sourceforge.phpeclipse; import net.sourceforge.phpdt.internal.ui.JavaElementAdapterFactory; @@ -17,218 +17,296 @@ import net.sourceforge.phpdt.internal.ui.JavaElementAdapterFactory; * Predefined prference constants */ public interface IPreferenceConstants { - /** - * Preference key suffix for bold text style preference keys. - * - * @since 2.1 - */ - public static final String EDITOR_BOLD_SUFFIX= "_bold"; //$NON-NLS-1$ - - /** - * Preference key suffix for italic text style preference keys. - * - * @since 3.0 - */ - public static final String EDITOR_ITALIC_SUFFIX= "_italic"; //$NON-NLS-1$ - -// public static final String LOCALHOST_PREF = "_localhost"; -// public static final String DOCUMENTROOT_PREF = "_documentroot"; + /** + * Preference key suffix for bold text style preference keys. + * + * @since 2.1 + */ + public static final String EDITOR_BOLD_SUFFIX = "_bold"; //$NON-NLS-1$ + + /** + * Preference key suffix for italic text style preference keys. + * + * @since 3.0 + */ + public static final String EDITOR_ITALIC_SUFFIX = "_italic"; //$NON-NLS-1$ + + // public static final String LOCALHOST_PREF = "_localhost"; + // public static final String DOCUMENTROOT_PREF = "_documentroot"; + public static final String XAMPP_START_PREF = "_xampp_start_pref"; + + public static final String XAMPP_STOP_PREF = "_xampp_stop_pref"; + 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"; + public static final String PHP_EXTENSION_PREFS = "_php_parser_extensions"; + public static final String PHP_PARSER_DEFAULT = "_php_parser_default"; -// public static final String PHP_INTERNAL_PARSER = "_php_internal_parser"; -// public static final String PHP_EXTERNAL_PARSER = "_php_external_parser"; + + // public static final String PHP_INTERNAL_PARSER = "_php_internal_parser"; + // public static final String PHP_EXTERNAL_PARSER = "_php_external_parser"; // public static final String PHP_PARSE_ON_SAVE = "_php_parse_on_save"; public static final String PHP_MULTILINE_COMMENT = "_php_multilineComment"; + public static final String PHP_MULTILINE_COMMENT_BOLD = "_php_multilineComment_bold"; + public static final String PHP_MULTILINE_COMMENT_ITALIC = "_php_multilineComment_italic"; + public static final String PHP_MULTILINE_COMMENT_UNDERLINE = "_php_multilineComment_underline"; - /** The color key for operators and brackets in PHP code - * (value "__php_operator"). - * @since 3.0 - */ + + /** + * The color key for operators and brackets in PHP code (value "__php_operator"). + * + * @since 3.0 + */ public static final String PHP_OPERATOR = "__php_operator"; //$NON-NLS-1$ - - /** The color key for {} in PHP code - * (value "__php_brace_operator"). - * @since 3.0 - */ + + /** + * The color key for {} in PHP code (value "__php_brace_operator"). + * + * @since 3.0 + */ public static final String PHP_BRACE_OPERATOR = "__php_brace_operator"; //$NON-NLS-1$ /** - * A named preference that holds the color used to render operators and brackets. - *

- * Value is of type String. A RGB color value encoded as a string - * using class PreferenceConverter - *

- * - * @see org.eclipse.jface.resource.StringConverter - * @see org.eclipse.jface.preference.PreferenceConverter - * @since 3.0 - */ - public final static String EDITOR_PHP_OPERATOR_COLOR= PHP_OPERATOR; - - /** - * A named preference that controls whether operators and brackets are rendered in bold. - *

- * Value is of type Boolean. - *

- * - * @since 3.0 - */ - public final static String EDITOR_PHP_OPERATOR_BOLD= PHP_OPERATOR + EDITOR_BOLD_SUFFIX; - - /** - * A named preference that controls whether operators and brackets are rendered in italic. - *

- * Value is of type Boolean. - *

- * - * @since 3.0 - */ - public final static String EDITOR_PHP_OPERATOR_ITALIC= PHP_OPERATOR + EDITOR_ITALIC_SUFFIX; - - /** - * A named preference that holds the color used to render operators and brackets. - *

- * Value is of type String. A RGB color value encoded as a string - * using class PreferenceConverter - *

- * - * @see org.eclipse.jface.resource.StringConverter - * @see org.eclipse.jface.preference.PreferenceConverter - * @since 3.0 - */ - public final static String EDITOR_PHP_BRACE_OPERATOR_COLOR= PHP_BRACE_OPERATOR; - - /** - * A named preference that controls whether operators and brackets are rendered in bold. - *

- * Value is of type Boolean. - *

- * - * @since 3.0 - */ - public final static String EDITOR_PHP_BRACE_OPERATOR_BOLD= PHP_BRACE_OPERATOR + EDITOR_BOLD_SUFFIX; - - /** - * A named preference that controls whether operators and brackets are rendered in italic. - *

- * Value is of type Boolean. - *

- * - * @since 3.0 - */ - public final static String EDITOR_PHP_BRACE_OPERATOR_ITALIC= PHP_BRACE_OPERATOR + EDITOR_ITALIC_SUFFIX; - - /** The color key for keyword 'return' in PHP code - * (value "__php_keyword_return"). - * @since 3.0 - */ - public static final String PHP_KEYWORD_RETURN= "__php_keyword_return"; //$NON-NLS-1$ + * A named preference that holds the color used to render operators and brackets. + *

+ * Value is of type String. A RGB color value encoded as a string using class PreferenceConverter + *

+ * + * @see org.eclipse.jface.resource.StringConverter + * @see org.eclipse.jface.preference.PreferenceConverter + * @since 3.0 + */ + public final static String EDITOR_PHP_OPERATOR_COLOR = PHP_OPERATOR; + + /** + * A named preference that controls whether operators and brackets are rendered in bold. + *

+ * Value is of type Boolean. + *

+ * + * @since 3.0 + */ + public final static String EDITOR_PHP_OPERATOR_BOLD = PHP_OPERATOR + EDITOR_BOLD_SUFFIX; + + /** + * A named preference that controls whether operators and brackets are rendered in italic. + *

+ * Value is of type Boolean. + *

+ * + * @since 3.0 + */ + public final static String EDITOR_PHP_OPERATOR_ITALIC = PHP_OPERATOR + EDITOR_ITALIC_SUFFIX; + + /** + * A named preference that holds the color used to render operators and brackets. + *

+ * Value is of type String. A RGB color value encoded as a string using class PreferenceConverter + *

+ * + * @see org.eclipse.jface.resource.StringConverter + * @see org.eclipse.jface.preference.PreferenceConverter + * @since 3.0 + */ + public final static String EDITOR_PHP_BRACE_OPERATOR_COLOR = PHP_BRACE_OPERATOR; + + /** + * A named preference that controls whether operators and brackets are rendered in bold. + *

+ * Value is of type Boolean. + *

+ * + * @since 3.0 + */ + public final static String EDITOR_PHP_BRACE_OPERATOR_BOLD = PHP_BRACE_OPERATOR + EDITOR_BOLD_SUFFIX; + + /** + * A named preference that controls whether operators and brackets are rendered in italic. + *

+ * Value is of type Boolean. + *

+ * + * @since 3.0 + */ + public final static String EDITOR_PHP_BRACE_OPERATOR_ITALIC = PHP_BRACE_OPERATOR + EDITOR_ITALIC_SUFFIX; + + /** + * The color key for keyword 'return' in PHP code (value "__php_keyword_return"). + * + * @since 3.0 + */ + public static final String PHP_KEYWORD_RETURN = "__php_keyword_return"; //$NON-NLS-1$ + + /** + * A named preference that holds the color used to render the 'return' keyword. + *

+ * Value is of type String. A RGB color value encoded as a string using class PreferenceConverter + *

+ * + * @see org.eclipse.jface.resource.StringConverter + * @see org.eclipse.jface.preference.PreferenceConverter + * @since 3.0 + */ + public final static String EDITOR_PHP_KEYWORD_RETURN_COLOR = PHP_KEYWORD_RETURN; + /** - * A named preference that holds the color used to render the 'return' keyword. - *

- * Value is of type String. A RGB color value encoded as a string - * using class PreferenceConverter - *

- * - * @see org.eclipse.jface.resource.StringConverter - * @see org.eclipse.jface.preference.PreferenceConverter - * @since 3.0 - */ - public final static String EDITOR_PHP_KEYWORD_RETURN_COLOR= PHP_KEYWORD_RETURN; - - /** - * A named preference that controls whether 'return' keyword is rendered in bold. - *

- * Value is of type Boolean. - *

- * - * @since 3.0 - */ - public final static String EDITOR_PHP_KEYWORD_RETURN_BOLD= PHP_KEYWORD_RETURN + EDITOR_BOLD_SUFFIX; - - /** - * A named preference that controls whether 'return' keyword is rendered in italic. - *

- * Value is of type Boolean. - *

- * - * @since 3.0 - */ - public final static String EDITOR_PHP_KEYWORD_RETURN_ITALIC= PHP_KEYWORD_RETURN + EDITOR_ITALIC_SUFFIX; - - public static final String PHP_SINGLELINE_COMMENT = "_php_singlelineComment"; + * A named preference that controls whether 'return' keyword is rendered in bold. + *

+ * Value is of type Boolean. + *

+ * + * @since 3.0 + */ + public final static String EDITOR_PHP_KEYWORD_RETURN_BOLD = PHP_KEYWORD_RETURN + EDITOR_BOLD_SUFFIX; + + /** + * A named preference that controls whether 'return' keyword is rendered in italic. + *

+ * Value is of type Boolean. + *

+ * + * @since 3.0 + */ + public final static String EDITOR_PHP_KEYWORD_RETURN_ITALIC = PHP_KEYWORD_RETURN + EDITOR_ITALIC_SUFFIX; + + public static final String PHP_SINGLELINE_COMMENT = "_php_singlelineComment"; + public static final String PHP_SINGLELINE_COMMENT_BOLD = "_php_singlelineComment_bold";//$NON-NLS-1$ + public static final String PHP_SINGLELINE_COMMENT_ITALIC = "_php_singlelineComment_italic";//$NON-NLS-1$ + public static final String PHP_SINGLELINE_COMMENT_UNDERLINE = "_php_singlelineComment_underline";//$NON-NLS-1$ + public static final String PHP_TAG = "_php_tag";//$NON-NLS-1$ + public static final String PHP_TAG_BOLD = "_php_tag_bold";//$NON-NLS-1$ + public static final String PHP_TAG_ITALIC = "_php_tag_italic";//$NON-NLS-1$ + public static final String PHP_TAG_UNDERLINE = "_php_tag_underline";//$NON-NLS-1$ + public static final String PHP_KEYWORD = "_php_keyword";//$NON-NLS-1$ + public static final String PHP_KEYWORD_BOLD = "_php_keyword_bold";//$NON-NLS-1$ + public static final String PHP_KEYWORD_ITALIC = "_php_keyword_italic";//$NON-NLS-1$ + public static final String PHP_KEYWORD_UNDERLINE = "_php_keyword_underline";//$NON-NLS-1$ + public static final String PHP_VARIABLE = "_php_variable";//$NON-NLS-1$ + public static final String PHP_VARIABLE_BOLD = "_php_variable_bold";//$NON-NLS-1$ + public static final String PHP_VARIABLE_ITALIC = "_php_variable_italic";//$NON-NLS-1$ + public static final String PHP_VARIABLE_UNDERLINE = "_php_variable_underline";//$NON-NLS-1$ + public static final String PHP_TYPE = "_php_type";//$NON-NLS-1$ + public static final String PHP_TYPE_BOLD = "_php_type_bold";//$NON-NLS-1$ + public static final String PHP_TYPE_ITALIC = "_php_type_italic";//$NON-NLS-1$ + public static final String PHP_TYPE_UNDERLINE = "_php_type_underline";//$NON-NLS-1$ + public static final String PHP_CONSTANT = "_php_constant";//$NON-NLS-1$ + public static final String PHP_CONSTANT_BOLD = "_php_constant_bold";//$NON-NLS-1$ + public static final String PHP_CONSTANT_ITALIC = "_php_constant_italic";//$NON-NLS-1$ + public static final String PHP_CONSTANT_UNDERLINE = "_php_constant_underline";//$NON-NLS-1$ + public static final String PHP_FUNCTIONNAME = "_php_functionname";//$NON-NLS-1$ + public static final String PHP_FUNCTIONNAME_BOLD = "_php_functionname_bold";//$NON-NLS-1$ + public static final String PHP_FUNCTIONNAME_ITALIC = "_php_functionname_italic";//$NON-NLS-1$ + public static final String PHP_FUNCTIONNAME_UNDERLINE = "_php_functionname_underline";//$NON-NLS-1$ + public static final String PHP_STRING = "_php_string";//$NON-NLS-1$ + public static final String PHP_STRING_BOLD = "_php_string_bold"; + public static final String PHP_STRING_ITALIC = "_php_string_italic"; + public static final String PHP_STRING_UNDERLINE = "_php_string_underline"; + public static final String PHP_DEFAULT = "_php_default"; + public static final String PHP_DEFAULT_BOLD = "_php_default_bold"; + public static final String PHP_DEFAULT_ITALIC = "_php_default_italic"; + public static final String PHP_DEFAULT_UNDERLINE = "_php_default_underline"; - public static final String TASK_TAG= "_php_comment_task_tag"; //$NON-NLS-1$ + + public static final String TASK_TAG = "_php_comment_task_tag"; //$NON-NLS-1$ + public static final String TASK_TAG_BOLD = "_php_comment_task_tag_bold"; //$NON-NLS-1$ - - /** The color key for PHPDoc keywords (@foo) in PHPDoc comments. */ + + /** + * The color key for PHPDoc keywords (@foo) in PHPDoc comments. + */ public static final String PHPDOC_KEYWORD = "_php_doc_keyword"; //$NON-NLS-1$ + public static final String PHPDOC_KEYWORD_BOLD = "_php_doc_keyword_bold"; + public static final String PHPDOC_KEYWORD_ITALIC = "_php_doc_keyword_italic"; + public static final String PHPDOC_KEYWORD_UNDERLINE = "_php_doc_keyword_underline"; + /** The color key for HTML tags (<foo>) in PHPDoc comments. */ public static final String PHPDOC_TAG = "_php_doc_tag"; //$NON-NLS-1$ + public static final String PHPDOC_TAG_BOLD = "_php_doc_tag_bold"; + public static final String PHPDOC_TAG_ITALIC = "_php_doc_tag_italic"; + public static final String PHPDOC_TAG_UNDERLINE = "_php_doc_tag_underline"; + /** The color key for PHPDoc links ({foo}) in PHPDoc comments. */ public static final String PHPDOC_LINK = "_php_doc_link"; //$NON-NLS-1$ + public static final String PHPDOC_LINK_BOLD = "_php_doc_link_bold"; + public static final String PHPDOC_LINK_ITALIC = "_php_doc_link_italic"; + public static final String PHPDOC_LINK_UNDERLINE = "_php_doc_link_underline"; + /** The color key for everthing in PHPDoc comments for which no other color is specified. */ public static final String PHPDOC_DEFAULT = "_php_doc_default"; //$NON-NLS-1$ + public static final String PHPDOC_DEFAULT_BOLD = "_php_doc_default_bold"; + public static final String PHPDOC_DEFAULT_ITALIC = "_php_doc_default_italic"; + public static final String PHPDOC_DEFAULT_UNDERLINE = "_php_doc_default_underline"; // public static final String LINKED_POSITION_COLOR = "_linkedPositionColor"; @@ -239,23 +317,24 @@ public interface IPreferenceConstants { // public final static String LINE_NUMBER_RULER = "_lineNumberRuler"; //$NON-NLS-1$ /** Preference key for the foreground color of the line numbers */ // public final static String LINE_NUMBER_COLOR = "_lineNumberColor"; //$NON-NLS-1$ - // public final static String PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT = "_defaultBackgroundColor"; //$NON-NLS-1$ // public final static String PREFERENCE_COLOR_BACKGROUND = "backgroundColor"; //$NON-NLS-1$ - /** Preference key for content assist proposal color */ public final static String PROPOSALS_FOREGROUND = "content_assist_proposals_foreground"; //$NON-NLS-1$ + /** Preference key for content assist proposal color */ public final static String PROPOSALS_BACKGROUND = "content_assist_proposals_background"; //$NON-NLS-1$ + public static final String EDITOR_EVALUTE_TEMPORARY_PROBLEMS = null; + public static final String EDITOR_CORRECTION_INDICATION = null; public static final String PHP_OBFUSCATOR_DEFAULT = "_php_obfuscator_default"; -// public static final String PHP_BOOKMARK_DEFAULT = "_php_bookmark_default"; -// public static final String PHP_LOCALHOST_PREF = "_php_localhost"; -// public static final String PHP_DOCUMENTROOT_PREF = "_php_documentroot"; -// -// public static final String PHP_AUTO_PREVIEW_DEFAULT = "_auto_preview"; -// public static final String PHP_BRING_TO_TOP_PREVIEW_DEFAULT = "_bring_to_top_preview"; -// public static final String PHP_SHOW_HTML_FILES_LOCAL = "_show_html_files_local"; + // public static final String PHP_BOOKMARK_DEFAULT = "_php_bookmark_default"; + // public static final String PHP_LOCALHOST_PREF = "_php_localhost"; + // public static final String PHP_DOCUMENTROOT_PREF = "_php_documentroot"; + // + // public static final String PHP_AUTO_PREVIEW_DEFAULT = "_auto_preview"; + // public static final String PHP_BRING_TO_TOP_PREVIEW_DEFAULT = "_bring_to_top_preview"; + // public static final String PHP_SHOW_HTML_FILES_LOCAL = "_show_html_files_local"; } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java index 2a290d5..51b3a3c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipseBasePreferencePage.java @@ -21,7 +21,8 @@ import org.eclipse.ui.IWorkbenchPreferencePage; public class PHPEclipseBasePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { StringFieldEditor phpParserExtensionsSFE; - + StringFieldEditor xamppStartSFE; + StringFieldEditor xamppStopSFE; StringFieldEditor apacheStartSFE; StringFieldEditor apacheStopSFE; @@ -55,6 +56,8 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor protected void performDefaults() { phpParserExtensionsSFE.loadDefault(); + xamppStartSFE.loadDefault(); + xamppStopSFE.loadDefault(); apacheStartSFE.loadDefault(); apacheStopSFE.loadDefault(); apacheRestartSFE.loadDefault(); @@ -72,6 +75,8 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor public boolean performOk() { PHPFileUtil.setExtensins(null); phpParserExtensionsSFE.store(); + xamppStartSFE.store(); + xamppStopSFE.store(); apacheStartSFE.store(); apacheStopSFE.store(); apacheRestartSFE.store(); @@ -113,6 +118,21 @@ public class PHPEclipseBasePreferencePage extends PreferencePage implements IWor apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); apacheSettingsGroup.setLayout(new GridLayout()); + + xamppStartSFE = new StringFieldEditor(IPreferenceConstants.XAMPP_START_PREF, PHPPreferencesMessages + .getString("PHPBasePreferencePage.apacheGroup.xampp_start"), apacheSettingsGroup); + xamppStartSFE.setPreferencePage(this); + xamppStartSFE.setPreferenceStore(getPreferenceStore()); + xamppStartSFE.load(); + new Label(apacheSettingsGroup, SWT.NONE); + + xamppStopSFE = new StringFieldEditor(IPreferenceConstants.XAMPP_STOP_PREF, PHPPreferencesMessages + .getString("PHPBasePreferencePage.apacheGroup.xampp_stop"), apacheSettingsGroup); + xamppStopSFE.setPreferencePage(this); + xamppStopSFE.setPreferenceStore(getPreferenceStore()); + xamppStopSFE.load(); + new Label(apacheSettingsGroup, SWT.NONE); + apacheStartBFE = new BooleanFieldEditor(PHPeclipsePlugin.APACHE_START_BACKGROUND, PHPPreferencesMessages .getString("PHPBasePreferencePage.apacheGroup.start_background"), apacheSettingsGroup); apacheStartBFE.setPreferencePage(this); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index 6bf2da9..5edecbb 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -717,11 +717,15 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon store.setDefault(EXTERNAL_PARSER_PREF, "c:\\apache\\php\\php -l -f {0}"); store.setDefault(MYSQL_RUN_PREF, "c:\\apache\\mysql\\bin\\mysqld-nt.exe"); store.setDefault(APACHE_RUN_PREF, "c:\\apache\\apache.exe"); + store.setDefault(XAMPP_START_PREF, "c:\\xampp\\xampp_start.exe"); + store.setDefault(XAMPP_STOP_PREF, "c:\\xampp\\xampp_stop.exe"); } else { store.setDefault(PHP_RUN_PREF, "/apache/php/php"); store.setDefault(EXTERNAL_PARSER_PREF, "/apache/php/php -l -f {0}"); store.setDefault(MYSQL_RUN_PREF, "/apache/mysql/bin/mysqld"); store.setDefault(APACHE_RUN_PREF, "/apache/apache"); + store.setDefault(XAMPP_START_PREF, "xamp/xampp_start"); + store.setDefault(XAMPP_STOP_PREF, "xampp/xampp_stop"); } store.setDefault(MYSQL_PREF, "--standalone"); store.setDefault(APACHE_START_PREF, "-c \"DocumentRoot \"{0}\"\""); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenSQLTableEditorAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenSQLTableEditorAction.java index 011993c..5eda806 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenSQLTableEditorAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPOpenSQLTableEditorAction.java @@ -1,20 +1,14 @@ -/******************************************************************************* - * Copyright (c) 2000, 2002 IBM Corp. and others. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Common Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/cpl-v10.html +/*********************************************************************************************************************************** + * Copyright (c) 2000, 2002 IBM Corp. and others. All rights reserved. This program and the accompanying materials are made + * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: www.phpeclipse.de - ******************************************************************************/ + **********************************************************************************************************************************/ package net.sourceforge.phpeclipse.actions; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; -import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.PHPEditor; import net.sourceforge.phpeclipse.ui.WebUI; import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil; @@ -29,8 +23,6 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.window.Window; import org.eclipse.swt.graphics.Point; import org.eclipse.ui.IEditorActionDelegate; import org.eclipse.ui.IEditorPart; @@ -40,26 +32,13 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; import org.eclipse.ui.actions.ActionDelegate; -import org.eclipse.ui.dialogs.ListSelectionDialog; -import org.eclipse.ui.internal.dialogs.ListContentProvider; +import com.quantum.ExternalInterface; import com.quantum.QuantumPlugin; -import com.quantum.adapters.DatabaseAdapter; -import com.quantum.model.Bookmark; -import com.quantum.model.BookmarkCollection; -import com.quantum.model.Entity; -import com.quantum.model.EntityFactory; import com.quantum.model.NotConnectedException; -import com.quantum.sql.MultiSQLServer; -import com.quantum.sql.SQLResultSetCollection; -import com.quantum.sql.SQLResultSetResults; -import com.quantum.sql.SQLResults; -import com.quantum.ui.dialog.ExceptionDisplayDialog; -import com.quantum.util.connection.ConnectionUtil; import com.quantum.view.tableview.TableView; -public class PHPOpenSQLTableEditorAction extends ActionDelegate implements - IEditorActionDelegate { +public class PHPOpenSQLTableEditorAction extends ActionDelegate implements IEditorActionDelegate { private IWorkbenchWindow fWindow; @@ -78,16 +57,14 @@ public class PHPOpenSQLTableEditorAction extends ActionDelegate implements if (!selection.isEmpty()) { if (selection instanceof TextSelection) { action.setEnabled(true); - } else if (fWindow.getActivePage() != null - && fWindow.getActivePage().getActivePart() != null) { + } else if (fWindow.getActivePage() != null && fWindow.getActivePage().getActivePart() != null) { // } } } private IWorkbenchPage getActivePage() { - fWindow = fEditor.getEditorSite() - .getWorkbenchWindow(); + fWindow = fEditor.getEditorSite().getWorkbenchWindow(); IWorkbenchPage page = fWindow.getActivePage(); return page; } @@ -99,8 +76,7 @@ public class PHPOpenSQLTableEditorAction extends ActionDelegate implements return editorInput.getFile().getParent(); } - private IFile getIncludeFile(IProject project, IFileEditorInput editorInput, - String relativeFilename) { + private IFile getIncludeFile(IProject project, IFileEditorInput editorInput, String relativeFilename) { // IContainer container = getWorkingLocation(editorInput); // String fullPath = project.getLocation().toString(); Path path = new Path(relativeFilename); @@ -116,35 +92,56 @@ public class PHPOpenSQLTableEditorAction extends ActionDelegate implements } } if (fEditor != null) { - // TableView view = TableView.getInstance(); - - // determine the current Project from a (file-based) Editor fWindow = fEditor.getEditorSite().getWorkbenchWindow(); IFile f = ((IFileEditorInput) fEditor.getEditorInput()).getFile(); fProject = f.getProject(); - - ITextSelection selection = (ITextSelection) fEditor - .getSelectionProvider().getSelection(); - IDocument doc = fEditor.getDocumentProvider().getDocument( - fEditor.getEditorInput()); - int pos = selection.getOffset(); - // System.out.println(selection.getText()); - String tableName = getSQLTableName(doc, pos); - - IViewPart viewPart = null; - String view = "com.quantum.view.tableview.TableView"; - try { - IWorkbenchPage page = QuantumPlugin.getDefault().getActivePage(); - viewPart = page.findView(view); - if (viewPart == null) { - viewPart = page.showView(view); - } - page.bringToTop(viewPart); - getTables((TableView) viewPart, fProject, tableName); - } catch (PartInitException e) { - e.printStackTrace(); + String bookmarkString = ProjectPrefUtil.getMiscProjectsPreferenceValue(fProject, WebUI.PHP_BOOKMARK_DEFAULT); + if (bookmarkString != null && !bookmarkString.equals("")) { + ITextSelection selection = (ITextSelection) fEditor.getSelectionProvider().getSelection(); + IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput()); + int pos = selection.getOffset(); + // System.out.println(selection.getText()); + String tableName = getSQLTableName(doc, pos); + if (tableName != null && tableName.length() > 0) + try { + ExternalInterface.displayTable(bookmarkString, tableName); + + IViewPart viewPart = null; + String view = "com.quantum.view.tableview.TableView"; + try { + IWorkbenchPage page = QuantumPlugin.getDefault().getActivePage(); + viewPart = page.findView(view); + if (viewPart == null) { + viewPart = page.showView(view); + } + page.bringToTop(viewPart); + } catch (PartInitException e) { + e.printStackTrace(); + } + } catch (NotConnectedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } + // + // IViewPart viewPart = null; + // String view = "com.quantum.view.tableview.TableView"; + // try { + // IWorkbenchPage page = QuantumPlugin.getDefault().getActivePage(); + // viewPart = page.findView(view); + // if (viewPart == null) { + // viewPart = page.showView(view); + // } + // page.bringToTop(viewPart); + // getTables((TableView) viewPart, fProject, tableName); + // } catch (PartInitException e) { + // e.printStackTrace(); + // } + } } @@ -166,8 +163,7 @@ public class PHPOpenSQLTableEditorAction extends ActionDelegate implements while (position >= 0) { character = doc.getChar(position); - if (Character.isWhitespace(character) || (character == '\"') - || (character == '\'') || (character == '\r') + if (Character.isWhitespace(character) || (character == '\"') || (character == '\'') || (character == '\r') || (character == '\n')) break; --position; @@ -180,8 +176,7 @@ public class PHPOpenSQLTableEditorAction extends ActionDelegate implements while (position < length) { character = doc.getChar(position); - if (Character.isWhitespace(character) || (character == '\"') - || (character == '\'') || (character == '\r') + if (Character.isWhitespace(character) || (character == '\"') || (character == '\'') || (character == '\r') || (character == '\n')) break; ++position; @@ -205,118 +200,118 @@ public class PHPOpenSQLTableEditorAction extends ActionDelegate implements return ""; } - public void getTables(TableView tableView, IProject project, String tableName) { - // Get The Database bookmark from the Quantum SQL plugin: - BookmarkCollection sqlBookMarks = BookmarkCollection.getInstance(); - if (sqlBookMarks != null) { - String bookmarkString = ProjectPrefUtil.getMiscProjectsPreferenceValue(project, - WebUI.PHP_BOOKMARK_DEFAULT); - if (bookmarkString != null && !bookmarkString.equals("")) { - Bookmark bookmark = sqlBookMarks.find(bookmarkString); - ArrayList sqlList = new ArrayList(); - if (bookmark != null && !bookmark.isConnected()) { - new ConnectionUtil().connect(bookmark, null); - } - if (bookmark != null && bookmark.isConnected()) { - try { - Connection connection = bookmark.getConnection(); - DatabaseMetaData metaData = connection.getMetaData(); - ConnectionUtil connectionUtil = new ConnectionUtil(); - Entity entity; - DatabaseAdapter adapter; - - if (metaData != null) { - String columnName; - String prefixWithoutDollar = tableName; - if (prefixWithoutDollar.charAt(0) == '$') { - prefixWithoutDollar = prefixWithoutDollar.substring(1); - } - ResultSet set; - set = metaData.getTables(null, null, "%" + prefixWithoutDollar - + "%", null); - while (set.next()) { - tableName = set.getString("TABLE_NAME"); - tableName = (tableName == null) ? "" : tableName.trim(); - if (tableName != null && tableName.length() > 0) { - sqlList.add(tableName); - } - } - set.close(); - EntityFactory entityFactory = EntityFactory.getInstance(); - if (sqlList.size() == 1) { - adapter = bookmark.getAdapter(); - entity = entityFactory.create(bookmark, null, (String) sqlList - .get(0), Entity.TABLE_TYPE, false); - String query = adapter.getTableQuery(entity.getQualifiedName()); - - try { - SQLResults results = MultiSQLServer.getInstance().execute( - bookmark, connectionUtil.connect(bookmark, fWindow.getShell()), - entity, query); - - if (results != null && results.isResultSet()) { - SQLResultSetCollection.getInstance().addSQLResultSet( - (SQLResultSetResults) results); - } - } catch (SQLException e) { - ExceptionDisplayDialog.openError(fWindow.getShell(), null, null, e); - } - // tableView.loadTable(entityFactory.create( - // bookmark, null, - // (String) sqlList.get(0), - // Entity.TABLE_TYPE)); - } else if (sqlList.size() > 1) { - ListSelectionDialog listSelectionDialog = new ListSelectionDialog( - PHPeclipsePlugin.getDefault().getWorkbench() - .getActiveWorkbenchWindow().getShell(), sqlList, - new ListContentProvider(), new LabelProvider(), - "Select the SQL table to open."); - listSelectionDialog.setTitle("Multiple tablenames found"); - if (listSelectionDialog.open() == Window.OK) { - Object[] locations = listSelectionDialog.getResult(); - if (locations != null) { - for (int i = 0; i < locations.length; i++) { - adapter = bookmark.getAdapter(); - entity = entityFactory.create(bookmark, null, - (String) locations[i], Entity.TABLE_TYPE, false); - String query = adapter.getTableQuery(entity - .getQualifiedName()); - - try { - SQLResults results = MultiSQLServer.getInstance() - .execute(bookmark, - connectionUtil.connect(bookmark, fWindow.getShell()), - entity, query); - - if (results != null && results.isResultSet()) { - SQLResultSetCollection.getInstance().addSQLResultSet( - (SQLResultSetResults) results); - } - } catch (SQLException e) { - ExceptionDisplayDialog.openError(fWindow.getShell(), null, null, e); - } - - // tableView - // .loadTable(entityFactory - // .create( - // bookmark, - // null, - // (String) locations[i], - // Entity.TABLE_TYPE)); - } - - } - } - } - } - } catch (NotConnectedException e) { - // ignore this - not mission critical - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - } + // public void getTables(TableView tableView, IProject project, String tableName) { + // // Get The Database bookmark from the Quantum SQL plugin: + // BookmarkCollection sqlBookMarks = BookmarkCollection.getInstance(); + // if (sqlBookMarks != null) { + // String bookmarkString = ProjectPrefUtil.getMiscProjectsPreferenceValue(project, + // WebUI.PHP_BOOKMARK_DEFAULT); + // if (bookmarkString != null && !bookmarkString.equals("")) { + // Bookmark bookmark = sqlBookMarks.find(bookmarkString); + // ArrayList sqlList = new ArrayList(); + // if (bookmark != null && !bookmark.isConnected()) { + // new ConnectionUtil().connect(bookmark, null); + // } + // if (bookmark != null && bookmark.isConnected()) { + // try { + // Connection connection = bookmark.getConnection(); + // DatabaseMetaData metaData = connection.getMetaData(); + // ConnectionUtil connectionUtil = new ConnectionUtil(); + // Entity entity; + // DatabaseAdapter adapter; + // + // if (metaData != null) { + // String columnName; + // String prefixWithoutDollar = tableName; + // if (prefixWithoutDollar.charAt(0) == '$') { + // prefixWithoutDollar = prefixWithoutDollar.substring(1); + // } + // ResultSet set; + // set = metaData.getTables(null, null, "%" + prefixWithoutDollar + // + "%", null); + // while (set.next()) { + // tableName = set.getString("TABLE_NAME"); + // tableName = (tableName == null) ? "" : tableName.trim(); + // if (tableName != null && tableName.length() > 0) { + // sqlList.add(tableName); + // } + // } + // set.close(); + // EntityFactory entityFactory = EntityFactory.getInstance(); + // if (sqlList.size() == 1) { + // adapter = bookmark.getAdapter(); + // entity = entityFactory.create(bookmark, null, (String) sqlList + // .get(0), Entity.TABLE_TYPE, false); + // String query = adapter.getTableQuery(entity.getQualifiedName()); + // + // try { + // SQLResults results = MultiSQLServer.getInstance().execute( + // bookmark, connectionUtil.connect(bookmark, fWindow.getShell()), + // entity, query); + // + // if (results != null && results.isResultSet()) { + // SQLResultSetCollection.getInstance().addSQLResultSet( + // (SQLResultSetResults) results); + // } + // } catch (SQLException e) { + // ExceptionDisplayDialog.openError(fWindow.getShell(), null, null, e); + // } + // // tableView.loadTable(entityFactory.create( + // // bookmark, null, + // // (String) sqlList.get(0), + // // Entity.TABLE_TYPE)); + // } else if (sqlList.size() > 1) { + // ListSelectionDialog listSelectionDialog = new ListSelectionDialog( + // PHPeclipsePlugin.getDefault().getWorkbench() + // .getActiveWorkbenchWindow().getShell(), sqlList, + // new ListContentProvider(), new LabelProvider(), + // "Select the SQL table to open."); + // listSelectionDialog.setTitle("Multiple tablenames found"); + // if (listSelectionDialog.open() == Window.OK) { + // Object[] locations = listSelectionDialog.getResult(); + // if (locations != null) { + // for (int i = 0; i < locations.length; i++) { + // adapter = bookmark.getAdapter(); + // entity = entityFactory.create(bookmark, null, + // (String) locations[i], Entity.TABLE_TYPE, false); + // String query = adapter.getTableQuery(entity + // .getQualifiedName()); + // + // try { + // SQLResults results = MultiSQLServer.getInstance() + // .execute(bookmark, + // connectionUtil.connect(bookmark, fWindow.getShell()), + // entity, query); + // + // if (results != null && results.isResultSet()) { + // SQLResultSetCollection.getInstance().addSQLResultSet( + // (SQLResultSetResults) results); + // } + // } catch (SQLException e) { + // ExceptionDisplayDialog.openError(fWindow.getShell(), null, null, e); + // } + // + // // tableView + // // .loadTable(entityFactory + // // .create( + // // bookmark, + // // null, + // // (String) locations[i], + // // Entity.TABLE_TYPE)); + // } + // + // } + // } + // } + // } + // } catch (NotConnectedException e) { + // // ignore this - not mission critical + // } catch (SQLException e) { + // e.printStackTrace(); + // } + // } + // } + // } + // } } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartXAMPPAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartXAMPPAction.java new file mode 100644 index 0000000..e3dcfff --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStartXAMPPAction.java @@ -0,0 +1,90 @@ +/********************************************************************** +Copyright (c) 2000, 2002 IBM Corp. and others. +All rights reserved. This program and the accompanying materials +are made available under the terms of the Common Public License v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/cpl-v10.html + +Contributors: + IBM Corporation - Initial implementation + www.phpeclipse.de +**********************************************************************/ +package net.sourceforge.phpeclipse.actions; + +import java.io.File; + +import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil; +import net.sourceforge.phpeclipse.PHPConsole; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; + +public class PHPStartXAMPPAction implements IWorkbenchWindowActionDelegate { + protected IWorkbenchWindow activeWindow = null; + + public void run(IAction action) { + final IPreferenceStore store = + PHPeclipsePlugin.getDefault().getPreferenceStore(); + String executable = store.getString(PHPeclipsePlugin.XAMPP_START_PREF); + String workingDirectory = null; + if (executable!=null && executable.length()>0) { + int index = executable.lastIndexOf(File.separatorChar); + if (index>0) { + workingDirectory = executable.substring(0, index); + } + } + execute( + "xampp_start", + executable, + workingDirectory, + true); + } + + /** + * 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 background run this configuration in background mode + */ + public static void execute( + String command, + String executable, + String workingDirectory, + boolean background) { + PHPConsole console = new PHPConsole(); + String consoleMessage; + if (background) { + consoleMessage = + "run in background mode-" + + command + + ": " + + executable; + } else { + consoleMessage = + "run in foreground mode-" + + command + + ": " + + executable; + } + console.println(consoleMessage); + + ExternalToolsUtil.execute(command, executable, workingDirectory, null, background); + } + + public void selectionChanged(IAction action, ISelection selection) { + + } + + public void init(IWorkbenchWindow window) { + this.activeWindow = window; + } + + public void dispose() { + + } + +} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStopXAMPPAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStopXAMPPAction.java new file mode 100644 index 0000000..89c6e0d --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPStopXAMPPAction.java @@ -0,0 +1,90 @@ +/********************************************************************** +Copyright (c) 2000, 2002 IBM Corp. and others. +All rights reserved. This program and the accompanying materials +are made available under the terms of the Common Public License v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/cpl-v10.html + +Contributors: + IBM Corporation - Initial implementation + www.phpeclipse.de +**********************************************************************/ +package net.sourceforge.phpeclipse.actions; + +import java.io.File; + +import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil; +import net.sourceforge.phpeclipse.PHPConsole; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; + +public class PHPStopXAMPPAction implements IWorkbenchWindowActionDelegate { + protected IWorkbenchWindow activeWindow = null; + + public void run(IAction action) { + final IPreferenceStore store = + PHPeclipsePlugin.getDefault().getPreferenceStore(); + String executable = store.getString(PHPeclipsePlugin.XAMPP_STOP_PREF); + String workingDirectory = null; + if (executable!=null && executable.length()>0) { + int index = executable.lastIndexOf(File.separatorChar); + if (index>0) { + workingDirectory = executable.substring(0, index); + } + } + execute( + "xampp_stop", + executable, + workingDirectory, + true); + } + + /** + * 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 background run this configuration in background mode + */ + public static void execute( + String command, + String executable, + String workingDirectory, + boolean background) { + PHPConsole console = new PHPConsole(); + String consoleMessage; + if (background) { + consoleMessage = + "run in background mode-" + + command + + ": " + + executable; + } else { + consoleMessage = + "run in foreground mode-" + + command + + ": " + + executable; + } + console.println(consoleMessage); + + ExternalToolsUtil.execute(command, executable, workingDirectory, null, background); + } + + public void selectionChanged(IAction action, ISelection selection) { + + } + + public void init(IWorkbenchWindow window) { + this.activeWindow = window; + } + + public void dispose() { + + } + +} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/SmartyDocumentSetupParticipant.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/SmartyDocumentSetupParticipant.java index ebf7655..7bd6ceb 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/SmartyDocumentSetupParticipant.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/SmartyDocumentSetupParticipant.java @@ -24,7 +24,7 @@ public class SmartyDocumentSetupParticipant implements IDocumentSetupParticipan public SmartyDocumentSetupParticipant() { } - + /* * @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument) */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPPreferencesMessages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPPreferencesMessages.properties index ff0b239..68cb473 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPPreferencesMessages.properties +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/preferences/PHPPreferencesMessages.properties @@ -36,6 +36,8 @@ 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.xampp_start=XAMPP Start +PHPBasePreferencePage.apacheGroup.xampp_stop=XAMPP Stop PHPBasePreferencePage.apacheGroup.run=Apache PHPBasePreferencePage.apacheGroup.start=Start Apache PHPBasePreferencePage.apacheGroup.start_background=Run in background mode