From 790fdd798e25386213d88e035c79b4d63cde290e Mon Sep 17 00:00:00 2001
From: pombredanne
- * This method extracts the substring from the source buffer containing
- * this source element. This corresponds to the source regione that would
- * be returned by {@link ISourceReference#getSourceRegion()}.
+ * This method extracts the substring from the source buffer containing this
+ * source element. This corresponds to the source regione that would be
+ * returned by {@link ISourceReference#getSourceRegion()}.
*
- * Clients are not intended to instantiate or subclass this class;
- * this class provides static utility methods only.
+ * Clients are not intended to instantiate or subclass this class; this class
+ * provides static utility methods only.
*
* A breakpoint is defined in two parts:
*
- * For example, following is a definition of corresponding breakpoint
- * and breakpoint marker definitions. Note that the
- * The breakpoint manager instantiates persisted breakpoints by
- * traversing all markers that are a subtype of
- *
- * Breakpoints may or may not be registered with the breakpoint manager, and
- * are persisted and restored as such. Since marker definitions only allow
- * all or none of a specific marker type to be persisted, breakpoints define
- * a "); //$NON-NLS-1$
buffer.append("null
if this element has no
+ * @return The source code, or null
if this element has no
* associated source code
*/
String getSource();
@@ -37,7 +37,7 @@ public interface ISourceReference {
/**
* Returns the source range associated with this element.
*
- * @return The source region, or null
if this element has no
+ * @return The source region, or null
if this element has no
* associated source code
*/
IRegion getSourceRegion();
diff --git a/net.sourceforge.phpeclipse.core/src/net/sourceforge/phpeclipse/core/model/SourceReference.java b/net.sourceforge.phpeclipse.core/src/net/sourceforge/phpeclipse/core/model/SourceReference.java
index ece105c..72b5c82 100644
--- a/net.sourceforge.phpeclipse.core/src/net/sourceforge/phpeclipse/core/model/SourceReference.java
+++ b/net.sourceforge.phpeclipse.core/src/net/sourceforge/phpeclipse/core/model/SourceReference.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: SourceReference.java,v 1.1 2004-09-02 18:05:21 jsurfer Exp $
+ * $Id: SourceReference.java,v 1.2 2006-10-21 23:14:29 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.core.model;
@@ -19,8 +19,7 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
/**
- * Default implementation of {@link ISourceReference} based on
- * {@link IDocument}.
+ * Default implementation of {@link ISourceReference} based on {@link IDocument}.
*/
public class SourceReference implements ISourceReference {
@@ -37,7 +36,8 @@ public class SourceReference implements ISourceReference {
/**
* Constructor.
*
- * @param document The document that contains the source reference
+ * @param document
+ * The document that contains the source reference
*/
public SourceReference(IDocument document) {
this(document, 0, 0);
@@ -46,7 +46,8 @@ public class SourceReference implements ISourceReference {
/**
* Constructor.
*
- * @param document The document that contains the source reference
+ * @param document
+ * The document that contains the source reference
*/
public SourceReference(IDocument document, int offset) {
this(document, offset, 0);
@@ -55,7 +56,8 @@ public class SourceReference implements ISourceReference {
/**
* Constructor.
*
- * @param document The document that contains the source reference
+ * @param document
+ * The document that contains the source reference
*/
public SourceReference(IDocument document, int offset, int length) {
this.document = document;
@@ -69,11 +71,11 @@ public class SourceReference implements ISourceReference {
*/
public String getSource() {
try {
- return document.get(sourceRegion.getOffset(),
- sourceRegion.getLength());
+ return document.get(sourceRegion.getOffset(), sourceRegion
+ .getLength());
} catch (BadLocationException e) {
throw new IllegalStateException(
- "Model not synchronized with document"); //$NON-NLS-1$
+ "Model not synchronized with document"); //$NON-NLS-1$
}
}
@@ -89,8 +91,10 @@ public class SourceReference implements ISourceReference {
/**
* Sets the source region covered by the element.
*
- * @param offset the offset of the region
- * @param length the length of the region
+ * @param offset
+ * the offset of the region
+ * @param length
+ * the length of the region
*/
public final void setSourceRegion(int offset, int length) {
sourceRegion = new Region(offset, length);
@@ -99,7 +103,8 @@ public class SourceReference implements ISourceReference {
/**
* Sets the source region covered by the element.
*
- * @param region the source region to set
+ * @param region
+ * the source region to set
*/
public final void setSourceRegion(IRegion region) {
setSourceRegion(region.getOffset(), region.getLength());
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/debug/core/PHPDebugModel.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/debug/core/PHPDebugModel.java
index 63231ae..7da4a4d 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/debug/core/PHPDebugModel.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/debug/core/PHPDebugModel.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
+ 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
- Vicente Fernando - www.alfersoft.com.ar
-**********************************************************************/
+ Contributors:
+ IBM Corporation - Initial implementation
+ Vicente Fernando - www.alfersoft.com.ar
+ **********************************************************************/
package net.sourceforge.phpdt.debug.core;
import java.util.HashMap;
@@ -28,109 +28,131 @@ import org.eclipse.debug.core.model.IBreakpoint;
* Provides utility methods for creating debug targets and breakpoints specific
* to the PHP debug model.
* null
if none.
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param lineNumber
+ * the lineNumber on which the breakpoint is set - line numbers
+ * are 1 based, associated with the source file in which the
+ * breakpoint is set
+ * @param charStart
+ * the first character index associated with the breakpoint, or
+ * -1 if unspecified, in the source file in which the breakpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the breakpoint, or -1
+ * if unspecified, in the source file in which the breakpoint is
+ * set
+ * @param hitCount
+ * the number of times the breakpoint will be hit before
+ * suspending execution - 0 if it should always suspend
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
+ * @param attributes
+ * a map of client defined attributes that should be assigned to
+ * the underlying breakpoint marker on creation, or
+ * null
if none.
* @return a line breakpoint
- * @exception CoreException If this method fails. Reasons include:
- *
+ * @exception CoreException
+ * If this method fails. Reasons include:
+ *
+ *
* @since 2.0
*/
- public static void createLineBreakpoint(IResource resource, int lineNumber, int charStart, int charEnd, int hitCount, boolean register, Map attributes) throws CoreException {
+ public static void createLineBreakpoint(IResource resource, int lineNumber,
+ int charStart, int charEnd, int hitCount, boolean register,
+ Map attributes) throws CoreException {
if (attributes == null) {
attributes = new HashMap(10);
}
- new PHPLineBreakpoint(resource, lineNumber, charStart, charEnd, hitCount, true, attributes);
+ new PHPLineBreakpoint(resource, lineNumber, charStart, charEnd,
+ hitCount, true, attributes);
}
-
- public static PHPLineBreakpoint createLineBreakpoint(IResource resource, int lineNumber, int hitCount, boolean register, Map attributes) throws CoreException {
+
+ public static PHPLineBreakpoint createLineBreakpoint(IResource resource,
+ int lineNumber, int hitCount, boolean register, Map attributes)
+ throws CoreException {
if (attributes == null) {
attributes = new HashMap(10);
}
- return new PHPLineBreakpoint(resource, lineNumber, hitCount, true, attributes);
+ return new PHPLineBreakpoint(resource, lineNumber, hitCount, true,
+ attributes);
}
-
/**
* Returns true if line breakpoint is already registered with the breakpoint
* manager for the given line number.
*
- * @param typeName fully qualified type name
- * @param lineNumber line number
+ * @param typeName
+ * fully qualified type name
+ * @param lineNumber
+ * line number
* @return true if line breakpoint is already registered with the breakpoint
- * manager for the given line number or false
- * if no such breakpoint is registered
- * @exception CoreException If this method fails.
+ * manager for the given line number or false
if no
+ * such breakpoint is registered
+ * @exception CoreException
+ * If this method fails.
*/
- public static PHPLineBreakpoint lineBreakpointExists(int lineNumber) throws CoreException {
- String modelId= PHPDebugCorePlugin.PLUGIN_ID; // getPluginIdentifier();
- String markerType= PHPLineBreakpoint.getMarkerType();
- IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints= manager.getBreakpoints(modelId);
+ public static PHPLineBreakpoint lineBreakpointExists(int lineNumber)
+ throws CoreException {
+ String modelId = PHPDebugCorePlugin.PLUGIN_ID; // getPluginIdentifier();
+ String markerType = PHPLineBreakpoint.getMarkerType();
+ IBreakpointManager manager = DebugPlugin.getDefault()
+ .getBreakpointManager();
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
for (int i = 0; i < breakpoints.length; i++) {
if (!(breakpoints[i] instanceof PHPLineBreakpoint)) {
continue;
}
PHPLineBreakpoint breakpoint = (PHPLineBreakpoint) breakpoints[i];
if (breakpoint.getMarker().getType().equals(markerType)) {
- if (breakpoint.getLineNumber() == lineNumber) {
- return breakpoint;
- }
+ if (breakpoint.getLineNumber() == lineNumber) {
+ return breakpoint;
+ }
}
}
return null;
- }
+ }
/**
- * Returns the preference store for this plug-in or null
- * if the store is not available.
+ * Returns the preference store for this plug-in or null
if
+ * the store is not available.
*
* @return the preference store for this plug-in
*/
public static Preferences getPreferences() {
- PHPDebugCorePlugin deflt= PHPDebugCorePlugin.getDefault();
+ PHPDebugCorePlugin deflt = PHPDebugCorePlugin.getDefault();
if (deflt != null) {
return deflt.getPluginPreferences();
}
@@ -145,50 +167,48 @@ public class PHPDebugModel {
public static void savePreferences() {
PHPDebugCorePlugin.getDefault().savePluginPreferences();
}
-
+
/**
- * Creates and returns a debug target for the given VM, with
- * the specified name, and associates the debug target with the
- * given process for console I/O. The allow terminate flag specifies whether
- * the debug target will support termination (ITerminate
).
- * The allow disconnect flag specifies whether the debug target will
- * support disconnection (IDisconnect
). The resume
- * flag specifies if the target VM should be resumed on startup (has
- * no effect if the VM was already running when the connection to the
+ * Creates and returns a debug target for the given VM, with the specified
+ * name, and associates the debug target with the given process for console
+ * I/O. The allow terminate flag specifies whether the debug target will
+ * support termination (ITerminate
). The allow disconnect
+ * flag specifies whether the debug target will support disconnection (IDisconnect
).
+ * The resume flag specifies if the target VM should be resumed on startup
+ * (has no effect if the VM was already running when the connection to the
* VM was esatbished). Launching the actual VM is a client responsibility.
* The debug target is added to the given launch.
- *
- * @param launch the launch the new debug target will be contained in
- * @param vm the VM to create a debug target for
- * @param name the name to associate with the VM, which will be
- * returned from IDebugTarget.getName
. If null
- * the name will be retrieved from the underlying VM.
- * @param process the process to associate with the debug target,
- * which will be returned from IDebugTarget.getProcess
- * @param allowTerminate whether the target will support termianation
- * @param allowDisconnect whether the target will support disconnection
- * @param resume whether the target is to be resumed on startup. Has
- * no effect if the target was already running when the connection
- * to the VM was established.
+ *
+ * @param launch
+ * the launch the new debug target will be contained in
+ * @param vm
+ * the VM to create a debug target for
+ * @param name
+ * the name to associate with the VM, which will be returned from
+ * IDebugTarget.getName
. If null
+ * the name will be retrieved from the underlying VM.
+ * @param process
+ * the process to associate with the debug target, which will be
+ * returned from IDebugTarget.getProcess
+ * @param allowTerminate
+ * whether the target will support termianation
+ * @param allowDisconnect
+ * whether the target will support disconnection
+ * @param resume
+ * whether the target is to be resumed on startup. Has no effect
+ * if the target was already running when the connection to the
+ * VM was established.
* @return a debug target
* @see org.eclipse.debug.core.model.ITerminate
* @see org.eclipse.debug.core.model.IDisconnect
* @since 2.0
*/
/*
- public static IDebugTarget newDebugTarget(final ILaunch launch, final String name, final IProcess process) {
- final IDebugTarget[] target = new IDebugTarget[1];
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
- public void run(IProgressMonitor m) {
- target[0]= new PHPDebugTarget(launch, process);
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run(r, null);
- } catch (CoreException e) {
- //PHPDebugPlugin.log(e);
- }
- return target[0];
- }
- */
+ * public static IDebugTarget newDebugTarget(final ILaunch launch, final
+ * String name, final IProcess process) { final IDebugTarget[] target = new
+ * IDebugTarget[1]; IWorkspaceRunnable r = new IWorkspaceRunnable() { public
+ * void run(IProgressMonitor m) { target[0]= new PHPDebugTarget(launch,
+ * process); } }; try { ResourcesPlugin.getWorkspace().run(r, null); } catch
+ * (CoreException e) { //PHPDebugPlugin.log(e); } return target[0]; }
+ */
}
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGMod.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGMod.java
index f973f8d..b393a07 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGMod.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGMod.java
@@ -1,25 +1,26 @@
/**********************************************************************
-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:
- Vicente Fernando - www.alfersoft.com.ar - Initial implementation
-**********************************************************************/
+ 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:
+ Vicente Fernando - www.alfersoft.com.ar - Initial implementation
+ **********************************************************************/
package net.sourceforge.phpdt.internal.debug.core;
public class PHPDBGMod {
private int modNo;
+
private String modName;
public PHPDBGMod() {
}
public PHPDBGMod(int modNo, String modName) {
- this.modNo= modNo;
- this.modName= modName;
+ this.modNo = modNo;
+ this.modName = modName;
}
public int getNo() {
@@ -31,10 +32,10 @@ public class PHPDBGMod {
}
public void setNo(int modNo) {
- this.modNo= modNo;
+ this.modNo = modNo;
}
public void setName(String modName) {
- this.modName= modName;
+ this.modName = modName;
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java
index 4efdb76..8e080dd 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDebugCorePlugin.java
@@ -18,16 +18,19 @@ import org.osgi.framework.BundleContext;
* The main plugin class to be used in the desktop.
*/
public class PHPDebugCorePlugin extends AbstractUIPlugin {
- // The shared instance.
+ // The shared instance.
protected static PHPDebugCorePlugin plugin;
+
public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.core"; //$NON-NLS-1$
-
+
public static IWorkbenchPage getActivePage() {
return getDefault().internalGetActivePage();
}
+
public static Shell getActiveWorkbenchShell() {
return getActiveWorkbenchWindow().getShell();
}
+
public static IWorkbenchWindow getActiveWorkbenchWindow() {
return getDefault().getWorkbench().getActiveWorkbenchWindow();
}
@@ -36,19 +39,20 @@ public class PHPDebugCorePlugin extends AbstractUIPlugin {
* Returns the shared instance.
*/
public static PHPDebugCorePlugin getDefault() {
- return plugin;
+ return plugin;
}
-
+
public static String getFormattedMessage(String key, String arg) {
String text = getResourceString(key);
return java.text.MessageFormat.format(text, new Object[] { arg });
}
+
public static String getResourceString(String key) {
ResourceBundle bundle = plugin.getResourceBundle();
if (bundle != null) {
try {
String bundleString = bundle.getString(key);
- //return "$"+bundleString;
+ // return "$"+bundleString;
return bundleString;
} catch (MissingResourceException e) {
// default actions is to return key, which is OK
@@ -70,10 +74,11 @@ public class PHPDebugCorePlugin extends AbstractUIPlugin {
public static IWorkspace getWorkspace() {
return PHPeclipsePlugin.getWorkspace();
}
-
+
public static void log(int severity, String message) {
- Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null) ;
- PHPDebugCorePlugin.log(status) ;
+ Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message,
+ null);
+ PHPDebugCorePlugin.log(status);
}
public static void log(IStatus status) {
@@ -81,9 +86,12 @@ public class PHPDebugCorePlugin extends AbstractUIPlugin {
}
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPLaunchingPlugin.internalErrorOccurred", e)); //$NON-NLS-1$
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR,
+ "PHPLaunchingPlugin.internalErrorOccurred", e)); //$NON-NLS-1$
}
+
private ResourceBundle resourceBundle;
+
/**
* The constructor.
*/
@@ -91,30 +99,28 @@ public class PHPDebugCorePlugin extends AbstractUIPlugin {
super();
plugin = this;
try {
- resourceBundle =
- ResourceBundle.getBundle(
- "net.sourceforge.phpdt.internal.debug.core.debugresources"); //$NON-NLS-1$
+ resourceBundle = ResourceBundle
+ .getBundle("net.sourceforge.phpdt.internal.debug.core.debugresources"); //$NON-NLS-1$
} catch (MissingResourceException x) {
resourceBundle = null;
}
- }
-
+ }
+
public java.util.ResourceBundle getResourceBundle() {
return resourceBundle;
}
-
+
private IWorkbenchPage internalGetActivePage() {
return getWorkbench().getActiveWorkbenchWindow().getActivePage();
}
-
+
/**
* @see Plugin#shutdown()
*/
-/* public void shutdown() throws CoreException {
- plugin = null;
- super.shutdown();
- }
-*/
+ /*
+ * public void shutdown() throws CoreException { plugin = null;
+ * super.shutdown(); }
+ */
/**
* This method is called upon plug-in activation
*/
@@ -126,7 +132,7 @@ public class PHPDebugCorePlugin extends AbstractUIPlugin {
* This method is called when the plug-in is stopped
*/
public void stop(BundleContext context) throws Exception {
- plugin=null;
+ plugin = null;
super.stop(context);
}
}
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java
index 42de200..cb042db 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDegugCorePluginImages.java
@@ -19,130 +19,162 @@ import org.eclipse.swt.graphics.Image;
public class PHPDegugCorePluginImages {
- private final static URL BASE_URL =
- PHPDebugCorePlugin.getDefault().getBundle().getEntry("/");
+ private final static URL BASE_URL = PHPDebugCorePlugin.getDefault()
+ .getBundle().getEntry("/");
- private final static ImageRegistry PLUGIN_REGISTRY =
- PHPDebugCorePlugin.getDefault().getImageRegistry();
+ private final static ImageRegistry PLUGIN_REGISTRY = PHPDebugCorePlugin
+ .getDefault().getImageRegistry();
public final static String ICONS_PATH = "icons/"; //$NON-NLS-1$
private static final String PATH_OBJ = ICONS_PATH + "obj16/"; //$NON-NLS-1$
+
private static final String PATH_LCL = ICONS_PATH + "elcl16/"; //$NON-NLS-1$
+
private static final String PATH_LCL_DISABLED = ICONS_PATH + "dlcl16/"; //$NON-NLS-1$
+
private static final String PATH_OVR = ICONS_PATH + "ovr16/"; //$NON-NLS-1$
+
private static final String PATH_EVENTS = ICONS_PATH + "eview16/"; //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ERROR_ST_OBJ = create(PATH_OBJ,
+ "error_st_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_ERROR_STACK_OBJ = create(PATH_OBJ,
+ "error_stack.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_EXT_POINT_OBJ = create(PATH_OBJ,
+ "ext_point_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_EXT_POINTS_OBJ = create(PATH_OBJ,
+ "ext_points_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_EXTENSION_OBJ = create(PATH_OBJ,
+ "extension_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_EXTENSIONS_OBJ = create(PATH_OBJ,
+ "extensions_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_GENERIC_XML_OBJ = create(PATH_OBJ,
+ "generic_xml_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_INFO_ST_OBJ = create(PATH_OBJ,
+ "info_st_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_JAVA_LIB_OBJ = create(PATH_OBJ,
+ "java_lib_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ERROR_ST_OBJ =
- create(PATH_OBJ, "error_st_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_ERROR_STACK_OBJ =
- create(PATH_OBJ, "error_stack.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_EXT_POINT_OBJ =
- create(PATH_OBJ, "ext_point_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_EXT_POINTS_OBJ =
- create(PATH_OBJ, "ext_points_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_EXTENSION_OBJ =
- create(PATH_OBJ, "extension_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_EXTENSIONS_OBJ =
- create(PATH_OBJ, "extensions_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_GENERIC_XML_OBJ =
- create(PATH_OBJ, "generic_xml_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_INFO_ST_OBJ =
- create(PATH_OBJ, "info_st_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_JAVA_LIB_OBJ =
- create(PATH_OBJ, "java_lib_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_NATIVE_LIB_OBJ =
- create(PATH_OBJ, "native_lib_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OK_ST_OBJ =
- create(PATH_OBJ, "ok_st_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_PLUGIN_OBJ =
- create(PATH_OBJ, "plugin_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_REQ_PLUGIN_OBJ =
- create(PATH_OBJ, "req_plugin_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_REQ_PLUGINS_OBJ =
- create(PATH_OBJ, "req_plugins_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_RUNTIME_OBJ =
- create(PATH_OBJ, "runtime_obj.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_WARNING_ST_OBJ =
- create(PATH_OBJ, "warning_st_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_NATIVE_LIB_OBJ = create(PATH_OBJ,
+ "native_lib_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_OK_ST_OBJ = create(PATH_OBJ,
+ "ok_st_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_PLUGIN_OBJ = create(PATH_OBJ,
+ "plugin_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_REQ_PLUGIN_OBJ = create(PATH_OBJ,
+ "req_plugin_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_REQ_PLUGINS_OBJ = create(PATH_OBJ,
+ "req_plugins_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_RUNTIME_OBJ = create(PATH_OBJ,
+ "runtime_obj.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_WARNING_ST_OBJ = create(PATH_OBJ,
+ "warning_st_obj.gif"); //$NON-NLS-1$
/*
* Local tool bar image descriptors
*/
- public static final ImageDescriptor DESC_PROPERTIES =
- create(PATH_LCL, "properties.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OPEN_LOG =
- create(PATH_LCL, "open_log.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_OPEN_LOG_DISABLED =
- create(PATH_LCL_DISABLED, "open_log.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_PROPERTIES_DISABLED =
- create(PATH_LCL_DISABLED, "properties.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_REFRESH =
- create(PATH_LCL, "refresh.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_REFRESH_DISABLED =
- create(PATH_LCL_DISABLED, "refresh.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_CLEAR = create(PATH_LCL, "clear.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_CLEAR_DISABLED =
- create(PATH_LCL_DISABLED, "clear.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_READ_LOG =
- create(PATH_LCL, "restore_log.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_READ_LOG_DISABLED =
- create(PATH_LCL_DISABLED, "restore_log.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_REMOVE_LOG =
- create(PATH_LCL, "remove.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_REMOVE_LOG_DISABLED =
- create(PATH_LCL_DISABLED, "remove.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_FILTER =
- create(PATH_LCL, "filter_ps.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_FILTER_DISABLED =
- create(PATH_LCL_DISABLED, "filter_ps.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_EXPORT =
- create(PATH_LCL, "export_log.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_EXPORT_DISABLED =
- create(PATH_LCL_DISABLED, "export_log.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_IMPORT =
- create(PATH_LCL, "import_log.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_IMPORT_DISABLED =
- create(PATH_LCL_DISABLED, "import_log.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_COLLAPSE_ALL =
- create(PATH_LCL, "collapseall.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_HORIZONTAL_VIEW =
- create(PATH_LCL, "th_horizontal.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_HORIZONTAL_VIEW_DISABLED =
- create(PATH_LCL_DISABLED, "th_horizontal.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_VERTICAL_VIEW =
- create(PATH_LCL, "th_vertical.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_VERTICAL_VIEW_DISABLED =
- create(PATH_LCL_DISABLED, "th_vertical.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor DESC_HIDE_PANE =
- create(PATH_EVENTS, "hide_pane.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_PROPERTIES = create(PATH_LCL,
+ "properties.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_OPEN_LOG = create(PATH_LCL,
+ "open_log.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_OPEN_LOG_DISABLED = create(
+ PATH_LCL_DISABLED, "open_log.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_PROPERTIES_DISABLED = create(
+ PATH_LCL_DISABLED, "properties.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_REFRESH = create(PATH_LCL,
+ "refresh.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_REFRESH_DISABLED = create(
+ PATH_LCL_DISABLED, "refresh.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_CLEAR = create(PATH_LCL,
+ "clear.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_CLEAR_DISABLED = create(
+ PATH_LCL_DISABLED, "clear.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_READ_LOG = create(PATH_LCL,
+ "restore_log.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_READ_LOG_DISABLED = create(
+ PATH_LCL_DISABLED, "restore_log.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_REMOVE_LOG = create(PATH_LCL,
+ "remove.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_REMOVE_LOG_DISABLED = create(
+ PATH_LCL_DISABLED, "remove.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_FILTER = create(PATH_LCL,
+ "filter_ps.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_FILTER_DISABLED = create(
+ PATH_LCL_DISABLED, "filter_ps.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_EXPORT = create(PATH_LCL,
+ "export_log.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_EXPORT_DISABLED = create(
+ PATH_LCL_DISABLED, "export_log.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_IMPORT = create(PATH_LCL,
+ "import_log.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_IMPORT_DISABLED = create(
+ PATH_LCL_DISABLED, "import_log.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_COLLAPSE_ALL = create(PATH_LCL,
+ "collapseall.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_HORIZONTAL_VIEW = create(PATH_LCL,
+ "th_horizontal.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_HORIZONTAL_VIEW_DISABLED = create(
+ PATH_LCL_DISABLED, "th_horizontal.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_VERTICAL_VIEW = create(PATH_LCL,
+ "th_vertical.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_VERTICAL_VIEW_DISABLED = create(
+ PATH_LCL_DISABLED, "th_vertical.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_HIDE_PANE = create(PATH_EVENTS,
+ "hide_pane.gif"); //$NON-NLS-1$
/*
* Event Details
*/
- public static final ImageDescriptor DESC_PREV_EVENT =
- create(PATH_EVENTS, "event_prev.gif"); //$NON-NLS-1$
- public static final ImageDescriptor DESC_NEXT_EVENT =
- create(PATH_EVENTS, "event_next.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_PREV_EVENT = create(PATH_EVENTS,
+ "event_prev.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor DESC_NEXT_EVENT = create(PATH_EVENTS,
+ "event_next.gif"); //$NON-NLS-1$
+
/*
* Overlays
*/
- public static final ImageDescriptor DESC_RUN_CO =
- create(PATH_OVR, "run_co.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_RUN_CO = create(PATH_OVR,
+ "run_co.gif"); //$NON-NLS-1$
private static ImageDescriptor create(String prefix, String name) {
return ImageDescriptor.createFromURL(makeIconURL(prefix, name));
@@ -151,6 +183,7 @@ public class PHPDegugCorePluginImages {
public static Image get(String key) {
return PLUGIN_REGISTRY.get(key);
}
+
private static URL makeIconURL(String prefix, String name) {
String path = prefix + name;
URL url = null;
@@ -161,6 +194,7 @@ public class PHPDegugCorePluginImages {
}
return url;
}
+
public static Image manage(String key, ImageDescriptor desc) {
Image image = desc.createImage();
PLUGIN_REGISTRY.put(key, image);
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/SocketUtil.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/SocketUtil.java
index dac0f05..39f97f5 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/SocketUtil.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/SocketUtil.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
+ 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
- Vicente Fernando - www.alfersoft.com.ar
-**********************************************************************/
+ Contributors:
+ IBM Corporation - Initial implementation
+ Vicente Fernando - www.alfersoft.com.ar
+ **********************************************************************/
package net.sourceforge.phpdt.internal.debug.core;
import java.io.IOException;
@@ -20,25 +20,30 @@ import java.util.Random;
* Utility class to find a port to debug on.
*/
public class SocketUtil {
- private static final Random fgRandom= new Random(System.currentTimeMillis());
-
+ private static final Random fgRandom = new Random(System
+ .currentTimeMillis());
+
/**
* Returns a free port number on the specified host within the given range,
* or -1 if none found.
*
- * @param host name or IP addres of host on which to find a free port
- * @param searchFrom the port number from which to start searching
- * @param searchTo the port number at which to stop searching
+ * @param host
+ * name or IP addres of host on which to find a free port
+ * @param searchFrom
+ * the port number from which to start searching
+ * @param searchTo
+ * the port number at which to stop searching
* @return a free port in the specified range, or -1 of none found
*/
- public static int findUnusedLocalPort(String host, int searchFrom, int searchTo) {
+ public static int findUnusedLocalPort(String host, int searchFrom,
+ int searchTo) {
- // First look at the five first ports starting on searchFrom
- for (int i= searchFrom; i <= searchFrom + 5; i++) {
- Socket s= null;
- int port= i;
+ // First look at the five first ports starting on searchFrom
+ for (int i = searchFrom; i <= searchFrom + 5; i++) {
+ Socket s = null;
+ int port = i;
try {
- s= new Socket(host, port);
+ s = new Socket(host, port);
} catch (ConnectException e) {
return port;
} catch (IOException e) {
@@ -52,11 +57,11 @@ public class SocketUtil {
}
}
// No free port found then look at 5 random ports numbers
- for (int i= 0; i < 5; i++) {
- Socket s= null;
- int port= getRandomPort(searchFrom, searchTo);
+ for (int i = 0; i < 5; i++) {
+ Socket s = null;
+ int port = getRandomPort(searchFrom, searchTo);
try {
- s= new Socket(host, port);
+ s = new Socket(host, port);
} catch (ConnectException e) {
return port;
} catch (IOException e) {
@@ -71,8 +76,8 @@ public class SocketUtil {
}
return -1;
}
-
+
private static int getRandomPort(int low, int high) {
- return (int)(fgRandom.nextFloat() * (high-low)) + low;
+ return (int) (fgRandom.nextFloat() * (high - low)) + low;
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPBreakpoint.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPBreakpoint.java
index 8d4b084..a434a36 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPBreakpoint.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPBreakpoint.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
- Vicente Fernando - www.alfersoft.com.ar
-**********************************************************************/
+ 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
+ Vicente Fernando - www.alfersoft.com.ar
+ **********************************************************************/
package net.sourceforge.phpdt.internal.debug.core.breakpoints;
import net.sourceforge.phpdt.internal.debug.core.PHPDebugCorePlugin;
@@ -23,50 +23,54 @@ import org.eclipse.debug.core.model.Breakpoint;
import org.eclipse.debug.core.model.IBreakpoint;
/**
- * A breakpoint is capable of suspending the execution of a
- * program at a specific location when a program is running
- * in debug mode. Each breakpoint has an associated marker which
- * stores and persists all attributes associated with a breakpoint.
+ * A breakpoint is capable of suspending the execution of a program at a
+ * specific location when a program is running in debug mode. Each breakpoint
+ * has an associated marker which stores and persists all attributes associated
+ * with a breakpoint.
*
- *
* "org.eclipse.debug.core.breakpoints"
"org.eclipse.debug.core.breakpoints"
markerType
- * attribute defined by the breakpoint extension corresponds to the
- * type of the marker definition.
+ * For example, following is a definition of corresponding breakpoint and
+ * breakpoint marker definitions. Note that the markerType
+ * attribute defined by the breakpoint extension corresponds to the type of the
+ * marker definition.
+ *
*
- * <extension point="org.eclipse.debug.core.breakpoints">
- * <breakpoint
- * id="com.example.Breakpoint"
- * class="com.example.Breakpoint"
- * markerType="com.example.BreakpointMarker">
- * </breakpoint>
- * </extension>
- * <extension point="org.eclipse.core.resources.markers">
- * <marker
- * id="com.example.BreakpointMarker"
- * super type="org.eclipse.debug.core.breakpointMarker"
- * attribute name ="exampleAttribute">
- * </marker>
- * </extension>
+ * <extension point="org.eclipse.debug.core.breakpoints">
+ * <breakpoint
+ * id="com.example.Breakpoint"
+ * class="com.example.Breakpoint"
+ * markerType="com.example.BreakpointMarker">
+ * </breakpoint>
+ * </extension>
+ * <extension point="org.eclipse.core.resources.markers">
+ * <marker
+ * id="com.example.BreakpointMarker"
+ * super type="org.eclipse.debug.core.breakpointMarker"
+ * attribute name ="exampleAttribute">
+ * </marker>
+ * </extension>
*
+ *
* "org.eclipse.debug.core.breakpointMarker"
, and
- * instantiating the class defined by the class
attribute
- * on the associated breakpoint extension. The method setMarker
- * is then called to associate a marker with the breakpoint.
+ * The breakpoint manager instantiates persisted breakpoints by traversing all
+ * markers that are a subtype of
+ * "org.eclipse.debug.core.breakpointMarker"
, and instantiating
+ * the class defined by the class
attribute on the associated
+ * breakpoint extension. The method setMarker
is then called to
+ * associate a marker with the breakpoint.
* PERSISTED
attribute for selective persistence of breakpoints
+ * Breakpoints may or may not be registered with the breakpoint manager, and are
+ * persisted and restored as such. Since marker definitions only allow all or
+ * none of a specific marker type to be persisted, breakpoints define a
+ * PERSISTED
attribute for selective persistence of breakpoints
* of the same type.
* "net.sourceforge.phpeclipse.debug.hitCount"
). This attribute is stored as an
- * int
.
+ * Breakpoint attribute storing a breakpoint's hit count value (value
+ * "net.sourceforge.phpeclipse.debug.hitCount"
). This
+ * attribute is stored as an int
.
*
- * For DBG the hit count is really a skip count.
- * Explanation: A hit count of e.g. 4 would break on the fourth occurence of the breakpoint.
- * A skip count means skip the first four occurences of the breakpoint, and break on the fifth occurence.
+ * For DBG the hit count is really a skip count. Explanation: A hit count of
+ * e.g. 4 would break on the fourth occurence of the breakpoint. A skip
+ * count means skip the first four occurences of the breakpoint, and break
+ * on the fifth occurence.
*/
protected static final String HIT_COUNT = "net.sourceforge.phpeclipse.debug.hitCount"; //$NON-NLS-1$
/**
- * Breakpoint attribute storing a breakpoint's changeID.
- * This is used for checking whether the breakpoint properties menu was finished with
- * a OK-button. Which means a possible change of breakpoint condition or skip count.
- * This is necessary because in method breakpointChanged in class PHPDebugTarget we need to know,
- * whether the breakpoint has changed or not (breakpointChanged is called also when
- * a PHP source file is modified and saved).
+ * Breakpoint attribute storing a breakpoint's changeID. This is used for
+ * checking whether the breakpoint properties menu was finished with a
+ * OK-button. Which means a possible change of breakpoint condition or skip
+ * count. This is necessary because in method breakpointChanged in class
+ * PHPDebugTarget we need to know, whether the breakpoint has changed or not
+ * (breakpointChanged is called also when a PHP source file is modified and
+ * saved).
*/
protected static final String CHANGE_ID = "net.sourceforge.phpeclipse.debug.changeID"; //$NON-NLS-1$
/**
- * Breakpoint attribute storing a breakpoint's condition
- * (value "net.sourceforge.phpeclipse.debug.condition"
). This attribute is stored as an
- * string
.
+ * Breakpoint attribute storing a breakpoint's condition (value
+ * "net.sourceforge.phpeclipse.debug.condition"
). This
+ * attribute is stored as an string
.
*/
protected static final String CONDITION = "net.sourceforge.phpeclipse.debug.condition"; //$NON-NLS-1$
/**
- * Breakpoint attribute storing whether a breakpoint's condition is enabled or not
- * (value "net.sourceforge.phpeclipse.debug.conditionEnabled"
). This attribute is stored as an
- * boolean
.
+ * Breakpoint attribute storing whether a breakpoint's condition is enabled
+ * or not (value
+ * "net.sourceforge.phpeclipse.debug.conditionEnabled"
).
+ * This attribute is stored as an boolean
.
*/
protected static final String CONDITION_ENABLED = "net.sourceforge.phpeclipse.debug.conditionEnabled"; //$NON-NLS-1$
/**
- * Breakpoint attribute storing the fully qualified name of the type
- * this breakpoint is located in.
- * (value "net.sourceforge.phpeclipse.debug.typeName"
). This attribute is a String
.
+ * Breakpoint attribute storing the fully qualified name of the type this
+ * breakpoint is located in. (value
+ * "net.sourceforge.phpeclipse.debug.typeName"
). This
+ * attribute is a String
.
*/
protected static final String TYPE_NAME = "net.sourceforge.phpeclipse.debug.typeName"; //$NON-NLS-1$
/**
- * Root breakpoint marker type
- * (value "org.eclipse.debug.core.breakpoint"
).
+ * Root breakpoint marker type (value
+ * "org.eclipse.debug.core.breakpoint"
).
*/
- public static final String BREAKPOINT_MARKER = DebugPlugin.getUniqueIdentifier() + ".breakpointMarker"; //$NON-NLS-1$
-
+ public static final String BREAKPOINT_MARKER = DebugPlugin
+ .getUniqueIdentifier()
+ + ".breakpointMarker"; //$NON-NLS-1$
+
/**
- * Line breakpoint marker type
- * (value "org.eclipse.debug.core.lineBreakpoint"
).
+ * Line breakpoint marker type (value
+ * "org.eclipse.debug.core.lineBreakpoint"
).
*/
- public static final String LINE_BREAKPOINT_MARKER = DebugPlugin.getUniqueIdentifier() + ".lineBreakpointMarker"; //$NON-NLS-1$
-
+ public static final String LINE_BREAKPOINT_MARKER = DebugPlugin
+ .getUniqueIdentifier()
+ + ".lineBreakpointMarker"; //$NON-NLS-1$
+
/**
- * Enabled breakpoint marker attribute (value "org.eclipse.debug.core.enabled"
).
- * The attribute is a boolean
corresponding to the
- * enabled state of a breakpoint.
- *
+ * Enabled breakpoint marker attribute (value
+ * "org.eclipse.debug.core.enabled"
). The attribute is a
+ * boolean
corresponding to the enabled state of a
+ * breakpoint.
+ *
* @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
*/
- public static final String ENABLED= "org.eclipse.debug.core.enabled"; //$NON-NLS-1$
-
+ public static final String ENABLED = "org.eclipse.debug.core.enabled"; //$NON-NLS-1$
+
/**
- * Debug model identifier breakpoint marker attribute (value "org.eclipse.debug.core.id"
).
- * The attribute is a String
corresponding to the
- * identifier of the debug model a breakpoint is associated with.
+ * Debug model identifier breakpoint marker attribute (value
+ * "org.eclipse.debug.core.id"
). The attribute is a
+ * String
corresponding to the identifier of the debug model
+ * a breakpoint is associated with.
*/
- public static final String ID= "org.eclipse.debug.core.id"; //$NON-NLS-1$
-
+ public static final String ID = "org.eclipse.debug.core.id"; //$NON-NLS-1$
+
/**
- * Registered breakpoint marker attribute (value "org.eclipse.debug.core.registered"
).
- * The attribute is a boolean
corresponding to
- * whether a breakpoint has been registered with the breakpoint manager.
- *
+ * Registered breakpoint marker attribute (value
+ * "org.eclipse.debug.core.registered"
). The attribute is a
+ * boolean
corresponding to whether a breakpoint has been
+ * registered with the breakpoint manager.
+ *
* @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
*/
- public static final String REGISTERED= "org.eclipse.debug.core.registered"; //$NON-NLS-1$
-
+ public static final String REGISTERED = "org.eclipse.debug.core.registered"; //$NON-NLS-1$
+
/**
- * Persisted breakpoint marker attribute (value "org.eclipse.debug.core.persisted"
).
- * The attribute is a boolean
corresponding to
- * whether a breakpoint is to be persisted accross workspace
- * invocations.
- *
+ * Persisted breakpoint marker attribute (value
+ * "org.eclipse.debug.core.persisted"
). The attribute is a
+ * boolean
corresponding to whether a breakpoint is to be
+ * persisted accross workspace invocations.
+ *
* @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
*/
- public static final String PERSISTED= "org.eclipse.debug.core.persisted"; //$NON-NLS-1$
+ public static final String PERSISTED = "org.eclipse.debug.core.persisted"; //$NON-NLS-1$
- private int DBGBpNo=0;
+ private int DBGBpNo = 0;
public PHPBreakpoint() {
- }
+ }
/**
* @see IBreakpoint#setMarker(IMarker)
@@ -175,10 +190,10 @@ public abstract class PHPBreakpoint extends Breakpoint implements IBreakpoint {
public void setMarker(IMarker marker) throws CoreException {
super.setMarker(marker);
}
-
+
/**
- * Add this breakpoint to the breakpoint manager,
- * or sets it as unregistered.
+ * Add this breakpoint to the breakpoint manager, or sets it as
+ * unregistered.
*/
protected void register(boolean register) throws CoreException {
if (register) {
@@ -187,7 +202,7 @@ public abstract class PHPBreakpoint extends Breakpoint implements IBreakpoint {
setRegistered(false);
}
}
-
+
/**
* Execute the given workspace runnable
*/
@@ -196,7 +211,7 @@ public abstract class PHPBreakpoint extends Breakpoint implements IBreakpoint {
ResourcesPlugin.getWorkspace().run(wr, null);
} catch (CoreException e) {
throw new DebugException(e.getStatus());
- }
+ }
}
/**
@@ -205,26 +220,26 @@ public abstract class PHPBreakpoint extends Breakpoint implements IBreakpoint {
public String getModelIdentifier() {
return PHPDebugCorePlugin.getUniqueIdentifier();
}
-
+
public void setDBGBpNo(int bpNo) {
this.DBGBpNo = bpNo;
}
-
+
public int getDBGBpNo() {
return this.DBGBpNo;
}
-
- public int getHitCount () throws CoreException {
- return getMarker ().getAttribute (HIT_COUNT, -1);
+
+ public int getHitCount() throws CoreException {
+ return getMarker().getAttribute(HIT_COUNT, -1);
}
-
- public void setHitCount (int hitCount) throws CoreException {
+
+ public void setHitCount(int hitCount) throws CoreException {
if (hitCount > 0) {
- if (!isEnabled ()) {
- getMarker ().setAttribute (ENABLED, true);
+ if (!isEnabled()) {
+ getMarker().setAttribute(ENABLED, true);
}
}
-
- getMarker ().setAttribute (HIT_COUNT, hitCount);
+
+ getMarker().setAttribute(HIT_COUNT, hitCount);
}
}
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPLineBreakpoint.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPLineBreakpoint.java
index 3d5ac2b..3196ff8 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPLineBreakpoint.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/breakpoints/PHPLineBreakpoint.java
@@ -1,13 +1,13 @@
/**********************************************************************
-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:
- Vicente Fernando - Initial implementation - www.alfersoft.com.ar
-**********************************************************************/
+ 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:
+ Vicente Fernando - Initial implementation - www.alfersoft.com.ar
+ **********************************************************************/
package net.sourceforge.phpdt.internal.debug.core.breakpoints;
import java.util.Map;
@@ -24,65 +24,67 @@ import org.eclipse.debug.core.model.ILineBreakpoint;
/**
* A breakpoint that can be located at a specific line of source code.
*/
-public class PHPLineBreakpoint extends PHPBreakpoint implements IBreakpoint, ILineBreakpoint {
+public class PHPLineBreakpoint extends PHPBreakpoint implements IBreakpoint,
+ ILineBreakpoint {
private static final String PHP_LINE_BREAKPOINT = "net.sourceforge.phpeclipse.debug.core.phpLineBreakpointMarker"; //$NON-NLS-1$
public PHPLineBreakpoint() {
}
- public PHPLineBreakpoint(IResource resource, int lineNumber, int charStart, int charEnd, int hitCount, boolean add, Map attributes) throws DebugException {
- this(resource, lineNumber, charStart, charEnd, hitCount, add, attributes, PHP_LINE_BREAKPOINT);
+ public PHPLineBreakpoint(IResource resource, int lineNumber, int charStart,
+ int charEnd, int hitCount, boolean add, Map attributes)
+ throws DebugException {
+ this(resource, lineNumber, charStart, charEnd, hitCount, add,
+ attributes, PHP_LINE_BREAKPOINT);
}
-
- public PHPLineBreakpoint(IResource resource, int lineNumber, int hitCount, boolean add, Map attributes) throws DebugException {
- this(resource, lineNumber, -1, -1, hitCount, add, attributes, PHP_LINE_BREAKPOINT);
+
+ public PHPLineBreakpoint(IResource resource, int lineNumber, int hitCount,
+ boolean add, Map attributes) throws DebugException {
+ this(resource, lineNumber, -1, -1, hitCount, add, attributes,
+ PHP_LINE_BREAKPOINT);
}
-
- protected PHPLineBreakpoint (final IResource resource,
- final int lineNumber,
- final int charStart,
- final int charEnd,
- final int hitCount,
- final boolean add,
- final Map attributes,
- final String markerType) throws DebugException {
- IWorkspaceRunnable wr= new IWorkspaceRunnable() {
+ protected PHPLineBreakpoint(final IResource resource, final int lineNumber,
+ final int charStart, final int charEnd, final int hitCount,
+ final boolean add, final Map attributes, final String markerType)
+ throws DebugException {
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
-
+
// create the marker
setMarker(resource.createMarker(markerType));
// add attributes
- addLineBreakpointAttributes(attributes, getModelIdentifier(), true, lineNumber, charStart, charEnd, hitCount);
+ addLineBreakpointAttributes(attributes, getModelIdentifier(),
+ true, lineNumber, charStart, charEnd, hitCount);
// set attributes
ensureMarker().setAttributes(attributes);
-
+
// add to breakpoint manager if requested
- register(add);
+ register(add);
}
};
run(wr);
}
-
- public void addLineBreakpointAttributes(Map attributes, String modelIdentifier, boolean enabled, int lineNumber, int charStart, int charEnd, int hitCount) {
+ public void addLineBreakpointAttributes(Map attributes,
+ String modelIdentifier, boolean enabled, int lineNumber,
+ int charStart, int charEnd, int hitCount) {
attributes.put(IBreakpoint.ID, modelIdentifier);
attributes.put(IBreakpoint.ENABLED, new Boolean(enabled));
attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
- if (charStart!=-1)
- {
+ if (charStart != -1) {
attributes.put(IMarker.CHAR_START, new Integer(charStart));
attributes.put(IMarker.CHAR_END, new Integer(charEnd));
}
- attributes.put(TYPE_NAME, "typeName");
+ attributes.put(TYPE_NAME, "typeName");
attributes.put(PHPBreakpoint.HIT_COUNT, new Integer(hitCount));
attributes.put(PHPBreakpoint.CONDITION, new String(""));
attributes.put(PHPBreakpoint.CONDITION_ENABLED, new Boolean(false));
attributes.put(PHPBreakpoint.CHANGE_ID, new Integer(0));
- }
+ }
/**
* @see ILineBreakpoint#getLineNumber()
@@ -104,39 +106,39 @@ public class PHPLineBreakpoint extends PHPBreakpoint implements IBreakpoint, ILi
public int getCharEnd() throws CoreException {
return ensureMarker().getAttribute(IMarker.CHAR_END, -1);
}
-
+
/**
* Returns the type of marker associated with Java line breakpoints
*/
public static String getMarkerType() {
return PHP_LINE_BREAKPOINT;
}
-
+
public int getHitCount() throws CoreException {
return ensureMarker().getAttribute(PHPBreakpoint.HIT_COUNT, 1);
}
-
+
public int getChangeID() throws CoreException {
return ensureMarker().getAttribute(CHANGE_ID, 1);
}
-
+
public void setChangeID(int changeID) throws CoreException {
ensureMarker().setAttribute(CHANGE_ID, changeID);
}
- public String getCondition () throws CoreException {
- return ensureMarker ().getAttribute (CONDITION, "");
+ public String getCondition() throws CoreException {
+ return ensureMarker().getAttribute(CONDITION, "");
}
-
- public void setCondition (String condition) throws CoreException {
- ensureMarker ().setAttribute (CONDITION, condition);
+
+ public void setCondition(String condition) throws CoreException {
+ ensureMarker().setAttribute(CONDITION, condition);
}
- public void setConditionEnabled (boolean enabled) throws CoreException {
- ensureMarker ().setAttribute (CONDITION_ENABLED, enabled);
+ public void setConditionEnabled(boolean enabled) throws CoreException {
+ ensureMarker().setAttribute(CONDITION_ENABLED, enabled);
}
- public boolean isConditionEnabled () throws CoreException {
- return ensureMarker ().getAttribute (CONDITION_ENABLED, false);
+ public boolean isConditionEnabled() throws CoreException {
+ return ensureMarker().getAttribute(CONDITION_ENABLED, false);
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/IPHPDebugTarget.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/IPHPDebugTarget.java
index 6bcd61c..597fd5c 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/IPHPDebugTarget.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/IPHPDebugTarget.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
- Vicente Fernando - www.alfersoft.com.ar
-**********************************************************************/
+ 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
+ Vicente Fernando - www.alfersoft.com.ar
+ **********************************************************************/
package net.sourceforge.phpdt.internal.debug.core.model;
import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy;
@@ -18,7 +18,10 @@ import org.eclipse.debug.core.model.IDebugTarget;
public interface IPHPDebugTarget extends IDebugTarget {
public final static String MODEL_IDENTIFIER = "net.sourceforge.phpdt.debug.core";
+
public void terminate();
+
public void setPHPDBGProxy(PHPDBGProxy phpDBGProxy);
+
public void addThread(PHPThread phpThread);
}
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugElement.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugElement.java
index e66ac6d..5cc42ea 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugElement.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPDebugElement.java
@@ -24,42 +24,54 @@ import org.eclipse.debug.core.model.IDebugTarget;
/**
* Common function of PHP debug model elements
*/
-public abstract class PHPDebugElement extends PlatformObject implements IDebugElement {
+public abstract class PHPDebugElement extends PlatformObject implements
+ IDebugElement {
// containing target
- protected PHPDebugTarget fTarget;
+ protected PHPDebugTarget fTarget;
/**
- * Constructs a new debug element contained in the given
- * debug target.
- *
- * @param target debug target (PHP VM)
+ * Constructs a new debug element contained in the given debug target.
+ *
+ * @param target
+ * debug target (PHP VM)
*/
- public PHPDebugElement(PHPDebugTarget target) {
+ public PHPDebugElement(PHPDebugTarget target) {
fTarget = target;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
*/
public String getModelIdentifier() {
return null;
- // return PHPDebugCorePlugin.PLUGIN_ID;
- // return IPDAConstants.ID_PDA_DEBUG_MODEL;
+ // return PHPDebugCorePlugin.PLUGIN_ID;
+ // return IPDAConstants.ID_PDA_DEBUG_MODEL;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
*/
public IDebugTarget getDebugTarget() {
return fTarget;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
*/
public ILaunch getLaunch() {
return getDebugTarget().getLaunch();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter(Class adapter) {
@@ -70,17 +82,21 @@ public abstract class PHPDebugElement extends PlatformObject implements IDebugEl
}
protected void abort(String message, Throwable e) throws DebugException {
- throw new DebugException(new Status(IStatus.ERROR, null /*DebugExamplesPlugin.getDefault().getDescriptor().getUniqueIdentifier()*/,
- DebugPlugin.INTERNAL_ERROR, message, e));
+ throw new DebugException(
+ new Status(
+ IStatus.ERROR,
+ null /* DebugExamplesPlugin.getDefault().getDescriptor().getUniqueIdentifier() */,
+ DebugPlugin.INTERNAL_ERROR, message, e));
}
/**
* Fires a debug event
- *
- * @param event the event to be fired
+ *
+ * @param event
+ * the event to be fired
*/
protected void fireEvent(DebugEvent event) {
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { event });
}
/**
@@ -91,20 +107,22 @@ public abstract class PHPDebugElement extends PlatformObject implements IDebugEl
}
/**
- * Fires a RESUME
event for this element with
- * the given detail.
- *
- * @param detail event detail code
+ * Fires a RESUME
event for this element with the given
+ * detail.
+ *
+ * @param detail
+ * event detail code
*/
public void fireResumeEvent(int detail) {
fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail));
}
/**
- * Fires a SUSPEND
event for this element with
- * the given detail.
- *
- * @param detail event detail code
+ * Fires a SUSPEND
event for this element with the given
+ * detail.
+ *
+ * @param detail
+ * event detail code
*/
public void fireSuspendEvent(int detail) {
fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail));
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPExpression.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPExpression.java
index 9ca57f1..80b40dc 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPExpression.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPExpression.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
- Vicente Fernando - www.alfersoft.com.ar
-**********************************************************************/
+ 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
+ Vicente Fernando - www.alfersoft.com.ar
+ **********************************************************************/
package net.sourceforge.phpdt.internal.debug.core.model;
import org.eclipse.debug.core.ILaunch;
@@ -18,41 +18,42 @@ import org.eclipse.debug.core.model.IValue;
public class PHPExpression implements IExpression {
- private PHPVariable inspectionResult;
- private String expression;
-
- public PHPExpression(String expression, PHPVariable inspectionResult) {
- this.inspectionResult = inspectionResult;
- this.expression = expression;
+ private PHPVariable inspectionResult;
- }
+ private String expression;
- public String getExpressionText() {
- return expression;
- }
+ public PHPExpression(String expression, PHPVariable inspectionResult) {
+ this.inspectionResult = inspectionResult;
+ this.expression = expression;
- public IValue getValue() {
- return inspectionResult.getValue();
- }
+ }
- public IDebugTarget getDebugTarget() {
- return inspectionResult.getDebugTarget();
- }
+ public String getExpressionText() {
+ return expression;
+ }
- public void dispose() {
+ public IValue getValue() {
+ return inspectionResult.getValue();
+ }
- }
+ public IDebugTarget getDebugTarget() {
+ return inspectionResult.getDebugTarget();
+ }
- public String getModelIdentifier() {
- return this.getDebugTarget().getModelIdentifier();
- }
+ public void dispose() {
- public ILaunch getLaunch() {
- return this.getDebugTarget().getLaunch();
- }
+ }
- public Object getAdapter(Class arg0) {
- return null;
- }
+ public String getModelIdentifier() {
+ return this.getDebugTarget().getModelIdentifier();
+ }
+
+ public ILaunch getLaunch() {
+ return this.getDebugTarget().getLaunch();
+ }
+
+ public Object getAdapter(Class arg0) {
+ return null;
+ }
}
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPVariableComparator.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPVariableComparator.java
index 1cd86e3..b0d152e 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPVariableComparator.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPVariableComparator.java
@@ -5,8 +5,8 @@ import java.util.Comparator;
public class PHPVariableComparator implements Comparator {
public int compare(Object arg0, Object arg1) {
- PHPVariable left=(PHPVariable) arg0;
- PHPVariable right=(PHPVariable) arg1;
+ PHPVariable left = (PHPVariable) arg0;
+ PHPVariable right = (PHPVariable) arg1;
return left.getName().compareTo(right.getName());
}
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPEvalException.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPEvalException.java
index cfe1108..52f02be 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPEvalException.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPEvalException.java
@@ -2,9 +2,8 @@ package net.sourceforge.phpdt.internal.debug.core.watch;
public class PHPEvalException extends Exception {
- public PHPEvalException(String s)
- {
- super(s);
- }
+ public PHPEvalException(String s) {
+ super(s);
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionDelegate.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionDelegate.java
index e37deff..1f38d53 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionDelegate.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionDelegate.java
@@ -11,40 +11,40 @@ import org.eclipse.debug.core.model.IWatchExpressionListener;
import org.eclipse.debug.core.model.IWatchExpressionResult;
/**
- *
+ *
*/
public class PHPWatchExpressionDelegate implements IWatchExpressionDelegate {
- public void evaluateExpression (String expression, IDebugElement context, IWatchExpressionListener listener) {
- IWatchExpressionResult x;
- PHPDBGProxy dbg;
- PHPStackFrame s;
+ public void evaluateExpression(String expression, IDebugElement context,
+ IWatchExpressionListener listener) {
+ IWatchExpressionResult x;
+ PHPDBGProxy dbg;
+ PHPStackFrame s;
- dbg = ((PHPDebugTarget) context.getDebugTarget ()).getPHPDBGProxy ();
- s = null;
+ dbg = ((PHPDebugTarget) context.getDebugTarget()).getPHPDBGProxy();
+ s = null;
if (context instanceof PHPStackFrame) {
s = (PHPStackFrame) context;
}
try {
- PHPVariable result[] = dbg.eval (s, expression);
+ PHPVariable result[] = dbg.eval(s, expression);
if (result.length == 0) {
- x = new PHPWatchExpressionResult (expression, null, null);
+ x = new PHPWatchExpressionResult(expression, null, null);
+ } else {
+ x = new PHPWatchExpressionResult(expression, result[0]
+ .getValue(), null);
}
- else {
- x = new PHPWatchExpressionResult (expression, result[0].getValue (), null);
- }
- }
- catch (Exception e) {
+ } catch (Exception e) {
String[] s1;
- s1 = new String[1];
- s1[0] = e.toString ();
- x = new PHPWatchExpressionResult (expression, null, s1);
+ s1 = new String[1];
+ s1[0] = e.toString();
+ x = new PHPWatchExpressionResult(expression, null, s1);
}
- listener.watchEvaluationFinished (x);
+ listener.watchEvaluationFinished(x);
}
}
diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionResult.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionResult.java
index 14b6c19..2d01e1c 100644
--- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionResult.java
+++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionResult.java
@@ -6,35 +6,36 @@ import org.eclipse.debug.core.model.IWatchExpressionResult;
public class PHPWatchExpressionResult implements IWatchExpressionResult {
- String text;
- IValue result;
- String[] err;
-
- public PHPWatchExpressionResult(String t,IValue v,String[] e)
- {
- text=t;
- result=v;
- err=e;
- }
-
- public IValue getValue() {
- return result;
- }
-
- public boolean hasErrors() {
- return err != null;
- }
-
- public String[] getErrorMessages() {
- return err;
- }
-
- public String getExpressionText() {
- return text;
- }
-
- public DebugException getException() {
- return null;
- }
+ String text;
+
+ IValue result;
+
+ String[] err;
+
+ public PHPWatchExpressionResult(String t, IValue v, String[] e) {
+ text = t;
+ result = v;
+ err = e;
+ }
+
+ public IValue getValue() {
+ return result;
+ }
+
+ public boolean hasErrors() {
+ return err != null;
+ }
+
+ public String[] getErrorMessages() {
+ return err;
+ }
+
+ public String getExpressionText() {
+ return text;
+ }
+
+ public DebugException getException() {
+ return null;
+ }
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiConstants.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiConstants.java
index d2a0475..7f6d137 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiConstants.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiConstants.java
@@ -3,7 +3,9 @@ package net.sourceforge.phpdt.debug.ui;
import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
public interface PHPDebugUiConstants {
- public static final String DEFAULT_WORKING_DIRECTORY = PHPDebugUiPlugin.getWorkspace().getRoot().getLocation().toString();
+ public static final String DEFAULT_WORKING_DIRECTORY = PHPDebugUiPlugin
+ .getWorkspace().getRoot().getLocation().toString();
- public static final String PREFERENCE_KEYWORDS = PHPDebugUiPlugin.PLUGIN_ID + ".preference_keywords";
+ public static final String PREFERENCE_KEYWORDS = PHPDebugUiPlugin.PLUGIN_ID
+ + ".preference_keywords";
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiImages.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiImages.java
index 1cd7a0b..26bffa7 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiImages.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/debug/ui/PHPDebugUiImages.java
@@ -13,36 +13,38 @@ import org.eclipse.swt.graphics.Image;
public class PHPDebugUiImages {
protected static final String NAME_PREFIX = "net.sourceforge.phpdt.debug.ui.";
+
protected static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
+
protected static URL iconBaseURL;
-
- static {
- iconBaseURL= PHPDebugUiPlugin.getDefault().getBundle().getEntry("/icons/"); //$NON-NLS-1$
- }
-/*
static {
- String pathSuffix = "icons/";
- try {
- iconBaseURL = new URL(PHPDebugUiPlugin.getDefault().getDescriptor().getInstallURL(), pathSuffix);
- } catch (MalformedURLException e) {
- PHPDebugUiPlugin.log(e);
- }
+ iconBaseURL = PHPDebugUiPlugin.getDefault().getBundle().getEntry(
+ "/icons/"); //$NON-NLS-1$
}
-*/
+
+ /*
+ * static { String pathSuffix = "icons/"; try { iconBaseURL = new
+ * URL(PHPDebugUiPlugin.getDefault().getDescriptor().getInstallURL(),
+ * pathSuffix); } catch (MalformedURLException e) { PHPDebugUiPlugin.log(e); } }
+ */
protected static final ImageRegistry IMAGE_REGISTRY = new ImageRegistry();
protected static final String CTOOL_PREFIX = "ctool16";
+
protected static final String EVIEW_PREFIX = "eview16";
- public static final String IMG_EVIEW_ARGUMENTS_TAB = NAME_PREFIX + "arguments_tab.gif";
+ public static final String IMG_EVIEW_ARGUMENTS_TAB = NAME_PREFIX
+ + "arguments_tab.gif";
- public static final ImageDescriptor DESC_EVIEW_ARGUMENTS_TAB = createManaged(EVIEW_PREFIX, IMG_EVIEW_ARGUMENTS_TAB);
+ public static final ImageDescriptor DESC_EVIEW_ARGUMENTS_TAB = createManaged(
+ EVIEW_PREFIX, IMG_EVIEW_ARGUMENTS_TAB);
/**
* Returns the image managed under the given key in this registry.
*
- * @param key the image's key
+ * @param key
+ * the image's key
* @return the image managed under the given key
*/
public static Image get(String key) {
@@ -50,16 +52,16 @@ public class PHPDebugUiImages {
}
/**
- * Sets the three image descriptors for enabled, disabled, and hovered to an action. The actions
- * are retrieved from the *tool16 folders.
+ * Sets the three image descriptors for enabled, disabled, and hovered to an
+ * action. The actions are retrieved from the *tool16 folders.
*/
public static void setToolImageDescriptors(IAction action, String iconName) {
setImageDescriptors(action, "tool16", iconName);
}
/**
- * Sets the three image descriptors for enabled, disabled, and hovered to an action. The actions
- * are retrieved from the *lcl16 folders.
+ * Sets the three image descriptors for enabled, disabled, and hovered to an
+ * action. The actions are retrieved from the *lcl16 folders.
*/
public static void setLocalImageDescriptors(IAction action, String iconName) {
setImageDescriptors(action, "lcl16", iconName);
@@ -69,28 +71,36 @@ public class PHPDebugUiImages {
return IMAGE_REGISTRY;
}
- //---- Helper methods to access icons on the file system --------------------------------------
+ // ---- Helper methods to access icons on the file system
+ // --------------------------------------
- protected static void setImageDescriptors(IAction action, String type, String relPath) {
+ protected static void setImageDescriptors(IAction action, String type,
+ String relPath) {
try {
- ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL("d" + type, relPath));
+ ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL(
+ "d" + type, relPath));
if (id != null)
action.setDisabledImageDescriptor(id);
- } catch (MalformedURLException e) {}
+ } catch (MalformedURLException e) {
+ }
try {
- ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL("c" + type, relPath));
+ ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL(
+ "c" + type, relPath));
if (id != null)
action.setHoverImageDescriptor(id);
- } catch (MalformedURLException e) {}
+ } catch (MalformedURLException e) {
+ }
action.setImageDescriptor(create("e" + type, relPath));
}
protected static ImageDescriptor createManaged(String prefix, String name) {
try {
- ImageDescriptor result = ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
+ ImageDescriptor result = ImageDescriptor
+ .createFromURL(makeIconFileURL(prefix, name
+ .substring(NAME_PREFIX_LENGTH)));
IMAGE_REGISTRY.put(name, result);
return result;
} catch (MalformedURLException e) {
@@ -106,7 +116,8 @@ public class PHPDebugUiImages {
}
}
- protected static URL makeIconFileURL(String prefix, String name) throws MalformedURLException {
+ protected static URL makeIconFileURL(String prefix, String name)
+ throws MalformedURLException {
if (iconBaseURL == null)
throw new MalformedURLException();
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java
index 8510396..d9053a9 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java
@@ -1,4 +1,3 @@
-
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -11,7 +10,6 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.debug.ui;
-
import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame;
import net.sourceforge.phpdt.internal.debug.core.model.PHPValue;
import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter;
@@ -42,25 +40,32 @@ import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
+public class PHPDebugHover implements IJavaEditorTextHover,
+ ITextHoverExtension, ISelectionListener, IPartListener {
-public class PHPDebugHover implements IJavaEditorTextHover, ITextHoverExtension, ISelectionListener, IPartListener {
-
protected IEditorPart fEditor;
+
protected ISelection fSelection = null;
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
*/
public void partActivated(IWorkbenchPart part) {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
*/
public void partBroughtToTop(IWorkbenchPart part) {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
*/
public void partClosed(IWorkbenchPart part) {
@@ -73,20 +78,27 @@ public class PHPDebugHover implements IJavaEditorTextHover, ITextHoverExtension,
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
*/
public void partDeactivated(IWorkbenchPart part) {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
*/
public void partOpened(IWorkbenchPart part) {
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
fSelection = selection;
@@ -95,82 +107,94 @@ public class PHPDebugHover implements IJavaEditorTextHover, ITextHoverExtension,
public PHPDebugHover() {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jdt.ui.text.java.hover.IJavaEditorTextHover#setEditor(org.eclipse.ui.IEditorPart)
*/
public void setEditor(IEditorPart editor) {
if (editor != null) {
- fEditor= editor;
+ fEditor = editor;
final IWorkbenchPage page = editor.getSite().getPage();
page.addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
page.addPartListener(this);
// initialize selection
Runnable r = new Runnable() {
public void run() {
- fSelection = page.getSelection(IDebugUIConstants.ID_DEBUG_VIEW);
+ fSelection = page
+ .getSelection(IDebugUIConstants.ID_DEBUG_VIEW);
}
};
PHPDebugUiPlugin.getStandardDisplay().asyncExec(r);
}
}
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, int)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer,
+ * int)
*/
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
return JavaWordFinder.findWord(textViewer.getDocument(), offset);
}
-
+
/**
- * Returns the stack frame in which to search for variables, or null
- * if none.
+ * Returns the stack frame in which to search for variables, or
+ * null
if none.
*
- * @return the stack frame in which to search for variables, or null
- * if none
+ * @return the stack frame in which to search for variables, or
+ * null
if none
*/
protected PHPStackFrame getFrame() {
if (fSelection instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection)fSelection;
+ IStructuredSelection selection = (IStructuredSelection) fSelection;
if (selection.size() == 1) {
Object el = selection.getFirstElement();
if (el instanceof IAdaptable) {
- return (PHPStackFrame)((IAdaptable)el).getAdapter(PHPStackFrame.class);
+ return (PHPStackFrame) ((IAdaptable) el)
+ .getAdapter(PHPStackFrame.class);
}
}
}
return null;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer,
+ * org.eclipse.jface.text.IRegion)
*/
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
- PHPStackFrame frame = getFrame();
+ PHPStackFrame frame = getFrame();
if (frame != null) {
try {
-
- IDocument document= textViewer.getDocument();
+
+ IDocument document = textViewer.getDocument();
if (document == null)
return null;
-
- String variableName= document.get(hoverRegion.getOffset(), hoverRegion.getLength());
-
- StringBuffer buffer= new StringBuffer();
+
+ String variableName = document.get(hoverRegion.getOffset(),
+ hoverRegion.getLength());
+
+ StringBuffer buffer = new StringBuffer();
try {
- IVariable variable= frame.findVariable(variableName);
+ IVariable variable = frame.findVariable(variableName);
if (variable != null) {
appendVariable(buffer, variable);
}
} catch (DebugException x) {
-// if (x.getStatus().getCode() != IJavaThread.ERR_THREAD_NOT_SUSPENDED) {
- PHPDebugUiPlugin.log(x);
-// }
+ // if (x.getStatus().getCode() !=
+ // IJavaThread.ERR_THREAD_NOT_SUSPENDED) {
+ PHPDebugUiPlugin.log(x);
+ // }
}
-
+
if (buffer.length() > 0) {
return buffer.toString();
}
-
+
} catch (BadLocationException x) {
PHPDebugUiPlugin.log(x);
}
@@ -182,15 +206,16 @@ public class PHPDebugHover implements IJavaEditorTextHover, ITextHoverExtension,
/**
* Append HTML for the given variable to the given buffer
*/
- private static void appendVariable(StringBuffer buffer, IVariable variable) throws DebugException {
+ private static void appendVariable(StringBuffer buffer, IVariable variable)
+ throws DebugException {
buffer.append("").append(variable.getName()).append("
"); //$NON-NLS-1$ //$NON-NLS-2$
buffer.append(" ="); //$NON-NLS-1$
-
- String type= getTypeName(variable);
- String value= "" + variable.getValue().getValueString() + "
"; //$NON-NLS-1$ //$NON-NLS-2$
-
+
+ String type = getTypeName(variable);
+ String value = "" + variable.getValue().getValueString() + "
"; //$NON-NLS-1$ //$NON-NLS-2$
+
if (type == null) {
buffer.append(" null"); //$NON-NLS-1$
} else if (type.equals("java.lang.String")) { //$NON-NLS-1$
@@ -204,46 +229,53 @@ public class PHPDebugHover implements IJavaEditorTextHover, ITextHoverExtension,
buffer.append(" ("); //$NON-NLS-1$
buffer.append("").append(type).append("
"); //$NON-NLS-1$ //$NON-NLS-2$
buffer.append(") "); //$NON-NLS-1$
- buffer.append(value);
- }
+ buffer.append(value);
+ }
buffer.append("
null
* if none is defined.
*/
protected Image getDebugElementImage(Object element) {
- Image image= null;
+ Image image = null;
if (element instanceof PHPThread) {
- PHPThread thread = (PHPThread)element;
+ PHPThread thread = (PHPThread) element;
if (thread.isSuspended()) {
- image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED);
+ image = DebugUITools
+ .getImage(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED);
} else if (thread.isTerminated()) {
- image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_TERMINATED);
+ image = DebugUITools
+ .getImage(IDebugUIConstants.IMG_OBJS_THREAD_TERMINATED);
} else {
- image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING);
+ image = DebugUITools
+ .getImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING);
}
} else if (element instanceof PHPStackFrame) {
- image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_STACKFRAME);
+ image = DebugUITools
+ .getImage(IDebugUIConstants.IMG_OBJS_STACKFRAME);
} else if (element instanceof IPHPDebugTarget) {
- IPHPDebugTarget debugTarget=(IPHPDebugTarget) element;
+ IPHPDebugTarget debugTarget = (IPHPDebugTarget) element;
if (debugTarget.isTerminated()) {
- image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_TERMINATED);
+ image = DebugUITools
+ .getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_TERMINATED);
} else {
- image= DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET);
+ image = DebugUITools
+ .getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET);
}
}
return image;
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.java
index dc23fa0..e6e28cd 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiMessages.java
@@ -6,10 +6,14 @@ import java.util.ResourceBundle;
public class PHPDebugUiMessages {
- private static final String BUNDLE_NAME = PHPDebugUiMessages.class.getName();
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+ private static final String BUNDLE_NAME = PHPDebugUiMessages.class
+ .getName();
- private PHPDebugUiMessages() {}
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private PHPDebugUiMessages() {
+ }
public static String getString(String key) {
try {
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java
index 7d66455..f914e46 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java
@@ -15,6 +15,7 @@ import org.osgi.framework.BundleContext;
public class PHPDebugUiPlugin extends AbstractUIPlugin {
public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.ui"; //$NON-NLS-1$
+
protected static PHPDebugUiPlugin plugin;
public PHPDebugUiPlugin() {
@@ -37,35 +38,34 @@ public class PHPDebugUiPlugin extends AbstractUIPlugin {
public static IWorkspace getWorkspace() {
return PHPeclipsePlugin.getWorkspace();
}
-
+
/**
* Convenience method which returns the unique identifier of this plugin.
*/
-// public static String getUniqueIdentifier()
-// {
-// if ( getDefault() == null )
-// {
-// // If the default instance is not yet initialized,
-// // return a static identifier. This identifier must
-// // match the plugin id defined in plugin.xml
-// return PLUGIN_ID;
-// }
-// return getDefault().getDescriptor().getUniqueIdentifier();
-// }
-
+ // public static String getUniqueIdentifier()
+ // {
+ // if ( getDefault() == null )
+ // {
+ // // If the default instance is not yet initialized,
+ // // return a static identifier. This identifier must
+ // // match the plugin id defined in plugin.xml
+ // return PLUGIN_ID;
+ // }
+ // return getDefault().getDescriptor().getUniqueIdentifier();
+ // }
/**
- * Returns the standard display to be used. The method first checks, if
- * the thread calling this method has an associated display. If so, this
- * display is returned. Otherwise the method returns the default display.
+ * Returns the standard display to be used. The method first checks, if the
+ * thread calling this method has an associated display. If so, this display
+ * is returned. Otherwise the method returns the default display.
*/
public static Display getStandardDisplay() {
Display display;
- display= Display.getCurrent();
+ display = Display.getCurrent();
if (display == null)
- display= Display.getDefault();
- return display;
+ display = Display.getDefault();
+ return display;
}
-
+
/**
* Returns the active workbench shell or null
if none
*
@@ -78,34 +78,33 @@ public class PHPDebugUiPlugin extends AbstractUIPlugin {
}
return null;
}
-
- public static void errorDialog( String message, IStatus status )
- {
- log( status );
- Shell shell = getActiveWorkbenchShell();
- if ( shell != null )
- {
- ErrorDialog.openError( shell, "Error", message, status );
- }
+
+ public static void errorDialog(String message, IStatus status) {
+ log(status);
+ Shell shell = getActiveWorkbenchShell();
+ if (shell != null) {
+ ErrorDialog.openError(shell, "Error", message, status);
}
+ }
- public static void errorDialog( String message, Throwable t )
- {
- log( t );
- Shell shell = getActiveWorkbenchShell();
- if ( shell != null )
- {
- IStatus status = new Status( IStatus.ERROR, PLUGIN_ID, /*ICDebugUIConstants.INTERNAL_ERROR*/ 150, t.getMessage(), null ); //$NON-NLS-1$
- ErrorDialog.openError( shell, "Error", message, status );
- }
- }
+ public static void errorDialog(String message, Throwable t) {
+ log(t);
+ Shell shell = getActiveWorkbenchShell();
+ if (shell != null) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, /* ICDebugUIConstants.INTERNAL_ERROR */
+ 150, t.getMessage(), null); //$NON-NLS-1$
+ ErrorDialog.openError(shell, "Error", message, status);
+ }
+ }
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, PHPDebugUiMessages.getString("RdtDebugUiPlugin.internalErrorOccurred"), e)); //$NON-NLS-1$
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR,
+ PHPDebugUiMessages
+ .getString("RdtDebugUiPlugin.internalErrorOccurred"), e)); //$NON-NLS-1$
}
/**
@@ -121,14 +120,15 @@ public class PHPDebugUiPlugin extends AbstractUIPlugin {
public void stop(BundleContext context) throws Exception {
super.stop(context);
}
-
-// protected void initializeDefaultPreferences(IPreferenceStore store) {
-// super.initializeDefaultPreferences(store);
-//
-// store.setDefault(RdtDebugUiConstants.PREFERENCE_KEYWORDS, getDefaultKeywords());
-// }
-
-// protected String getDefaultKeywords() {
-// return "class,def,end,if,module,new,puts,require,rescue,throw,while";
-// }
+
+ // protected void initializeDefaultPreferences(IPreferenceStore store) {
+ // super.initializeDefaultPreferences(store);
+ //
+ // store.setDefault(RdtDebugUiConstants.PREFERENCE_KEYWORDS,
+ // getDefaultKeywords());
+ // }
+
+ // protected String getDefaultKeywords() {
+ // return "class,def,end,if,module,new,puts,require,rescue,throw,while";
+ // }
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPExecutionArgumentsPage.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPExecutionArgumentsPage.java
index bc3200b..25fdd7b 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPExecutionArgumentsPage.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPExecutionArgumentsPage.java
@@ -13,53 +13,67 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbenchPropertyPage;
import org.eclipse.ui.dialogs.PropertyPage;
-public class PHPExecutionArgumentsPage extends PropertyPage implements IWorkbenchPropertyPage {
+public class PHPExecutionArgumentsPage extends PropertyPage implements
+ IWorkbenchPropertyPage {
protected Text interpreterArgumentsText, programArgumentsText;
-
+
public PHPExecutionArgumentsPage() {
}
- protected Control createContents(Composite parent) {
+ protected Control createContents(Composite parent) {
noDefaultAndApplyButton();
Composite composite = new Composite(parent, SWT.NONE);
-
+
GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
- new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.interpreter_args_box_title"));
+ new Label(composite, SWT.NONE)
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPArguments.interpreter_args_box_title"));
new Label(composite, SWT.NONE).setText(" ");
interpreterArgumentsText = new Text(composite, SWT.BORDER);
- GridData interpreterArgumentsData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ GridData interpreterArgumentsData = new GridData(
+ GridData.HORIZONTAL_ALIGN_FILL);
interpreterArgumentsData.horizontalSpan = 2;
interpreterArgumentsText.setLayoutData(interpreterArgumentsData);
interpreterArgumentsText.setText(getArgument("interpreter"));
-
- new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.program_args_box_title"));
+
+ new Label(composite, SWT.NONE)
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPArguments.program_args_box_title"));
programArgumentsText = new Text(composite, SWT.BORDER);
- GridData programArgumentsData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ GridData programArgumentsData = new GridData(
+ GridData.HORIZONTAL_ALIGN_FILL);
programArgumentsData.horizontalSpan = 2;
programArgumentsText.setLayoutData(programArgumentsData);
programArgumentsText.setText(getArgument("program"));
-
+
return composite;
}
-
+
protected String getArgument(String name) {
String argumentValue = null;
try {
- argumentValue = ((IFile)getElement()).getPersistentProperty(new QualifiedName("executionArguments", name));
- } catch(CoreException e) {}
-
+ argumentValue = ((IFile) getElement())
+ .getPersistentProperty(new QualifiedName(
+ "executionArguments", name));
+ } catch (CoreException e) {
+ }
+
return argumentValue != null ? argumentValue : "";
}
-
+
public boolean performOk() {
- IFile phpFile = (IFile)getElement();
+ IFile phpFile = (IFile) getElement();
try {
- phpFile.setPersistentProperty(new QualifiedName("executionArguments", "interpreter"), interpreterArgumentsText.getText());
- phpFile.setPersistentProperty(new QualifiedName("executionArguments", "program"), programArgumentsText.getText());
- } catch(CoreException e) {
+ phpFile.setPersistentProperty(new QualifiedName(
+ "executionArguments", "interpreter"),
+ interpreterArgumentsText.getText());
+ phpFile.setPersistentProperty(new QualifiedName(
+ "executionArguments", "program"), programArgumentsText
+ .getText());
+ } catch (CoreException e) {
PHPDebugUiPlugin.log(e);
return false;
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ActionMessages.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ActionMessages.java
index 090d847..23e28bc 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ActionMessages.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ActionMessages.java
@@ -10,17 +10,15 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.debug.ui.actions;
-
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class ActionMessages {
- private static final String BUNDLE_NAME =
- "org.eclipse.jdt.internal.debug.ui.actions.ActionMessages";//$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.jdt.internal.debug.ui.actions.ActionMessages";//$NON-NLS-1$
- private static final ResourceBundle RESOURCE_BUNDLE =
- ResourceBundle.getBundle(BUNDLE_NAME);
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
private ActionMessages() {
}
@@ -32,7 +30,7 @@ public class ActionMessages {
return '!' + key + '!';
}
}
-
+
public static ResourceBundle getResourceBundle() {
return RESOURCE_BUNDLE;
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPDebugBreakpointAction.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPDebugBreakpointAction.java
index 28d4954..44dd7ba 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPDebugBreakpointAction.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPDebugBreakpointAction.java
@@ -1,51 +1,57 @@
package net.sourceforge.phpdt.internal.debug.ui.actions;
+import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
+import net.sourceforge.phpdt.internal.debug.ui.properties.PHPBreakpointPropertiesDialog;
+
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
-import net.sourceforge.phpdt.internal.debug.ui.properties.*;
-import net.sourceforge.phpdt.internal.debug.core.breakpoints.*;
-
/**
- * Enables the context menu entry if object is of type PHPLineBreakpoint.
- * This is used for Breakpoint properties menu.
- * Properties menu let you set 'skip count' and condition of a PHP breakpoint.
+ * Enables the context menu entry if object is of type PHPLineBreakpoint. This
+ * is used for Breakpoint properties menu. Properties menu let you set 'skip
+ * count' and condition of a PHP breakpoint.
*
*/
public class PHPDebugBreakpointAction implements IViewActionDelegate {
protected PHPLineBreakpoint fBreakpoint = null;
-
+
public void init(IViewPart view) {
}
public void run(IAction action) {
- PHPBreakpointPropertiesDialog dialog = new PHPBreakpointPropertiesDialog (null, fBreakpoint);
- dialog.open();
+ PHPBreakpointPropertiesDialog dialog = new PHPBreakpointPropertiesDialog(
+ null, fBreakpoint);
+ dialog.open();
}
public void selectionChanged(IAction action, ISelection selection) {
IStructuredSelection bpSelection;
- Object bpObject;
-
+ Object bpObject;
+
if (selection instanceof IStructuredSelection) {
bpSelection = (IStructuredSelection) selection;
-
- if (bpSelection.size () == 1) { // Do we have something selected
- bpObject = bpSelection.getFirstElement(); // Get the selected object
-
- if (bpObject instanceof PHPLineBreakpoint) { // Is the object of type PHPLineBreakpoint?
+
+ if (bpSelection.size() == 1) { // Do we have something selected
+ bpObject = bpSelection.getFirstElement(); // Get the selected
+ // object
+
+ if (bpObject instanceof PHPLineBreakpoint) { // Is the object
+ // of type
+ // PHPLineBreakpoint?
fBreakpoint = (PHPLineBreakpoint) bpObject;
- action.setEnabled (true); // Then enable the context menu item
+ action.setEnabled(true); // Then enable the context menu
+ // item
return;
}
}
- }
-
- action.setEnabled (false); // It isn't a PHPLineBreakpoint, so disable the menu item
+ }
+
+ action.setEnabled(false); // It isn't a PHPLineBreakpoint, so disable
+ // the menu item
}
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerAction.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerAction.java
index 5b1c7ef..585a9c3 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerAction.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerAction.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
- Vicente Fernando - www.alfersoft.com.ar
-**********************************************************************/
+ 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
+ Vicente Fernando - www.alfersoft.com.ar
+ **********************************************************************/
package net.sourceforge.phpdt.internal.debug.ui.actions;
import java.util.ArrayList;
@@ -43,91 +43,102 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.IUpdate;
-public class PHPManageBreakpointRulerAction extends Action implements IUpdate {
-
+public class PHPManageBreakpointRulerAction extends Action implements IUpdate {
+
private IVerticalRulerInfo fRuler;
+
private ITextEditor fTextEditor;
+
private String fMarkerType;
+
private List fMarkers;
private String fAddLabel;
+
private String fRemoveLabel;
-
- public PHPManageBreakpointRulerAction(IVerticalRulerInfo ruler, ITextEditor editor) {
- fRuler= ruler;
- fTextEditor= editor;
- fMarkerType= IBreakpoint.BREAKPOINT_MARKER;
- fAddLabel= PHPDebugUiMessages.getString("PHPManageBreakpointRulerAction.ToggleBreakpoint"); //$NON-NLS-1$
- fRemoveLabel= PHPDebugUiMessages.getString("PHPManageBreakpointRulerAction.ToggleBreakpoint"); //$NON-NLS-1$
+
+ public PHPManageBreakpointRulerAction(IVerticalRulerInfo ruler,
+ ITextEditor editor) {
+ fRuler = ruler;
+ fTextEditor = editor;
+ fMarkerType = IBreakpoint.BREAKPOINT_MARKER;
+ fAddLabel = PHPDebugUiMessages
+ .getString("PHPManageBreakpointRulerAction.ToggleBreakpoint"); //$NON-NLS-1$
+ fRemoveLabel = PHPDebugUiMessages
+ .getString("PHPManageBreakpointRulerAction.ToggleBreakpoint"); //$NON-NLS-1$
}
-
- /**
- * Returns the resource for which to create the marker,
- * or null
if there is no applicable resource.
- *
+
+ /**
+ * Returns the resource for which to create the marker, or null
+ * if there is no applicable resource.
+ *
* @return the resource for which to create the marker or null
*/
protected IResource getResource() {
- IEditorInput input= fTextEditor.getEditorInput();
-
- IResource resource= (IResource) input.getAdapter(IFile.class);
-
+ IEditorInput input = fTextEditor.getEditorInput();
+
+ IResource resource = (IResource) input.getAdapter(IFile.class);
+
if (resource == null) {
- resource= (IResource) input.getAdapter(IResource.class);
+ resource = (IResource) input.getAdapter(IResource.class);
}
-
+
return resource;
}
-
+
/**
* Checks whether a position includes the ruler's line of activity.
- *
- * @param position the position to be checked
- * @param document the document the position refers to
+ *
+ * @param position
+ * the position to be checked
+ * @param document
+ * the document the position refers to
* @return true
if the line is included by the given position
*/
protected boolean includesRulerLine(Position position, IDocument document) {
if (position != null) {
try {
- int markerLine= document.getLineOfOffset(position.getOffset());
- int line= fRuler.getLineOfLastMouseButtonActivity();
+ int markerLine = document.getLineOfOffset(position.getOffset());
+ int line = fRuler.getLineOfLastMouseButtonActivity();
if (line == markerLine) {
return true;
}
} catch (BadLocationException x) {
}
}
-
+
return false;
}
-
+
/**
* Returns this action's vertical ruler info.
- *
+ *
* @return this action's vertical ruler
*/
protected IVerticalRulerInfo getVerticalRulerInfo() {
return fRuler;
}
-
+
/**
* Returns this action's editor.
- *
+ *
* @return this action's editor
*/
protected ITextEditor getTextEditor() {
return fTextEditor;
}
-
+
/**
- * Returns the AbstractMarkerAnnotationModel
of the editor's input.
- *
+ * Returns the AbstractMarkerAnnotationModel
of the editor's
+ * input.
+ *
* @return the marker annotation model
*/
protected AbstractMarkerAnnotationModel getAnnotationModel() {
- IDocumentProvider provider= fTextEditor.getDocumentProvider();
- IAnnotationModel model= provider.getAnnotationModel(fTextEditor.getEditorInput());
+ IDocumentProvider provider = fTextEditor.getDocumentProvider();
+ IAnnotationModel model = provider.getAnnotationModel(fTextEditor
+ .getEditorInput());
if (model instanceof AbstractMarkerAnnotationModel) {
return (AbstractMarkerAnnotationModel) model;
}
@@ -136,19 +147,19 @@ public class PHPManageBreakpointRulerAction extends Action implements IUpdate {
/**
* Returns the IDocument
of the editor's input.
- *
+ *
* @return the document of the editor's input
*/
protected IDocument getDocument() {
- IDocumentProvider provider= fTextEditor.getDocumentProvider();
+ IDocumentProvider provider = fTextEditor.getDocumentProvider();
return provider.getDocument(fTextEditor.getEditorInput());
}
-
+
/**
* @see IUpdate#update()
*/
public void update() {
- fMarkers= getMarkers();
+ fMarkers = getMarkers();
setText(fMarkers.isEmpty() ? fAddLabel : fRemoveLabel);
}
@@ -162,70 +173,85 @@ public class PHPManageBreakpointRulerAction extends Action implements IUpdate {
removeMarkers(fMarkers);
}
}
-
+
protected List getMarkers() {
- List breakpoints= new ArrayList();
-
- IResource resource= getResource();
- IDocument document= getDocument();
- AbstractMarkerAnnotationModel model= getAnnotationModel();
-
+ List breakpoints = new ArrayList();
+
+ IResource resource = getResource();
+ IDocument document = getDocument();
+ AbstractMarkerAnnotationModel model = getAnnotationModel();
+
if (model != null) {
try {
-
- IMarker[] markers= null;
+
+ IMarker[] markers = null;
if (resource instanceof IFile)
- markers= resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
+ markers = resource.findMarkers(
+ IBreakpoint.BREAKPOINT_MARKER, true,
+ IResource.DEPTH_INFINITE);
else {
- IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
- markers= root.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace()
+ .getRoot();
+ markers = root.findMarkers(IBreakpoint.BREAKPOINT_MARKER,
+ true, IResource.DEPTH_INFINITE);
}
-
+
if (markers != null) {
- IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
- int iFe =0;
- for (iFe= 0; iFe < markers.length; iFe++) {
- IBreakpoint breakpoint= breakpointManager.getBreakpoint(markers[iFe]);
- if (breakpoint != null && breakpointManager.isRegistered(breakpoint) &&
- includesRulerLine(model.getMarkerPosition(markers[iFe]), document))
+ IBreakpointManager breakpointManager = DebugPlugin
+ .getDefault().getBreakpointManager();
+ int iFe = 0;
+ for (iFe = 0; iFe < markers.length; iFe++) {
+ IBreakpoint breakpoint = breakpointManager
+ .getBreakpoint(markers[iFe]);
+ if (breakpoint != null
+ && breakpointManager.isRegistered(breakpoint)
+ && includesRulerLine(model
+ .getMarkerPosition(markers[iFe]),
+ document))
breakpoints.add(markers[iFe]);
}
}
} catch (CoreException x) {
System.out.println(x.getStatus());
-// JDIDebugUIPlugin.log(x.getStatus());
+ // JDIDebugUIPlugin.log(x.getStatus());
}
}
return breakpoints;
}
-
+
protected void addMarker() {
- //IResource resource= getResource();
- IEditorInput editorInput= getTextEditor().getEditorInput();
- IDocument document= getDocument();
- //IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
+ // IResource resource= getResource();
+ IEditorInput editorInput = getTextEditor().getEditorInput();
+ IDocument document = getDocument();
+ // IBreakpointManager breakpointManager=
+ // DebugPlugin.getDefault().getBreakpointManager();
- int rulerLine= getVerticalRulerInfo().getLineOfLastMouseButtonActivity();
+ int rulerLine = getVerticalRulerInfo()
+ .getLineOfLastMouseButtonActivity();
// create the marker
try {
- // Falta verificar si la ubicación del Breakpoint es válida
- int lineNumber= rulerLine + 1;
+ // Falta verificar si la ubicaci�n del Breakpoint es v�lida
+ int lineNumber = rulerLine + 1;
if (lineNumber > 0) {
- if (PHPDebugModel.lineBreakpointExists(lineNumber)==null) {
-// Map attributes = new HashMap(10);
- IRegion line= document.getLineInformation(lineNumber - 1);
- int start= line.getOffset();
- int lenline= line.getLength();
- //int end= start + ((lenline > 0)?lenline:0);
- int end= start + lenline;
-
- //PHPDebugModel.createLineBreakpoint(getResource(), lineNumber, start, end, 0, true, attributes);
- PHPDebugModel.createLineBreakpoint(((IFileEditorInput) editorInput).getFile(), lineNumber, start, end, 0, true, null);
-// PHPDebugModel.createLineBreakpoint(((IFileEditorInput) editorInput).getFile(), lineNumber, 0, true, attributes);
-
+ if (PHPDebugModel.lineBreakpointExists(lineNumber) == null) {
+ // Map attributes = new HashMap(10);
+ IRegion line = document.getLineInformation(lineNumber - 1);
+ int start = line.getOffset();
+ int lenline = line.getLength();
+ // int end= start + ((lenline > 0)?lenline:0);
+ int end = start + lenline;
+
+ // PHPDebugModel.createLineBreakpoint(getResource(),
+ // lineNumber, start, end, 0, true, attributes);
+ PHPDebugModel.createLineBreakpoint(
+ ((IFileEditorInput) editorInput).getFile(),
+ lineNumber, start, end, 0, true, null);
+ // PHPDebugModel.createLineBreakpoint(((IFileEditorInput)
+ // editorInput).getFile(), lineNumber, 0, true, attributes);
+
}
}
} catch (DebugException e) {
@@ -236,13 +262,15 @@ public class PHPManageBreakpointRulerAction extends Action implements IUpdate {
System.out.println("Error");
}
}
-
+
protected void removeMarkers(List markers) {
- IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
+ IBreakpointManager breakpointManager = DebugPlugin.getDefault()
+ .getBreakpointManager();
try {
- Iterator e= markers.iterator();
+ Iterator e = markers.iterator();
while (e.hasNext()) {
- IBreakpoint breakpoint= breakpointManager.getBreakpoint((IMarker) e.next());
+ IBreakpoint breakpoint = breakpointManager
+ .getBreakpoint((IMarker) e.next());
breakpointManager.removeBreakpoint(breakpoint, true);
}
} catch (CoreException e) {
@@ -250,7 +278,7 @@ public class PHPManageBreakpointRulerAction extends Action implements IUpdate {
}
public IResource getUnderlyingResource(String fName) {
- IResource parentResource = getResource(); //fParent.getUnderlyingResource();
+ IResource parentResource = getResource(); // fParent.getUnderlyingResource();
if (parentResource == null) {
return null;
}
@@ -259,7 +287,7 @@ public class PHPManageBreakpointRulerAction extends Action implements IUpdate {
IContainer folder = (IContainer) parentResource;
IResource resource = folder.findMember(fName);
if (resource == null) {
- //throw newNotPresentException();
+ // throw newNotPresentException();
return null;
} else {
return resource;
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerActionDelegate.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerActionDelegate.java
index f374e92..ef0aedd 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerActionDelegate.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/PHPManageBreakpointRulerActionDelegate.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
+ 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
- Vicente Fernando - www.alfersoft.com.ar
-**********************************************************************/
+ Contributors:
+ IBM Corporation - Initial implementation
+ Vicente Fernando - www.alfersoft.com.ar
+ **********************************************************************/
package net.sourceforge.phpdt.internal.debug.ui.actions;
import org.eclipse.jface.action.IAction;
@@ -16,12 +16,14 @@ import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
import org.eclipse.ui.texteditor.ITextEditor;
-public class PHPManageBreakpointRulerActionDelegate extends AbstractRulerActionDelegate {
+public class PHPManageBreakpointRulerActionDelegate extends
+ AbstractRulerActionDelegate {
/**
* @see AbstractRulerActionDelegate#createAction()
*/
- protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
+ protected IAction createAction(ITextEditor editor,
+ IVerticalRulerInfo rulerInfo) {
return new PHPManageBreakpointRulerAction(rulerInfo, editor);
}
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java
index 0779dba..bff33b2 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/RetargettableActionAdapterFactory.java
@@ -14,30 +14,36 @@ import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
/**
- * Creates adapters for retargettable actions in debug platform.
- * Contributed via org.eclipse.core.runtime.adapters
- * extension point.
+ * Creates adapters for retargettable actions in debug platform. Contributed via
+ * org.eclipse.core.runtime.adapters
extension point.
*
* @since 3.0
*/
public class RetargettableActionAdapterFactory implements IAdapterFactory {
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object,
+ * java.lang.Class)
*/
public Object getAdapter(Object adaptableObject, Class adapterType) {
-// if (adapterType == IRunToLineTarget.class) {
-// return new RunToLineAdapter();
-// }
+ // if (adapterType == IRunToLineTarget.class) {
+ // return new RunToLineAdapter();
+ // }
if (adapterType == IToggleBreakpointsTarget.class) {
return new ToggleBreakpointAdapter();
- }
+ }
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
public Class[] getAdapterList() {
- // return new Class[]{IRunToLineTarget.class, IToggleBreakpointsTarget.class};
- return new Class[]{IToggleBreakpointsTarget.class};
+ // return new Class[]{IRunToLineTarget.class,
+ // IToggleBreakpointsTarget.class};
+ return new Class[] { IToggleBreakpointsTarget.class };
}
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
index dfdc1ea..7725750 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
@@ -24,6 +24,7 @@ import net.sourceforge.phpdt.core.Signature;
import net.sourceforge.phpdt.debug.core.PHPDebugModel;
import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -42,13 +43,14 @@ import org.eclipse.ui.texteditor.ITextEditor;
/**
* Toggles a line breakpoint in a Java editor.
- *
+ *
* @since 3.0
*/
public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
protected void report(String message, IWorkbenchPart part) {
- IEditorStatusLine statusLine= (IEditorStatusLine) part.getAdapter(IEditorStatusLine.class);
+ IEditorStatusLine statusLine = (IEditorStatusLine) part
+ .getAdapter(IEditorStatusLine.class);
if (statusLine != null) {
if (message != null) {
statusLine.setMessage(true, message, null);
@@ -56,204 +58,257 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
statusLine.setMessage(true, null, null);
}
}
- if (message != null && PHPDebugUiPlugin.getActiveWorkbenchShell() != null) {
+ if (message != null
+ && PHPDebugUiPlugin.getActiveWorkbenchShell() != null) {
PHPDebugUiPlugin.getActiveWorkbenchShell().getDisplay().beep();
}
}
-// protected IType getType(ITextSelection selection) {
-// IMember member= ActionDelegateHelper.getDefault().getCurrentMember(selection);
-// IType type= null;
-// if (member instanceof IType) {
-// type = (IType)member;
-// } else if (member != null) {
-// type= member.getDeclaringType();
-// }
-// // bug 52385: we don't want local and anonymous types from compilation unit,
-// // we are getting 'not-always-correct' names for them.
-// try {
-// while (type != null && !type.isBinary() && type.isLocal()) {
-// type= type.getDeclaringType();
-// }
-// } catch (JavaModelException e) {
-// PHPDebugUiPlugin.log(e);
-// }
-// return type;
-// }
+ // protected IType getType(ITextSelection selection) {
+ // IMember member=
+ // ActionDelegateHelper.getDefault().getCurrentMember(selection);
+ // IType type= null;
+ // if (member instanceof IType) {
+ // type = (IType)member;
+ // } else if (member != null) {
+ // type= member.getDeclaringType();
+ // }
+ // // bug 52385: we don't want local and anonymous types from compilation
+ // unit,
+ // // we are getting 'not-always-correct' names for them.
+ // try {
+ // while (type != null && !type.isBinary() && type.isLocal()) {
+ // type= type.getDeclaringType();
+ // }
+ // } catch (JavaModelException e) {
+ // PHPDebugUiPlugin.log(e);
+ // }
+ // return type;
+ // }
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(IWorkbenchPart, ISelection)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(IWorkbenchPart,
+ * ISelection)
*/
- public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+ public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection)
+ throws CoreException {
if (selection instanceof ITextSelection) {
report(null, part);
- IEditorPart editorPart = (IEditorPart)part;
- ITextSelection textSelection = (ITextSelection)selection;
-// IType type = getType(textSelection);
+ IEditorPart editorPart = (IEditorPart) part;
+ ITextSelection textSelection = (ITextSelection) selection;
+ // IType type = getType(textSelection);
IEditorInput editorInput = editorPart.getEditorInput();
- IDocument document= ((ITextEditor)editorPart).getDocumentProvider().getDocument(editorInput);
- int lineNumber= textSelection.getStartLine() + 1;
- int offset= textSelection.getOffset();
+ IDocument document = ((ITextEditor) editorPart)
+ .getDocumentProvider().getDocument(editorInput);
+ int lineNumber = textSelection.getStartLine() + 1;
+ int offset = textSelection.getOffset();
try {
-// if (type == null) {
-// IClassFile classFile= (IClassFile)editorInput.getAdapter(IClassFile.class);
-// if (classFile != null) {
-// type= classFile.getType();
-// // bug 34856 - if this is an inner type, ensure the breakpoint is not
-// // being added to the outer type
-// if (type.getDeclaringType() != null) {
-// ISourceRange sourceRange= type.getSourceRange();
-// int start= sourceRange.getOffset();
-// int end= start + sourceRange.getLength();
-// if (offset < start || offset > end) {
-// // not in the inner type
-// IStatusLineManager statusLine = editorPart.getEditorSite().getActionBars().getStatusLineManager();
-// statusLine .setErrorMessage(MessageFormat.format(ActionMessages.getString("ManageBreakpointRulerAction.Breakpoints_can_only_be_created_within_the_type_associated_with_the_editor__{0}._1"), new String[] { type.getTypeQualifiedName()})); //$NON-NLS-1$
-// Display.getCurrent().beep();
-// return;
-// }
-// }
-// }
-// }
+ // if (type == null) {
+ // IClassFile classFile=
+ // (IClassFile)editorInput.getAdapter(IClassFile.class);
+ // if (classFile != null) {
+ // type= classFile.getType();
+ // // bug 34856 - if this is an inner type, ensure the
+ // breakpoint is not
+ // // being added to the outer type
+ // if (type.getDeclaringType() != null) {
+ // ISourceRange sourceRange= type.getSourceRange();
+ // int start= sourceRange.getOffset();
+ // int end= start + sourceRange.getLength();
+ // if (offset < start || offset > end) {
+ // // not in the inner type
+ // IStatusLineManager statusLine =
+ // editorPart.getEditorSite().getActionBars().getStatusLineManager();
+ // statusLine
+ // .setErrorMessage(MessageFormat.format(ActionMessages.getString("ManageBreakpointRulerAction.Breakpoints_can_only_be_created_within_the_type_associated_with_the_editor__{0}._1"),
+ // new String[] { type.getTypeQualifiedName()})); //$NON-NLS-1$
+ // Display.getCurrent().beep();
+ // return;
+ // }
+ // }
+ // }
+ // }
-// String typeName= null;
+ // String typeName= null;
IResource resource;
- PHPLineBreakpoint breakpoint= null;
-// if (type == null) {
- if (editorInput instanceof IFileEditorInput) {
- resource= ((IFileEditorInput)editorInput).getFile();
- } else {
- resource= ResourcesPlugin.getWorkspace().getRoot();
- }
-// } else {
-// typeName= type.getFullyQualifiedName();
-// PHPLineBreakpoint breakpoint=PHPDebugModel.lineBreakpointExists(lineNumber);
-// if (breakpoint==null)
-// PHPDebugModel.createLineBreakpoint(getFile(), lineNumber, 0, true, null);
-// else
-// DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
-//
- PHPLineBreakpoint existingBreakpoint= PHPDebugModel.lineBreakpointExists(lineNumber); //typeName, lineNumber);
- if (existingBreakpoint != null) {
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(existingBreakpoint, true);
- return;
- } else {
- breakpoint = PHPDebugModel.createLineBreakpoint(resource, lineNumber, 0, true, null);
- }
- // }
-// new BreakpointLocationVerifierJob(document, breakpoint, lineNumber, typeName, type, resource, (IEditorStatusLine) editorPart.getAdapter(IEditorStatusLine.class)).schedule();
+ PHPLineBreakpoint breakpoint = null;
+ // if (type == null) {
+ if (editorInput instanceof IFileEditorInput) {
+ resource = ((IFileEditorInput) editorInput).getFile();
+ } else {
+ resource = ResourcesPlugin.getWorkspace().getRoot();
+ }
+ // } else {
+ // typeName= type.getFullyQualifiedName();
+ // PHPLineBreakpoint
+ // breakpoint=PHPDebugModel.lineBreakpointExists(lineNumber);
+ // if (breakpoint==null)
+ // PHPDebugModel.createLineBreakpoint(getFile(), lineNumber, 0,
+ // true, null);
+ // else
+ // DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(
+ // breakpoint, true );
+ //
+ PHPLineBreakpoint existingBreakpoint = PHPDebugModel
+ .lineBreakpointExists(lineNumber); // typeName,
+ // lineNumber);
+ if (existingBreakpoint != null) {
+ DebugPlugin.getDefault().getBreakpointManager()
+ .removeBreakpoint(existingBreakpoint, true);
+ return;
+ } else {
+ breakpoint = PHPDebugModel.createLineBreakpoint(resource,
+ lineNumber, 0, true, null);
+ }
+ // }
+ // new BreakpointLocationVerifierJob(document, breakpoint,
+ // lineNumber, typeName, type, resource, (IEditorStatusLine)
+ // editorPart.getAdapter(IEditorStatusLine.class)).schedule();
} catch (CoreException ce) {
- // TODO: no message in ActionMessages
- //ExceptionHandler.handle(ce, ActionMessages.getString("ManageBreakpointActionDelegate.error.title1"), ActionMessages.getString("ManageBreakpointActionDelegate.error.message1")); //$NON-NLS-1$ //$NON-NLS-2$
+ // TODO: no message in ActionMessages
+ // ExceptionHandler.handle(ce,
+ // ActionMessages.getString("ManageBreakpointActionDelegate.error.title1"),
+ // ActionMessages.getString("ManageBreakpointActionDelegate.error.message1"));
+ // //$NON-NLS-1$ //$NON-NLS-2$
return;
}
}
}
- /*(non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(IWorkbenchPart, ISelection)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(IWorkbenchPart,
+ * ISelection)
*/
- public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
+ public boolean canToggleLineBreakpoints(IWorkbenchPart part,
+ ISelection selection) {
return selection instanceof ITextSelection;
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
*/
- public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
-// report(null, part);
-// selection = translateToMembers(part, selection);
-// if (selection instanceof ITextSelection) {
-// ITextSelection textSelection = (ITextSelection) selection;
-// if (selection != null) {
-// CompilationUnit compilationUnit= parseCompilationUnit((ITextEditor)part);
-// if (compilationUnit != null) {
-// BreakpointMethodLocator locator= new BreakpointMethodLocator(textSelection.getOffset());
-// compilationUnit.accept(locator);
-// String methodName= locator.getMethodName();
-// if (methodName == null) {
-// report(ActionMessages.getString("ManageMethodBreakpointActionDelegate.CantAdd"), part); //$NON-NLS-1$
-// return;
-// }
-// String typeName= locator.getTypeName();
-// String methodSignature= locator.getMethodSignature();
-// if (methodSignature == null) {
-// report(ActionMessages.getString("ManageMethodBreakpointActionDelegate.methodNonAvailable"), part); //$NON-NLS-1$
-// return;
-// }
-// // check if this method breakpoint already exist. If yes, remove it.
-// IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
-// IBreakpoint[] breakpoints= breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier());
-// for (int i= 0; i < breakpoints.length; i++) {
-// IBreakpoint breakpoint= breakpoints[i];
-// if (breakpoint instanceof IJavaMethodBreakpoint) {
-// IJavaMethodBreakpoint methodBreakpoint= (IJavaMethodBreakpoint)breakpoint;
-// if (typeName.equals(methodBreakpoint.getTypeName())
-// && methodName.equals(methodBreakpoint.getMethodName())
-// && methodSignature.equals(methodBreakpoint.getMethodSignature())) {
-// breakpointManager.removeBreakpoint(methodBreakpoint, true);
-// return;
-// }
-// }
-// }
-// // add the breakpoint
-// JDIDebugModel.createMethodBreakpoint(getResource((IEditorPart)part), typeName, methodName, methodSignature, true, false, false, -1, -1, -1, 0, true, new HashMap(10));
-// }
-// }
-// } else if (selection instanceof IStructuredSelection) {
-// IMethod[] members= getMethods((IStructuredSelection)selection);
-// if (members.length == 0) {
-// report(ActionMessages.getString("ToggleBreakpointAdapter.9"), part); //$NON-NLS-1$
-// return;
-// }
-// // add or remove the breakpoint
-// IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
-// for (int i= 0, length= members.length; i < length; i++) {
-// IMethod method= members[i];
-// IJavaBreakpoint breakpoint= getBreakpoint(method);
-// if (breakpoint == null) {
-// // add breakpoint
-// int start = -1;
-// int end = -1;
-// ISourceRange range = method.getNameRange();
-// if (range != null) {
-// start = range.getOffset();
-// end = start + range.getLength();
-// }
-// Map attributes = new HashMap(10);
-// BreakpointUtils.addJavaBreakpointAttributes(attributes, method);
-// String methodName = method.getElementName();
-// if (method.isConstructor()) {
-// methodName = "null
if none.
- *
- * @param editorPart the editor containing the method
+ *
+ * @param editorPart
+ * the editor containing the method
* @param typeName
* @param methodName
* @param signature
* @return handle or null
*/
- protected IMethod getMethodHandle(IEditorPart editorPart, String typeName, String methodName, String signature) throws CoreException {
- IJavaElement element = (IJavaElement) editorPart.getEditorInput().getAdapter(IJavaElement.class);
+ protected IMethod getMethodHandle(IEditorPart editorPart, String typeName,
+ String methodName, String signature) throws CoreException {
+ IJavaElement element = (IJavaElement) editorPart.getEditorInput()
+ .getAdapter(IJavaElement.class);
IType type = null;
if (element instanceof ICompilationUnit) {
- IType[] types = ((ICompilationUnit)element).getAllTypes();
+ IType[] types = ((ICompilationUnit) element).getAllTypes();
for (int i = 0; i < types.length; i++) {
if (types[i].getFullyQualifiedName().equals(typeName)) {
type = types[i];
@@ -433,9 +517,9 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
}
}
}
-// else if (element instanceof IClassFile) {
-// type = ((IClassFile)element).getType();
-// }
+ // else if (element instanceof IClassFile) {
+ // type = ((IClassFile)element).getType();
+ // }
if (type != null) {
String[] sigs = Signature.getParameterTypes(signature);
return type.getMethod(methodName, sigs);
@@ -443,260 +527,280 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
return null;
}
-// protected IJavaBreakpoint getBreakpoint(IMember element) {
-// IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
-// IBreakpoint[] breakpoints= breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier());
-// if (element instanceof IMethod) {
-// IMethod method= (IMethod)element;
-// for (int i= 0; i < breakpoints.length; i++) {
-// IBreakpoint breakpoint= breakpoints[i];
-// if (breakpoint instanceof IJavaMethodBreakpoint) {
-// IJavaMethodBreakpoint methodBreakpoint= (IJavaMethodBreakpoint)breakpoint;
-// IMember container = null;
-// try {
-// container= BreakpointUtils.getMember(methodBreakpoint);
-// } catch (CoreException e) {
-// JDIDebugUIPlugin.log(e);
-// return null;
-// }
-// if (container == null) {
-// try {
-// if (method.getDeclaringType().getFullyQualifiedName().equals(methodBreakpoint.getTypeName())
-// && method.getElementName().equals(methodBreakpoint.getMethodName())
-// && method.getSignature().equals(methodBreakpoint.getMethodSignature())) {
-// return methodBreakpoint;
-// }
-// } catch (CoreException e) {
-// JDIDebugUIPlugin.log(e);
-// }
-// } else {
-// if (container instanceof IMethod) {
-// if (method.getDeclaringType().getFullyQualifiedName().equals(container.getDeclaringType().getFullyQualifiedName())) {
-// if (method.isSimilar((IMethod)container)) {
-// return methodBreakpoint;
-// }
-// }
-// }
-// }
-// }
-// }
-// } else if (element instanceof IField) {
-// for (int i= 0; i < breakpoints.length; i++) {
-// IBreakpoint breakpoint= breakpoints[i];
-// if (breakpoint instanceof IJavaWatchpoint) {
-// try {
-// if (equalFields(element, (IJavaWatchpoint)breakpoint))
-// return (IJavaBreakpoint)breakpoint;
-// } catch (CoreException e) {
-// JDIDebugUIPlugin.log(e);
-// }
-// }
-// }
-// }
-// return null;
-// }
+ // protected IJavaBreakpoint getBreakpoint(IMember element) {
+ // IBreakpointManager breakpointManager=
+ // DebugPlugin.getDefault().getBreakpointManager();
+ // IBreakpoint[] breakpoints=
+ // breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier());
+ // if (element instanceof IMethod) {
+ // IMethod method= (IMethod)element;
+ // for (int i= 0; i < breakpoints.length; i++) {
+ // IBreakpoint breakpoint= breakpoints[i];
+ // if (breakpoint instanceof IJavaMethodBreakpoint) {
+ // IJavaMethodBreakpoint methodBreakpoint=
+ // (IJavaMethodBreakpoint)breakpoint;
+ // IMember container = null;
+ // try {
+ // container= BreakpointUtils.getMember(methodBreakpoint);
+ // } catch (CoreException e) {
+ // JDIDebugUIPlugin.log(e);
+ // return null;
+ // }
+ // if (container == null) {
+ // try {
+ // if
+ // (method.getDeclaringType().getFullyQualifiedName().equals(methodBreakpoint.getTypeName())
+ // && method.getElementName().equals(methodBreakpoint.getMethodName())
+ // && method.getSignature().equals(methodBreakpoint.getMethodSignature())) {
+ // return methodBreakpoint;
+ // }
+ // } catch (CoreException e) {
+ // JDIDebugUIPlugin.log(e);
+ // }
+ // } else {
+ // if (container instanceof IMethod) {
+ // if
+ // (method.getDeclaringType().getFullyQualifiedName().equals(container.getDeclaringType().getFullyQualifiedName()))
+ // {
+ // if (method.isSimilar((IMethod)container)) {
+ // return methodBreakpoint;
+ // }
+ // }
+ // }
+ // }
+ // }
+ // }
+ // } else if (element instanceof IField) {
+ // for (int i= 0; i < breakpoints.length; i++) {
+ // IBreakpoint breakpoint= breakpoints[i];
+ // if (breakpoint instanceof IJavaWatchpoint) {
+ // try {
+ // if (equalFields(element, (IJavaWatchpoint)breakpoint))
+ // return (IJavaBreakpoint)breakpoint;
+ // } catch (CoreException e) {
+ // JDIDebugUIPlugin.log(e);
+ // }
+ // }
+ // }
+ // }
+ // return null;
+ // }
/**
- * Compare two fields. The default equals()
- * method for IField
doesn't give the comparison desired.
+ * Compare two fields. The default equals()
method for
+ * IField
doesn't give the comparison desired.
*/
-// private boolean equalFields(IMember breakpointField, IJavaWatchpoint watchpoint) throws CoreException {
-// return (breakpointField.getElementName().equals(watchpoint.getFieldName()) &&
-// breakpointField.getDeclaringType().getFullyQualifiedName().equals(watchpoint.getTypeName()));
-// }
-//
-// protected CompilationUnit parseCompilationUnit(ITextEditor editor) {
-// IEditorInput editorInput = editor.getEditorInput();
-// IDocument document= editor.getDocumentProvider().getDocument(editorInput);
-// ASTParser parser = ASTParser.newParser(AST.JLS2);
-// parser.setSource(document.get().toCharArray());
-// return (CompilationUnit) parser.createAST(null);
-// }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ // private boolean equalFields(IMember breakpointField, IJavaWatchpoint
+ // watchpoint) throws CoreException {
+ // return
+ // (breakpointField.getElementName().equals(watchpoint.getFieldName()) &&
+ // breakpointField.getDeclaringType().getFullyQualifiedName().equals(watchpoint.getTypeName()));
+ // }
+ //
+ // protected CompilationUnit parseCompilationUnit(ITextEditor editor) {
+ // IEditorInput editorInput = editor.getEditorInput();
+ // IDocument document=
+ // editor.getDocumentProvider().getDocument(editorInput);
+ // ASTParser parser = ASTParser.newParser(AST.JLS2);
+ // parser.setSource(document.get().toCharArray());
+ // return (CompilationUnit) parser.createAST(null);
+ // }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
*/
- public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
-// if (selection instanceof IStructuredSelection) {
-// IStructuredSelection ss = (IStructuredSelection) selection;
-// return getFields(ss).length > 0;
-// } else {
-// return selection instanceof ITextSelection;
-// }
+ public boolean canToggleWatchpoints(IWorkbenchPart part,
+ ISelection selection) {
+ // if (selection instanceof IStructuredSelection) {
+ // IStructuredSelection ss = (IStructuredSelection) selection;
+ // return getFields(ss).length > 0;
+ // } else {
+ // return selection instanceof ITextSelection;
+ // }
return false;
}
/**
- * Returns a selection of the member in the given text selection,
- * or the original selection if none.
- *
+ * Returns a selection of the member in the given text selection, or the
+ * original selection if none.
+ *
* @param part
* @param selection
* @return a structured selection of the member in the given text selection,
- * or the original selection if none
- * @exception CoreException if an exceptoin occurrs
+ * or the original selection if none
+ * @exception CoreException
+ * if an exceptoin occurrs
*/
-// protected ISelection translateToMembers(IWorkbenchPart part, ISelection selection) throws CoreException {
-// if (selection instanceof ITextSelection && part instanceof IEditorPart) {
-// ITextSelection textSelection = (ITextSelection)selection;
-// IEditorPart editorPart = (IEditorPart) part;
-// IEditorInput editorInput = editorPart.getEditorInput();
-// IMember m= null;
-// IClassFile classFile= (IClassFile)editorInput.getAdapter(IClassFile.class);
-// if (classFile != null) {
-// IJavaElement e= classFile.getElementAt(textSelection.getOffset());
-// if (e instanceof IMember) {
-// m= (IMember)e;
-// }
-// } else {
-// IWorkingCopyManager manager= JavaUI.getWorkingCopyManager();
-// ICompilationUnit unit= manager.getWorkingCopy(editorInput);
-// if (unit != null) {
-// synchronized (unit) {
-// unit.reconcile(ICompilationUnit.NO_AST /*don't create ast*/, false/*don't force problem detection*/, null/*use primary owner*/, null/*no progress monitor*/);
-// }
-// IJavaElement e = unit.getElementAt(textSelection.getOffset());
-// if (e instanceof IMember) {
-// m= (IMember)e;
-// }
-// }
-// }
-// if (m != null) {
-// return new StructuredSelection(m);
-// }
-// }
-// return selection;
-// }
-
+ // protected ISelection translateToMembers(IWorkbenchPart part, ISelection
+ // selection) throws CoreException {
+ // if (selection instanceof ITextSelection && part instanceof IEditorPart) {
+ // ITextSelection textSelection = (ITextSelection)selection;
+ // IEditorPart editorPart = (IEditorPart) part;
+ // IEditorInput editorInput = editorPart.getEditorInput();
+ // IMember m= null;
+ // IClassFile classFile=
+ // (IClassFile)editorInput.getAdapter(IClassFile.class);
+ // if (classFile != null) {
+ // IJavaElement e= classFile.getElementAt(textSelection.getOffset());
+ // if (e instanceof IMember) {
+ // m= (IMember)e;
+ // }
+ // } else {
+ // IWorkingCopyManager manager= JavaUI.getWorkingCopyManager();
+ // ICompilationUnit unit= manager.getWorkingCopy(editorInput);
+ // if (unit != null) {
+ // synchronized (unit) {
+ // unit.reconcile(ICompilationUnit.NO_AST /*don't create ast*/, false/*don't
+ // force problem detection*/, null/*use primary owner*/, null/*no progress
+ // monitor*/);
+ // }
+ // IJavaElement e = unit.getElementAt(textSelection.getOffset());
+ // if (e instanceof IMember) {
+ // m= (IMember)e;
+ // }
+ // }
+ // }
+ // if (m != null) {
+ // return new StructuredSelection(m);
+ // }
+ // }
+ // return selection;
+ // }
/**
- * Returns a list of matching types (IType - Java model) that correspond to the
- * declaring type (ReferenceType - JDI model) of the given variable.
+ * Returns a list of matching types (IType - Java model) that correspond to
+ * the declaring type (ReferenceType - JDI model) of the given variable.
*/
-// protected static List searchForDeclaringType(IJavaFieldVariable variable) {
-// List types= new ArrayList();
-// ILaunch launch = variable.getDebugTarget().getLaunch();
-// if (launch == null) {
-// return types;
-// }
-//
-// ILaunchConfiguration configuration= launch.getLaunchConfiguration();
-// IJavaProject[] javaProjects = null;
-// IWorkspace workspace= ResourcesPlugin.getWorkspace();
-// if (configuration != null) {
-// // Launch configuration support
-// try {
-// String projectName= configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
-// if (projectName.length() != 0) {
-// javaProjects= new IJavaProject[] {JavaCore.create(workspace.getRoot().getProject(projectName))};
-// } else {
-// IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects();
-// IProject project;
-// List projectList= new ArrayList();
-// for (int i= 0, numProjects= projects.length; i < numProjects; i++) {
-// project= projects[i];
-// if (project.isAccessible() && project.hasNature(JavaCore.NATURE_ID)) {
-// projectList.add(JavaCore.create(project));
-// }
-// }
-// javaProjects= new IJavaProject[projectList.size()];
-// projectList.toArray(javaProjects);
-// }
-// } catch (CoreException e) {
-// JDIDebugUIPlugin.log(e);
-// }
-// }
-// if (javaProjects == null) {
-// return types;
-// }
-//
-// SearchEngine engine= new SearchEngine();
-// IJavaSearchScope scope= SearchEngine.createJavaSearchScope(javaProjects, true);
-// String declaringType= null;
-// try {
-// declaringType= variable.getDeclaringType().getName();
-// } catch (DebugException x) {
-// JDIDebugUIPlugin.log(x);
-// return types;
-// }
-// ArrayList typeRefsFound= new ArrayList(3);
-// ITypeNameRequestor requestor= new TypeInfoRequestor(typeRefsFound);
-// try {
-// engine.searchAllTypeNames(
-// getPackage(declaringType),
-// getTypeName(declaringType),
-// SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,
-// IJavaSearchConstants.CLASS,
-// scope,
-// requestor,
-// IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
-// null);
-// } catch (JavaModelException x) {
-// JDIDebugUIPlugin.log(x);
-// return types;
-// }
-// Iterator iter= typeRefsFound.iterator();
-// TypeInfo typeInfo= null;
-// while (iter.hasNext()) {
-// typeInfo= (TypeInfo)iter.next();
-// try {
-// types.add(typeInfo.resolveType(scope));
-// } catch (JavaModelException jme) {
-// JDIDebugUIPlugin.log(jme);
-// }
-// }
-// return types;
-// }
-
+ // protected static List searchForDeclaringType(IJavaFieldVariable variable)
+ // {
+ // List types= new ArrayList();
+ // ILaunch launch = variable.getDebugTarget().getLaunch();
+ // if (launch == null) {
+ // return types;
+ // }
+ //
+ // ILaunchConfiguration configuration= launch.getLaunchConfiguration();
+ // IJavaProject[] javaProjects = null;
+ // IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ // if (configuration != null) {
+ // // Launch configuration support
+ // try {
+ // String projectName=
+ // configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
+ // ""); //$NON-NLS-1$
+ // if (projectName.length() != 0) {
+ // javaProjects= new IJavaProject[]
+ // {JavaCore.create(workspace.getRoot().getProject(projectName))};
+ // } else {
+ // IProject[] projects=
+ // ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ // IProject project;
+ // List projectList= new ArrayList();
+ // for (int i= 0, numProjects= projects.length; i < numProjects; i++) {
+ // project= projects[i];
+ // if (project.isAccessible() && project.hasNature(JavaCore.NATURE_ID)) {
+ // projectList.add(JavaCore.create(project));
+ // }
+ // }
+ // javaProjects= new IJavaProject[projectList.size()];
+ // projectList.toArray(javaProjects);
+ // }
+ // } catch (CoreException e) {
+ // JDIDebugUIPlugin.log(e);
+ // }
+ // }
+ // if (javaProjects == null) {
+ // return types;
+ // }
+ //
+ // SearchEngine engine= new SearchEngine();
+ // IJavaSearchScope scope= SearchEngine.createJavaSearchScope(javaProjects,
+ // true);
+ // String declaringType= null;
+ // try {
+ // declaringType= variable.getDeclaringType().getName();
+ // } catch (DebugException x) {
+ // JDIDebugUIPlugin.log(x);
+ // return types;
+ // }
+ // ArrayList typeRefsFound= new ArrayList(3);
+ // ITypeNameRequestor requestor= new TypeInfoRequestor(typeRefsFound);
+ // try {
+ // engine.searchAllTypeNames(
+ // getPackage(declaringType),
+ // getTypeName(declaringType),
+ // SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,
+ // IJavaSearchConstants.CLASS,
+ // scope,
+ // requestor,
+ // IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
+ // null);
+ // } catch (JavaModelException x) {
+ // JDIDebugUIPlugin.log(x);
+ // return types;
+ // }
+ // Iterator iter= typeRefsFound.iterator();
+ // TypeInfo typeInfo= null;
+ // while (iter.hasNext()) {
+ // typeInfo= (TypeInfo)iter.next();
+ // try {
+ // types.add(typeInfo.resolveType(scope));
+ // } catch (JavaModelException jme) {
+ // JDIDebugUIPlugin.log(jme);
+ // }
+ // }
+ // return types;
+ // }
/**
- * Returns the package name of the given fully qualified type name.
- * The package name is assumed to be the dot-separated prefix of the
- * type name.
+ * Returns the package name of the given fully qualified type name. The
+ * package name is assumed to be the dot-separated prefix of the type name.
*/
-// protected static char[] getPackage(String fullyQualifiedName) {
-// int index= fullyQualifiedName.lastIndexOf('.');
-// if (index == -1) {
-// return new char[0];
-// }
-// return fullyQualifiedName.substring(0, index).toCharArray();
-// }
-//
-// /**
-// * Returns a simple type name from the given fully qualified type name.
-// * The type name is assumed to be the last contiguous segment of the
-// * fullyQualifiedName not containing a '.' or '$'
-// */
-// protected static char[] getTypeName(String fullyQualifiedName) {
-// int index= fullyQualifiedName.lastIndexOf('.');
-// String typeName= fullyQualifiedName.substring(index + 1);
-// int lastInnerClass= typeName.lastIndexOf('$');
-// if (lastInnerClass != -1) {
-// typeName= typeName.substring(lastInnerClass + 1);
-// }
-// return typeName.toCharArray();
-// }
-//
-// /**
-// * Return the associated IField (Java model) for the given
-// * IJavaFieldVariable (JDI model)
-// */
-// private IField getField(IJavaFieldVariable variable) {
-// String varName= null;
-// try {
-// varName= variable.getName();
-// } catch (DebugException x) {
-// JDIDebugUIPlugin.log(x);
-// return null;
-// }
-// IField field;
-// List types= searchForDeclaringType(variable);
-// Iterator iter= types.iterator();
-// while (iter.hasNext()) {
-// IType type= (IType)iter.next();
-// field= type.getField(varName);
-// if (field.exists()) {
-// return field;
-// }
-// }
-// return null;
-// }
+ // protected static char[] getPackage(String fullyQualifiedName) {
+ // int index= fullyQualifiedName.lastIndexOf('.');
+ // if (index == -1) {
+ // return new char[0];
+ // }
+ // return fullyQualifiedName.substring(0, index).toCharArray();
+ // }
+ //
+ // /**
+ // * Returns a simple type name from the given fully qualified type name.
+ // * The type name is assumed to be the last contiguous segment of the
+ // * fullyQualifiedName not containing a '.' or '$'
+ // */
+ // protected static char[] getTypeName(String fullyQualifiedName) {
+ // int index= fullyQualifiedName.lastIndexOf('.');
+ // String typeName= fullyQualifiedName.substring(index + 1);
+ // int lastInnerClass= typeName.lastIndexOf('$');
+ // if (lastInnerClass != -1) {
+ // typeName= typeName.substring(lastInnerClass + 1);
+ // }
+ // return typeName.toCharArray();
+ // }
+ //
+ // /**
+ // * Return the associated IField (Java model) for the given
+ // * IJavaFieldVariable (JDI model)
+ // */
+ // private IField getField(IJavaFieldVariable variable) {
+ // String varName= null;
+ // try {
+ // varName= variable.getName();
+ // } catch (DebugException x) {
+ // JDIDebugUIPlugin.log(x);
+ // return null;
+ // }
+ // IField field;
+ // List types= searchForDeclaringType(variable);
+ // Iterator iter= types.iterator();
+ // while (iter.hasNext()) {
+ // IType type= (IType)iter.next();
+ // field= type.getField(varName);
+ // if (field.exists()) {
+ // return field;
+ // }
+ // }
+ // return null;
+ // }
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/ExecutionArguments.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/ExecutionArguments.java
index 108e2fb..79311cd 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/ExecutionArguments.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/ExecutionArguments.java
@@ -5,32 +5,45 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName;
public class ExecutionArguments {
- protected static final QualifiedName EXECUTION_ARGUMENTS_PROPERTY = new QualifiedName("net.sourceforge.phpdt", "executionArguments");
+ protected static final QualifiedName EXECUTION_ARGUMENTS_PROPERTY = new QualifiedName(
+ "net.sourceforge.phpdt", "executionArguments");
+
protected static final String ARGUMENT_SEPARATOR = "**null
if adding a new
+ * item
+ */
+ private void openNewPathMapDialog(EditPathMapDialog dialog,
+ TableItem updateItem) {
+ if (dialog.open() != EditPathMapDialog.OK) {
+ return;
+ }
+ String[] pathPair = dialog.getPathPair();
+ TableItem tableItem = updateItem;
+ if (tableItem == null) {
+ tableItem = getTableItemForName(pathPair[0]);
+ if (tableItem == null) {
+ tableItem = new TableItem(this.fRemoteDebugPathMapTable,
+ SWT.NONE);
+ }
+ }
+ tableItem.setText(pathPair);
+ this.fRemoteDebugPathMapTable
+ .setSelection(new TableItem[] { tableItem });
+ updateLaunchConfigurationDialog();
+ }
+
+ /**
+ * Helper method that indicates whether the specified parameter name is
+ * already present in the parameters table.
+ */
+ private TableItem getTableItemForName(String candidateName) {
+ TableItem[] items = this.fRemoteDebugPathMapTable.getItems();
+ for (int i = 0; i < items.length; i++) {
+ String name = items[i].getText(0);
+ if (name.equals(candidateName)) {
+ return items[i];
+ }
}
- }
- fPathMapAddButton.setEnabled(true);
+ return null;
+ }
+
+ // protected void addLoadPathTab(TabFolder tabFolder) {
+ // Composite loadPathComposite = new Composite(tabFolder, SWT.NONE);
+ // loadPathComposite.setLayout(new GridLayout());
+ //
+ // loadPathListViewer = new ListViewer(loadPathComposite, SWT.BORDER |
+ // SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
+ // loadPathListViewer.setContentProvider(new ListContentProvider());
+ // loadPathListViewer.setLabelProvider(new LoadPathEntryLabelProvider());
+ // loadPathListViewer.getList().setLayoutData(new
+ // GridData(GridData.FILL_BOTH));
+ //
+ // TabItem loadPathTab = new TabItem(tabFolder, SWT.NONE, 0);
+ // loadPathTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.loadPathTab.label"));
+ // loadPathTab.setControl(loadPathComposite);
+ // loadPathTab.setData(loadPathListViewer);
+
+ // loadPathDefaultButton = new Button(loadPathComposite, SWT.CHECK);
+ // loadPathDefaultButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.loadPathDefaultButton.label"));
+ // loadPathDefaultButton.setLayoutData(new
+ // GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ // loadPathDefaultButton.addSelectionListener(getLoadPathDefaultButtonSelectionListener());
+ //
+ // loadPathDefaultButton.setEnabled(false); //for now, until the load path
+ // is customizable on the configuration
+ // }
+
+ protected SelectionListener getLoadPathSelectionListener() {
+ return new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ System.out.println("Loadpath list selection occurred: "
+ + e.getSource());
+ }
+ };
}
- }
-
- /**
- * Show the specified dialog and update the pathMapTable table based on its results.
- *
- * @param updateItem
- * the item to update, or null
if adding a new item
- */
- private void openNewPathMapDialog(EditPathMapDialog dialog, TableItem updateItem) {
- if (dialog.open() != EditPathMapDialog.OK) {
- return;
+
+ protected SelectionListener getLoadPathDefaultButtonSelectionListener() {
+ return new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ setUseLoadPathDefaults(((Button) e.getSource()).getSelection());
+ }
+ };
}
- String[] pathPair = dialog.getPathPair();
- TableItem tableItem = updateItem;
- if (tableItem == null) {
- tableItem = getTableItemForName(pathPair[0]);
- if (tableItem == null) {
- tableItem = new TableItem(this.fRemoteDebugPathMapTable, SWT.NONE);
- }
+
+ protected void addInterpreterTab(TabFolder tabFolder) {
+ Composite interpreterComposite = new Composite(tabFolder, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ interpreterComposite.setLayout(layout);
+ interpreterComposite.setLayoutData(new GridData(
+ GridData.FILL_HORIZONTAL));
+
+ createVerticalSpacer(interpreterComposite, 2);
+
+ interpreterCombo = new Combo(interpreterComposite, SWT.READ_ONLY);
+ interpreterCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ initializeInterpreterCombo(interpreterCombo);
+ interpreterCombo.addModifyListener(getInterpreterComboModifyListener());
+
+ Button interpreterAddButton = new Button(interpreterComposite, SWT.PUSH);
+ interpreterAddButton
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.interpreterAddButton.label"));
+ interpreterAddButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ PHPInterpreter newInterpreter = new PHPInterpreter(null);
+ File phpRuntime = PHPInterpreterPreferencePage.getFile(
+ getShell(), null);
+ if (phpRuntime != null) {
+ newInterpreter.setInstallLocation(phpRuntime);
+ PHPRuntime.getDefault().addInstalledInterpreter(
+ newInterpreter);
+ interpreterCombo.add(newInterpreter.getInstallLocation()
+ .toString());
+ interpreterCombo.select(interpreterCombo
+ .indexOf(newInterpreter.getInstallLocation()
+ .toString()));
+ }
+ }
+ });
+
+ TabItem interpreterTab = new TabItem(tabFolder, SWT.NONE);
+ interpreterTab
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.interpreterTab.label"));
+ interpreterTab.setControl(interpreterComposite);
}
- tableItem.setText(pathPair);
- this.fRemoteDebugPathMapTable.setSelection(new TableItem[] { tableItem });
- updateLaunchConfigurationDialog();
- }
-
- /**
- * Helper method that indicates whether the specified parameter name is already present in the parameters table.
- */
- private TableItem getTableItemForName(String candidateName) {
- TableItem[] items = this.fRemoteDebugPathMapTable.getItems();
- for (int i = 0; i < items.length; i++) {
- String name = items[i].getText(0);
- if (name.equals(candidateName)) {
- return items[i];
- }
+
+ protected ModifyListener getInterpreterComboModifyListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent evt) {
+ updateLaunchConfigurationDialog();
+ }
+ };
}
- return null;
- }
-
- // protected void addLoadPathTab(TabFolder tabFolder) {
- // Composite loadPathComposite = new Composite(tabFolder, SWT.NONE);
- // loadPathComposite.setLayout(new GridLayout());
- //
- // loadPathListViewer = new ListViewer(loadPathComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- // loadPathListViewer.setContentProvider(new ListContentProvider());
- // loadPathListViewer.setLabelProvider(new LoadPathEntryLabelProvider());
- // loadPathListViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
- //
- // TabItem loadPathTab = new TabItem(tabFolder, SWT.NONE, 0);
- // loadPathTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.loadPathTab.label"));
- // loadPathTab.setControl(loadPathComposite);
- // loadPathTab.setData(loadPathListViewer);
-
- // loadPathDefaultButton = new Button(loadPathComposite, SWT.CHECK);
- // loadPathDefaultButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.loadPathDefaultButton.label"));
- // loadPathDefaultButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- // loadPathDefaultButton.addSelectionListener(getLoadPathDefaultButtonSelectionListener());
- //
- // loadPathDefaultButton.setEnabled(false); //for now, until the load path is customizable on the configuration
- // }
-
- protected SelectionListener getLoadPathSelectionListener() {
- return new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- System.out.println("Loadpath list selection occurred: " + e.getSource());
- }
- };
- }
-
- protected SelectionListener getLoadPathDefaultButtonSelectionListener() {
- return new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setUseLoadPathDefaults(((Button) e.getSource()).getSelection());
- }
- };
- }
-
- protected void addInterpreterTab(TabFolder tabFolder) {
- Composite interpreterComposite = new Composite(tabFolder, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- interpreterComposite.setLayout(layout);
- interpreterComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- createVerticalSpacer(interpreterComposite, 2);
-
- interpreterCombo = new Combo(interpreterComposite, SWT.READ_ONLY);
- interpreterCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- initializeInterpreterCombo(interpreterCombo);
- interpreterCombo.addModifyListener(getInterpreterComboModifyListener());
-
- Button interpreterAddButton = new Button(interpreterComposite, SWT.PUSH);
- interpreterAddButton.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterAddButton.label"));
- interpreterAddButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent evt) {
- PHPInterpreter newInterpreter = new PHPInterpreter(null);
- File phpRuntime = PHPInterpreterPreferencePage.getFile(getShell(), null);
- if (phpRuntime != null) {
- newInterpreter.setInstallLocation(phpRuntime);
- PHPRuntime.getDefault().addInstalledInterpreter(newInterpreter);
- interpreterCombo.add(newInterpreter.getInstallLocation().toString());
- interpreterCombo.select(interpreterCombo.indexOf(newInterpreter.getInstallLocation().toString()));
- }
- }
- });
- TabItem interpreterTab = new TabItem(tabFolder, SWT.NONE);
- interpreterTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.interpreterTab.label"));
- interpreterTab.setControl(interpreterComposite);
- }
+ protected void createVerticalSpacer(Composite comp, int colSpan) {
+ Label label = new Label(comp, SWT.NONE);
+ GridData gd = new GridData();
+ gd.horizontalSpan = colSpan;
+ label.setLayoutData(gd);
+ }
- protected ModifyListener getInterpreterComboModifyListener() {
- return new ModifyListener() {
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- };
- }
-
- protected void createVerticalSpacer(Composite comp, int colSpan) {
- Label label = new Label(comp, SWT.NONE);
- GridData gd = new GridData();
- gd.horizontalSpan = colSpan;
- label.setLayoutData(gd);
- }
-
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
PHPInterpreter selectedInterpreter = PHPRuntime.getDefault()
.getSelectedInterpreter();
if (selectedInterpreter != null) {
@@ -459,17 +514,23 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
interpreterLocation);
}
try {
- String projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME,"");
- if (projectName!="") {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if (project!=null) {
+ String projectName = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
+ if (projectName != "") {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(projectName);
+ if (project != null) {
IPath remotePath = project.getLocation();
- String fileName=configuration.getAttribute(PHPLaunchConfigurationAttribute.FILE_NAME,"");
- if (fileName!="") {
+ String fileName = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.FILE_NAME, "");
+ if (fileName != "") {
Path filePath = new Path(fileName);
- remotePath=remotePath.append(filePath.removeLastSegments(1));
+ remotePath = remotePath.append(filePath
+ .removeLastSegments(1));
}
- configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, remotePath.toOSString());
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.REMOTE_PATH,
+ remotePath.toOSString());
}
}
} catch (CoreException e) {
@@ -478,200 +539,237 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
}
}
- public void initializeFrom(ILaunchConfiguration configuration) {
- // initializeLoadPath(configuration);
- initializeInterpreterSelection(configuration);
- initializeRemoteDebug(configuration);
- }
-
- protected void initializeRemoteDebug(ILaunchConfiguration configuration) {
- try {
- fRemoteDebugCheckBox.setSelection(configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG,
- DEFAULT_REMOTE_DEBUG));
- } catch (CoreException ce) {
- fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG);
- }
- try {
- fRemoteDebugTranslate.setSelection(configuration.getAttribute(
- PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, DEFAULT_REMOTE_DEBUG_TRANSLATE));
- } catch (CoreException ce) {
- fRemoteDebugTranslate.setSelection(DEFAULT_REMOTE_DEBUG_TRANSLATE);
- }
- try {
- fOpenDBGSessionInBrowserCheckBox.setSelection(configuration.getAttribute(
- PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, DEFAULT_OPEN_DBGSESSION_IN_BROWSER));
- } catch (CoreException ce) {
- fOpenDBGSessionInBrowserCheckBox.setSelection(DEFAULT_OPEN_DBGSESSION_IN_BROWSER);
- }
- setRemoteTabEnableState();
- try {
- fRemoteSourcePath.setText(configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, ""));
- } catch (CoreException ce) {
- fRemoteSourcePath.setText("");
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ // initializeLoadPath(configuration);
+ initializeInterpreterSelection(configuration);
+ initializeRemoteDebug(configuration);
}
- updatePathMapFromConfig(configuration);
+ protected void initializeRemoteDebug(ILaunchConfiguration configuration) {
+ try {
+ fRemoteDebugCheckBox.setSelection(configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.REMOTE_DEBUG,
+ DEFAULT_REMOTE_DEBUG));
+ } catch (CoreException ce) {
+ fRemoteDebugCheckBox.setSelection(DEFAULT_REMOTE_DEBUG);
+ }
+ try {
+ fRemoteDebugTranslate.setSelection(configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE,
+ DEFAULT_REMOTE_DEBUG_TRANSLATE));
+ } catch (CoreException ce) {
+ fRemoteDebugTranslate.setSelection(DEFAULT_REMOTE_DEBUG_TRANSLATE);
+ }
+ try {
+ fOpenDBGSessionInBrowserCheckBox
+ .setSelection(configuration
+ .getAttribute(
+ PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER,
+ DEFAULT_OPEN_DBGSESSION_IN_BROWSER));
+ } catch (CoreException ce) {
+ fOpenDBGSessionInBrowserCheckBox
+ .setSelection(DEFAULT_OPEN_DBGSESSION_IN_BROWSER);
+ }
+ setRemoteTabEnableState();
+ try {
+ fRemoteSourcePath.setText(configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.REMOTE_PATH, ""));
+ } catch (CoreException ce) {
+ fRemoteSourcePath.setText("");
+ }
- }
+ updatePathMapFromConfig(configuration);
+
+ }
+
+ private void updatePathMapFromConfig(ILaunchConfiguration config) {
+ Map envVars = null;
+ try {
+ if (config != null) {
+ envVars = config.getAttribute(
+ PHPLaunchConfigurationAttribute.FILE_MAP, (Map) null);
+ }
+ updatePathMapTable(envVars, this.fRemoteDebugPathMapTable);
+ setPathMapButtonsEnableState();
+ } catch (CoreException ce) {
+ log(ce);
+ }
+ }
- private void updatePathMapFromConfig(ILaunchConfiguration config) {
- Map envVars = null;
- try {
- if (config != null) {
- envVars = config.getAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, (Map) null);
- }
- updatePathMapTable(envVars, this.fRemoteDebugPathMapTable);
- setPathMapButtonsEnableState();
- } catch (CoreException ce) {
- log(ce);
+ private void updatePathMapTable(Map map, Table tableWidget) {
+ tableWidget.removeAll();
+ if (map == null) {
+ return;
+ }
+ Iterator iterator = map.keySet().iterator();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ String value = (String) map.get(key);
+ TableItem tableItem = new TableItem(tableWidget, SWT.NONE);
+ tableItem.setText(new String[] { key, value });
+ }
}
- }
- private void updatePathMapTable(Map map, Table tableWidget) {
- tableWidget.removeAll();
- if (map == null) {
- return;
+ // protected void initializeLoadPath(ILaunchConfiguration configuration) {
+ // boolean useDefaultLoadPath = true;
+ // try {
+ // useDefaultLoadPath =
+ // configuration.getAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH,
+ // true);
+ // setUseLoadPathDefaults(useDefaultLoadPath);
+ // if (useDefaultLoadPath) {
+ // String projectName =
+ // configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME,
+ // "");
+ // if (projectName != "") {
+ // IProject aProject =
+ // PHPeclipsePlugin.getWorkspace().getRoot().getProject(projectName);
+ // if ((aProject != null) && JavaCore.isPHPProject(aProject)) {
+ // JavaProject thePHPProject = new JavaProject();
+ // thePHPProject.setProject(aProject);
+ // List loadPathEntries = thePHPProject.getLoadPathEntries();
+ // loadPathListViewer.setInput(loadPathEntries);
+ // }
+ // }
+ // }
+ // } catch (CoreException e) {
+ // log(e);
+ // }
+ // }
+
+ protected void setUseLoadPathDefaults(boolean useDefaults) {
+ loadPathListViewer.getList().setEnabled(!useDefaults);
+ // loadPathDefaultButton.setSelection(useDefaults);
}
- Iterator iterator = map.keySet().iterator();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- String value = (String) map.get(key);
- TableItem tableItem = new TableItem(tableWidget, SWT.NONE);
- tableItem.setText(new String[] { key, value });
+
+ protected void initializeInterpreterSelection(
+ ILaunchConfiguration configuration) {
+ String interpreterName = null;
+ try {
+ interpreterName = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
+ } catch (CoreException e) {
+ log(e);
+ }
+ if (interpreterName != null && !interpreterName.equals(""))
+ interpreterCombo.select(interpreterCombo.indexOf(interpreterName));
}
- }
-
- // protected void initializeLoadPath(ILaunchConfiguration configuration) {
- // boolean useDefaultLoadPath = true;
- // try {
- // useDefaultLoadPath = configuration.getAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH, true);
- // setUseLoadPathDefaults(useDefaultLoadPath);
- // if (useDefaultLoadPath) {
- // String projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
- // if (projectName != "") {
- // IProject aProject = PHPeclipsePlugin.getWorkspace().getRoot().getProject(projectName);
- // if ((aProject != null) && JavaCore.isPHPProject(aProject)) {
- // JavaProject thePHPProject = new JavaProject();
- // thePHPProject.setProject(aProject);
- // List loadPathEntries = thePHPProject.getLoadPathEntries();
- // loadPathListViewer.setInput(loadPathEntries);
- // }
- // }
- // }
- // } catch (CoreException e) {
- // log(e);
- // }
- // }
-
- protected void setUseLoadPathDefaults(boolean useDefaults) {
- loadPathListViewer.getList().setEnabled(!useDefaults);
- // loadPathDefaultButton.setSelection(useDefaults);
- }
-
- protected void initializeInterpreterSelection(ILaunchConfiguration configuration) {
- String interpreterName = null;
- try {
- interpreterName = configuration.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
- } catch (CoreException e) {
- log(e);
+
+ protected void initializeInterpreterCombo(Combo interpreterCombo) {
+ installedInterpretersWorkingCopy = new ArrayList();
+ installedInterpretersWorkingCopy.addAll(PHPRuntime.getDefault()
+ .getInstalledInterpreters());
+
+ String[] interpreterNames = new String[installedInterpretersWorkingCopy
+ .size()];
+ for (int interpreterIndex = 0; interpreterIndex < installedInterpretersWorkingCopy
+ .size(); interpreterIndex++) {
+ PHPInterpreter interpreter = (PHPInterpreter) installedInterpretersWorkingCopy
+ .get(interpreterIndex);
+ interpreterNames[interpreterIndex] = interpreter
+ .getInstallLocation().toString();
+ }
+ interpreterCombo.setItems(interpreterNames);
+
+ PHPInterpreter selectedInterpreter = PHPRuntime.getDefault()
+ .getSelectedInterpreter();
+ if (selectedInterpreter != null)
+ interpreterCombo.select(interpreterCombo
+ .indexOf(selectedInterpreter.getInstallLocation()
+ .toString()));
}
- if (interpreterName != null && !interpreterName.equals(""))
- interpreterCombo.select(interpreterCombo.indexOf(interpreterName));
- }
-
- protected void initializeInterpreterCombo(Combo interpreterCombo) {
- installedInterpretersWorkingCopy = new ArrayList();
- installedInterpretersWorkingCopy.addAll(PHPRuntime.getDefault().getInstalledInterpreters());
-
- String[] interpreterNames = new String[installedInterpretersWorkingCopy.size()];
- for (int interpreterIndex = 0; interpreterIndex < installedInterpretersWorkingCopy.size(); interpreterIndex++) {
- PHPInterpreter interpreter = (PHPInterpreter) installedInterpretersWorkingCopy.get(interpreterIndex);
- interpreterNames[interpreterIndex] = interpreter.getInstallLocation().toString();
+
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ int selectionIndex = interpreterCombo.getSelectionIndex();
+ if (selectionIndex >= 0)
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER,
+ interpreterCombo.getItem(selectionIndex));
+
+ // configuration.setAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH,
+ // loadPathDefaultButton.getSelection());
+
+ // if (!loadPathDefaultButton.getSelection()) {
+ // List loadPathEntries = (List) loadPathListViewer.getInput();
+ // List loadPathStrings = new ArrayList();
+ // for (Iterator iterator = loadPathEntries.iterator();
+ // iterator.hasNext();) {
+ // LoadPathEntry entry = (LoadPathEntry) iterator.next();
+ // loadPathStrings.add(entry.getPath().toString());
+ // }
+ // configuration.setAttribute(PHPLaunchConfigurationAttribute.CUSTOM_LOAD_PATH,
+ // loadPathStrings);
+ // }
+
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.REMOTE_DEBUG,
+ fRemoteDebugCheckBox.getSelection());
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE,
+ fRemoteDebugTranslate.getSelection());
+ configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_MAP,
+ getMapFromPathMapTable());
+ configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH,
+ fRemoteSourcePath.getText());
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER,
+ fOpenDBGSessionInBrowserCheckBox.getSelection());
}
- interpreterCombo.setItems(interpreterNames);
-
- PHPInterpreter selectedInterpreter = PHPRuntime.getDefault().getSelectedInterpreter();
- if (selectedInterpreter != null)
- interpreterCombo.select(interpreterCombo.indexOf(selectedInterpreter.getInstallLocation().toString()));
- }
-
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- int selectionIndex = interpreterCombo.getSelectionIndex();
- if (selectionIndex >= 0)
- configuration.setAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, interpreterCombo.getItem(selectionIndex));
-
- // configuration.setAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_LOAD_PATH, loadPathDefaultButton.getSelection());
-
- // if (!loadPathDefaultButton.getSelection()) {
- // List loadPathEntries = (List) loadPathListViewer.getInput();
- // List loadPathStrings = new ArrayList();
- // for (Iterator iterator = loadPathEntries.iterator(); iterator.hasNext();) {
- // LoadPathEntry entry = (LoadPathEntry) iterator.next();
- // loadPathStrings.add(entry.getPath().toString());
- // }
- // configuration.setAttribute(PHPLaunchConfigurationAttribute.CUSTOM_LOAD_PATH, loadPathStrings);
- // }
-
- configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, fRemoteDebugCheckBox.getSelection());
- configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, fRemoteDebugTranslate.getSelection());
- configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, getMapFromPathMapTable());
- configuration.setAttribute(PHPLaunchConfigurationAttribute.REMOTE_PATH, fRemoteSourcePath.getText());
- configuration.setAttribute(PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, fOpenDBGSessionInBrowserCheckBox
- .getSelection());
- }
-
- protected Composite createPageRoot(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- createVerticalSpacer(composite, 2);
- setControl(composite);
-
- return composite;
- }
-
- private Map getMapFromPathMapTable() {
- TableItem[] items = fRemoteDebugPathMapTable.getItems();
- if (items.length == 0) {
- return null;
+
+ protected Composite createPageRoot(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ createVerticalSpacer(composite, 2);
+ setControl(composite);
+
+ return composite;
}
- Map map = new HashMap(items.length);
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
- String key = item.getText(0);
- String value = item.getText(1);
- map.put(key, value);
+
+ private Map getMapFromPathMapTable() {
+ TableItem[] items = fRemoteDebugPathMapTable.getItems();
+ if (items.length == 0) {
+ return null;
+ }
+ Map map = new HashMap(items.length);
+ for (int i = 0; i < items.length; i++) {
+ TableItem item = items[i];
+ String key = item.getText(0);
+ String value = item.getText(1);
+ map.put(key, value);
+ }
+ return map;
}
- return map;
- }
-
- public String getName() {
- return PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.name");
- }
-
- public boolean isValid(ILaunchConfiguration launchConfig) {
- try {
- String selectedInterpreter = launchConfig.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
- if (selectedInterpreter.length() == 0) {
- setErrorMessage(PHPDebugUiMessages
- .getString("LaunchConfigurationTab.PHPEnvironment.interpreter_not_selected_error_message"));
- return false;
- }
- } catch (CoreException e) {
- log(e);
+
+ public String getName() {
+ return PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.name");
}
- setErrorMessage(null);
- return true;
- }
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ try {
+ String selectedInterpreter = launchConfig.getAttribute(
+ PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
+ if (selectedInterpreter.length() == 0) {
+ setErrorMessage(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.interpreter_not_selected_error_message"));
+ return false;
+ }
+ } catch (CoreException e) {
+ log(e);
+ }
+
+ setErrorMessage(null);
+ return true;
+ }
- protected void log(Throwable t) {
- PHPDebugUiPlugin.log(t);
- }
+ protected void log(Throwable t) {
+ PHPDebugUiPlugin.log(t);
+ }
- public Image getImage() {
- return PHPUiImages.get(PHPUiImages.IMG_CTOOLS_PHP);
- }
+ public Image getImage() {
+ return PHPUiImages.get(PHPUiImages.IMG_CTOOLS_PHP);
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab2.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab2.java
index 390d7c1..288910f 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab2.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab2.java
@@ -69,53 +69,62 @@ import org.eclipse.ui.dialogs.ListSelectionDialog;
/**
* @author Christian
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
*/
public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
-
protected TableViewer environmentTable;
- protected String[] envTableColumnHeaders =
- {
- LaunchConfigurationsMessages.EnvironmentTab_Variable_1, //$NON-NLS-1$
- LaunchConfigurationsMessages.EnvironmentTab_Value_2 //$NON-NLS-1$
- };
- protected ColumnLayoutData[] envTableColumnLayouts =
- {
- new ColumnWeightData(50),
- new ColumnWeightData(50)
+
+ protected String[] envTableColumnHeaders = {
+ LaunchConfigurationsMessages.EnvironmentTab_Variable_1, //$NON-NLS-1$
+ LaunchConfigurationsMessages.EnvironmentTab_Value_2 //$NON-NLS-1$
};
- private static final String NAME_LABEL= LaunchConfigurationsMessages.EnvironmentTab_8; //$NON-NLS-1$
- private static final String VALUE_LABEL= LaunchConfigurationsMessages.EnvironmentTab_9; //$NON-NLS-1$
+
+ protected ColumnLayoutData[] envTableColumnLayouts = {
+ new ColumnWeightData(50), new ColumnWeightData(50) };
+
+ private static final String NAME_LABEL = LaunchConfigurationsMessages.EnvironmentTab_8; //$NON-NLS-1$
+
+ private static final String VALUE_LABEL = LaunchConfigurationsMessages.EnvironmentTab_9; //$NON-NLS-1$
+
protected static final String P_VARIABLE = "variable"; //$NON-NLS-1$
+
protected static final String P_VALUE = "value"; //$NON-NLS-1$
- protected static String[] envTableColumnProperties =
- {
- P_VARIABLE,
- P_VALUE
- };
+
+ protected static String[] envTableColumnProperties = { P_VARIABLE, P_VALUE };
+
protected Button envAddButton;
+
protected Button envAddCGIButton;
+
protected Button envEditButton;
+
protected Button envRemoveButton;
+
protected Button appendEnvironment;
+
protected Button replaceEnvironment;
+
protected Button envSelectButton;
/**
* Content provider for the environment table
*/
- protected class EnvironmentVariableContentProvider implements IStructuredContentProvider {
+ protected class EnvironmentVariableContentProvider implements
+ IStructuredContentProvider {
public Object[] getElements(Object inputElement) {
EnvironmentVariable[] elements = new EnvironmentVariable[0];
ILaunchConfiguration config = (ILaunchConfiguration) inputElement;
Map m;
try {
- m = config.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null);
+ m = config.getAttribute(
+ ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null);
} catch (CoreException e) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, "Error reading configuration", e)); //$NON-NLS-1$
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin
+ .getUniqueIdentifier(), IStatus.ERROR,
+ "Error reading configuration", e)); //$NON-NLS-1$
return elements;
}
if (m != null && !m.isEmpty()) {
@@ -123,19 +132,22 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
String[] varNames = new String[m.size()];
m.keySet().toArray(varNames);
for (int i = 0; i < m.size(); i++) {
- elements[i] = new EnvironmentVariable(varNames[i], (String) m.get(varNames[i]));
+ elements[i] = new EnvironmentVariable(varNames[i],
+ (String) m.get(varNames[i]));
}
}
return elements;
}
+
public void dispose() {
}
+
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput == null){
+ if (newInput == null) {
return;
}
- if (viewer instanceof TableViewer){
- TableViewer tableViewer= (TableViewer) viewer;
+ if (viewer instanceof TableViewer) {
+ TableViewer tableViewer = (TableViewer) viewer;
if (tableViewer.getTable().isDisposed()) {
return;
}
@@ -146,7 +158,10 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
} else if (e2 == null) {
return 1;
} else {
- return ((EnvironmentVariable)e1).getName().compareToIgnoreCase(((EnvironmentVariable)e2).getName());
+ return ((EnvironmentVariable) e1).getName()
+ .compareToIgnoreCase(
+ ((EnvironmentVariable) e2)
+ .getName());
}
}
});
@@ -157,35 +172,44 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
/**
* Label provider for the environment table
*/
- public class EnvironmentVariableLabelProvider extends LabelProvider implements ITableLabelProvider {
- public String getColumnText(Object element, int columnIndex) {
+ public class EnvironmentVariableLabelProvider extends LabelProvider
+ implements ITableLabelProvider {
+ public String getColumnText(Object element, int columnIndex) {
String result = null;
if (element != null) {
EnvironmentVariable var = (EnvironmentVariable) element;
switch (columnIndex) {
- case 0: // variable
- result = var.getName();
- break;
- case 1: // value
- result = var.getValue();
- break;
+ case 0: // variable
+ result = var.getName();
+ break;
+ case 1: // value
+ result = var.getValue();
+ break;
}
}
return result;
}
+
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
// Create main composite
Composite mainComposite = new Composite(parent, SWT.NONE);
setControl(mainComposite);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB);
+ PlatformUI
+ .getWorkbench()
+ .getHelpSystem()
+ .setHelp(
+ getControl(),
+ IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ENVIRONMENT_TAB);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
@@ -201,46 +225,52 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
}
/**
- * Creates and configures the widgets which allow the user to
- * choose whether the specified environment should be appended
- * to the native environment or if it should completely replace it.
- * @param parent the composite in which the widgets should be created
+ * Creates and configures the widgets which allow the user to choose whether
+ * the specified environment should be appended to the native environment or
+ * if it should completely replace it.
+ *
+ * @param parent
+ * the composite in which the widgets should be created
*/
protected void createAppendReplace(Composite parent) {
- Composite appendReplaceComposite= new Composite(parent, SWT.NONE);
- GridData gridData= new GridData();
- gridData.horizontalSpan= 2;
- GridLayout layout= new GridLayout();
+ Composite appendReplaceComposite = new Composite(parent, SWT.NONE);
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 2;
+ GridLayout layout = new GridLayout();
appendReplaceComposite.setLayoutData(gridData);
appendReplaceComposite.setLayout(layout);
appendReplaceComposite.setFont(parent.getFont());
- appendEnvironment= createRadioButton(appendReplaceComposite, LaunchConfigurationsMessages.EnvironmentTab_16); //$NON-NLS-1$
+ appendEnvironment = createRadioButton(appendReplaceComposite,
+ LaunchConfigurationsMessages.EnvironmentTab_16); //$NON-NLS-1$
appendEnvironment.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
- replaceEnvironment= createRadioButton(appendReplaceComposite, LaunchConfigurationsMessages.EnvironmentTab_17); //$NON-NLS-1$
+ replaceEnvironment = createRadioButton(appendReplaceComposite,
+ LaunchConfigurationsMessages.EnvironmentTab_17); //$NON-NLS-1$
}
/**
- * Updates the enablement of the append/replace widgets. The
- * widgets should disable when there are no environment variables specified.
+ * Updates the enablement of the append/replace widgets. The widgets should
+ * disable when there are no environment variables specified.
*/
protected void updateAppendReplace() {
- boolean enable= environmentTable.getTable().getItemCount() > 0;
+ boolean enable = environmentTable.getTable().getItemCount() > 0;
appendEnvironment.setEnabled(enable);
replaceEnvironment.setEnabled(enable);
}
/**
- * Creates and configures the table that displayed the key/value
- * pairs that comprise the environment.
- * @param parent the composite in which the table should be created
+ * Creates and configures the table that displayed the key/value pairs that
+ * comprise the environment.
+ *
+ * @param parent
+ * the composite in which the table should be created
*/
protected void createEnvironmentTable(Composite parent) {
- Font font= parent.getFont();
+ Font font = parent.getFont();
// Create table composite
Composite tableComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
@@ -255,9 +285,11 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
// Create label
Label label = new Label(tableComposite, SWT.NONE);
label.setFont(font);
- label.setText(LaunchConfigurationsMessages.EnvironmentTab_Environment_variables_to_set__3); //$NON-NLS-1$
+ label
+ .setText(LaunchConfigurationsMessages.EnvironmentTab_Environment_variables_to_set__3); //$NON-NLS-1$
// Create table
- environmentTable = new TableViewer(tableComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
+ environmentTable = new TableViewer(tableComposite, SWT.BORDER
+ | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
Table table = environmentTable.getTable();
TableLayout tableLayout = new TableLayout();
table.setLayout(tableLayout);
@@ -265,14 +297,17 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
table.setFont(font);
gridData = new GridData(GridData.FILL_BOTH);
environmentTable.getControl().setLayoutData(gridData);
- environmentTable.setContentProvider(new EnvironmentVariableContentProvider());
- environmentTable.setLabelProvider(new EnvironmentVariableLabelProvider());
+ environmentTable
+ .setContentProvider(new EnvironmentVariableContentProvider());
+ environmentTable
+ .setLabelProvider(new EnvironmentVariableLabelProvider());
environmentTable.setColumnProperties(envTableColumnProperties);
- environmentTable.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleTableSelectionChanged(event);
- }
- });
+ environmentTable
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleTableSelectionChanged(event);
+ }
+ });
environmentTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
if (!environmentTable.getSelection().isEmpty()) {
@@ -291,17 +326,21 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
/**
* Responds to a selection changed event in the environment table
- * @param event the selection change event
+ *
+ * @param event
+ * the selection change event
*/
protected void handleTableSelectionChanged(SelectionChangedEvent event) {
- int size = ((IStructuredSelection)event.getSelection()).size();
+ int size = ((IStructuredSelection) event.getSelection()).size();
envEditButton.setEnabled(size == 1);
envRemoveButton.setEnabled(size > 0);
}
/**
* Creates the add/edit/remove buttons for the environment table
- * @param parent the composite in which the buttons should be created
+ *
+ * @param parent
+ * the composite in which the buttons should be created
*/
protected void createTableButtons(Composite parent) {
// Create button composite
@@ -310,44 +349,49 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
glayout.marginHeight = 0;
glayout.marginWidth = 0;
glayout.numColumns = 1;
- GridData gdata = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_END);
+ GridData gdata = new GridData(GridData.VERTICAL_ALIGN_BEGINNING
+ | GridData.HORIZONTAL_ALIGN_END);
buttonComposite.setLayout(glayout);
buttonComposite.setLayoutData(gdata);
buttonComposite.setFont(parent.getFont());
createVerticalSpacer(buttonComposite, 1);
// Create buttons
- envAddButton = createPushButton(buttonComposite, LaunchConfigurationsMessages.EnvironmentTab_New_4, null); //$NON-NLS-1$
- envAddButton.addSelectionListener(new SelectionAdapter()
- {
+ envAddButton = createPushButton(buttonComposite,
+ LaunchConfigurationsMessages.EnvironmentTab_New_4, null); //$NON-NLS-1$
+ envAddButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleEnvAddButtonSelected();
}
- });
- envAddCGIButton = createPushButton(buttonComposite, PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment2.CGIButton"), null); //$NON-NLS-1$
+ });
+ envAddCGIButton = createPushButton(
+ buttonComposite,
+ PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment2.CGIButton"), null); //$NON-NLS-1$
envAddCGIButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleEnvAddCGIButtonSelected();
}
});
- envSelectButton = createPushButton(buttonComposite, LaunchConfigurationsMessages.EnvironmentTab_18, null); //$NON-NLS-1$
+ envSelectButton = createPushButton(buttonComposite,
+ LaunchConfigurationsMessages.EnvironmentTab_18, null); //$NON-NLS-1$
envSelectButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleEnvSelectButtonSelected();
}
});
- envEditButton = createPushButton(buttonComposite, LaunchConfigurationsMessages.EnvironmentTab_Edit_5, null); //$NON-NLS-1$
- envEditButton.addSelectionListener(new SelectionAdapter()
- {
+ envEditButton = createPushButton(buttonComposite,
+ LaunchConfigurationsMessages.EnvironmentTab_Edit_5, null); //$NON-NLS-1$
+ envEditButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleEnvEditButtonSelected();
}
});
envEditButton.setEnabled(false);
- envRemoveButton = createPushButton(buttonComposite, LaunchConfigurationsMessages.EnvironmentTab_Remove_6, null); //$NON-NLS-1$
- envRemoveButton.addSelectionListener(new SelectionAdapter()
- {
+ envRemoveButton = createPushButton(buttonComposite,
+ LaunchConfigurationsMessages.EnvironmentTab_Remove_6, null); //$NON-NLS-1$
+ envRemoveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleEnvRemoveButtonSelected();
}
@@ -359,7 +403,8 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
* Adds a new environment variable to the table.
*/
protected void handleEnvAddButtonSelected() {
- MultipleInputDialog dialog = new MultipleInputDialog(getShell(), LaunchConfigurationsMessages.EnvironmentTab_22); //$NON-NLS-1$
+ MultipleInputDialog dialog = new MultipleInputDialog(getShell(),
+ LaunchConfigurationsMessages.EnvironmentTab_22); //$NON-NLS-1$
dialog.addTextField(NAME_LABEL, null, false);
dialog.addVariablesField(VALUE_LABEL, null, true);
@@ -370,26 +415,34 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
String name = dialog.getStringValue(NAME_LABEL);
String value = dialog.getStringValue(VALUE_LABEL);
- if (name != null && value != null && name.length() > 0 && value.length() >0) {
+ if (name != null && value != null && name.length() > 0
+ && value.length() > 0) {
addVariable(new EnvironmentVariable(name.trim(), value.trim()));
updateAppendReplace();
}
}
/**
- * Attempts to add the given variable. Returns whether the variable
- * was added or not (as when the user answers not to overwrite an
- * existing variable).
- * @param variable the variable to add
+ * Attempts to add the given variable. Returns whether the variable was
+ * added or not (as when the user answers not to overwrite an existing
+ * variable).
+ *
+ * @param variable
+ * the variable to add
* @return whether the variable was added
*/
protected boolean addVariable(EnvironmentVariable variable) {
- String name= variable.getName();
+ String name = variable.getName();
TableItem[] items = environmentTable.getTable().getItems();
for (int i = 0; i < items.length; i++) {
- EnvironmentVariable existingVariable = (EnvironmentVariable) items[i].getData();
+ EnvironmentVariable existingVariable = (EnvironmentVariable) items[i]
+ .getData();
if (existingVariable.getName().equals(name)) {
- boolean overWrite= MessageDialog.openQuestion(getShell(), LaunchConfigurationsMessages.EnvironmentTab_12, MessageFormat.format(LaunchConfigurationsMessages.EnvironmentTab_13, new String[] {name})); //$NON-NLS-1$ //$NON-NLS-2$
+ boolean overWrite = MessageDialog.openQuestion(getShell(),
+ LaunchConfigurationsMessages.EnvironmentTab_12,
+ MessageFormat.format(
+ LaunchConfigurationsMessages.EnvironmentTab_13,
+ new String[] { name })); //$NON-NLS-1$ //$NON-NLS-2$
if (!overWrite) {
return false;
}
@@ -407,18 +460,21 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
* to add to the table.
*/
private void handleEnvSelectButtonSelected() {
- //get Environment Variables from the OS
+ // get Environment Variables from the OS
Map envVariables = getNativeEnvironment();
- //get Environment Variables from the table
+ // get Environment Variables from the table
TableItem[] items = environmentTable.getTable().getItems();
for (int i = 0; i < items.length; i++) {
EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
envVariables.remove(var.getName());
}
- ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(), envVariables, createSelectionDialogContentProvider(), createSelectionDialogLabelProvider(), LaunchConfigurationsMessages.EnvironmentTab_19); //$NON-NLS-1$
- dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20); //$NON-NLS-1$
+ ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(),
+ envVariables, createSelectionDialogContentProvider(),
+ createSelectionDialogLabelProvider(),
+ LaunchConfigurationsMessages.EnvironmentTab_19); //$NON-NLS-1$
+ dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20); //$NON-NLS-1$
int button = dialog.open();
if (button == Window.OK) {
@@ -440,35 +496,50 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
Map envVariables = new HashMap();
-
- envVariables.put("HTTP_COOKIE",new EnvironmentVariable("HTTP_COOKIE", "TestCookie=1"));
- envVariables.put("REDIRECT_QUERY_STRING",new EnvironmentVariable("REDIRECT_QUERY_STRING", ""));
- envVariables.put("REDIRECT_STATUS",new EnvironmentVariable("REDIRECT_STATUS", "200"));
- envVariables.put("REDIRECT_URL",new EnvironmentVariable("REDIRECT_URL", ""));
- envVariables.put("SERVER_SOFTWARE",new EnvironmentVariable("SERVER_SOFTWARE","DBG / 2.1"));
- envVariables.put("SERVER_NAME",new EnvironmentVariable("SERVER_NAME","localhost"));
- envVariables.put("SERVER_ADDR",new EnvironmentVariable("SERVER_ADDR","127.0.0.1"));
- envVariables.put("SERVER_PORT",new EnvironmentVariable("SERVER_PORT","80"));
- envVariables.put("REMOTE_ADDR",new EnvironmentVariable("REMOTE_ADDR","127.0.0.1"));
- envVariables.put("GATEWAY_INTERFACE",new EnvironmentVariable("GATEWAY_INTERFACE","CGI / 1.1"));
- envVariables.put("SERVER_PROTOCOL",new EnvironmentVariable("SERVER_PROTOCOL","HTTP / 1.1"));
- envVariables.put("REQUEST_METHOD",new EnvironmentVariable("REQUEST_METHOD","GET"));
- envVariables.put("QUERY_STRING",new EnvironmentVariable("QUERY_STRING",""));
- envVariables.put("REDIRECT_QUERY_STRING",new EnvironmentVariable("REDIRECT_QUERY_STRING",""));
-// envVariables.put("REQUEST_URI" + OSFilePath;
-// envVariables.put("PATH_INFO=" + OSFilePath;
-// envVariables.put("PATH_TRANSLATED=" + OSFilePath;
-
-
- //get Environment Variables from the table
+ envVariables.put("HTTP_COOKIE", new EnvironmentVariable("HTTP_COOKIE",
+ "TestCookie=1"));
+ envVariables.put("REDIRECT_QUERY_STRING", new EnvironmentVariable(
+ "REDIRECT_QUERY_STRING", ""));
+ envVariables.put("REDIRECT_STATUS", new EnvironmentVariable(
+ "REDIRECT_STATUS", "200"));
+ envVariables.put("REDIRECT_URL", new EnvironmentVariable(
+ "REDIRECT_URL", ""));
+ envVariables.put("SERVER_SOFTWARE", new EnvironmentVariable(
+ "SERVER_SOFTWARE", "DBG / 2.1"));
+ envVariables.put("SERVER_NAME", new EnvironmentVariable("SERVER_NAME",
+ "localhost"));
+ envVariables.put("SERVER_ADDR", new EnvironmentVariable("SERVER_ADDR",
+ "127.0.0.1"));
+ envVariables.put("SERVER_PORT", new EnvironmentVariable("SERVER_PORT",
+ "80"));
+ envVariables.put("REMOTE_ADDR", new EnvironmentVariable("REMOTE_ADDR",
+ "127.0.0.1"));
+ envVariables.put("GATEWAY_INTERFACE", new EnvironmentVariable(
+ "GATEWAY_INTERFACE", "CGI / 1.1"));
+ envVariables.put("SERVER_PROTOCOL", new EnvironmentVariable(
+ "SERVER_PROTOCOL", "HTTP / 1.1"));
+ envVariables.put("REQUEST_METHOD", new EnvironmentVariable(
+ "REQUEST_METHOD", "GET"));
+ envVariables.put("QUERY_STRING", new EnvironmentVariable(
+ "QUERY_STRING", ""));
+ envVariables.put("REDIRECT_QUERY_STRING", new EnvironmentVariable(
+ "REDIRECT_QUERY_STRING", ""));
+ // envVariables.put("REQUEST_URI" + OSFilePath;
+ // envVariables.put("PATH_INFO=" + OSFilePath;
+ // envVariables.put("PATH_TRANSLATED=" + OSFilePath;
+
+ // get Environment Variables from the table
TableItem[] items = environmentTable.getTable().getItems();
for (int i = 0; i < items.length; i++) {
EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
envVariables.remove(var.getName());
}
- ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(), envVariables, createSelectionDialogContentProvider(), createSelectionDialogLabelProvider(), LaunchConfigurationsMessages.EnvironmentTab_19); //$NON-NLS-1$
- dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20); //$NON-NLS-1$
+ ListSelectionDialog dialog = new NativeEnvironmentDialog(getShell(),
+ envVariables, createSelectionDialogContentProvider(),
+ createSelectionDialogLabelProvider(),
+ LaunchConfigurationsMessages.EnvironmentTab_19); //$NON-NLS-1$
+ dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20); //$NON-NLS-1$
int button = dialog.open();
if (button == Window.OK) {
@@ -482,35 +553,45 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
updateLaunchConfigurationDialog();
}
-
/**
- * Creates a label provider for the native native environment variable selection dialog.
- * @return A label provider for the native native environment variable selection dialog.
+ * Creates a label provider for the native native environment variable
+ * selection dialog.
+ *
+ * @return A label provider for the native native environment variable
+ * selection dialog.
*/
private ILabelProvider createSelectionDialogLabelProvider() {
return new ILabelProvider() {
public Image getImage(Object element) {
return null;
}
+
public String getText(Object element) {
EnvironmentVariable var = (EnvironmentVariable) element;
return var.getName() + " [" + var.getValue() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
+
public void addListener(ILabelProviderListener listener) {
}
+
public void dispose() {
}
+
public boolean isLabelProperty(Object element, String property) {
return false;
}
+
public void removeListener(ILabelProviderListener listener) {
}
};
}
/**
- * Creates a content provider for the native native environment variable selection dialog.
- * @return A content provider for the native native environment variable selection dialog.
+ * Creates a content provider for the native native environment variable
+ * selection dialog.
+ *
+ * @return A content provider for the native native environment variable
+ * selection dialog.
*/
private IStructuredContentProvider createSelectionDialogContentProvider() {
return new IStructuredContentProvider() {
@@ -519,38 +600,47 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
if (inputElement instanceof HashMap) {
Comparator comparator = new Comparator() {
public int compare(Object o1, Object o2) {
- String s1 = (String)o1;
- String s2 = (String)o2;
+ String s1 = (String) o1;
+ String s2 = (String) o2;
return s1.compareTo(s2);
}
};
TreeMap envVars = new TreeMap(comparator);
- envVars.putAll((Map)inputElement);
+ envVars.putAll((Map) inputElement);
elements = new EnvironmentVariable[envVars.size()];
int index = 0;
- for (Iterator iterator = envVars.keySet().iterator(); iterator.hasNext(); index++) {
+ for (Iterator iterator = envVars.keySet().iterator(); iterator
+ .hasNext(); index++) {
Object key = iterator.next();
- elements[index] = (EnvironmentVariable) envVars.get(key);
+ elements[index] = (EnvironmentVariable) envVars
+ .get(key);
}
}
return elements;
}
+
public void dispose() {
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
}
};
}
/**
- * Gets native environment variable from the LaunchManager. Creates EnvironmentVariable objects.
- * @return Map of name - EnvironmentVariable pairs based on native environment.
+ * Gets native environment variable from the LaunchManager. Creates
+ * EnvironmentVariable objects.
+ *
+ * @return Map of name - EnvironmentVariable pairs based on native
+ * environment.
*/
private Map getNativeEnvironment() {
- Map stringVars = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment();
+ Map stringVars = DebugPlugin.getDefault().getLaunchManager()
+ .getNativeEnvironment();
HashMap vars = new HashMap();
- for (Iterator i = stringVars.keySet().iterator(); i.hasNext(); ) {
+ for (Iterator i = stringVars.keySet().iterator(); i.hasNext();) {
String key = (String) i.next();
String value = (String) stringVars.get(key);
vars.put(key, new EnvironmentVariable(key, value));
@@ -562,22 +652,24 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
* Creates an editor for the value of the selected environment variable.
*/
private void handleEnvEditButtonSelected() {
- IStructuredSelection sel= (IStructuredSelection) environmentTable.getSelection();
- EnvironmentVariable var= (EnvironmentVariable) sel.getFirstElement();
+ IStructuredSelection sel = (IStructuredSelection) environmentTable
+ .getSelection();
+ EnvironmentVariable var = (EnvironmentVariable) sel.getFirstElement();
if (var == null) {
return;
}
- String originalName= var.getName();
- String value= var.getValue();
- MultipleInputDialog dialog= new MultipleInputDialog(getShell(), LaunchConfigurationsMessages.EnvironmentTab_11); //$NON-NLS-1$
+ String originalName = var.getName();
+ String value = var.getValue();
+ MultipleInputDialog dialog = new MultipleInputDialog(getShell(),
+ LaunchConfigurationsMessages.EnvironmentTab_11); //$NON-NLS-1$
dialog.addTextField(NAME_LABEL, originalName, false);
dialog.addVariablesField(VALUE_LABEL, value, true);
if (dialog.open() != Window.OK) {
return;
}
- String name= dialog.getStringValue(NAME_LABEL);
- value= dialog.getStringValue(VALUE_LABEL);
+ String name = dialog.getStringValue(NAME_LABEL);
+ value = dialog.getStringValue(VALUE_LABEL);
if (!originalName.equals(name)) {
if (addVariable(new EnvironmentVariable(name, value))) {
environmentTable.remove(var);
@@ -593,11 +685,12 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
* Removes the selected environment variable from the table.
*/
private void handleEnvRemoveButtonSelected() {
- IStructuredSelection sel = (IStructuredSelection) environmentTable.getSelection();
+ IStructuredSelection sel = (IStructuredSelection) environmentTable
+ .getSelection();
environmentTable.getControl().setRedraw(false);
- for (Iterator i = sel.iterator(); i.hasNext(); ) {
+ for (Iterator i = sel.iterator(); i.hasNext();) {
EnvironmentVariable var = (EnvironmentVariable) i.next();
- environmentTable.remove(var);
+ environmentTable.remove(var);
}
environmentTable.getControl().setRedraw(true);
updateAppendReplace();
@@ -606,31 +699,37 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
/**
* Updates the environment table for the given launch configuration
+ *
* @param configuration
*/
protected void updateEnvironment(ILaunchConfiguration configuration) {
environmentTable.setInput(configuration);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
public void initializeFrom(ILaunchConfiguration configuration) {
- boolean append= true;
+ boolean append = true;
try {
- append = configuration.getAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
+ append = configuration.getAttribute(
+ ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
} catch (CoreException e) {
DebugUIPlugin.log(e.getStatus());
}
if (append) {
appendEnvironment.setSelection(true);
- replaceEnvironment.setSelection(false);
+ replaceEnvironment.setSelection(false);
} else {
replaceEnvironment.setSelection(true);
appendEnvironment.setSelection(false);
@@ -641,6 +740,7 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
/**
* Stores the environment in the given configuration
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
@@ -648,41 +748,53 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
// configuration's attributes.
TableItem[] items = environmentTable.getTable().getItems();
Map map = new HashMap(items.length);
- for (int i = 0; i < items.length; i++)
- {
+ for (int i = 0; i < items.length; i++) {
EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
map.put(var.getName(), var.getValue());
}
if (map.size() == 0) {
- configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null);
+ configuration.setAttribute(
+ ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null);
} else {
- configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
+ configuration.setAttribute(
+ ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map);
}
- configuration.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, appendEnvironment.getSelection());
+ configuration.setAttribute(
+ ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES,
+ appendEnvironment.getSelection());
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
public String getName() {
- return LaunchConfigurationsMessages.EnvironmentTab_Environment_7; //$NON-NLS-1$
+ return LaunchConfigurationsMessages.EnvironmentTab_Environment_7; //$NON-NLS-1$
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
*/
public Image getImage() {
- return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_ENVIRONMENT);
+ return DebugPluginImages
+ .getImage(IDebugUIConstants.IMG_OBJS_ENVIRONMENT);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
// do nothing when activated
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
@@ -690,29 +802,34 @@ public class PHPEnvironmentTab2 extends AbstractLaunchConfigurationTab {
}
private class NativeEnvironmentDialog extends ListSelectionDialog {
- public NativeEnvironmentDialog(Shell parentShell, Object input, IStructuredContentProvider contentProvider, ILabelProvider labelProvider, String message) {
+ public NativeEnvironmentDialog(Shell parentShell, Object input,
+ IStructuredContentProvider contentProvider,
+ ILabelProvider labelProvider, String message) {
super(parentShell, input, contentProvider, labelProvider, message);
setShellStyle(getShellStyle() | SWT.RESIZE);
}
protected IDialogSettings getDialogSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
+ IDialogSettings settings = DebugUIPlugin.getDefault()
+ .getDialogSettings();
+ IDialogSettings section = settings
+ .getSection(getDialogSettingsSectionName());
if (section == null) {
- section = settings.addNewSection(getDialogSettingsSectionName());
+ section = settings
+ .addNewSection(getDialogSettingsSectionName());
}
return section;
}
/**
- * Returns the name of the section that this dialog stores its settings in
- *
+ * Returns the name of the section that this dialog stores its settings
+ * in
+ *
* @return String
*/
protected String getDialogSettingsSectionName() {
- return IDebugUIConstants.PLUGIN_ID + ".ENVIRONMENT_TAB.NATIVE_ENVIROMENT_DIALOG"; //$NON-NLS-1$
+ return IDebugUIConstants.PLUGIN_ID
+ + ".ENVIRONMENT_TAB.NATIVE_ENVIROMENT_DIALOG"; //$NON-NLS-1$
}
}
}
-
-
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPLaunchShortcut.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPLaunchShortcut.java
index 53b337f..dbe826f 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPLaunchShortcut.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPLaunchShortcut.java
@@ -27,13 +27,15 @@ import org.eclipse.ui.IEditorPart;
public class PHPLaunchShortcut implements ILaunchShortcut {
public PHPLaunchShortcut() {
}
-
- public void launch(ISelection selection, String mode) {
- if (selection instanceof IStructuredSelection) {
- Object firstSelection = ((IStructuredSelection)selection).getFirstElement();
- if (firstSelection instanceof IFile) {
+
+ public void launch(ISelection selection, String mode) {
+ if (selection instanceof IStructuredSelection) {
+ Object firstSelection = ((IStructuredSelection) selection)
+ .getFirstElement();
+ if (firstSelection instanceof IFile) {
if (PHPFileUtil.isPHPFile((IFile) firstSelection)) {
- ILaunchConfiguration config = findLaunchConfiguration((IFile)firstSelection, mode);
+ ILaunchConfiguration config = findLaunchConfiguration(
+ (IFile) firstSelection, mode);
try {
if (config != null)
config.launch(mode, null);
@@ -48,36 +50,43 @@ public class PHPLaunchShortcut implements ILaunchShortcut {
log("The resource selected is not a PHP file.");
}
- public void launch(IEditorPart editor, String mode) {
+ public void launch(IEditorPart editor, String mode) {
IEditorInput input = editor.getEditorInput();
- ISelection selection = new StructuredSelection(input.getAdapter(IFile.class));
+ ISelection selection = new StructuredSelection(input
+ .getAdapter(IFile.class));
launch(selection, mode);
}
- protected ILaunchConfiguration findLaunchConfiguration(IFile phpFile, String mode) {
+ protected ILaunchConfiguration findLaunchConfiguration(IFile phpFile,
+ String mode) {
ILaunchConfigurationType configType = getPHPLaunchConfigType();
List candidateConfigs = null;
try {
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations(configType);
+ ILaunchConfiguration[] configs = getLaunchManager()
+ .getLaunchConfigurations(configType);
candidateConfigs = new ArrayList(configs.length);
for (int i = 0; i < configs.length; i++) {
ILaunchConfiguration config = configs[i];
- if (config.getAttribute(PHPLaunchConfigurationAttribute.FILE_NAME, "").equals(phpFile.getFullPath().toString())) {
- candidateConfigs.add(config);
+ if (config.getAttribute(
+ PHPLaunchConfigurationAttribute.FILE_NAME, "").equals(
+ phpFile.getFullPath().toString())) {
+ candidateConfigs.add(config);
}
}
} catch (CoreException e) {
log(e);
}
-
+
switch (candidateConfigs.size()) {
- case 0 :
- return createConfiguration(phpFile);
- case 1 :
- return (ILaunchConfiguration) candidateConfigs.get(0);
- default :
- log(new RuntimeException(PHPDebugUiMessages.getString("LaunchConfigurationShortcut.PHP.multipleConfigurationsError")));
- return null;
+ case 0:
+ return createConfiguration(phpFile);
+ case 1:
+ return (ILaunchConfiguration) candidateConfigs.get(0);
+ default:
+ log(new RuntimeException(
+ PHPDebugUiMessages
+ .getString("LaunchConfigurationShortcut.PHP.multipleConfigurationsError")));
+ return null;
}
}
@@ -85,29 +94,37 @@ public class PHPLaunchShortcut implements ILaunchShortcut {
ILaunchConfiguration config = null;
try {
ILaunchConfigurationType configType = getPHPLaunchConfigType();
- ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager().generateUniqueLaunchConfigurationNameFrom(phpFile.getName()));
- wc.setAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, phpFile.getProject().getName());
- wc.setAttribute(PHPLaunchConfigurationAttribute.FILE_NAME, phpFile.getProjectRelativePath().toString());
- wc.setAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, PHPDebugUiConstants.DEFAULT_WORKING_DIRECTORY);
- config = wc.doSave();
+ ILaunchConfigurationWorkingCopy wc = configType.newInstance(null,
+ getLaunchManager()
+ .generateUniqueLaunchConfigurationNameFrom(
+ phpFile.getName()));
+ wc.setAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME,
+ phpFile.getProject().getName());
+ wc.setAttribute(PHPLaunchConfigurationAttribute.FILE_NAME, phpFile
+ .getProjectRelativePath().toString());
+ wc.setAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY,
+ PHPDebugUiConstants.DEFAULT_WORKING_DIRECTORY);
+ config = wc.doSave();
} catch (CoreException ce) {
- log(ce);
+ log(ce);
}
return config;
}
protected ILaunchConfigurationType getPHPLaunchConfigType() {
- return getLaunchManager().getLaunchConfigurationType(PHPLaunchConfigurationAttribute.PHP_LAUNCH_CONFIGURATION_TYPE);
+ return getLaunchManager().getLaunchConfigurationType(
+ PHPLaunchConfigurationAttribute.PHP_LAUNCH_CONFIGURATION_TYPE);
}
-
+
protected ILaunchManager getLaunchManager() {
return DebugPlugin.getDefault().getLaunchManager();
}
-
+
protected void log(String message) {
- PHPDebugUiPlugin.log(new Status(Status.INFO, PHPDebugUiPlugin.PLUGIN_ID, Status.INFO, message, null));
+ PHPDebugUiPlugin.log(new Status(Status.INFO,
+ PHPDebugUiPlugin.PLUGIN_ID, Status.INFO, message, null));
}
-
+
protected void log(Throwable t) {
PHPDebugUiPlugin.log(t);
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/EditPathMapDialog.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/EditPathMapDialog.java
index c6e88e8..1d15279 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/EditPathMapDialog.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/EditPathMapDialog.java
@@ -24,82 +24,90 @@ import org.eclipse.swt.widgets.Text;
/**
* @author Christian
- *
+ *
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class EditPathMapDialog extends StatusDialog {
-
private Text fLocalPathText;
+
private Text fRemotePathText;
+
private String[] fInitialValues;
+
private String fLocalPath;
- private String fRemotePath;
-
- public EditPathMapDialog(Shell parentShell, String aDialogTitle, String[] initialValues) {
+
+ private String fRemotePath;
+
+ public EditPathMapDialog(Shell parentShell, String aDialogTitle,
+ String[] initialValues) {
super(parentShell);
setTitle(aDialogTitle);
- fInitialValues= initialValues;
+ fInitialValues = initialValues;
}
-
+
protected void okPressed() {
- fLocalPath= fLocalPathText.getText();
+ fLocalPath = fLocalPathText.getText();
fRemotePath = fRemotePathText.getText();
super.okPressed();
}
+
protected Control createDialogArea(Composite composite) {
Composite comp = new Composite(composite, SWT.NONE);
- comp.setLayout(new GridLayout());
-
- Composite fileComp= new Composite(comp,SWT.NONE);
- GridLayout gridLayout = new GridLayout();
+ comp.setLayout(new GridLayout());
+
+ Composite fileComp = new Composite(comp, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
-// gridLayout.marginHeight = 0;
-// gridLayout.marginWidth = 0;
+ // gridLayout.marginHeight = 0;
+ // gridLayout.marginWidth = 0;
fileComp.setLayout(gridLayout);
-
- Label label= new Label(fileComp,SWT.NONE);
- label.setText(PHPDebugUiMessages.getString("EditPathDialog.Local_Path"));//$NON-NLS-1$
-
-
- fLocalPathText = new Text(fileComp,SWT.SINGLE | SWT.BORDER);
+
+ Label label = new Label(fileComp, SWT.NONE);
+ label
+ .setText(PHPDebugUiMessages
+ .getString("EditPathDialog.Local_Path"));//$NON-NLS-1$
+
+ fLocalPathText = new Text(fileComp, SWT.SINGLE | SWT.BORDER);
GridData gd = new GridData();
- gd.widthHint=250;
+ gd.widthHint = 250;
fLocalPathText.setLayoutData(gd);
fLocalPathText.setText(fInitialValues[0]);
- Button button= new Button(fileComp, SWT.PUSH);
- button.setText(PHPDebugUiMessages.getString("EditPathMapDialog.Browse")); //$NON-NLS-1$
+ Button button = new Button(fileComp, SWT.PUSH);
+ button
+ .setText(PHPDebugUiMessages
+ .getString("EditPathMapDialog.Browse")); //$NON-NLS-1$
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleBrowseButtonSelected();
}
});
- label= new Label(fileComp,SWT.NONE);
- label.setText(PHPDebugUiMessages.getString("EditPathMapDialog.Remote_Path")); //$NON-NLS-1$
- fRemotePathText = new Text(fileComp,SWT.SINGLE | SWT.BORDER);
+ label = new Label(fileComp, SWT.NONE);
+ label.setText(PHPDebugUiMessages
+ .getString("EditPathMapDialog.Remote_Path")); //$NON-NLS-1$
+ fRemotePathText = new Text(fileComp, SWT.SINGLE | SWT.BORDER);
fRemotePathText.setText(fInitialValues[1]);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
fRemotePathText.setLayoutData(gd);
-
+
return composite;
}
-
+
public String[] getPathPair() {
- return new String[] {fLocalPath,fRemotePath};
+ return new String[] { fLocalPath, fRemotePath };
}
-
-
+
private void handleBrowseButtonSelected() {
- DirectoryDialog dd = new DirectoryDialog(getShell(),SWT.OPEN);
- dd.setMessage(PHPDebugUiMessages.getString("EditPathMapDialog.Select_the_directory_to_map")); //$NON-NLS-1$
- String path=dd.open();
-
+ DirectoryDialog dd = new DirectoryDialog(getShell(), SWT.OPEN);
+ dd.setMessage(PHPDebugUiMessages
+ .getString("EditPathMapDialog.Select_the_directory_to_map")); //$NON-NLS-1$
+ String path = dd.open();
+
if (path != null)
fLocalPathText.setText(path);
-
- }
+ }
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPBasePreferencePage.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPBasePreferencePage.java
index b7ecbcc..4d56fce 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPBasePreferencePage.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPBasePreferencePage.java
@@ -11,13 +11,15 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-public class PHPBasePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+public class PHPBasePreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
public PHPBasePreferencePage() {
super();
}
- public void init(IWorkbench workbench) {}
+ public void init(IWorkbench workbench) {
+ }
protected Control createContents(Composite parent) {
noDefaultAndApplyButton();
@@ -28,7 +30,8 @@ public class PHPBasePreferencePage extends PreferencePage implements IWorkbenchP
layout.marginWidth = 0;
composite.setLayout(layout);
- new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("PHPBasePreferencePage.label")); //$NON-NLS-1$
+ new Label(composite, SWT.NONE).setText(PHPDebugUiMessages
+ .getString("PHPBasePreferencePage.label")); //$NON-NLS-1$
return composite;
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterContentProvider.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterContentProvider.java
index 329d7ac..1db48a4 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterContentProvider.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterContentProvider.java
@@ -5,7 +5,8 @@ import java.util.List;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
-public class PHPInterpreterContentProvider implements IStructuredContentProvider {
+public class PHPInterpreterContentProvider implements
+ IStructuredContentProvider {
protected List interpreters;
public PHPInterpreterContentProvider() {
@@ -16,7 +17,8 @@ public class PHPInterpreterContentProvider implements IStructuredContentProvider
return interpreters.toArray();
}
- public void dispose() {}
+ public void dispose() {
+ }
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
interpreters = (List) newInput;
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterLabelProvider.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterLabelProvider.java
index 84b52f9..1ebb99f 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterLabelProvider.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterLabelProvider.java
@@ -19,24 +19,28 @@ public class PHPInterpreterLabelProvider implements ITableLabelProvider {
public String getColumnText(Object element, int columnIndex) {
PHPInterpreter interpreter = (PHPInterpreter) element;
switch (columnIndex) {
- case 0 :
- return interpreter.getInstallLocation().toString();
-// case 1 :
-// IPath installLocation = interpreter.getInstallLocation();
-// return installLocation != null ? installLocation.toOSString() : "In user path";
- default :
- return "Unknown Column Index";
+ case 0:
+ return interpreter.getInstallLocation().toString();
+ // case 1 :
+ // IPath installLocation = interpreter.getInstallLocation();
+ // return installLocation != null ? installLocation.toOSString() :
+ // "In user path";
+ default:
+ return "Unknown Column Index";
}
}
- public void addListener(ILabelProviderListener listener) {}
+ public void addListener(ILabelProviderListener listener) {
+ }
- public void dispose() {}
+ public void dispose() {
+ }
public boolean isLabelProperty(Object element, String property) {
return false;
}
- public void removeListener(ILabelProviderListener listener) {}
+ public void removeListener(ILabelProviderListener listener) {
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterPreferencePage.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterPreferencePage.java
index 689b864..84a4f31 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterPreferencePage.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/preferences/PHPInterpreterPreferencePage.java
@@ -34,219 +34,232 @@ import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-public class PHPInterpreterPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- protected CheckboxTableViewer tableViewer;
-
- protected Button addButton, editButton, removeButton;
-
- public PHPInterpreterPreferencePage() {
- super();
- }
-
- public void init(IWorkbench workbench) {
- }
-
- protected Control createContents(Composite parent) {
- noDefaultAndApplyButton();
-
- Composite composite = createPageRoot(parent);
- Table table = createInstalledInterpretersTable(composite);
- createInstalledInterpretersTableViewer(table);
- createButtonGroup(composite);
-
- tableViewer.setInput(PHPRuntime.getDefault().getInstalledInterpreters());
- PHPInterpreter selectedInterpreter = PHPRuntime.getDefault().getSelectedInterpreter();
- if (selectedInterpreter != null)
- tableViewer.setChecked(selectedInterpreter, true);
-
- enableButtons();
-
- return composite;
- }
-
- protected void createButtonGroup(Composite composite) {
- Composite buttons = new Composite(composite, SWT.NULL);
- buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttons.setLayout(layout);
-
- addButton = new Button(buttons, SWT.PUSH);
- addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- addButton.setText(PHPDebugUiMessages.getString("PHPInterpreterPreferencePage.addButton.label")); //$NON-NLS-1$
- addButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event evt) {
- addInterpreter();
- }
- });
-
- editButton = new Button(buttons, SWT.PUSH);
- editButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- editButton.setText(PHPDebugUiMessages.getString("PHPInterpreterPreferencePage.editButton.label")); //$NON-NLS-1$
- editButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event evt) {
- editInterpreter();
- }
- });
-
- removeButton = new Button(buttons, SWT.PUSH);
- removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- removeButton.setText(PHPDebugUiMessages.getString("PHPInterpreterPreferencePage.removeButton.label")); //$NON-NLS-1$
- removeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event evt) {
- removeInterpreter();
- }
- });
- }
-
- protected void createInstalledInterpretersTableViewer(Table table) {
- tableViewer = new CheckboxTableViewer(table);
-
- tableViewer.setLabelProvider(new PHPInterpreterLabelProvider());
- tableViewer.setContentProvider(new PHPInterpreterContentProvider());
-
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent evt) {
- enableButtons();
- }
- });
-
- tableViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateSelectedInterpreter(event.getElement());
- }
- });
-
- tableViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent e) {
- editInterpreter();
- }
- });
- }
-
- protected Table createInstalledInterpretersTable(Composite composite) {
- Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(80);
- data.heightHint = convertHeightInCharsToPixels(10);
- table.setLayoutData(data);
- table.setHeaderVisible(true);
- table.setLinesVisible(false);
-
- TableColumn column = new TableColumn(table, SWT.NULL);
- column.setText(PHPDebugUiMessages.getString("PHPInterpreterPreferencePage.PHPInterpreterTable.interpreterPath")); //$NON-NLS-1$
- column.setWidth(400);
-
- // column = new TableColumn(table, SWT.NULL);
- // column.setText(PHPDebugUiMessages.getString("PHPInterpreterPreferencePage.PHPInterpreterTable.interpreterPath"));
- // //$NON-NLS-1$
- // column.setWidth(350);
-
- return table;
- }
-
- protected Composite createPageRoot(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- return composite;
- }
-
- protected void addInterpreter() {
- PHPInterpreter newInterpreter = new PHPInterpreter(null);
- File phpRuntime = getFile(getShell(), null);
- if (phpRuntime != null) {
- newInterpreter.setInstallLocation(phpRuntime);
- tableViewer.add(newInterpreter);
- }
- }
-
- protected void removeInterpreter() {
- tableViewer.remove(getSelectedInterpreter());
- }
-
- protected void enableButtons() {
- if (getSelectedInterpreter() != null) {
- editButton.setEnabled(true);
- removeButton.setEnabled(true);
- } else {
- editButton.setEnabled(false);
- removeButton.setEnabled(false);
- }
- }
-
- protected void updateSelectedInterpreter(Object interpreter) {
- Object[] checkedElements = tableViewer.getCheckedElements();
- for (int i = 0; i < checkedElements.length; i++) {
- tableViewer.setChecked(checkedElements[i], false);
- }
-
- tableViewer.setChecked(interpreter, true);
- }
-
- protected void editInterpreter() {
- PHPInterpreter anInterpreter = getSelectedInterpreter();
- File phpRuntime = anInterpreter.getInstallLocation();
- if (phpRuntime != null) {
- File parent = phpRuntime.getParentFile();
- phpRuntime = getFile(getShell(), parent);
- } else {
- phpRuntime = getFile(getShell(), null);
- }
- if (phpRuntime != null) {
- anInterpreter.setInstallLocation(phpRuntime);
- tableViewer.update(anInterpreter, null);
- }
-
- }
-
- protected PHPInterpreter getSelectedInterpreter() {
- IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
- return (PHPInterpreter) selection.getFirstElement();
- }
-
- public boolean performOk() {
- TableItem[] tableItems = tableViewer.getTable().getItems();
- List installedInterpreters = new ArrayList(tableItems.length);
- for (int i = 0; i < tableItems.length; i++)
- installedInterpreters.add(tableItems[i].getData());
- PHPRuntime.getDefault().setInstalledInterpreters(installedInterpreters);
-
- Object[] checkedElements = tableViewer.getCheckedElements();
- if (checkedElements.length > 0)
- PHPRuntime.getDefault().setSelectedInterpreter((PHPInterpreter) checkedElements[0]);
-
- return super.performOk();
- }
-
- /**
- * Helper to open the file chooser dialog.
- *
- * @param startingDirectory
- * the directory to open the dialog on.
- * @return File The File the user selected or null
if they do not.
- */
- public static File getFile(Shell shell, File startingDirectory) {
-
- FileDialog dialog = new FileDialog(shell, SWT.OPEN);
- if (startingDirectory != null) {
- dialog.setFileName(startingDirectory.getPath());
- }
- String operatingSystem = Platform.getOS();
- if (operatingSystem.equals(Platform.OS_WIN32)) {
- String[] extensions = { "*.exe" };
- dialog.setFilterExtensions(extensions);
- }
- String file = dialog.open();
- if (file != null) {
- file = file.trim();
- if (file.length() > 0)
- return new File(file);
- }
-
- return null;
- }
+public class PHPInterpreterPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
+ protected CheckboxTableViewer tableViewer;
+
+ protected Button addButton, editButton, removeButton;
+
+ public PHPInterpreterPreferencePage() {
+ super();
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+
+ protected Control createContents(Composite parent) {
+ noDefaultAndApplyButton();
+
+ Composite composite = createPageRoot(parent);
+ Table table = createInstalledInterpretersTable(composite);
+ createInstalledInterpretersTableViewer(table);
+ createButtonGroup(composite);
+
+ tableViewer
+ .setInput(PHPRuntime.getDefault().getInstalledInterpreters());
+ PHPInterpreter selectedInterpreter = PHPRuntime.getDefault()
+ .getSelectedInterpreter();
+ if (selectedInterpreter != null)
+ tableViewer.setChecked(selectedInterpreter, true);
+
+ enableButtons();
+
+ return composite;
+ }
+
+ protected void createButtonGroup(Composite composite) {
+ Composite buttons = new Composite(composite, SWT.NULL);
+ buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ buttons.setLayout(layout);
+
+ addButton = new Button(buttons, SWT.PUSH);
+ addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ addButton.setText(PHPDebugUiMessages
+ .getString("PHPInterpreterPreferencePage.addButton.label")); //$NON-NLS-1$
+ addButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ addInterpreter();
+ }
+ });
+
+ editButton = new Button(buttons, SWT.PUSH);
+ editButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ editButton.setText(PHPDebugUiMessages
+ .getString("PHPInterpreterPreferencePage.editButton.label")); //$NON-NLS-1$
+ editButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ editInterpreter();
+ }
+ });
+
+ removeButton = new Button(buttons, SWT.PUSH);
+ removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ removeButton.setText(PHPDebugUiMessages
+ .getString("PHPInterpreterPreferencePage.removeButton.label")); //$NON-NLS-1$
+ removeButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event evt) {
+ removeInterpreter();
+ }
+ });
+ }
+
+ protected void createInstalledInterpretersTableViewer(Table table) {
+ tableViewer = new CheckboxTableViewer(table);
+
+ tableViewer.setLabelProvider(new PHPInterpreterLabelProvider());
+ tableViewer.setContentProvider(new PHPInterpreterContentProvider());
+
+ tableViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent evt) {
+ enableButtons();
+ }
+ });
+
+ tableViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ updateSelectedInterpreter(event.getElement());
+ }
+ });
+
+ tableViewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent e) {
+ editInterpreter();
+ }
+ });
+ }
+
+ protected Table createInstalledInterpretersTable(Composite composite) {
+ Table table = new Table(composite, SWT.CHECK | SWT.BORDER
+ | SWT.FULL_SELECTION);
+
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = convertWidthInCharsToPixels(80);
+ data.heightHint = convertHeightInCharsToPixels(10);
+ table.setLayoutData(data);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(false);
+
+ TableColumn column = new TableColumn(table, SWT.NULL);
+ column
+ .setText(PHPDebugUiMessages
+ .getString("PHPInterpreterPreferencePage.PHPInterpreterTable.interpreterPath")); //$NON-NLS-1$
+ column.setWidth(400);
+
+ // column = new TableColumn(table, SWT.NULL);
+ // column.setText(PHPDebugUiMessages.getString("PHPInterpreterPreferencePage.PHPInterpreterTable.interpreterPath"));
+ // //$NON-NLS-1$
+ // column.setWidth(350);
+
+ return table;
+ }
+
+ protected Composite createPageRoot(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ return composite;
+ }
+
+ protected void addInterpreter() {
+ PHPInterpreter newInterpreter = new PHPInterpreter(null);
+ File phpRuntime = getFile(getShell(), null);
+ if (phpRuntime != null) {
+ newInterpreter.setInstallLocation(phpRuntime);
+ tableViewer.add(newInterpreter);
+ }
+ }
+
+ protected void removeInterpreter() {
+ tableViewer.remove(getSelectedInterpreter());
+ }
+
+ protected void enableButtons() {
+ if (getSelectedInterpreter() != null) {
+ editButton.setEnabled(true);
+ removeButton.setEnabled(true);
+ } else {
+ editButton.setEnabled(false);
+ removeButton.setEnabled(false);
+ }
+ }
+
+ protected void updateSelectedInterpreter(Object interpreter) {
+ Object[] checkedElements = tableViewer.getCheckedElements();
+ for (int i = 0; i < checkedElements.length; i++) {
+ tableViewer.setChecked(checkedElements[i], false);
+ }
+
+ tableViewer.setChecked(interpreter, true);
+ }
+
+ protected void editInterpreter() {
+ PHPInterpreter anInterpreter = getSelectedInterpreter();
+ File phpRuntime = anInterpreter.getInstallLocation();
+ if (phpRuntime != null) {
+ File parent = phpRuntime.getParentFile();
+ phpRuntime = getFile(getShell(), parent);
+ } else {
+ phpRuntime = getFile(getShell(), null);
+ }
+ if (phpRuntime != null) {
+ anInterpreter.setInstallLocation(phpRuntime);
+ tableViewer.update(anInterpreter, null);
+ }
+
+ }
+
+ protected PHPInterpreter getSelectedInterpreter() {
+ IStructuredSelection selection = (IStructuredSelection) tableViewer
+ .getSelection();
+ return (PHPInterpreter) selection.getFirstElement();
+ }
+
+ public boolean performOk() {
+ TableItem[] tableItems = tableViewer.getTable().getItems();
+ List installedInterpreters = new ArrayList(tableItems.length);
+ for (int i = 0; i < tableItems.length; i++)
+ installedInterpreters.add(tableItems[i].getData());
+ PHPRuntime.getDefault().setInstalledInterpreters(installedInterpreters);
+
+ Object[] checkedElements = tableViewer.getCheckedElements();
+ if (checkedElements.length > 0)
+ PHPRuntime.getDefault().setSelectedInterpreter(
+ (PHPInterpreter) checkedElements[0]);
+
+ return super.performOk();
+ }
+
+ /**
+ * Helper to open the file chooser dialog.
+ *
+ * @param startingDirectory
+ * the directory to open the dialog on.
+ * @return File The File the user selected or null
if they do
+ * not.
+ */
+ public static File getFile(Shell shell, File startingDirectory) {
+
+ FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+ if (startingDirectory != null) {
+ dialog.setFileName(startingDirectory.getPath());
+ }
+ String operatingSystem = Platform.getOS();
+ if (operatingSystem.equals(Platform.OS_WIN32)) {
+ String[] extensions = { "*.exe" };
+ dialog.setFilterExtensions(extensions);
+ }
+ String file = dialog.open();
+ if (file != null) {
+ file = file.trim();
+ if (file.length() > 0)
+ return new File(file);
+ }
+
+ return null;
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/properties/PHPBreakpointPropertiesDialog.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/properties/PHPBreakpointPropertiesDialog.java
index 423b927..3774832 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/properties/PHPBreakpointPropertiesDialog.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/properties/PHPBreakpointPropertiesDialog.java
@@ -1,8 +1,9 @@
-
package net.sourceforge.phpdt.internal.debug.ui.properties;
+import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
+
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.internal.ui.actions.*;
+import org.eclipse.debug.internal.ui.actions.StatusInfo;
import org.eclipse.jface.dialogs.StatusDialog;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.Document;
@@ -22,148 +23,150 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
-import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
-
public class PHPBreakpointPropertiesDialog extends StatusDialog {
private PHPLineBreakpoint fBreakpoint;
- private SourceViewer fSnippetViewer;
- private Button fCheckBox;
- private Spinner fSpinner;
-
+
+ private SourceViewer fSnippetViewer;
+
+ private Button fCheckBox;
+
+ private Spinner fSpinner;
+
public PHPBreakpointPropertiesDialog(Shell parentShell, PHPLineBreakpoint bp) {
super(parentShell);
-
+
fBreakpoint = bp;
}
-
- protected Control createDialogArea (Composite parent) {
- Composite container;
+ protected Control createDialogArea(Composite parent) {
+ Composite container;
GridLayout layout;
- GridData gd;
- IDocument document;
- Control control;
- Label label;
- Spinner spinner;
- String condition = "";
- boolean enabled = false;
- int hitCount = 0;
-
+ GridData gd;
+ IDocument document;
+ Control control;
+ Label label;
+ Spinner spinner;
+ String condition = "";
+ boolean enabled = false;
+ int hitCount = 0;
+
try {
- condition = fBreakpoint.getCondition ();
- enabled = fBreakpoint.isConditionEnabled ();
- hitCount = fBreakpoint.getHitCount();
- }
- catch (CoreException e) {
+ condition = fBreakpoint.getCondition();
+ enabled = fBreakpoint.isConditionEnabled();
+ hitCount = fBreakpoint.getHitCount();
+ } catch (CoreException e) {
}
-
- Font font = parent.getFont(); // Get the dialog's font
- container = new Composite(parent, SWT.NONE); // Create a new container for our controls
- layout = new GridLayout(); // Create a grid for control layouting
-
- container.setLayout (layout); // Set the grid to the container
- gd = new GridData (SWT.FILL, SWT.FILL, true, true);
- container.setLayoutData (gd);
-
- label = new Label (container, SWT.NONE); // spinner label
- label.setText ("Skip count"); // $NON-NLS-1$
-
- gd = new GridData (SWT.BEGINNING); // Left align of label text
- label.setLayoutData (gd); //
- label.setFont (font); // Set the label's font
-
- fSpinner = new Spinner (container, SWT.BORDER);
- fSpinner.setMinimum (0);
- fSpinner.setMaximum (100000);
- fSpinner.setIncrement (1);
- fSpinner.setPageIncrement (100);
- fSpinner.setSelection (hitCount);
- gd = new GridData (SWT.BEGINNING);
- label.setLayoutData (gd); //
- label.setFont (font); // Set the label's font
-
- label = new Label (container, SWT.NONE); // snippet label
- label.setText ("Break Condition"); // $NON-NLS-1$
-
- gd = new GridData (SWT.BEGINNING); // Left align of label text
- label.setLayoutData (gd); //
- label.setFont (font); // Set the label's font
-
- fSnippetViewer = new SourceViewer (container, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- fSnippetViewer.setInput (this);
-
- document = new Document();
-
- //IDocumentPartitioner partitioner= new RuleBasedPartitioner(...);
- //document.setDocumentPartitioner(partitioner);
- //partitioner.connect(document);
-
- fSnippetViewer.configure (new SourceViewerConfiguration());
- fSnippetViewer.setEditable (true);
- fSnippetViewer.setDocument (document);
-
- document.addDocumentListener (new IDocumentListener() {
+
+ Font font = parent.getFont(); // Get the dialog's font
+ container = new Composite(parent, SWT.NONE); // Create a new
+ // container for our
+ // controls
+ layout = new GridLayout(); // Create a grid for control layouting
+
+ container.setLayout(layout); // Set the grid to the container
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ container.setLayoutData(gd);
+
+ label = new Label(container, SWT.NONE); // spinner label
+ label.setText("Skip count"); // $NON-NLS-1$
+
+ gd = new GridData(SWT.BEGINNING); // Left align of label text
+ label.setLayoutData(gd); //
+ label.setFont(font); // Set the label's font
+
+ fSpinner = new Spinner(container, SWT.BORDER);
+ fSpinner.setMinimum(0);
+ fSpinner.setMaximum(100000);
+ fSpinner.setIncrement(1);
+ fSpinner.setPageIncrement(100);
+ fSpinner.setSelection(hitCount);
+ gd = new GridData(SWT.BEGINNING);
+ label.setLayoutData(gd); //
+ label.setFont(font); // Set the label's font
+
+ label = new Label(container, SWT.NONE); // snippet label
+ label.setText("Break Condition"); // $NON-NLS-1$
+
+ gd = new GridData(SWT.BEGINNING); // Left align of label text
+ label.setLayoutData(gd); //
+ label.setFont(font); // Set the label's font
+
+ fSnippetViewer = new SourceViewer(container, null, SWT.BORDER
+ | SWT.V_SCROLL | SWT.H_SCROLL);
+ fSnippetViewer.setInput(this);
+
+ document = new Document();
+
+ // IDocumentPartitioner partitioner= new RuleBasedPartitioner(...);
+ // document.setDocumentPartitioner(partitioner);
+ // partitioner.connect(document);
+
+ fSnippetViewer.configure(new SourceViewerConfiguration());
+ fSnippetViewer.setEditable(true);
+ fSnippetViewer.setDocument(document);
+
+ document.addDocumentListener(new IDocumentListener() {
public void documentAboutToBeChanged(DocumentEvent event) {
}
+
public void documentChanged(DocumentEvent event) {
checkValues();
}
});
- fSnippetViewer.getTextWidget ().setFont (JFaceResources.getTextFont());
+ fSnippetViewer.getTextWidget().setFont(JFaceResources.getTextFont());
- control = fSnippetViewer.getControl ();
- gd = new GridData (GridData.FILL_BOTH);
- gd.heightHint = convertHeightInCharsToPixels (10);
- gd.widthHint = convertWidthInCharsToPixels (80);
-
- control.setLayoutData (gd);
- fSnippetViewer.getDocument ().set (condition);
+ control = fSnippetViewer.getControl();
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = convertHeightInCharsToPixels(10);
+ gd.widthHint = convertWidthInCharsToPixels(80);
+
+ control.setLayoutData(gd);
+ fSnippetViewer.getDocument().set(condition);
// enable checkbox
- fCheckBox = new Button (container, SWT.CHECK | SWT.LEFT);
- fCheckBox.setText ("Enable Condition"); //$NON-NLS-1$
- fCheckBox.setSelection (enabled);
- fCheckBox.setFont (font);
+ fCheckBox = new Button(container, SWT.CHECK | SWT.LEFT);
+ fCheckBox.setText("Enable Condition"); //$NON-NLS-1$
+ fCheckBox.setSelection(enabled);
+ fCheckBox.setFont(font);
applyDialogFont(container);
fSnippetViewer.getControl().setFocus();
-
- checkValues ();
-
+
+ checkValues();
+
return container;
}
-
- protected void okPressed () {
+
+ protected void okPressed() {
try {
- fBreakpoint.setCondition (fSnippetViewer.getDocument().get());
- fBreakpoint.setConditionEnabled (fCheckBox.getSelection());
+ fBreakpoint.setCondition(fSnippetViewer.getDocument().get());
+ fBreakpoint.setConditionEnabled(fCheckBox.getSelection());
fBreakpoint.setHitCount(fSpinner.getSelection());
-
+
int id = fBreakpoint.getChangeID();
id++;
fBreakpoint.setChangeID(id);
+ } catch (CoreException e) {
}
- catch (CoreException e) {
- }
-
- super.okPressed ();
+
+ super.okPressed();
}
-
+
/**
* Check the field values and display a message in the status if needed.
*/
private void checkValues() {
StatusInfo status;
-
- status = new StatusInfo ();
+
+ status = new StatusInfo();
/*
- StatusInfo status = new StatusInfo();
- if (fSnippetViewer.getDocument().get().trim().length() == 0) {
- status.setError(ActionMessages.WatchExpressionDialog_4); //$NON-NLS-1$
- }
- */
+ * StatusInfo status = new StatusInfo(); if
+ * (fSnippetViewer.getDocument().get().trim().length() == 0) {
+ * status.setError(ActionMessages.WatchExpressionDialog_4);
+ * //$NON-NLS-1$ }
+ */
updateStatus(status);
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/ExternalPHPParser.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/ExternalPHPParser.java
index 9169c71..ffb9ca7 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/ExternalPHPParser.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/ExternalPHPParser.java
@@ -20,299 +20,326 @@ import org.eclipse.ui.texteditor.MarkerUtilities;
* Calls the external parser and generates problem markers if necessary
*/
public class ExternalPHPParser {
- private final static String PROBLEM_ID = "net.sourceforge.phpeclipse.problem";
-
- // strings for external parser call
- private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$
-
- private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$
-
- public static final int ERROR = 2;
-
- public static final int WARNING = 1;
-
- public static final int INFO = 0;
-
- public static final int TASK = 3;
-
- // TODO design error? Analyze why fileToParse must be static ???
- final protected IFile fFileToParse;
-
- public ExternalPHPParser(IFile file) {
- fFileToParse = file;
- }
-
- /**
- * Call the php parse command ( php -l -f <filename> ) and create markers according to the external parser output.
- *
- * @param file
- * the file that will be parsed
- */
- public void phpExternalParse() {
- //IFile file = (IFile) resource;
- // final IPath path = file.getFullPath();
- final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
- final String filename = fFileToParse.getLocation().toString();
-
- final String[] arguments = { filename };
- final MessageFormat form = new MessageFormat(store.getString(ExternalToolsPlugin.EXTERNAL_PARSER_PREF));
- final String command = form.format(arguments);
-
- final String parserResult = getParserOutput(command, "External parser: ");
-
- try {
- // parse the buffer to find the errors and warnings
- createMarkers(parserResult, fFileToParse);
- } catch (CoreException e) {
- }
- }
-
- /**
- * Create markers according to the external parser output.
- *
- * @param output
- * the external parser output
- * @param file
- * the file that was parsed.
- */
- protected void createMarkers(final String output, final IFile file) throws CoreException {
- // delete all markers
- file.deleteMarkers(PROBLEM_ID, false, 0);
-
- int indx = 0;
- int brIndx;
- boolean flag = true;
- while ((brIndx = output.indexOf("- * This interface is not intended to be extended - * nor implemented by clients. + * This interface is not intended to be extended nor implemented by clients. *
*/ public interface IGroupDialogPage extends IMessageProvider { /** - * Sets theGridData
on the specified button to
- * be one that is spaced for the current dialog page units.
+ * Sets the GridData
on the specified button to be one that
+ * is spaced for the current dialog page units.
*
- * @param button the button to set the GridData
+ * @param button
+ * the button to set the GridData
* @return the GridData
set on the specified button
*/
public GridData setButtonGridData(Button button);
/**
- * Sets the message for this page with an indication of what type
- * of message it is.
+ * Sets the message for this page with an indication of what type of message
+ * it is.
*
- * The valid message types are one of NONE
,
- * INFORMATION
, WARNING
, or ERROR
.
+ * The valid message types are one of NONE
,
+ * INFORMATION
, WARNING
, or
+ * ERROR
.
*
null
to clear the message
- * @param newType the message type
+ *
+ * @param newMessage
+ * the message, or null
to clear the message
+ * @param newType
+ * the message type
*/
public void setMessage(String newMessage, int newType);
/**
- * Updates the page's valid state using the group's
- * current valid state. This will cause the dialog's
- * buttons dependent on the page's valid state to
- * update to reflect the new state.
+ * Updates the page's valid state using the group's current valid state.
+ * This will cause the dialog's buttons dependent on the page's valid state
+ * to update to reflect the new state.
*/
public void updateValidState();
-
+
/**
* Converts a height in characters to a height in pixels.
*
- * @param chars the height in characters to be converted
+ * @param chars
+ * the height in characters to be converted
* @return the corresponding height in pixels
*/
public int convertHeightHint(int chars);
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/dialog/ExternalToolVariableForm.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/dialog/ExternalToolVariableForm.java
index 5a9de70..f528485 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/dialog/ExternalToolVariableForm.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/dialog/ExternalToolVariableForm.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.dialog;
/**********************************************************************
-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 net.sourceforge.phpdt.externaltools.group.IGroupDialogPage;
import net.sourceforge.phpdt.externaltools.internal.registry.ExternalToolVariable;
@@ -28,31 +28,40 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
/**
- * Visual grouping of controls that allows the user to
- * select a variable and configure it with extra
- * information.
+ * Visual grouping of controls that allows the user to select a variable and
+ * configure it with extra information.
*/
public class ExternalToolVariableForm {
private static final int VISIBLE_ITEM_COUNT = 9;
-
+
private String variableListLabelText;
+
private ExternalToolVariable[] variables;
+
private IVariableComponent[] components;
+
private IGroupDialogPage page;
-
+
private Label variableListLabel;
+
private List variableList;
+
private Composite variableComposite;
+
private StackLayout variableLayout;
+
private int activeComponentIndex = -1;
-
+
/**
* Creates the visual grouping
*
- * @param variableListLabelText the label text to use for identifying the list of variables
- * @param variables the collection of variables to display to the user
+ * @param variableListLabelText
+ * the label text to use for identifying the list of variables
+ * @param variables
+ * the collection of variables to display to the user
*/
- public ExternalToolVariableForm(String variableListLabelText, ExternalToolVariable[] variables) {
+ public ExternalToolVariableForm(String variableListLabelText,
+ ExternalToolVariable[] variables) {
super();
this.variableListLabelText = variableListLabelText;
this.variables = variables;
@@ -61,9 +70,9 @@ public class ExternalToolVariableForm {
public Composite createContents(Composite parent, IGroupDialogPage page) {
Font font = parent.getFont();
-
+
this.page = page;
-
+
Composite mainComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
@@ -79,8 +88,9 @@ public class ExternalToolVariableForm {
data.horizontalSpan = 1;
variableListLabel.setLayoutData(data);
variableListLabel.setFont(font);
-
- variableList = new List(mainComposite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+
+ variableList = new List(mainComposite, SWT.SINGLE | SWT.BORDER
+ | SWT.H_SCROLL | SWT.V_SCROLL);
data = new GridData(GridData.FILL_HORIZONTAL);
data.heightHint = variableList.getItemHeight() * VISIBLE_ITEM_COUNT;
variableList.setLayoutData(data);
@@ -94,25 +104,24 @@ public class ExternalToolVariableForm {
variableComposite.setLayout(variableLayout);
variableComposite.setLayoutData(data);
variableComposite.setFont(font);
-
+
createVariableComponents(data);
-
+
populateVariableList();
-
+
variableList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateVariableComposite(null, false);
}
});
-
+
setEnabled(true);
return mainComposite;
}
-
+
/**
- * Creates the visual component for each variable
- * and determine the initial size so the form
- * can be layout properly.
+ * Creates the visual component for each variable and determine the initial
+ * size so the form can be layout properly.
*/
private void createVariableComponents(GridData data) {
for (int i = 0; i < variables.length; i++) {
@@ -121,34 +130,36 @@ public class ExternalToolVariableForm {
components[i].createContents(variableComposite, var.getTag(), page);
Control control = components[i].getControl();
if (control != null) {
- Point newSize = control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ Point newSize = control.computeSize(SWT.DEFAULT, SWT.DEFAULT,
+ true);
data.widthHint = Math.max(newSize.x, data.widthHint);
data.heightHint = Math.max(newSize.y, data.heightHint);
}
}
}
-
+
/**
- * Returns the formatted variable or null
if
- * none selected.
+ * Returns the formatted variable or null
if none selected.
*/
public String getSelectedVariable() {
if (activeComponentIndex != -1) {
- String varValue = components[activeComponentIndex].getVariableValue();
- return ToolUtil.buildVariableTag(variables[activeComponentIndex].getTag(), varValue);
+ String varValue = components[activeComponentIndex]
+ .getVariableValue();
+ return ToolUtil.buildVariableTag(variables[activeComponentIndex]
+ .getTag(), varValue);
}
return null;
}
/**
- * Returns whether the current variable selection is
- * valid, including the selected variable value.
+ * Returns whether the current variable selection is valid, including the
+ * selected variable value.
*/
public boolean isValid() {
if (activeComponentIndex != -1)
return components[activeComponentIndex].isValid();
-
+
return true;
}
@@ -165,7 +176,7 @@ public class ExternalToolVariableForm {
variableList.setItems(items);
}
- public void selectVariable(String varName, String varValue) {
+ public void selectVariable(String varName, String varValue) {
if (varName != null && varName.length() > 0) {
for (int i = 0; i < variables.length; i++) {
if (varName.equals(variables[i].getTag())) {
@@ -175,11 +186,11 @@ public class ExternalToolVariableForm {
}
}
}
-
+
variableList.deselectAll();
updateVariableComposite(varValue, false);
}
-
+
private void setComponentVisible(int index) {
if (index == -1)
variableLayout.topControl = null;
@@ -187,7 +198,7 @@ public class ExternalToolVariableForm {
variableLayout.topControl = components[index].getControl();
variableComposite.layout();
}
-
+
/**
* Enables or disables the variable form controls.
*/
@@ -197,12 +208,12 @@ public class ExternalToolVariableForm {
if (enabled && variableList.getSelection().length == 0) {
if (variableList.getItemCount() > 0) {
variableList.select(0);
- activeComponentIndex= 0;
+ activeComponentIndex = 0;
}
}
variableComposite.setVisible(enabled);
}
-
+
private void updateVariableComposite(String value, boolean setValue) {
activeComponentIndex = variableList.getSelectionIndex();
setComponentVisible(activeComponentIndex);
@@ -211,8 +222,7 @@ public class ExternalToolVariableForm {
}
/**
- * Validates the current variable selection is and
- * its value are acceptable.
+ * Validates the current variable selection is and its value are acceptable.
*/
public void validate() {
if (activeComponentIndex != -1)
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsImages.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsImages.java
index e333652..c765760 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsImages.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsImages.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.model;
/**********************************************************************
-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.net.MalformedURLException;
import java.net.URL;
@@ -26,99 +26,143 @@ import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
*/
public class ExternalToolsImages {
- /**
+ /**
* The image registry containing Image
s.
*/
private static ImageRegistry imageRegistry;
-
+
/**
* A table of all the ImageDescriptor
s.
*/
private static HashMap imageDescriptors;
private static final String ATTR_LAUNCH_CONFIG_TYPE_ICON = "icon"; //$NON-NLS-1$
+
private static final String ATTR_LAUNCH_CONFIG_TYPE_ID = "configTypeID"; //$NON-NLS-1$
-
+
/* Declare Common paths */
- private static URL ICON_BASE_URL= null;
-
-// static {
-// String pathSuffix = "icons/externaltools/full/"; //$NON-NLS-1$
-//
-// try {
-// ICON_BASE_URL= new URL(PHPeclipsePlugin.getDefault().getDescriptor().getInstallURL(), pathSuffix);
-// } catch (MalformedURLException e) {
-// // do nothing
-// }
-// }
+ private static URL ICON_BASE_URL = null;
+
+ // static {
+ // String pathSuffix = "icons/externaltools/full/"; //$NON-NLS-1$
+ //
+ // try {
+ // ICON_BASE_URL= new
+ // URL(PHPeclipsePlugin.getDefault().getDescriptor().getInstallURL(),
+ // pathSuffix);
+ // } catch (MalformedURLException e) {
+ // // do nothing
+ // }
+ // }
static {
String pathSuffix = "icons/full/"; //$NON-NLS-1$
- ICON_BASE_URL= ExternalToolsPlugin.getDefault().getBundle().getEntry(pathSuffix);
+ ICON_BASE_URL = ExternalToolsPlugin.getDefault().getBundle().getEntry(
+ pathSuffix);
}
- // Use IPath and toOSString to build the names to ensure they have the slashes correct
- private final static String CTOOL= "ctool16/"; //basic colors - size 16x16 //$NON-NLS-1$
- private final static String LOCALTOOL= "clcl16/"; //basic colors - size 16x16 //$NON-NLS-1$
- private final static String DLCL= "dlcl16/"; //disabled - size 16x16 //$NON-NLS-1$
- private final static String ELCL= "elcl16/"; //enabled - size 16x16 //$NON-NLS-1$
- private final static String OBJECT= "obj16/"; //basic colors - size 16x16 //$NON-NLS-1$
- private final static String WIZBAN= "wizban/"; //basic colors - size 16x16 //$NON-NLS-1$
- private final static String OVR= "ovr16/"; //basic colors - size 7x8 //$NON-NLS-1$
- private final static String VIEW= "cview16/"; // views //$NON-NLS-1$
-
+ // Use IPath and toOSString to build the names to ensure they have the
+ // slashes correct
+ private final static String CTOOL = "ctool16/"; // basic colors - size 16x16
+ // //$NON-NLS-1$
+
+ private final static String LOCALTOOL = "clcl16/"; // basic colors - size
+ // 16x16 //$NON-NLS-1$
+
+ private final static String DLCL = "dlcl16/"; // disabled - size 16x16
+ // //$NON-NLS-1$
+
+ private final static String ELCL = "elcl16/"; // enabled - size 16x16
+ // //$NON-NLS-1$
+
+ private final static String OBJECT = "obj16/"; // basic colors - size 16x16
+ // //$NON-NLS-1$
+
+ private final static String WIZBAN = "wizban/"; // basic colors - size 16x16
+ // //$NON-NLS-1$
+
+ private final static String OVR = "ovr16/"; // basic colors - size 7x8
+ // //$NON-NLS-1$
+
+ private final static String VIEW = "cview16/"; // views //$NON-NLS-1$
+
/**
* Declare all images
*/
private static void declareImages() {
// Ant View Actions
- declareRegistryImage(IExternalToolsUIConstants.IMG_REMOVE, LOCALTOOL + "remove_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IExternalToolsUIConstants.IMG_REMOVE_ALL, LOCALTOOL + "removeAll_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IExternalToolsUIConstants.IMG_ADD, LOCALTOOL + "add_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IExternalToolsUIConstants.IMG_RUN, LOCALTOOL + "run_tool.gif"); //$NON-NLS-1$
- declareRegistryImage(IExternalToolsUIConstants.IMG_SEARCH, LOCALTOOL + "search.gif"); //$NON-NLS-1$
- declareRegistryImage(IExternalToolsUIConstants.IMG_MOVE_UP, LOCALTOOL + "moveUp.gif"); //$NON-NLS-1$
- declareRegistryImage(IExternalToolsUIConstants.IMG_MOVE_DOWN, LOCALTOOL + "moveDown.gif"); //$NON-NLS-1$
- declareRegistryImage(IExternalToolsUIConstants.IMG_ACTIVATE, LOCALTOOL + "activate.gif"); //$NON-NLS-1$
- declareRegistryImage(IExternalToolsUIConstants.IMG_DEACTIVATE, LOCALTOOL + "deactivate.gif"); //$NON-NLS-1$
- declareRegistryImage(IExternalToolsUIConstants.IMG_GO_TO_FILE, LOCALTOOL + "gotoobj_tsk.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolsUIConstants.IMG_REMOVE, LOCALTOOL
+ + "remove_co.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolsUIConstants.IMG_REMOVE_ALL,
+ LOCALTOOL + "removeAll_co.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolsUIConstants.IMG_ADD, LOCALTOOL
+ + "add_co.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolsUIConstants.IMG_RUN, LOCALTOOL
+ + "run_tool.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolsUIConstants.IMG_SEARCH, LOCALTOOL
+ + "search.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolsUIConstants.IMG_MOVE_UP, LOCALTOOL
+ + "moveUp.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolsUIConstants.IMG_MOVE_DOWN, LOCALTOOL
+ + "moveDown.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolsUIConstants.IMG_ACTIVATE, LOCALTOOL
+ + "activate.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolsUIConstants.IMG_DEACTIVATE,
+ LOCALTOOL + "deactivate.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolsUIConstants.IMG_GO_TO_FILE,
+ LOCALTOOL + "gotoobj_tsk.gif"); //$NON-NLS-1$
// Ant View Labels
-// declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_PROJECT, OBJECT + "file_obj.gif"); //$NON-NLS-1$
-// declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_PROJECT_ERROR, LOCALTOOL + "ant_project_err.gif"); //$NON-NLS-1$
-// declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_TARGET, LOCALTOOL + "ant_target.gif"); //$NON-NLS-1$
-// declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_TARGET_ERROR, LOCALTOOL + "error.gif"); //$NON-NLS-1$
-// declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_TARGET_ELEMENTS, LOCALTOOL + "elements.gif"); //$NON-NLS-1$
-// declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_TARGET_ELEMENT, LOCALTOOL + "element.gif"); //$NON-NLS-1$
+ // declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_PROJECT,
+ // OBJECT + "file_obj.gif"); //$NON-NLS-1$
+ // declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_PROJECT_ERROR,
+ // LOCALTOOL + "ant_project_err.gif"); //$NON-NLS-1$
+ // declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_TARGET,
+ // LOCALTOOL + "ant_target.gif"); //$NON-NLS-1$
+ // declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_TARGET_ERROR,
+ // LOCALTOOL + "error.gif"); //$NON-NLS-1$
+ // declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_TARGET_ELEMENTS,
+ // LOCALTOOL + "elements.gif"); //$NON-NLS-1$
+ // declareRegistryImage(IExternalToolsUIConstants.IMG_ANT_TARGET_ELEMENT,
+ // LOCALTOOL + "element.gif"); //$NON-NLS-1$
// Wizards
- declareRegistryImage(IExternalToolConstants.IMG_WIZBAN_EXTERNAL_TOOLS, WIZBAN + "ext_tools_wiz.gif"); //$NON-NLS-1$
-
+ declareRegistryImage(IExternalToolConstants.IMG_WIZBAN_EXTERNAL_TOOLS,
+ WIZBAN + "ext_tools_wiz.gif"); //$NON-NLS-1$
+
// Actions
- declareRegistryImage(IExternalToolConstants.IMG_ACTION_REFRESH, LOCALTOOL + "refresh.gif"); //$NON-NLS-1$
-
+ declareRegistryImage(IExternalToolConstants.IMG_ACTION_REFRESH,
+ LOCALTOOL + "refresh.gif"); //$NON-NLS-1$
+
// Objects
- declareRegistryImage(IExternalToolConstants.IMG_TAB_MAIN, OBJECT + "main_tab.gif"); //$NON-NLS-1$
- declareRegistryImage(IExternalToolConstants.IMG_TAB_OPTIONS, OBJECT + "options_tab.gif"); //$NON-NLS-1$
-
- //ANT object
- declareRegistryImage(IExternalToolConstants.IMG_TAB_ANT_TARGETS, LOCALTOOL + "ant_tsk_check.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolConstants.IMG_TAB_MAIN, OBJECT
+ + "main_tab.gif"); //$NON-NLS-1$
+ declareRegistryImage(IExternalToolConstants.IMG_TAB_OPTIONS, OBJECT
+ + "options_tab.gif"); //$NON-NLS-1$
+
+ // ANT object
+ declareRegistryImage(IExternalToolConstants.IMG_TAB_ANT_TARGETS,
+ LOCALTOOL + "ant_tsk_check.gif"); //$NON-NLS-1$
}
/**
* Declare an Image in the registry table.
- * @param key The key to use when registering the image
- * @param path The path where the image can be found. This path is relative to where
- * this plugin class is found (i.e. typically the packages directory)
+ *
+ * @param key
+ * The key to use when registering the image
+ * @param path
+ * The path where the image can be found. This path is relative
+ * to where this plugin class is found (i.e. typically the
+ * packages directory)
*/
private final static void declareRegistryImage(String key, String path) {
- ImageDescriptor desc= ImageDescriptor.getMissingImageDescriptor();
+ ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
try {
- desc= ImageDescriptor.createFromURL(makeIconFileURL(path));
+ desc = ImageDescriptor.createFromURL(makeIconFileURL(path));
} catch (MalformedURLException me) {
- //ExternalToolsPlugin.log(me);
+ // ExternalToolsPlugin.log(me);
}
imageRegistry.put(key, desc);
imageDescriptors.put(key, desc);
}
-
+
/**
* Returns the ImageRegistry.
*/
@@ -130,35 +174,27 @@ public class ExternalToolsImages {
}
/**
- * Initialize the image registry by declaring all of the required
- * graphics. This involves creating JFace image descriptors describing
- * how to create/find the image should it be needed.
- * The image is not actually allocated until requested.
- *
- * Prefix conventions
- * Wizard Banners WIZBAN_
- * Preference Banners PREF_BAN_
- * Property Page Banners PROPBAN_
- * Color toolbar CTOOL_
- * Enable toolbar ETOOL_
- * Disable toolbar DTOOL_
- * Local enabled toolbar ELCL_
- * Local Disable toolbar DLCL_
- * Object large OBJL_
- * Object small OBJS_
- * View VIEW_
- * Product images PROD_
- * Misc images MISC_
- *
- * Where are the images?
- * The images (typically gifs) are found in the same location as this plugin class.
- * This may mean the same package directory as the package holding this class.
- * The images are declared using this.getClass() to ensure they are looked up via
- * this plugin class.
- * @see JFace's ImageRegistry
+ * Initialize the image registry by declaring all of the required graphics.
+ * This involves creating JFace image descriptors describing how to
+ * create/find the image should it be needed. The image is not actually
+ * allocated until requested.
+ *
+ * Prefix conventions Wizard Banners WIZBAN_ Preference Banners PREF_BAN_
+ * Property Page Banners PROPBAN_ Color toolbar CTOOL_ Enable toolbar ETOOL_
+ * Disable toolbar DTOOL_ Local enabled toolbar ELCL_ Local Disable toolbar
+ * DLCL_ Object large OBJL_ Object small OBJS_ View VIEW_ Product images
+ * PROD_ Misc images MISC_
+ *
+ * Where are the images? The images (typically gifs) are found in the same
+ * location as this plugin class. This may mean the same package directory
+ * as the package holding this class. The images are declared using
+ * this.getClass() to ensure they are looked up via this plugin class.
+ *
+ * @see JFace's ImageRegistry
*/
public static ImageRegistry initializeImageRegistry() {
- imageRegistry= new ImageRegistry(ExternalToolsPlugin.getStandardDisplay());
+ imageRegistry = new ImageRegistry(ExternalToolsPlugin
+ .getStandardDisplay());
imageDescriptors = new HashMap(30);
declareImages();
return imageRegistry;
@@ -171,7 +207,7 @@ public class ExternalToolsImages {
public static Image getImage(String key) {
return getImageRegistry().get(key);
}
-
+
/**
* Returns the ImageDescriptor identified by the given key,
* or null
if it does not exist.
@@ -180,16 +216,15 @@ public class ExternalToolsImages {
if (imageDescriptors == null) {
initializeImageRegistry();
}
- return (ImageDescriptor)imageDescriptors.get(key);
+ return (ImageDescriptor) imageDescriptors.get(key);
}
-
- private static URL makeIconFileURL(String iconPath) throws MalformedURLException {
+
+ private static URL makeIconFileURL(String iconPath)
+ throws MalformedURLException {
if (ICON_BASE_URL == null) {
throw new MalformedURLException();
}
-
+
return new URL(ICON_BASE_URL, iconPath);
}
}
-
-
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsModelMessages.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsModelMessages.java
index 7e56a8b..e234173 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsModelMessages.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ExternalToolsModelMessages.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.model;
/**********************************************************************
-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.text.MessageFormat;
import java.util.MissingResourceException;
@@ -17,33 +17,36 @@ import java.util.ResourceBundle;
* Utility class which helps managing messages
*/
public final class ExternalToolsModelMessages {
- private static final String RESOURCE_BUNDLE= "net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages"; //$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private ExternalToolsModelMessages(){
+ private static final String RESOURCE_BUNDLE = "net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages"; //$NON-NLS-1$
+
+ private static ResourceBundle bundle = ResourceBundle
+ .getBundle(RESOURCE_BUNDLE);
+
+ private ExternalToolsModelMessages() {
// prevent instantiation of class
}
-
+
/**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the message name
- * @param args the message arguments
+ * Returns the formatted message for the given key in the resource bundle.
+ *
+ * @param key
+ * the message name
+ * @param args
+ * the message arguments
* @return the formatted message
- */
+ */
public static String format(String key, Object[] args) {
return MessageFormat.format(getString(key), args);
}
-
+
/**
- * Returns the message with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the message name
+ * Returns the message with the given key in the resource bundle. If there
+ * isn't any value under the given key, the key is returned.
+ *
+ * @param key
+ * the message name
* @return the message
- */
+ */
public static String getString(String key) {
try {
return bundle.getString(key);
@@ -51,7 +54,7 @@ public final class ExternalToolsModelMessages {
return key;
}
}
-
+
/**
* Returns the resource bundle for the plug-in
*/
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/IHelpContextIds.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/IHelpContextIds.java
index 1517fc2..3a0ebc0 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/IHelpContextIds.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/IHelpContextIds.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.model;
/**********************************************************************
-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:
+ **********************************************************************/
/**
* Help context ids for the external tools.
@@ -20,39 +20,75 @@ public interface IHelpContextIds {
public static final String PREFIX = "net.sourceforge.phpdt.externaltools."; //$NON-NLS-1$
// Actions
- public static final String NEW_TOOL_ACTION = PREFIX + "new_tool_action_context"; //$NON-NLS-1$
- public static final String DUPLICATE_TOOL_ACTION = PREFIX + "duplicate_tool_action_context"; //$NON-NLS-1$
- public static final String DELETE_TOOL_ACTION = PREFIX + "delete_tool_action_context"; //$NON-NLS-1$
- public static final String RENAME_TOOL_ACTION = PREFIX + "rename_tool_action_context"; //$NON-NLS-1$
- public static final String REFRESH_VIEW_ACTION = PREFIX + "refresh_view_action_context"; //$NON-NLS-1$
- public static final String RUN_TOOL_ACTION = PREFIX + "run_tool_action_context"; //$NON-NLS-1$
- public static final String RUN_WITH_TOOL_ACTION = PREFIX + "run_with_tool_action_context"; //$NON-NLS-1$
- public static final String EDIT_TOOL_PROPERTIES_ACTION = PREFIX + "edit_tool_properties_action_context"; //$NON-NLS-1$
- //public static final String ANT_ACTION = PREFIX + "ant_action_context"; //$NON-NLS-1$
-
+ public static final String NEW_TOOL_ACTION = PREFIX
+ + "new_tool_action_context"; //$NON-NLS-1$
+
+ public static final String DUPLICATE_TOOL_ACTION = PREFIX
+ + "duplicate_tool_action_context"; //$NON-NLS-1$
+
+ public static final String DELETE_TOOL_ACTION = PREFIX
+ + "delete_tool_action_context"; //$NON-NLS-1$
+
+ public static final String RENAME_TOOL_ACTION = PREFIX
+ + "rename_tool_action_context"; //$NON-NLS-1$
+
+ public static final String REFRESH_VIEW_ACTION = PREFIX
+ + "refresh_view_action_context"; //$NON-NLS-1$
+
+ public static final String RUN_TOOL_ACTION = PREFIX
+ + "run_tool_action_context"; //$NON-NLS-1$
+
+ public static final String RUN_WITH_TOOL_ACTION = PREFIX
+ + "run_with_tool_action_context"; //$NON-NLS-1$
+
+ public static final String EDIT_TOOL_PROPERTIES_ACTION = PREFIX
+ + "edit_tool_properties_action_context"; //$NON-NLS-1$
+
+ // public static final String ANT_ACTION = PREFIX + "ant_action_context";
+ // //$NON-NLS-1$
+
// Dialogs
- public static final String RESOURCE_SELECTION_DIALOG = PREFIX + "resource_selection_dialog_context"; //$NON-NLS-1$
+ public static final String RESOURCE_SELECTION_DIALOG = PREFIX
+ + "resource_selection_dialog_context"; //$NON-NLS-1$
// Preference Pages
- //public static final String ANT_PREFERENCE_PAGE = PREFIX + "ant_preference_page_context"; //$NON-NLS-1$
- public static final String ADD_TASK_DIALOG = PREFIX + "add_task_dialog_context"; //$NON-NLS-1$
+ // public static final String ANT_PREFERENCE_PAGE = PREFIX +
+ // "ant_preference_page_context"; //$NON-NLS-1$
+ public static final String ADD_TASK_DIALOG = PREFIX
+ + "add_task_dialog_context"; //$NON-NLS-1$
// Property Pages
- public static final String TOOL_MAIN_PROPERTY_PAGE = PREFIX + "tool_main_property_page_context"; //$NON-NLS-1$
- public static final String TOOL_OPTION_PROPERTY_PAGE = PREFIX + "tool_option_property_page_context"; //$NON-NLS-1$
- public static final String TOOL_REFRESH_PROPERTY_PAGE = PREFIX + "tool_refresh_property_page_context"; //$NON-NLS-1$
- public static final String ANT_TARGETS_PROPERTY_PAGE = PREFIX + "ant_targets_property_page_context"; //$NON-NLS-1$
-
+ public static final String TOOL_MAIN_PROPERTY_PAGE = PREFIX
+ + "tool_main_property_page_context"; //$NON-NLS-1$
+
+ public static final String TOOL_OPTION_PROPERTY_PAGE = PREFIX
+ + "tool_option_property_page_context"; //$NON-NLS-1$
+
+ public static final String TOOL_REFRESH_PROPERTY_PAGE = PREFIX
+ + "tool_refresh_property_page_context"; //$NON-NLS-1$
+
+ public static final String ANT_TARGETS_PROPERTY_PAGE = PREFIX
+ + "ant_targets_property_page_context"; //$NON-NLS-1$
+
// Views
- public static final String EXTERNAL_TOOLS_VIEW = PREFIX + "external_tools_view_context"; //$NON-NLS-1$
+ public static final String EXTERNAL_TOOLS_VIEW = PREFIX
+ + "external_tools_view_context"; //$NON-NLS-1$
// Wizards
-// public static final String ANT_LAUNCH_WIZARD = PREFIX + "ant_launch_wizard_context"; //$NON-NLS-1$
-
+ // public static final String ANT_LAUNCH_WIZARD = PREFIX +
+ // "ant_launch_wizard_context"; //$NON-NLS-1$
+
// Wizard Pages
- public static final String TOOL_MAIN_WIZARD_PAGE = PREFIX + "tool_main_wizard_page_context"; //$NON-NLS-1$
- public static final String TOOL_OPTION_WIZARD_PAGE = PREFIX + "tool_option_wizard_page_context"; //$NON-NLS-1$
- public static final String TOOL_REFRESH_WIZARD_PAGE = PREFIX + "tool_refresh_wizard_page_context"; //$NON-NLS-1$
-// public static final String ANT_TARGETS_WIZARD_PAGE = PREFIX + "ant_targets_wizard_page_context"; //$NON-NLS-1$
-// public static final String ANT_LAUNCH_WIZARD_PAGE = PREFIX + "ant_launch_wizard_page_context"; //$NON-NLS-1$
+ public static final String TOOL_MAIN_WIZARD_PAGE = PREFIX
+ + "tool_main_wizard_page_context"; //$NON-NLS-1$
+
+ public static final String TOOL_OPTION_WIZARD_PAGE = PREFIX
+ + "tool_option_wizard_page_context"; //$NON-NLS-1$
+
+ public static final String TOOL_REFRESH_WIZARD_PAGE = PREFIX
+ + "tool_refresh_wizard_page_context"; //$NON-NLS-1$
+ // public static final String ANT_TARGETS_WIZARD_PAGE = PREFIX +
+ // "ant_targets_wizard_page_context"; //$NON-NLS-1$
+ // public static final String ANT_LAUNCH_WIZARD_PAGE = PREFIX +
+ // "ant_launch_wizard_page_context"; //$NON-NLS-1$
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/IPreferenceConstants.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/IPreferenceConstants.java
index c6b52fb..3979be6 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/IPreferenceConstants.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/IPreferenceConstants.java
@@ -1,31 +1,38 @@
package net.sourceforge.phpdt.externaltools.internal.model;
/**********************************************************************
-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:
+ **********************************************************************/
/**
* Constants used to identify user preferences.
*/
public interface IPreferenceConstants {
-
+
public static final String PROMPT_FOR_MIGRATION = "externaltools.builders.promptForMigration"; //$NON-NLS-1$
-
+
public static final String CONSOLE_ERROR_RGB = "externaltools.console.errorColor"; //$NON-NLS-1$
+
public static final String CONSOLE_WARNING_RGB = "externaltools.console.warningColor"; //$NON-NLS-1$
- public static final String CONSOLE_INFO_RGB = "externaltools.console.infoColor"; //$NON-NLS-1$
- public static final String CONSOLE_VERBOSE_RGB = "externaltools.console.verboseColor"; //$NON-NLS-1$
- public static final String CONSOLE_DEBUG_RGB = "externaltools.console.debugColor"; //$NON-NLS-1$
-
+
+ public static final String CONSOLE_INFO_RGB = "externaltools.console.infoColor"; //$NON-NLS-1$
+
+ public static final String CONSOLE_VERBOSE_RGB = "externaltools.console.verboseColor"; //$NON-NLS-1$
+
+ public static final String CONSOLE_DEBUG_RGB = "externaltools.console.debugColor"; //$NON-NLS-1$
+
public static final String ANTVIEW_INCLUDE_ERROR_SEARCH_RESULTS = "externaltools.antview.includeErrorSearchResults"; //$NON-NLS-1$
+
public static final String ANTVIEW_LAST_SEARCH_STRING = "externaltools.antview.lastSearchString"; //$NON-NLS-1$
+
public static final String ANTVIEW_LAST_WORKINGSET_SEARCH_SCOPE = "externaltools.antview.lastSearchScope"; //$NON-NLS-1$
+
public static final String ANTVIEW_USE_WORKINGSET_SEARCH_SCOPE = "externaltools.antview.useWorkingSetSearchScope"; //$NON-NLS-1$
-
+
public static final String ANT_FIND_BUILD_FILE_NAMES = "ant.findBuildFileNames"; //$NON-NLS-1$
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ToolMessages.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ToolMessages.java
index c2b9bf7..d0cfc96 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ToolMessages.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/ToolMessages.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.model;
/**********************************************************************
-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.text.MessageFormat;
import java.util.MissingResourceException;
@@ -17,33 +17,36 @@ import java.util.ResourceBundle;
* Utility class which helps managing messages
*/
public final class ToolMessages {
- private static final String RESOURCE_BUNDLE= "net.sourceforge.phpdt.externaltools.internal.model.messages"; //$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private ToolMessages(){
+ private static final String RESOURCE_BUNDLE = "net.sourceforge.phpdt.externaltools.internal.model.messages"; //$NON-NLS-1$
+
+ private static ResourceBundle bundle = ResourceBundle
+ .getBundle(RESOURCE_BUNDLE);
+
+ private ToolMessages() {
// prevent instantiation of class
}
-
+
/**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the message name
- * @param args the message arguments
+ * Returns the formatted message for the given key in the resource bundle.
+ *
+ * @param key
+ * the message name
+ * @param args
+ * the message arguments
* @return the formatted message
- */
+ */
public static String format(String key, Object[] args) {
return MessageFormat.format(getString(key), args);
}
-
+
/**
- * Returns the message with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the message name
+ * Returns the message with the given key in the resource bundle. If there
+ * isn't any value under the given key, the key is returned.
+ *
+ * @param key
+ * the message name
* @return the message
- */
+ */
public static String getString(String key) {
try {
return bundle.getString(key);
@@ -51,7 +54,7 @@ public final class ToolMessages {
return key;
}
}
-
+
/**
* Returns the resource bundle for the plug-in
*/
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/VariableContextManager.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/VariableContextManager.java
index 686413e..c604f13 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/VariableContextManager.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/model/VariableContextManager.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.internal.model;
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import java.util.Map;
@@ -30,32 +30,36 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder;
/**
- * Maintains the context used to expand variables. The context is based on
- * the selected resource, unless a build is in progress - in which case
- * the context is based on the project being built..
+ * Maintains the context used to expand variables. The context is based on the
+ * selected resource, unless a build is in progress - in which case the context
+ * is based on the project being built..
*/
-public class VariableContextManager implements IWindowListener, ISelectionListener {
+public class VariableContextManager implements IWindowListener,
+ ISelectionListener {
// singleton
private static VariableContextManager fgDefault;
-
+
private IResource fSelectedResource = null;
-
+
private boolean fBuilding = false;
+
private IProject fProject = null;
+
private int fKind;
-
+
private VariableContextManager() {
IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null) { //may be running headless
+ if (workbench != null) { // may be running headless
workbench.addWindowListener(this);
- IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchWindow activeWindow = workbench
+ .getActiveWorkbenchWindow();
if (activeWindow != null) {
windowActivated(activeWindow);
}
- }
+ }
}
-
+
/**
* Returns the singleton resource selection manager
*
@@ -63,22 +67,22 @@ public class VariableContextManager implements IWindowListener, ISelectionListen
*/
public static VariableContextManager getDefault() {
if (fgDefault == null) {
- fgDefault = new VariableContextManager();
+ fgDefault = new VariableContextManager();
}
return fgDefault;
}
-
+
/**
* @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow)
*/
public void windowActivated(IWorkbenchWindow window) {
fSelectedResource = null;
- ISelectionService service = window.getSelectionService();
+ ISelectionService service = window.getSelectionService();
service.addSelectionListener(this);
IWorkbenchPage page = window.getActivePage();
if (page != null) {
IWorkbenchPart part = page.getActivePart();
- if (part != null) {
+ if (part != null) {
ISelection selection = service.getSelection();
if (selection != null) {
selectionChanged(part, selection);
@@ -108,31 +112,36 @@ public class VariableContextManager implements IWindowListener, ISelectionListen
}
/**
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
IResource selectedResource = null;
if (selection instanceof IStructuredSelection) {
- Object result = ((IStructuredSelection)selection).getFirstElement();
+ Object result = ((IStructuredSelection) selection)
+ .getFirstElement();
if (result instanceof IResource) {
selectedResource = (IResource) result;
} else if (result instanceof IAdaptable) {
- selectedResource = (IResource)((IAdaptable) result).getAdapter(IResource.class);
+ selectedResource = (IResource) ((IAdaptable) result)
+ .getAdapter(IResource.class);
}
}
-
+
if (selectedResource == null) {
- // If the active part is an editor, get the file resource used as input.
+ // If the active part is an editor, get the file resource used as
+ // input.
if (part instanceof IEditorPart) {
IEditorPart editorPart = (IEditorPart) part;
IEditorInput input = editorPart.getEditorInput();
- selectedResource = (IResource) input.getAdapter(IResource.class);
- }
+ selectedResource = (IResource) input
+ .getAdapter(IResource.class);
+ }
}
-
+
fSelectedResource = selectedResource;
}
-
+
/**
* Returns the active variable context. The context is that of the selected
* resource, or a project being built.
@@ -146,7 +155,7 @@ public class VariableContextManager implements IWindowListener, ISelectionListen
return new ExpandVariableContext(fSelectedResource);
}
}
-
+
/**
* Notification that the given project is being built.
*
@@ -159,13 +168,14 @@ public class VariableContextManager implements IWindowListener, ISelectionListen
fProject = project;
fKind = kind;
}
-
+
/**
* Notification the building the current project has completed.
+ *
* @see ExternalToolBuilder#build(int, Map, IProgressMonitor)
*/
public void buildEnded() {
fBuilding = false;
- fProject= null;
+ fProject = null;
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java
index 1625a08..5a7f8bc 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/BackgroundResourceRefresher.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.program.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.lang.reflect.InvocationTargetException;
@@ -26,21 +26,25 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
/**
- * Refreshes resources as specified by a lanunch configuration, when
- * an associated process terminates.
+ * Refreshes resources as specified by a lanunch configuration, when an
+ * associated process terminates.
*/
-public class BackgroundResourceRefresher implements IDebugEventSetListener, Runnable, IRunnableWithProgress {
+public class BackgroundResourceRefresher implements IDebugEventSetListener,
+ Runnable, IRunnableWithProgress {
private ExpandVariableContext fContext;
+
private ILaunchConfiguration fConfiguration;
+
private IProcess fProcess;
-
- public BackgroundResourceRefresher(ILaunchConfiguration configuration, IProcess process, ExpandVariableContext context) {
+
+ public BackgroundResourceRefresher(ILaunchConfiguration configuration,
+ IProcess process, ExpandVariableContext context) {
fConfiguration = configuration;
fProcess = process;
fContext = context;
}
-
+
/**
* If the process has already terminated, resource refreshing is done
* immediately in the current thread. Otherwise, refreshing is done when the
@@ -55,35 +59,37 @@ public class BackgroundResourceRefresher implements IDebugEventSetListener, Runn
}
}
}
-
+
/**
* @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent)
*/
public void handleDebugEvents(DebugEvent[] events) {
for (int i = 0; i < events.length; i++) {
DebugEvent event = events[i];
- if (event.getSource() == fProcess && event.getKind() == DebugEvent.TERMINATE) {
+ if (event.getSource() == fProcess
+ && event.getKind() == DebugEvent.TERMINATE) {
DebugPlugin.getDefault().removeDebugEventListener(this);
refresh();
break;
}
}
}
-
+
/**
* Submits a runnable to do the refresh
*/
protected void refresh() {
- ExternalToolsPlugin.getStandardDisplay().asyncExec(this);
+ ExternalToolsPlugin.getStandardDisplay().asyncExec(this);
}
-
- /**
+
+ /**
* Creates a dialog to run the refresh
*
* @see java.lang.Runnable#run()
*/
public void run() {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(ExternalToolsPlugin.getStandardDisplay().getActiveShell());
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(
+ ExternalToolsPlugin.getStandardDisplay().getActiveShell());
try {
dialog.run(true, true, this);
} catch (InvocationTargetException e) {
@@ -91,17 +97,20 @@ public class BackgroundResourceRefresher implements IDebugEventSetListener, Runn
} catch (InterruptedException e) {
}
}
+
/**
* Peforms the refresh
*
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
*/
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
try {
- ExternalToolsUtil.refreshResources(fConfiguration, fContext, monitor);
+ ExternalToolsUtil.refreshResources(fConfiguration, fContext,
+ monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
- }
+ }
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramBuilderTabGroup.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramBuilderTabGroup.java
index 46c3b6d..f0501e9 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramBuilderTabGroup.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramBuilderTabGroup.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.internal.program.launchConfigurations;
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsRefreshTab;
@@ -16,14 +16,13 @@ import org.eclipse.debug.ui.ILaunchConfigurationTab;
public class ProgramBuilderTabGroup extends AbstractLaunchConfigurationTabGroup {
/**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog,
+ * java.lang.String)
*/
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
- new ProgramMainTab(),
- new ExternalToolsRefreshTab(),
- };
+ new ProgramMainTab(), new ExternalToolsRefreshTab(), };
setTabs(tabs);
}
-
+
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java
index 7df974e..38d227a 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramLaunchDelegate.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.program.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;
@@ -36,42 +36,49 @@ public class ProgramLaunchDelegate implements ILaunchConfigurationDelegate {
}
/**
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration,
+ * java.lang.String, org.eclipse.debug.core.ILaunch,
+ * org.eclipse.core.runtime.IProgressMonitor)
*/
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
-
+ public void launch(ILaunchConfiguration configuration, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
+
if (monitor.isCanceled()) {
return;
}
-
+
// get variable context
- ExpandVariableContext resourceContext = ExternalToolsUtil.getVariableContext();
+ ExpandVariableContext resourceContext = ExternalToolsUtil
+ .getVariableContext();
if (monitor.isCanceled()) {
return;
}
-
+
// resolve location
- IPath location = ExternalToolsUtil.getLocation(configuration, resourceContext);
-
+ IPath location = ExternalToolsUtil.getLocation(configuration,
+ resourceContext);
+
if (monitor.isCanceled()) {
return;
- }
-
+ }
+
// resolve working directory
- IPath workingDirectory = ExternalToolsUtil.getWorkingDirectory(configuration, resourceContext);
-
+ IPath workingDirectory = ExternalToolsUtil.getWorkingDirectory(
+ configuration, resourceContext);
+
if (monitor.isCanceled()) {
return;
}
-
+
// resolve arguments
- String[] arguments = ExternalToolsUtil.getArguments(configuration, resourceContext);
-
+ String[] arguments = ExternalToolsUtil.getArguments(configuration,
+ resourceContext);
+
if (monitor.isCanceled()) {
return;
}
-
+
int cmdLineLength = 1;
if (arguments != null) {
cmdLineLength += arguments.length;
@@ -81,29 +88,30 @@ public class ProgramLaunchDelegate implements ILaunchConfigurationDelegate {
if (arguments != null) {
System.arraycopy(arguments, 0, cmdLine, 1, arguments.length);
}
-
+
File workingDir = null;
if (workingDirectory != null) {
workingDir = workingDirectory.toFile();
}
-
+
if (monitor.isCanceled()) {
return;
}
-
+
Process p = DebugPlugin.exec(cmdLine, workingDir);
IProcess process = null;
if (p != null) {
process = DebugPlugin.newProcess(launch, p, location.toOSString());
}
process.setAttribute(IProcess.ATTR_CMDLINE, renderCommandLine(cmdLine));
-
+
if (ExternalToolsUtil.isBackground(configuration)) {
// refresh resources after process finishes
if (ExternalToolsUtil.getRefreshScope(configuration) != null) {
- BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(configuration, process, resourceContext);
+ BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(
+ configuration, process, resourceContext);
refresher.startBackgroundRefresh();
- }
+ }
} else {
// wait for process to exit
while (!process.isTerminated()) {
@@ -116,23 +124,23 @@ public class ProgramLaunchDelegate implements ILaunchConfigurationDelegate {
} catch (InterruptedException e) {
}
}
-
+
// refresh resources
- ExternalToolsUtil.refreshResources(configuration, resourceContext, monitor);
+ ExternalToolsUtil.refreshResources(configuration, resourceContext,
+ monitor);
}
-
-
+
}
-
+
protected static String renderCommandLine(String[] commandLine) {
if (commandLine.length < 1)
return ""; //$NON-NLS-1$
- StringBuffer buf= new StringBuffer(commandLine[0]);
- for (int i= 1; i < commandLine.length; i++) {
+ StringBuffer buf = new StringBuffer(commandLine[0]);
+ for (int i = 1; i < commandLine.length; i++) {
buf.append(' ');
buf.append(commandLine[i]);
- }
+ }
return buf.toString();
- }
-
+ }
+
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramMainTab.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramMainTab.java
index 6217692..b788580 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramMainTab.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramMainTab.java
@@ -17,15 +17,17 @@ public class ProgramMainTab extends ExternalToolsMainTab {
*/
protected void handleWorkspaceLocationButtonSelected() {
FileSelectionDialog dialog;
- dialog = new FileSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), "&Select a program");
+ dialog = new FileSelectionDialog(getShell(), ResourcesPlugin
+ .getWorkspace().getRoot(), "&Select a program");
dialog.open();
IFile file = dialog.getResult();
if (file == null) {
return;
}
StringBuffer buf = new StringBuffer();
- ToolUtil.buildVariableTag(IExternalToolConstants.VAR_WORKSPACE_LOC, file.getFullPath().toString(), buf);
- String text= buf.toString();
+ ToolUtil.buildVariableTag(IExternalToolConstants.VAR_WORKSPACE_LOC,
+ file.getFullPath().toString(), buf);
+ String text = buf.toString();
if (text != null) {
locationField.setText(text);
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java
index 19d81a9..55bf044 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/program/launchConfigurations/ProgramTabGroup.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.internal.program.launchConfigurations;
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsRefreshTab;
@@ -17,14 +17,13 @@ import org.eclipse.debug.ui.ILaunchConfigurationTab;
public class ProgramTabGroup extends AbstractLaunchConfigurationTabGroup {
/**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog,
+ * java.lang.String)
*/
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
- new ProgramMainTab(),
- new ExternalToolsRefreshTab(),
- new CommonTab()
- };
+ new ProgramMainTab(), new ExternalToolsRefreshTab(),
+ new CommonTab() };
setTabs(tabs);
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariable.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariable.java
index e3fc7b2..da01310 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariable.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariable.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.registry;
/**********************************************************************
-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 net.sourceforge.phpdt.externaltools.variable.ExpandVariableContext;
import net.sourceforge.phpdt.externaltools.variable.IVariableTextExpander;
@@ -19,23 +19,26 @@ import org.eclipse.core.runtime.IConfigurationElement;
*/
public final class ArgumentVariable extends ExternalToolVariable {
private static final DefaultTextExpander defaultExpander = new DefaultTextExpander();
-
+
private IVariableTextExpander expander = null;
/**
* Creates an argument variable
*
- * @param tag the variable tag
- * @param description a short description of what the variable will expand to
- * @param element the configuration element
+ * @param tag
+ * the variable tag
+ * @param description
+ * a short description of what the variable will expand to
+ * @param element
+ * the configuration element
*/
- /*package*/ ArgumentVariable(String tag, String description, IConfigurationElement element) {
+ /* package */ArgumentVariable(String tag, String description,
+ IConfigurationElement element) {
super(tag, description, element);
}
/**
- * Returns the object that can expand the variable
- * as text.
+ * Returns the object that can expand the variable as text.
*/
public IVariableTextExpander getExpander() {
if (expander == null) {
@@ -50,16 +53,17 @@ public final class ArgumentVariable extends ExternalToolVariable {
return expander;
}
-
/**
- * Default variable text expander implementation which does
- * not expand variables, but just returns null
.
- */
- private static final class DefaultTextExpander implements IVariableTextExpander {
- /* (non-Javadoc)
- * Method declared on IVariableTextExpander.
+ * Default variable text expander implementation which does not expand
+ * variables, but just returns null
.
+ */
+ private static final class DefaultTextExpander implements
+ IVariableTextExpander {
+ /*
+ * (non-Javadoc) Method declared on IVariableTextExpander.
*/
- public String getText(String varTag, String varValue, ExpandVariableContext context) {
+ public String getText(String varTag, String varValue,
+ ExpandVariableContext context) {
return null;
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariableRegistry.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariableRegistry.java
index 5e02868..8c9a5cf 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariableRegistry.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ArgumentVariableRegistry.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.registry;
/**********************************************************************
-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 net.sourceforge.phpdt.externaltools.model.IExternalToolConstants;
@@ -26,13 +26,13 @@ public class ArgumentVariableRegistry extends ExternalToolVariableRegistry {
}
/**
- * Returns the argument variable for the given tag
- * or null
if none.
+ * Returns the argument variable for the given tag or null
if
+ * none.
*/
public ArgumentVariable getArgumentVariable(String tag) {
return (ArgumentVariable) findVariable(tag);
}
-
+
/**
* Returns the list of argument variables in the registry.
*/
@@ -41,11 +41,12 @@ public class ArgumentVariableRegistry extends ExternalToolVariableRegistry {
copyVariables(results);
return results;
}
-
- /* (non-Javadoc)
- * Method declared on ExternalToolVariableRegistry.
+
+ /*
+ * (non-Javadoc) Method declared on ExternalToolVariableRegistry.
*/
- protected ExternalToolVariable newVariable(String tag, String description, IConfigurationElement element) {
+ protected ExternalToolVariable newVariable(String tag, String description,
+ IConfigurationElement element) {
return new ArgumentVariable(tag, description, element);
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolMigration.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolMigration.java
index 3ca3b59..babbcc6 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolMigration.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolMigration.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.registry;
/**********************************************************************
-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.io.FileInputStream;
@@ -34,70 +34,107 @@ import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.XMLMemento;
/**
- * Responsible reading an old external tool format and creating
- * and migrating it to create a new external tool.
+ * Responsible reading an old external tool format and creating and migrating it
+ * to create a new external tool.
*/
public final class ExternalToolMigration {
private static final String SEPERATOR = ";"; //$NON-NLS-1$
+
private static final String STATE_FILE_NAME_OLD = "oldexternaltools.xml"; //$NON-NLS-1$
+
private static final String STATE_FILE_NAME = "externaltools.xml"; //$NON-NLS-1$
+
private static final String TAG_EXTERNALTOOLS = "externaltools"; //$NON-NLS-1$
+
private static final String TAG_TOOL = "tool"; //$NON-NLS-1$
+
private static final String TAG_ENTRY = "entry"; //$NON-NLS-1$
- //private static final String TAG_KEY = "key"; //$NON-NLS-1$
+
+ // private static final String TAG_KEY = "key"; //$NON-NLS-1$
private static final String TAG_VALUE = "value"; //$NON-NLS-1$
/*
* Ant tags
*/
- //public static final String RUN_TARGETS_ATTRIBUTE = IExternalToolConstants.TOOL_TYPE_ANT_BUILD + ".runTargets"; //$NON-NLS-1$;
-
+ // public static final String RUN_TARGETS_ATTRIBUTE =
+ // IExternalToolConstants.TOOL_TYPE_ANT_BUILD + ".runTargets";
+ // //$NON-NLS-1$;
/*
* 2.0 External Tool Tags
*/
private static final String TAG_TOOL_TYPE = "!{tool_type}"; //$NON-NLS-1$
+
private static final String TAG_TOOL_NAME = "!{tool_name}"; //$NON-NLS-1$
+
private static final String TAG_TOOL_LOCATION = "!{tool_loc}"; //$NON-NLS-1$
+
private static final String TAG_TOOL_ARGUMENTS = "!{tool_args}"; //$NON-NLS-1$
+
private static final String TAG_TOOL_DIRECTORY = "!{tool_dir}"; //$NON-NLS-1$
+
private static final String TAG_TOOL_REFRESH = "!{tool_refresh}"; //$NON-NLS-1$
+
private static final String TAG_TOOL_SHOW_LOG = "!{tool_show_log}"; //$NON-NLS-1$
+
private static final String TAG_TOOL_BUILD_TYPES = "!{tool_build_types}"; //$NON-NLS-1$
+
private static final String TAG_TOOL_BLOCK = "!{tool_block}"; //$NON-NLS-1$
// Known kind of tools
private static final String TOOL_TYPE_PROGRAM = "net.sourceforge.phpdt.externaltools.type.program"; //$NON-NLS-1$
- //private static final String TOOL_TYPE_ANT = "org.eclipse.ui.externaltools.type.ant"; //$NON-NLS-1$
+
+ // private static final String TOOL_TYPE_ANT =
+ // "org.eclipse.ui.externaltools.type.ant"; //$NON-NLS-1$
/*
* 2.1 External Tool Keys
*/
private static final String TAG_EXTERNAL_TOOL = "externalTool"; //$NON-NLS-1$
+
private static final String TAG_TYPE = "type"; //$NON-NLS-1$
+
private static final String TAG_NAME = "name"; //$NON-NLS-1$
+
private static final String TAG_LOCATION = "location"; //$NON-NLS-1$
+
private static final String TAG_WORK_DIR = "workDirectory"; //$NON-NLS-1$
+
private static final String TAG_CAPTURE_OUTPUT = "captureOutput"; //$NON-NLS-1$
+
private static final String TAG_SHOW_CONSOLE = "showConsole"; //$NON-NLS-1$
+
private static final String TAG_RUN_BKGRND = "runInBackground"; //$NON-NLS-1$
+
private static final String TAG_OPEN_PERSP = "openPerspective"; //$NON-NLS-1$
+
private static final String TAG_PROMPT_ARGS = "promptForArguments"; //$NON-NLS-1$
+
private static final String TAG_SHOW_MENU = "showInMenu"; //$NON-NLS-1$
+
private static final String TAG_SAVE_DIRTY = "saveDirtyEditors"; //$NON-NLS-1$
+
private static final String TAG_ARGS = "arguments"; //$NON-NLS-1$
+
private static final String TAG_REFRESH_SCOPE = "refreshScope"; //$NON-NLS-1$
+
private static final String TAG_REFRESH_RECURSIVE = "refreshRecursive"; //$NON-NLS-1$
+
private static final String TAG_RUN_BUILD_KINDS = "runForBuildKinds"; //$NON-NLS-1$
+
private static final String TAG_EXTRA_ATTR = "extraAttribute"; //$NON-NLS-1$
+
private static final String TAG_KEY = "key"; //$NON-NLS-1$
+
private static final String TAG_VERSION = "version"; //$NON-NLS-1$
private static final String BUILD_TYPE_SEPARATOR = ","; //$NON-NLS-1$
+
private static final String EXTRA_ATTR_SEPARATOR = "="; //$NON-NLS-1$
private static final String VERSION_21 = "2.1"; //$NON-NLS-1$;
private static final String TRUE = "true"; //$NON-NLS-1$
+
private static final String FALSE = "false"; //$NON-NLS-1$
/**
@@ -108,11 +145,10 @@ public final class ExternalToolMigration {
}
/**
- * Loads the external tools from storage and
- * adds them to the registry.
+ * Loads the external tools from storage and adds them to the registry.
*/
- /*package*/
- // This method is not called. It is left here in case
+ /* package */
+ // This method is not called. It is left here in case
// we decide to do tool migration in the future
private static void readInOldTools() {
readIn20Tools();
@@ -159,35 +195,44 @@ public final class ExternalToolMigration {
} catch (FileNotFoundException e) {
// Silently ignore this...
} catch (IOException e) {
- ExternalToolsPlugin.getDefault().log("File I/O error with reading old external tools.", e);
+ ExternalToolsPlugin.getDefault().log(
+ "File I/O error with reading old external tools.", e);
migrationSuccessful = false;
} catch (WorkbenchException e) {
- ExternalToolsPlugin.getDefault().getLog().log(e.getStatus());
- System.err.println("Error reading old external tools. See .log file for more details");
+ ExternalToolsPlugin.getDefault().getLog().log(e.getStatus());
+ System.err
+ .println("Error reading old external tools. See .log file for more details");
migrationSuccessful = false;
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
- ExternalToolsPlugin.getDefault().log("Unable to close external tool old state reader.", e);
+ ExternalToolsPlugin.getDefault().log(
+ "Unable to close external tool old state reader.",
+ e);
}
}
}
if (migrationSuccessful) {
if (!file.renameTo(path.append(STATE_FILE_NAME_OLD).toFile())) {
- ExternalToolsPlugin.getDefault().log("Unable to rename old external tool state file. Please rename externaltools.xml to oldexternaltools.xml manually.", null);
- System.err.println("Unable to rename old external tool state file. Please rename externaltools.xml to oldexternaltools.xml manually.");
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ "Unable to rename old external tool state file. Please rename externaltools.xml to oldexternaltools.xml manually.",
+ null);
+ System.err
+ .println("Unable to rename old external tool state file. Please rename externaltools.xml to oldexternaltools.xml manually.");
}
}
}
/**
- * Returns a launch configuration working copy from the argument map or
- * null
if the given map cannot be interpreted as a 2.0 or 2.1
- * branch external tool. The returned working copy will be unsaved and its
- * location will be set to the metadata area.
+ * Returns a launch configuration working copy from the argument map or
+ * null
if the given map cannot be interpreted as a 2.0 or
+ * 2.1 branch external tool. The returned working copy will be unsaved and
+ * its location will be set to the metadata area.
*/
public static ILaunchConfigurationWorkingCopy configFromArgumentMap(Map args) {
String version = (String) args.get(TAG_VERSION);
@@ -197,43 +242,56 @@ public final class ExternalToolMigration {
return configFrom20ArgumentMap(args);
}
- public static ILaunchConfigurationWorkingCopy configFrom21ArgumentMap(Map commandArgs) {
+ public static ILaunchConfigurationWorkingCopy configFrom21ArgumentMap(
+ Map commandArgs) {
String name = (String) commandArgs.get(TAG_NAME);
String type = (String) commandArgs.get(TAG_TYPE);
-
+
ILaunchConfigurationWorkingCopy config = newConfig(type, name);
if (config == null) {
return null;
}
-
- config.setAttribute(IExternalToolConstants.ATTR_LOCATION, (String) commandArgs.get(TAG_LOCATION));
- config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) commandArgs.get(TAG_WORK_DIR));
- config.setAttribute(IExternalToolConstants.ATTR_CAPTURE_OUTPUT, TRUE.equals((String) commandArgs.get(TAG_CAPTURE_OUTPUT)));
- config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE.equals((String) commandArgs.get(TAG_SHOW_CONSOLE)));
- config.setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, TRUE.equals((String) commandArgs.get(TAG_RUN_BKGRND)));
- config.setAttribute(IExternalToolConstants.ATTR_PROMPT_FOR_ARGUMENTS, TRUE.equals((String) commandArgs.get(TAG_PROMPT_ARGS)));
- config.setAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, (String) commandArgs.get(TAG_REFRESH_SCOPE));
- config.setAttribute(IExternalToolConstants.ATTR_REFRESH_RECURSIVE, TRUE.equals((String) commandArgs.get(TAG_REFRESH_RECURSIVE)));
-
- config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) commandArgs.get(TAG_RUN_BUILD_KINDS));
-
+
+ config.setAttribute(IExternalToolConstants.ATTR_LOCATION,
+ (String) commandArgs.get(TAG_LOCATION));
+ config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY,
+ (String) commandArgs.get(TAG_WORK_DIR));
+ config.setAttribute(IExternalToolConstants.ATTR_CAPTURE_OUTPUT, TRUE
+ .equals((String) commandArgs.get(TAG_CAPTURE_OUTPUT)));
+ config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE
+ .equals((String) commandArgs.get(TAG_SHOW_CONSOLE)));
+ config.setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, TRUE
+ .equals((String) commandArgs.get(TAG_RUN_BKGRND)));
+ config.setAttribute(IExternalToolConstants.ATTR_PROMPT_FOR_ARGUMENTS,
+ TRUE.equals((String) commandArgs.get(TAG_PROMPT_ARGS)));
+ config.setAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE,
+ (String) commandArgs.get(TAG_REFRESH_SCOPE));
+ config.setAttribute(IExternalToolConstants.ATTR_REFRESH_RECURSIVE, TRUE
+ .equals((String) commandArgs.get(TAG_REFRESH_RECURSIVE)));
+
+ config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS,
+ (String) commandArgs.get(TAG_RUN_BUILD_KINDS));
+
String args = (String) commandArgs.get(TAG_ARGS);
if (args != null) {
- config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, args);
+ config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS,
+ args);
}
String extraAttributes = (String) commandArgs.get(TAG_EXTRA_ATTR);
if (extraAttributes != null) {
- StringTokenizer tokenizer = new StringTokenizer(extraAttributes, EXTRA_ATTR_SEPARATOR);
+ StringTokenizer tokenizer = new StringTokenizer(extraAttributes,
+ EXTRA_ATTR_SEPARATOR);
while (tokenizer.hasMoreTokens()) {
String key = tokenizer.nextToken();
if (!tokenizer.hasMoreTokens())
break;
String value = tokenizer.nextToken();
-// if (key.equals(RUN_TARGETS_ATTRIBUTE)) {
-// // 2.1 implementation only defined 1 "extra attribute"
-// config.setAttribute(IExternalToolConstants.ATTR_ANT_TARGETS, value);
-// }
+ // if (key.equals(RUN_TARGETS_ATTRIBUTE)) {
+ // // 2.1 implementation only defined 1 "extra attribute"
+ // config.setAttribute(IExternalToolConstants.ATTR_ANT_TARGETS,
+ // value);
+ // }
}
}
return config;
@@ -242,16 +300,17 @@ public final class ExternalToolMigration {
/**
* Creates an external tool from the map.
*/
- public static ILaunchConfigurationWorkingCopy configFrom20ArgumentMap(Map args) {
+ public static ILaunchConfigurationWorkingCopy configFrom20ArgumentMap(
+ Map args) {
// Update the type...
String type = (String) args.get(TAG_TOOL_TYPE);
-// if (TOOL_TYPE_ANT.equals(type))
-// type = IExternalToolConstants.TOOL_TYPE_ANT_BUILD;
-// else
- type = IExternalToolConstants.TOOL_TYPE_PROGRAM;
+ // if (TOOL_TYPE_ANT.equals(type))
+ // type = IExternalToolConstants.TOOL_TYPE_ANT_BUILD;
+ // else
+ type = IExternalToolConstants.TOOL_TYPE_PROGRAM;
String name = (String) args.get(TAG_TOOL_NAME);
-
+
ILaunchConfigurationWorkingCopy config = newConfig(type, name);
if (config == null) {
return null;
@@ -260,9 +319,12 @@ public final class ExternalToolMigration {
// Update the location...
String location = (String) args.get(TAG_TOOL_LOCATION);
if (location != null) {
- ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(location, 0);
+ ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(
+ location, 0);
if (IExternalToolConstants.VAR_WORKSPACE_LOC.equals(varDef.name)) {
- location = ToolUtil.buildVariableTag(IExternalToolConstants.VAR_RESOURCE_LOC, varDef.argument);
+ location = ToolUtil.buildVariableTag(
+ IExternalToolConstants.VAR_RESOURCE_LOC,
+ varDef.argument);
}
config.setAttribute(IExternalToolConstants.ATTR_LOCATION, location);
}
@@ -270,11 +332,13 @@ public final class ExternalToolMigration {
// Update the refresh scope...
String refresh = (String) args.get(TAG_TOOL_REFRESH);
if (refresh != null) {
- ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(refresh, 0);
+ ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(
+ refresh, 0);
if ("none".equals(varDef.name)) { //$NON-NLS-1$
refresh = null;
}
- config.setAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, refresh);
+ config.setAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE,
+ refresh);
}
// Update the arguments
@@ -284,7 +348,8 @@ public final class ExternalToolMigration {
int start = 0;
ArrayList targets = new ArrayList();
StringBuffer buffer = new StringBuffer();
- ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(arguments, start);
+ ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(
+ arguments, start);
while (varDef.end != -1) {
if ("ant_target".equals(varDef.name) && varDef.argument != null) { //$NON-NLS-1$
targets.add(varDef.argument);
@@ -309,16 +374,23 @@ public final class ExternalToolMigration {
targetNames = buffer.toString();
}
if (targetNames != null && targetNames.length() > 0) {
- config.setAttribute(IExternalToolConstants.ATTR_ANT_TARGETS, targetNames);
+ config.setAttribute(IExternalToolConstants.ATTR_ANT_TARGETS,
+ targetNames);
}
// Collect the rest of the information
- config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE.equals((String) args.get(TAG_TOOL_SHOW_LOG)));
- config.setAttribute(IExternalToolConstants.ATTR_CAPTURE_OUTPUT, TRUE.equals((String) args.get(TAG_TOOL_SHOW_LOG)));
- config.setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, FALSE.equals((String) args.get(TAG_TOOL_BLOCK)));
- config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) args.get(TAG_TOOL_BUILD_TYPES));
- config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments);
- config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) args.get(TAG_TOOL_DIRECTORY));
+ config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE
+ .equals((String) args.get(TAG_TOOL_SHOW_LOG)));
+ config.setAttribute(IExternalToolConstants.ATTR_CAPTURE_OUTPUT, TRUE
+ .equals((String) args.get(TAG_TOOL_SHOW_LOG)));
+ config.setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND,
+ FALSE.equals((String) args.get(TAG_TOOL_BLOCK)));
+ config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS,
+ (String) args.get(TAG_TOOL_BUILD_TYPES));
+ config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS,
+ arguments);
+ config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY,
+ (String) args.get(TAG_TOOL_DIRECTORY));
return config;
}
@@ -326,17 +398,20 @@ public final class ExternalToolMigration {
* Returns a new working copy with the given external tool name and external
* tool type or null
if no config could be created.
*/
- private static ILaunchConfigurationWorkingCopy newConfig(String type, String name) {
+ private static ILaunchConfigurationWorkingCopy newConfig(String type,
+ String name) {
if (type == null || name == null) {
return null;
}
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType;
-// if (IExternalToolConstants.TOOL_TYPE_ANT_BUILD.equals(type)) {
-// configType = manager.getLaunchConfigurationType(IExternalToolConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE);
-// } else
+ // if (IExternalToolConstants.TOOL_TYPE_ANT_BUILD.equals(type)) {
+ // configType =
+ // manager.getLaunchConfigurationType(IExternalToolConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE);
+ // } else
if (IExternalToolConstants.TOOL_TYPE_PROGRAM.equals(type)) {
- configType = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE);
+ configType = manager
+ .getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE);
} else {
return null;
}
@@ -346,17 +421,17 @@ public final class ExternalToolMigration {
return null;
}
}
-
+
/**
* Returns the tool name extracted from the given command argument map.
* Extraction is attempted using 2.0 and 2.1 external tool formats.
*/
public static String getNameFromCommandArgs(Map commandArgs) {
- String name= (String) commandArgs.get(TAG_NAME);
+ String name = (String) commandArgs.get(TAG_NAME);
if (name == null) {
- name= (String) commandArgs.get(TAG_TOOL_NAME);
+ name = (String) commandArgs.get(TAG_TOOL_NAME);
}
return name;
}
-
+
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java
index ea4a706..c0416e6 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariable.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.registry;
/**********************************************************************
-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 net.sourceforge.phpdt.externaltools.group.IGroupDialogPage;
import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages;
@@ -27,57 +27,64 @@ import org.eclipse.swt.widgets.Label;
* Abtract representation of the different variables.
*/
public abstract class ExternalToolVariable {
- private static final IVariableComponent defaultComponent = new DefaultVariableComponent(false);
-
+ private static final IVariableComponent defaultComponent = new DefaultVariableComponent(
+ false);
+
private String tag;
+
private String description;
+
private IConfigurationElement element;
/**
* Creates an variable definition
*
- * @param tag the variable tag
- * @param description a short description of what the variable will expand to
- * @param element the configuration element
+ * @param tag
+ * the variable tag
+ * @param description
+ * a short description of what the variable will expand to
+ * @param element
+ * the configuration element
*/
- /*package*/ ExternalToolVariable(String tag, String description, IConfigurationElement element) {
+ /* package */ExternalToolVariable(String tag, String description,
+ IConfigurationElement element) {
super();
this.tag = tag;
this.description = description;
this.element = element;
}
-
+
/**
- * Creates an instance of the class specified by
- * the given element attribute name. Can return
- * null
if none or if problems creating
- * the instance.
+ * Creates an instance of the class specified by the given element attribute
+ * name. Can return null
if none or if problems creating the
+ * instance.
*/
protected final Object createObject(String attributeName) {
try {
return element.createExecutableExtension(attributeName);
} catch (CoreException e) {
- ExternalToolsPlugin.getDefault().getLog().log(e.getStatus());
+ ExternalToolsPlugin.getDefault().getLog().log(e.getStatus());
return null;
}
}
-
+
/**
- * Returns the component class to allow
- * visual editing of the variable's value.
+ * Returns the component class to allow visual editing of the variable's
+ * value.
*/
public final IVariableComponent getComponent() {
- String className = element.getAttribute(ExternalToolVariableRegistry.TAG_COMPONENT_CLASS);
+ String className = element
+ .getAttribute(ExternalToolVariableRegistry.TAG_COMPONENT_CLASS);
if (className == null || className.trim().length() == 0)
return defaultComponent;
-
+
Object component = createObject(ExternalToolVariableRegistry.TAG_COMPONENT_CLASS);
if (component == null)
return new DefaultVariableComponent(true);
else
- return (IVariableComponent)component;
+ return (IVariableComponent) component;
}
-
+
/**
* Returns the variable's description
*/
@@ -92,63 +99,68 @@ public abstract class ExternalToolVariable {
return tag;
}
-
/**
- * Default variable component implementation which does not
- * allow variable value editing visually.
- */
- private static final class DefaultVariableComponent implements IVariableComponent {
+ * Default variable component implementation which does not allow variable
+ * value editing visually.
+ */
+ private static final class DefaultVariableComponent implements
+ IVariableComponent {
private boolean showError = false;
+
private Label message = null;
-
+
public DefaultVariableComponent(boolean showError) {
super();
this.showError = showError;
}
-
- /* (non-Javadoc)
- * Method declared on IVariableComponent.
+
+ /*
+ * (non-Javadoc) Method declared on IVariableComponent.
*/
public Control getControl() {
return message;
}
-
- /* (non-Javadoc)
- * Method declared on IVariableComponent.
+
+ /*
+ * (non-Javadoc) Method declared on IVariableComponent.
*/
- public void createContents(Composite parent, String varTag, IGroupDialogPage page) {
+ public void createContents(Composite parent, String varTag,
+ IGroupDialogPage page) {
if (showError) {
message = new Label(parent, SWT.NONE);
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
message.setLayoutData(data);
message.setFont(parent.getFont());
- message.setText(ExternalToolsModelMessages.getString("ExternalToolVariable.componentErrorMessage")); //$NON-NLS-1$
- message.setForeground(JFaceColors.getErrorText(message.getDisplay()));
+ message
+ .setText(ExternalToolsModelMessages
+ .getString("ExternalToolVariable.componentErrorMessage")); //$NON-NLS-1$
+ message.setForeground(JFaceColors.getErrorText(message
+ .getDisplay()));
}
}
-
- /* (non-Javadoc)
- * Method declared on IVariableComponent.
+
+ /*
+ * (non-Javadoc) Method declared on IVariableComponent.
*/
public String getVariableValue() {
return null;
}
-
- /* (non-Javadoc)
- * Method declared on IVariableComponent.
+
+ /*
+ * (non-Javadoc) Method declared on IVariableComponent.
*/
public boolean isValid() {
return true;
}
-
- /* (non-Javadoc)
- * Method declared on IVariableComponent.
+
+ /*
+ * (non-Javadoc) Method declared on IVariableComponent.
*/
public void setVariableValue(String varValue) {
}
- /* (non-Javadoc)
- * Method declared on IVariableComponent.
+ /*
+ * (non-Javadoc) Method declared on IVariableComponent.
*/
public void validate() {
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariableRegistry.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariableRegistry.java
index d1b6b90..09b94b4 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariableRegistry.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/ExternalToolVariableRegistry.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.registry;
/**********************************************************************
-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.util.HashMap;
@@ -26,47 +26,48 @@ import org.eclipse.core.runtime.Platform;
public abstract class ExternalToolVariableRegistry {
// Format of the variable extension points
// null
if none found.
+ * Returns the variable for the specified tag, or null
if
+ * none found.
*/
protected final ExternalToolVariable findVariable(String tag) {
return (ExternalToolVariable) variables.get(tag);
@@ -88,50 +89,65 @@ public abstract class ExternalToolVariableRegistry {
public final int getVariableCount() {
return variables.size();
}
-
+
/**
* Load the available variables
*/
private void loadVariables() {
variables = new HashMap();
- IExtensionRegistry registry= Platform.getExtensionRegistry();
-// IPluginRegistry registry = Platform.getPluginRegistry();
- IExtensionPoint point = registry.getExtensionPoint(IExternalToolConstants.PLUGIN_ID, extensionPointId);
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ // IPluginRegistry registry = Platform.getPluginRegistry();
+ IExtensionPoint point = registry.getExtensionPoint(
+ IExternalToolConstants.PLUGIN_ID, extensionPointId);
if (point != null) {
IExtension[] extensions = point.getExtensions();
for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] elements = extensions[i].getConfigurationElements();
+ IConfigurationElement[] elements = extensions[i]
+ .getConfigurationElements();
for (int j = 0; j < elements.length; j++) {
IConfigurationElement element = elements[j];
if (element.getName().equals(TAG_VARIABLE)) {
String tag = element.getAttribute(TAG_TAG);
- String description = element.getAttribute(TAG_DESCRIPTION);
- String className = element.getAttribute(TAG_EXPANDER_CLASS);
-
+ String description = element
+ .getAttribute(TAG_DESCRIPTION);
+ String className = element
+ .getAttribute(TAG_EXPANDER_CLASS);
+
boolean valid = true;
if (tag == null || tag.length() == 0) {
valid = false;
- ExternalToolsPlugin.getDefault().log("Missing tag attribute value for variable element.", null); //$NON-NLS-1$
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ "Missing tag attribute value for variable element.", null); //$NON-NLS-1$
}
if (description == null || description.length() == 0) {
valid = false;
- ExternalToolsPlugin.getDefault().log("Missing description attribute value for variable element.", null); //$NON-NLS-1$
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ "Missing description attribute value for variable element.", null); //$NON-NLS-1$
}
if (className == null || className.length() == 0) {
valid = false;
- ExternalToolsPlugin.getDefault().log("Missing expander class attribute value for variable element.", null); //$NON-NLS-1$
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ "Missing expander class attribute value for variable element.", null); //$NON-NLS-1$
}
if (valid)
- variables.put(tag, newVariable(tag, description, element));
+ variables.put(tag, newVariable(tag, description,
+ element));
}
}
}
}
}
-
+
/**
* Creates a new variable from the specified information.
*/
- protected abstract ExternalToolVariable newVariable(String tag, String description, IConfigurationElement element);
+ protected abstract ExternalToolVariable newVariable(String tag,
+ String description, IConfigurationElement element);
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariable.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariable.java
index 4385da3..004cf8c 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariable.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariable.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.registry;
/**********************************************************************
-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 net.sourceforge.phpdt.externaltools.variable.ExpandVariableContext;
import net.sourceforge.phpdt.externaltools.variable.IVariableLocationExpander;
@@ -20,23 +20,26 @@ import org.eclipse.core.runtime.IPath;
*/
public final class PathLocationVariable extends ExternalToolVariable {
private static final DefaultLocationExpander defaultExpander = new DefaultLocationExpander();
-
+
private IVariableLocationExpander expander = null;
/**
* Creates a path location variable
*
- * @param tag the variable tag
- * @param description a short description of what the variable will expand to
- * @param element the configuration element
+ * @param tag
+ * the variable tag
+ * @param description
+ * a short description of what the variable will expand to
+ * @param element
+ * the configuration element
*/
- /*package*/ PathLocationVariable(String tag, String description, IConfigurationElement element) {
+ /* package */PathLocationVariable(String tag, String description,
+ IConfigurationElement element) {
super(tag, description, element);
}
/**
- * Returns the object that can expand the variable
- * into a path location.
+ * Returns the object that can expand the variable into a path location.
*/
public IVariableLocationExpander getExpander() {
if (expander == null) {
@@ -47,16 +50,17 @@ public final class PathLocationVariable extends ExternalToolVariable {
return expander;
}
-
/**
- * Default variable location implementation which does
- * not expand variables, but just returns null
.
- */
- private static final class DefaultLocationExpander implements IVariableLocationExpander {
- /* (non-Javadoc)
- * Method declared on IVariableLocationExpander.
+ * Default variable location implementation which does not expand variables,
+ * but just returns null
.
+ */
+ private static final class DefaultLocationExpander implements
+ IVariableLocationExpander {
+ /*
+ * (non-Javadoc) Method declared on IVariableLocationExpander.
*/
- public IPath getPath(String varTag, String varValue, ExpandVariableContext context) {
+ public IPath getPath(String varTag, String varValue,
+ ExpandVariableContext context) {
return null;
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariableRegistry.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariableRegistry.java
index 1a2fa3e..70fc909 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariableRegistry.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/PathLocationVariableRegistry.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.registry;
/**********************************************************************
-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 org.eclipse.core.runtime.IConfigurationElement;
@@ -24,13 +24,13 @@ public class PathLocationVariableRegistry extends ExternalToolVariableRegistry {
}
/**
- * Returns the path location variable for the given tag
- * or null
if none.
+ * Returns the path location variable for the given tag or null
+ * if none.
*/
public PathLocationVariable getPathLocationVariable(String tag) {
return (PathLocationVariable) findVariable(tag);
}
-
+
/**
* Returns the list of path location variables in the registry.
*/
@@ -39,11 +39,12 @@ public class PathLocationVariableRegistry extends ExternalToolVariableRegistry {
copyVariables(results);
return results;
}
-
- /* (non-Javadoc)
- * Method declared on ExternalToolVariableRegistry.
+
+ /*
+ * (non-Javadoc) Method declared on ExternalToolVariableRegistry.
*/
- protected ExternalToolVariable newVariable(String tag, String description, IConfigurationElement element) {
+ protected ExternalToolVariable newVariable(String tag, String description,
+ IConfigurationElement element) {
return new PathLocationVariable(tag, description, element);
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariable.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariable.java
index ea634ec..14f2866 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariable.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariable.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.registry;
/**********************************************************************
-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 net.sourceforge.phpdt.externaltools.variable.ExpandVariableContext;
import net.sourceforge.phpdt.externaltools.variable.IVariableResourceExpander;
@@ -20,23 +20,26 @@ import org.eclipse.core.runtime.IConfigurationElement;
*/
public final class RefreshScopeVariable extends ExternalToolVariable {
private static final DefaultResourceExpander defaultExpander = new DefaultResourceExpander();
-
+
private IVariableResourceExpander expander = null;
/**
* Creates a refresh scope variable
*
- * @param tag the variable tag
- * @param description a short description of what the variable will expand to
- * @param element the configuration element
+ * @param tag
+ * the variable tag
+ * @param description
+ * a short description of what the variable will expand to
+ * @param element
+ * the configuration element
*/
- /*package*/ RefreshScopeVariable(String tag, String description, IConfigurationElement element) {
+ /* package */RefreshScopeVariable(String tag, String description,
+ IConfigurationElement element) {
super(tag, description, element);
}
/**
- * Returns the object that can expand the variable
- * as resources.
+ * Returns the object that can expand the variable as resources.
*/
public IVariableResourceExpander getExpander() {
if (expander == null) {
@@ -47,16 +50,17 @@ public final class RefreshScopeVariable extends ExternalToolVariable {
return expander;
}
-
/**
- * Default variable resource expander implementation which does
- * not expand variables, but just returns null
.
- */
- private static final class DefaultResourceExpander implements IVariableResourceExpander {
- /* (non-Javadoc)
- * Method declared on IVariableResourceExpander.
+ * Default variable resource expander implementation which does not expand
+ * variables, but just returns null
.
+ */
+ private static final class DefaultResourceExpander implements
+ IVariableResourceExpander {
+ /*
+ * (non-Javadoc) Method declared on IVariableResourceExpander.
*/
- public IResource[] getResources(String varTag, String varValue, ExpandVariableContext context) {
+ public IResource[] getResources(String varTag, String varValue,
+ ExpandVariableContext context) {
return null;
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariableRegistry.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariableRegistry.java
index d0b3d99..5c8f437 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariableRegistry.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/registry/RefreshScopeVariableRegistry.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.internal.registry;
/**********************************************************************
-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 net.sourceforge.phpdt.externaltools.model.IExternalToolConstants;
@@ -26,13 +26,13 @@ public class RefreshScopeVariableRegistry extends ExternalToolVariableRegistry {
}
/**
- * Returns the refresh scope variable for the given tag
- * or null
if none.
+ * Returns the refresh scope variable for the given tag or null
+ * if none.
*/
public RefreshScopeVariable getRefreshVariable(String tag) {
return (RefreshScopeVariable) findVariable(tag);
}
-
+
/**
* Returns the list of refresh scope variables in the registry.
*/
@@ -41,11 +41,12 @@ public class RefreshScopeVariableRegistry extends ExternalToolVariableRegistry {
copyVariables(results);
return results;
}
-
- /* (non-Javadoc)
- * Method declared on ExternalToolVariableRegistry.
+
+ /*
+ * (non-Javadoc) Method declared on ExternalToolVariableRegistry.
*/
- protected ExternalToolVariable newVariable(String tag, String description, IConfigurationElement element) {
+ protected ExternalToolVariable newVariable(String tag, String description,
+ IConfigurationElement element) {
return new RefreshScopeVariable(tag, description, element);
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/ExternalToolsContentProvider.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/ExternalToolsContentProvider.java
index 1227293..5c0083e 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/ExternalToolsContentProvider.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/ExternalToolsContentProvider.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.internal.ui;
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import java.util.ArrayList;
import java.util.Arrays;
@@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.Viewer;
*/
public class ExternalToolsContentProvider implements IStructuredContentProvider {
protected List elements = new ArrayList();
+
protected TableViewer viewer;
public void add(Object o) {
@@ -55,9 +56,9 @@ public class ExternalToolsContentProvider implements IStructuredContentProvider
elements.remove(o);
viewer.remove(o);
}
-
+
public void remove(IStructuredSelection selection) {
- Object[] array= selection.toArray();
+ Object[] array = selection.toArray();
elements.removeAll(Arrays.asList(array));
viewer.remove(array);
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/FileSelectionDialog.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/FileSelectionDialog.java
index 01f95f9..26f7b68 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/FileSelectionDialog.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/FileSelectionDialog.java
@@ -26,185 +26,210 @@ import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
/**
- * Dialog for selecting a file in the workspace. Derived from
+ * Dialog for selecting a file in the workspace. Derived from
* org.eclipse.ui.dialogs.ResourceSelectionDialog
*/
public class FileSelectionDialog extends MessageDialog {
// the root element to populate the viewer with
- private IAdaptable root;
+ private IAdaptable root;
// the visual selection widget group
- private TreeAndListGroup selectionGroup;
+ private TreeAndListGroup selectionGroup;
+
// constants
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 400;
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 300;
+ private final static int SIZING_SELECTION_WIDGET_WIDTH = 400;
+
+ private final static int SIZING_SELECTION_WIDGET_HEIGHT = 300;
+
/**
* The file selected by the user.
*/
- private IFile result= null;
+ private IFile result = null;
+
/**
* String matcher used to filter content
*/
- private StringMatcher stringMatcher= null;
-/**
- * Creates a resource selection dialog rooted at the given element.
- *
- * @param parentShell the parent shell
- * @param rootElement the root element to populate this dialog with
- * @param message the message to be displayed at the top of this dialog, or
- * null
to display a default message
- */
-public FileSelectionDialog(Shell parentShell, IAdaptable rootElement, String message) {
- super(parentShell, "Add Build File", null, message, MessageDialog.NONE, new String[] {"Ok", "Cancel"}, 0);
- root = rootElement;
- setShellStyle(getShellStyle() | SWT.RESIZE);
-}
-/**
- * Limits the files displayed in this dialog to files matching the given
- * pattern. The string can be a filename or a regular expression containing
- * '*' for any series of characters or '?' for any single character.
- *
- * @param pattern a pattern used to filter the displayed files or
- * null
to display all files. If a pattern is supplied, only files
- * whose names match the given pattern will be available for selection.
- * @param ignoreCase if true, case is ignored. If the pattern argument is
- * null
, this argument is ignored.
- */
-public void setFileFilter(String pattern, boolean ignoreCase) {
- if (pattern != null) {
- stringMatcher= new StringMatcher(pattern, ignoreCase, false);
- } else {
- stringMatcher= null;
+ private StringMatcher stringMatcher = null;
+
+ /**
+ * Creates a resource selection dialog rooted at the given element.
+ *
+ * @param parentShell
+ * the parent shell
+ * @param rootElement
+ * the root element to populate this dialog with
+ * @param message
+ * the message to be displayed at the top of this dialog, or
+ * null
to display a default message
+ */
+ public FileSelectionDialog(Shell parentShell, IAdaptable rootElement,
+ String message) {
+ super(parentShell, "Add Build File", null, message, MessageDialog.NONE,
+ new String[] { "Ok", "Cancel" }, 0);
+ root = rootElement;
+ setShellStyle(getShellStyle() | SWT.RESIZE);
}
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- //WorkbenchHelp.setHelp(shell, IHelpContextIds.RESOURCE_SELECTION_DIALOG);
-}
-protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- initializeDialog();
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite) super.createDialogArea(parent);
-
- //create the input element, which has the root resource
- //as its only child
-
- selectionGroup =
- new TreeAndListGroup(
- composite,
- root,
- getResourceProvider(IResource.FOLDER | IResource.PROJECT | IResource.ROOT),
- new WorkbenchLabelProvider(),
- getResourceProvider(IResource.FILE),
- new WorkbenchLabelProvider(),
- SWT.NONE,
- // since this page has no other significantly-sized
- // widgets we need to hardcode the combined widget's
- // size, otherwise it will open too small
- SIZING_SELECTION_WIDGET_WIDTH,
- SIZING_SELECTION_WIDGET_HEIGHT);
-
- composite.addControlListener(new ControlListener() {
- public void controlMoved(ControlEvent e) {};
- public void controlResized(ControlEvent e) {
- //Also try and reset the size of the columns as appropriate
- TableColumn[] columns = selectionGroup.getListTable().getColumns();
- for (int i = 0; i < columns.length; i++) {
- columns[i].pack();
- }
+ /**
+ * Limits the files displayed in this dialog to files matching the given
+ * pattern. The string can be a filename or a regular expression containing
+ * '*' for any series of characters or '?' for any single character.
+ *
+ * @param pattern
+ * a pattern used to filter the displayed files or
+ * null
to display all files. If a pattern is
+ * supplied, only files whose names match the given pattern will
+ * be available for selection.
+ * @param ignoreCase
+ * if true, case is ignored. If the pattern argument is
+ * null
, this argument is ignored.
+ */
+ public void setFileFilter(String pattern, boolean ignoreCase) {
+ if (pattern != null) {
+ stringMatcher = new StringMatcher(pattern, ignoreCase, false);
+ } else {
+ stringMatcher = null;
}
- });
+ }
- return composite;
-}
-/**
- * Returns a content provider for IResource
s that returns
- * only children of the given resource type.
- */
-private ITreeContentProvider getResourceProvider(final int resourceType) {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof IContainer) {
- IResource[] members = null;
- try {
- members = ((IContainer)o).members();
- List accessibleMembers= new ArrayList(members.length);
- for (int i = 0; i < members.length; i++) {
- IResource resource = members[i];
- if (resource.isAccessible()) {
- accessibleMembers.add(resource);
+ /*
+ * (non-Javadoc) Method declared in Window.
+ */
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ // WorkbenchHelp.setHelp(shell,
+ // IHelpContextIds.RESOURCE_SELECTION_DIALOG);
+ }
+
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ initializeDialog();
+ }
+
+ /*
+ * (non-Javadoc) Method declared on Dialog.
+ */
+ protected Control createDialogArea(Composite parent) {
+ // page group
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ // create the input element, which has the root resource
+ // as its only child
+
+ selectionGroup = new TreeAndListGroup(composite, root,
+ getResourceProvider(IResource.FOLDER | IResource.PROJECT
+ | IResource.ROOT), new WorkbenchLabelProvider(),
+ getResourceProvider(IResource.FILE),
+ new WorkbenchLabelProvider(), SWT.NONE,
+ // since this page has no other significantly-sized
+ // widgets we need to hardcode the combined widget's
+ // size, otherwise it will open too small
+ SIZING_SELECTION_WIDGET_WIDTH, SIZING_SELECTION_WIDGET_HEIGHT);
+
+ composite.addControlListener(new ControlListener() {
+ public void controlMoved(ControlEvent e) {
+ };
+
+ public void controlResized(ControlEvent e) {
+ // Also try and reset the size of the columns as appropriate
+ TableColumn[] columns = selectionGroup.getListTable()
+ .getColumns();
+ for (int i = 0; i < columns.length; i++) {
+ columns[i].pack();
+ }
+ }
+ });
+
+ return composite;
+ }
+
+ /**
+ * Returns a content provider for IResource
s that returns
+ * only children of the given resource type.
+ */
+ private ITreeContentProvider getResourceProvider(final int resourceType) {
+ return new WorkbenchContentProvider() {
+ public Object[] getChildren(Object o) {
+ if (o instanceof IContainer) {
+ IResource[] members = null;
+ try {
+ members = ((IContainer) o).members();
+ List accessibleMembers = new ArrayList(members.length);
+ for (int i = 0; i < members.length; i++) {
+ IResource resource = members[i];
+ if (resource.isAccessible()) {
+ accessibleMembers.add(resource);
+ }
}
+ members = (IResource[]) accessibleMembers
+ .toArray(new IResource[accessibleMembers.size()]);
+ } catch (CoreException e) {
+ // just return an empty set of children
+ return new Object[0];
}
- members= (IResource[])accessibleMembers.toArray(new IResource[accessibleMembers.size()]);
- } catch (CoreException e) {
- //just return an empty set of children
- return new Object[0];
- }
- //filter out the desired resource types
- ArrayList results = new ArrayList();
- for (int i = 0; i < members.length; i++) {
- //And the test bits with the resource types to see if they are what we want
- if ((members[i].getType() & resourceType) > 0) {
- if (members[i].getType() == IResource.FILE &&
- stringMatcher != null &&
- !stringMatcher.match(members[i].getName())) {
- continue;
+ // filter out the desired resource types
+ ArrayList results = new ArrayList();
+ for (int i = 0; i < members.length; i++) {
+ // And the test bits with the resource types to see if
+ // they are what we want
+ if ((members[i].getType() & resourceType) > 0) {
+ if (members[i].getType() == IResource.FILE
+ && stringMatcher != null
+ && !stringMatcher.match(members[i]
+ .getName())) {
+ continue;
+ }
+ results.add(members[i]);
}
- results.add(members[i]);
}
+ return results.toArray();
+ } else {
+ return new Object[0];
}
- return results.toArray();
- } else {
- return new Object[0];
}
- }
- };
-}
-/**
- * Initializes this dialog's controls.
- */
-private void initializeDialog() {
- selectionGroup.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- getOkButton().setEnabled(!selectionGroup.getListTableSelection().isEmpty());
- }
- });
+ };
+ }
- getOkButton().setEnabled(false);
-}
+ /**
+ * Initializes this dialog's controls.
+ */
+ private void initializeDialog() {
+ selectionGroup
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ getOkButton().setEnabled(
+ !selectionGroup.getListTableSelection()
+ .isEmpty());
+ }
+ });
-/**
- * Returns this dialog's OK button.
- */
-protected Button getOkButton() {
- return getButton(0);
-}
-/**
- * Returns the file the user chose or null
if none.
- */
-public IFile getResult() {
- return result;
-}
+ getOkButton().setEnabled(false);
+ }
+
+ /**
+ * Returns this dialog's OK button.
+ */
+ protected Button getOkButton() {
+ return getButton(0);
+ }
-protected void buttonPressed(int buttonId) {
- if (buttonId == 0) {
- Object resource= selectionGroup.getListTableSelection().getFirstElement();
- if (resource instanceof IFile) {
- result = (IFile) resource;
+ /**
+ * Returns the file the user chose or null
if none.
+ */
+ public IFile getResult() {
+ return result;
+ }
+
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == 0) {
+ Object resource = selectionGroup.getListTableSelection()
+ .getFirstElement();
+ if (resource instanceof IFile) {
+ result = (IFile) resource;
+ }
}
+ super.buttonPressed(buttonId);
}
- super.buttonPressed(buttonId);
-}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/IExternalToolsUIConstants.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/IExternalToolsUIConstants.java
index 10b049e..225c688 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/IExternalToolsUIConstants.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/IExternalToolsUIConstants.java
@@ -1,39 +1,70 @@
package net.sourceforge.phpdt.externaltools.internal.ui;
/**********************************************************************
-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
-**********************************************************************/
+ 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
+ **********************************************************************/
import net.sourceforge.phpdt.externaltools.model.IExternalToolConstants;
-
public interface IExternalToolsUIConstants {
-
+
// Action images
- public static final String IMG_REMOVE= IExternalToolConstants.PLUGIN_ID + ".remove"; //$NON-NLS-1$
- public static final String IMG_MOVE_UP = IExternalToolConstants.PLUGIN_ID + ".moveUp"; //$NON-NLS-1$
- public static final String IMG_MOVE_DOWN = IExternalToolConstants.PLUGIN_ID + ".moveDown"; //$NON-NLS-1$
- public static final String IMG_ACTIVATE = IExternalToolConstants.PLUGIN_ID + ".activate"; //$NON-NLS-1$
- public static final String IMG_DEACTIVATE = IExternalToolConstants.PLUGIN_ID + ".deactivate"; //$NON-NLS-1$
- public static final String IMG_REMOVE_ALL= IExternalToolConstants.PLUGIN_ID + ".removeAll"; //$NON-NLS-1$
- public static final String IMG_ADD= IExternalToolConstants.PLUGIN_ID + ".add"; //$NON-NLS-1$
- public static final String IMG_RUN= IExternalToolConstants.PLUGIN_ID + ".run"; //$NON-NLS-1$
- public static final String IMG_SEARCH= IExternalToolConstants.PLUGIN_ID + ".search"; //$NON-NLS-1$
- public static final String IMG_GO_TO_FILE= IExternalToolConstants.PLUGIN_ID + ".goToFile"; //$NON-NLS-1$
-
+ public static final String IMG_REMOVE = IExternalToolConstants.PLUGIN_ID
+ + ".remove"; //$NON-NLS-1$
+
+ public static final String IMG_MOVE_UP = IExternalToolConstants.PLUGIN_ID
+ + ".moveUp"; //$NON-NLS-1$
+
+ public static final String IMG_MOVE_DOWN = IExternalToolConstants.PLUGIN_ID
+ + ".moveDown"; //$NON-NLS-1$
+
+ public static final String IMG_ACTIVATE = IExternalToolConstants.PLUGIN_ID
+ + ".activate"; //$NON-NLS-1$
+
+ public static final String IMG_DEACTIVATE = IExternalToolConstants.PLUGIN_ID
+ + ".deactivate"; //$NON-NLS-1$
+
+ public static final String IMG_REMOVE_ALL = IExternalToolConstants.PLUGIN_ID
+ + ".removeAll"; //$NON-NLS-1$
+
+ public static final String IMG_ADD = IExternalToolConstants.PLUGIN_ID
+ + ".add"; //$NON-NLS-1$
+
+ public static final String IMG_RUN = IExternalToolConstants.PLUGIN_ID
+ + ".run"; //$NON-NLS-1$
+
+ public static final String IMG_SEARCH = IExternalToolConstants.PLUGIN_ID
+ + ".search"; //$NON-NLS-1$
+
+ public static final String IMG_GO_TO_FILE = IExternalToolConstants.PLUGIN_ID
+ + ".goToFile"; //$NON-NLS-1$
+
// Label images
-// public static final String IMG_ANT_PROJECT= IExternalToolConstants.PLUGIN_ID + ".antProject"; //$NON-NLS-1$
-// public static final String IMG_ANT_PROJECT_ERROR = IExternalToolConstants.PLUGIN_ID + ".antProjectError"; //$NON-NLS-1$
-// public static final String IMG_ANT_TARGET= IExternalToolConstants.PLUGIN_ID + ".antTarget"; //$NON-NLS-1$
-// public static final String IMG_ANT_TARGET_ERROR = IExternalToolConstants.PLUGIN_ID + ".antTargetError"; //$NON-NLS-1$
-// public static final String IMG_ANT_TARGET_ELEMENTS= IExternalToolConstants.PLUGIN_ID + ".antTargetElements"; //$NON-NLS-1$
-// public static final String IMG_ANT_TARGET_ELEMENT= IExternalToolConstants.PLUGIN_ID + ".antTargetElement"; //$NON-NLS-1$
-
- public static final String DIALOGSTORE_LASTEXTJAR= IExternalToolConstants.PLUGIN_ID + ".lastextjar"; //$NON-NLS-1$
- public static final String DIALOGSTORE_LASTEXTFILE= IExternalToolConstants.PLUGIN_ID + ".lastextfile"; //$NON-NLS-1$
- public static final String DIALOGSTORE_LASTFOLDER= IExternalToolConstants.PLUGIN_ID + ".lastfolder"; //$NON-NLS-1$
- public static final String DIALOGSTORE_LASTANTHOME= IExternalToolConstants.PLUGIN_ID + ".lastanthome"; //$NON-NLS-1$
+ // public static final String IMG_ANT_PROJECT=
+ // IExternalToolConstants.PLUGIN_ID + ".antProject"; //$NON-NLS-1$
+ // public static final String IMG_ANT_PROJECT_ERROR =
+ // IExternalToolConstants.PLUGIN_ID + ".antProjectError"; //$NON-NLS-1$
+ // public static final String IMG_ANT_TARGET=
+ // IExternalToolConstants.PLUGIN_ID + ".antTarget"; //$NON-NLS-1$
+ // public static final String IMG_ANT_TARGET_ERROR =
+ // IExternalToolConstants.PLUGIN_ID + ".antTargetError"; //$NON-NLS-1$
+ // public static final String IMG_ANT_TARGET_ELEMENTS=
+ // IExternalToolConstants.PLUGIN_ID + ".antTargetElements"; //$NON-NLS-1$
+ // public static final String IMG_ANT_TARGET_ELEMENT=
+ // IExternalToolConstants.PLUGIN_ID + ".antTargetElement"; //$NON-NLS-1$
+
+ public static final String DIALOGSTORE_LASTEXTJAR = IExternalToolConstants.PLUGIN_ID
+ + ".lastextjar"; //$NON-NLS-1$
+
+ public static final String DIALOGSTORE_LASTEXTFILE = IExternalToolConstants.PLUGIN_ID
+ + ".lastextfile"; //$NON-NLS-1$
+
+ public static final String DIALOGSTORE_LASTFOLDER = IExternalToolConstants.PLUGIN_ID
+ + ".lastfolder"; //$NON-NLS-1$
+
+ public static final String DIALOGSTORE_LASTANTHOME = IExternalToolConstants.PLUGIN_ID
+ + ".lastanthome"; //$NON-NLS-1$
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/MessageDialogWithToggle.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/MessageDialogWithToggle.java
index 959db60..1e3e84f 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/MessageDialogWithToggle.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/MessageDialogWithToggle.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.internal.ui;
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -25,29 +25,36 @@ import org.eclipse.swt.widgets.Shell;
* should be shown in the future
*/
public class MessageDialogWithToggle extends MessageDialog {
-
+
/**
- * The preference key which is set by the toggle button.
- * This key must be a boolean preference in the preference store.
+ * The preference key which is set by the toggle button. This key must be a
+ * boolean preference in the preference store.
*/
private String fPreferenceKey = null;
+
/**
* The message displayed to the user, with the toggle button
*/
private String fToggleMessage = null;
+
private Button fToggleButton = null;
+
/**
* The preference store which will be affected by the toggle button
*/
IPreferenceStore fStore = null;
- public MessageDialogWithToggle(Shell parentShell, String dialogTitle, Image image, String message, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, String preferenceKey, String toggleMessage, IPreferenceStore store) {
- super(parentShell, dialogTitle, image, message, dialogImageType, dialogButtonLabels, defaultIndex);
+ public MessageDialogWithToggle(Shell parentShell, String dialogTitle,
+ Image image, String message, int dialogImageType,
+ String[] dialogButtonLabels, int defaultIndex,
+ String preferenceKey, String toggleMessage, IPreferenceStore store) {
+ super(parentShell, dialogTitle, image, message, dialogImageType,
+ dialogButtonLabels, defaultIndex);
fStore = store;
fPreferenceKey = preferenceKey;
fToggleMessage = toggleMessage;
}
-
+
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
fToggleButton = createCheckButton(dialogArea, fToggleMessage);
@@ -56,16 +63,16 @@ public class MessageDialogWithToggle extends MessageDialog {
}
/**
- * Creates a button with the given label and sets the default
- * configuration data.
+ * Creates a button with the given label and sets the default configuration
+ * data.
*/
protected Button createCheckButton(Composite parent, String label) {
- Button button= new Button(parent, SWT.CHECK | SWT.LEFT);
+ Button button = new Button(parent, SWT.CHECK | SWT.LEFT);
button.setText(label);
GridData data = new GridData(SWT.NONE);
- data.horizontalSpan= 2;
- data.horizontalAlignment= GridData.CENTER;
+ data.horizontalSpan = 2;
+ data.horizontalAlignment = GridData.CENTER;
button.setLayoutData(data);
button.setFont(parent.getFont());
@@ -78,7 +85,7 @@ public class MessageDialogWithToggle extends MessageDialog {
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
protected void buttonPressed(int id) {
- if (id == IDialogConstants.OK_ID) { // was the OK button pressed?
+ if (id == IDialogConstants.OK_ID) { // was the OK button pressed?
storePreference();
}
super.buttonPressed(id);
@@ -99,110 +106,116 @@ public class MessageDialogWithToggle extends MessageDialog {
protected Button getToggleButton() {
return fToggleButton;
}
-
+
/**
* Convenience method to open a simple confirm (OK/Cancel) dialog.
- *
- * @param parent the parent shell of the dialog, or null
if none
- * @param title the dialog's title, or null
if none
- * @param message the message
+ *
+ * @param parent
+ * the parent shell of the dialog, or null
if none
+ * @param title
+ * the dialog's title, or null
if none
+ * @param message
+ * the message
* @return true
if the user presses the OK button,
- * false
otherwise
+ * false
otherwise
*/
- public static boolean openConfirm(Shell parent, String title, String message, String preferenceKey, String toggleMessage, IPreferenceStore store) {
- MessageDialogWithToggle dialog = new MessageDialogWithToggle(
- parent,
- title,
- null, // accept the default window icon
- message,
- QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0, // OK is the default
- preferenceKey,
- toggleMessage,
- store);
+ public static boolean openConfirm(Shell parent, String title,
+ String message, String preferenceKey, String toggleMessage,
+ IPreferenceStore store) {
+ MessageDialogWithToggle dialog = new MessageDialogWithToggle(parent,
+ title, null, // accept the default window icon
+ message, QUESTION, new String[] { IDialogConstants.OK_LABEL,
+ IDialogConstants.CANCEL_LABEL }, 0, // OK is the default
+ preferenceKey, toggleMessage, store);
return dialog.open() == 0;
}
+
/**
* Convenience method to open a standard error dialog.
- *
- * @param parent the parent shell of the dialog, or null
if none
- * @param title the dialog's title, or null
if none
- * @param message the message
+ *
+ * @param parent
+ * the parent shell of the dialog, or null
if none
+ * @param title
+ * the dialog's title, or null
if none
+ * @param message
+ * the message
*/
- public static void openError(Shell parent, String title, String message, String preferenceKey, String toggleMessage, IPreferenceStore store) {
- MessageDialogWithToggle dialog = new MessageDialogWithToggle(
- parent,
- title,
- null, // accept the default window icon
- message,
- ERROR,
- new String[] {IDialogConstants.OK_LABEL},
- 0, // ok is the default
- preferenceKey,
- toggleMessage,
- store);
+ public static void openError(Shell parent, String title, String message,
+ String preferenceKey, String toggleMessage, IPreferenceStore store) {
+ MessageDialogWithToggle dialog = new MessageDialogWithToggle(parent,
+ title, null, // accept the default window icon
+ message, ERROR, new String[] { IDialogConstants.OK_LABEL }, 0, // ok
+ // is
+ // the
+ // default
+ preferenceKey, toggleMessage, store);
dialog.open();
}
+
/**
* Convenience method to open a standard information dialog.
- *
- * @param parent the parent shell of the dialog, or null
if none
- * @param title the dialog's title, or null
if none
- * @param message the message
+ *
+ * @param parent
+ * the parent shell of the dialog, or null
if none
+ * @param title
+ * the dialog's title, or null
if none
+ * @param message
+ * the message
*/
- public static void openInformation(
- Shell parent,
- String title,
- String message, String preferenceKey, String toggleMessage, IPreferenceStore store) {
- MessageDialogWithToggle dialog =
- new MessageDialogWithToggle(parent, title, null, // accept the default window icon
- message, INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0, // ok is the default
- preferenceKey, toggleMessage, store);
+ public static void openInformation(Shell parent, String title,
+ String message, String preferenceKey, String toggleMessage,
+ IPreferenceStore store) {
+ MessageDialogWithToggle dialog = new MessageDialogWithToggle(parent,
+ title,
+ null, // accept the default window icon
+ message, INFORMATION,
+ new String[] { IDialogConstants.OK_LABEL }, 0, // ok is the
+ // default
+ preferenceKey, toggleMessage, store);
dialog.open();
}
+
/**
* Convenience method to open a simple Yes/No question dialog.
- *
- * @param parent the parent shell of the dialog, or null
if none
- * @param title the dialog's title, or null
if none
- * @param message the message
+ *
+ * @param parent
+ * the parent shell of the dialog, or null
if none
+ * @param title
+ * the dialog's title, or null
if none
+ * @param message
+ * the message
* @return true
if the user presses the OK button,
- * false
otherwise
+ * false
otherwise
*/
- public static boolean openQuestion(Shell parent, String title, String message, String preferenceKey, String toggleMessage, IPreferenceStore store) {
- MessageDialogWithToggle dialog = new MessageDialogWithToggle(
- parent,
- title,
- null, // accept the default window icon
- message,
- QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0, // yes is the default
- preferenceKey,
- toggleMessage,
- store);
+ public static boolean openQuestion(Shell parent, String title,
+ String message, String preferenceKey, String toggleMessage,
+ IPreferenceStore store) {
+ MessageDialogWithToggle dialog = new MessageDialogWithToggle(parent,
+ title, null, // accept the default window icon
+ message, QUESTION, new String[] { IDialogConstants.YES_LABEL,
+ IDialogConstants.NO_LABEL }, 0, // yes is the default
+ preferenceKey, toggleMessage, store);
return dialog.open() == 0;
}
+
/**
* Convenience method to open a standard warning dialog.
- *
- * @param parent the parent shell of the dialog, or null
if none
- * @param title the dialog's title, or null
if none
- * @param message the message
+ *
+ * @param parent
+ * the parent shell of the dialog, or null
if none
+ * @param title
+ * the dialog's title, or null
if none
+ * @param message
+ * the message
*/
- public static void openWarning(Shell parent, String title, String message, String preferenceKey, String toggleMessage, IPreferenceStore store) {
- MessageDialogWithToggle dialog = new MessageDialogWithToggle(
- parent,
- title,
- null, // accept the default window icon
- message,
- WARNING,
- new String[] {IDialogConstants.OK_LABEL},
- 0, // ok is the default
- preferenceKey,
- toggleMessage,
- store);
+ public static void openWarning(Shell parent, String title, String message,
+ String preferenceKey, String toggleMessage, IPreferenceStore store) {
+ MessageDialogWithToggle dialog = new MessageDialogWithToggle(parent,
+ title,
+ null, // accept the default window icon
+ message, WARNING, new String[] { IDialogConstants.OK_LABEL },
+ 0, // ok is the default
+ preferenceKey, toggleMessage, store);
dialog.open();
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/MessageLine.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/MessageLine.java
index b724f3b..12189a1 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/MessageLine.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/MessageLine.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.internal.ui;
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.SWT;
@@ -25,6 +25,7 @@ public class MessageLine extends CLabel {
private static final RGB ERROR_BACKGROUND_RGB = new RGB(230, 226, 221);
private Color fNormalMsgAreaBackground;
+
private Color fErrorMsgAreaBackground;
/**
@@ -35,40 +36,44 @@ public class MessageLine extends CLabel {
}
/**
- * Creates a new message line as a child of the parent and with the given SWT stylebits.
+ * Creates a new message line as a child of the parent and with the given
+ * SWT stylebits.
*/
public MessageLine(Composite parent, int style) {
super(parent, style);
- fNormalMsgAreaBackground= getBackground();
- fErrorMsgAreaBackground= null;
+ fNormalMsgAreaBackground = getBackground();
+ fErrorMsgAreaBackground = null;
}
-
private Image findImage(IStatus status) {
if (status.isOK()) {
return null;
} else if (status.matches(IStatus.ERROR)) {
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ return PlatformUI.getWorkbench().getSharedImages().getImage(
+ ISharedImages.IMG_OBJS_ERROR_TSK);
} else if (status.matches(IStatus.WARNING)) {
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+ return PlatformUI.getWorkbench().getSharedImages().getImage(
+ ISharedImages.IMG_OBJS_WARN_TSK);
} else if (status.matches(IStatus.INFO)) {
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
+ return PlatformUI.getWorkbench().getSharedImages().getImage(
+ ISharedImages.IMG_OBJS_INFO_TSK);
}
return null;
}
/**
- * Sets the message and image to the given status.
- * null
is a valid argument and will set the empty text and no image
+ * Sets the message and image to the given status. null
is a
+ * valid argument and will set the empty text and no image
*/
public void setErrorStatus(IStatus status) {
if (status != null) {
- String message= status.getMessage();
+ String message = status.getMessage();
if (message != null && message.length() > 0) {
setText(message);
setImage(findImage(status));
if (fErrorMsgAreaBackground == null) {
- fErrorMsgAreaBackground= new Color(getDisplay(), ERROR_BACKGROUND_RGB);
+ fErrorMsgAreaBackground = new Color(getDisplay(),
+ ERROR_BACKGROUND_RGB);
}
setBackground(fErrorMsgAreaBackground);
return;
@@ -85,7 +90,7 @@ public class MessageLine extends CLabel {
public void dispose() {
if (fErrorMsgAreaBackground != null) {
fErrorMsgAreaBackground.dispose();
- fErrorMsgAreaBackground= null;
+ fErrorMsgAreaBackground = null;
}
super.dispose();
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusDialog.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusDialog.java
index 5b19da3..b809c79 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusDialog.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusDialog.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.internal.ui;
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
@@ -21,16 +21,20 @@ import org.eclipse.swt.widgets.Shell;
/**
* An abstract base class for dialogs with a status bar and ok/cancel buttons.
- * The status message must be passed over as StatusInfo object and can be
- * an error, warning or ok. The OK button is enabled or disabled depending
- * on the status.
+ * The status message must be passed over as StatusInfo object and can be an
+ * error, warning or ok. The OK button is enabled or disabled depending on the
+ * status.
*/
public abstract class StatusDialog extends Dialog {
private Button fOkButton;
+
private MessageLine fStatusLine;
+
private IStatus fLastStatus;
+
private String fTitle;
+
private Image fImage;
private boolean fStatusLineAboveButtons;
@@ -40,27 +44,28 @@ public abstract class StatusDialog extends Dialog {
*/
public StatusDialog(Shell parent) {
super(parent);
- fStatusLineAboveButtons= false;
- fLastStatus= new StatusInfo();
+ fStatusLineAboveButtons = false;
+ fLastStatus = new StatusInfo();
}
/**
- * Specifies whether status line appears to the left of the buttons (default)
- * or above them.
- *
- * @param aboveButtons if true
status line is placed above buttons; if
- * false
to the right
+ * Specifies whether status line appears to the left of the buttons
+ * (default) or above them.
+ *
+ * @param aboveButtons
+ * if true
status line is placed above buttons; if
+ * false
to the right
*/
public void setStatusLineAboveButtons(boolean aboveButtons) {
- fStatusLineAboveButtons= aboveButtons;
+ fStatusLineAboveButtons = aboveButtons;
}
/**
- * Update the dialog's status line to reflect the given status.
- * It is save to call this method before the dialog has been opened.
+ * Update the dialog's status line to reflect the given status. It is save
+ * to call this method before the dialog has been opened.
*/
protected void updateStatus(IStatus status) {
- fLastStatus= status;
+ fLastStatus = status;
if (fStatusLine != null && !fStatusLine.isDisposed()) {
updateButtonsEnableState(status);
fStatusLine.setErrorStatus(status);
@@ -77,7 +82,9 @@ public abstract class StatusDialog extends Dialog {
/**
* Updates the status of the ok button to reflect the given status.
* Subclasses may override this method to update additional buttons.
- * @param status the status.
+ *
+ * @param status
+ * the status.
*/
protected void updateButtonsEnableState(IStatus status) {
if (fOkButton != null && !fOkButton.isDisposed())
@@ -101,9 +108,9 @@ public abstract class StatusDialog extends Dialog {
if (fLastStatus != null) {
// policy: dialogs are not allowed to come up with an error message
if (fLastStatus.matches(IStatus.ERROR)) {
- StatusInfo status= new StatusInfo();
+ StatusInfo status = new StatusInfo();
status.setError(""); //$NON-NLS-1$
- fLastStatus= status;
+ fLastStatus = status;
}
updateStatus(fLastStatus);
}
@@ -113,23 +120,25 @@ public abstract class StatusDialog extends Dialog {
* @see Dialog#createButtonsForButtonBar(Composite)
*/
protected void createButtonsForButtonBar(Composite parent) {
- fOkButton= createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ fOkButton = createButton(parent, IDialogConstants.OK_ID,
+ IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID,
+ IDialogConstants.CANCEL_LABEL, false);
}
/*
* @see Dialog#createButtonBar(Composite)
*/
protected Control createButtonBar(Composite parent) {
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns= 1;
- layout.marginHeight= 0;
- layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 0;
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fStatusLine= new MessageLine(composite);
+ fStatusLine = new MessageLine(composite);
fStatusLine.setAlignment(SWT.LEFT);
fStatusLine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fStatusLine.setErrorStatus(null); //$NON-NLS-1$
@@ -140,22 +149,26 @@ public abstract class StatusDialog extends Dialog {
/**
* Sets the title for this dialog.
- * @param title the title.
+ *
+ * @param title
+ * the title.
*/
public void setTitle(String title) {
- fTitle= title != null ? title : ""; //$NON-NLS-1$
- Shell shell= getShell();
+ fTitle = title != null ? title : ""; //$NON-NLS-1$
+ Shell shell = getShell();
if ((shell != null) && !shell.isDisposed())
shell.setText(fTitle);
}
/**
* Sets the image for this dialog.
- * @param image the image.
+ *
+ * @param image
+ * the image.
*/
public void setImage(Image image) {
- fImage= image;
- Shell shell= getShell();
+ fImage = image;
+ Shell shell = getShell();
if ((shell != null) && !shell.isDisposed())
shell.setImage(fImage);
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusInfo.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusInfo.java
index 418cef8..a06bce9 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusInfo.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusInfo.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.internal.ui;
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import net.sourceforge.phpdt.externaltools.model.IExternalToolConstants;
@@ -13,13 +13,13 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.util.Assert;
/**
- * A settable IStatus.
- * Can be an error, warning, info or ok. For error, info and warning states,
- * a message describes the problem.
+ * A settable IStatus. Can be an error, warning, info or ok. For error, info and
+ * warning states, a message describes the problem.
*/
public class StatusInfo implements IStatus {
private String fStatusMessage;
+
private int fSeverity;
/**
@@ -31,38 +31,41 @@ public class StatusInfo implements IStatus {
/**
* Creates a status .
- * @param severity The status severity: ERROR, WARNING, INFO and OK.
- * @param message The message of the status. Applies only for ERROR,
- * WARNING and INFO.
+ *
+ * @param severity
+ * The status severity: ERROR, WARNING, INFO and OK.
+ * @param message
+ * The message of the status. Applies only for ERROR, WARNING and
+ * INFO.
*/
public StatusInfo(int severity, String message) {
- fStatusMessage= message;
- fSeverity= severity;
+ fStatusMessage = message;
+ fSeverity = severity;
}
/**
- * Returns if the status' severity is OK.
+ * Returns if the status' severity is OK.
*/
public boolean isOK() {
return fSeverity == IStatus.OK;
}
/**
- * Returns if the status' severity is WARNING.
+ * Returns if the status' severity is WARNING.
*/
public boolean isWarning() {
return fSeverity == IStatus.WARNING;
}
/**
- * Returns if the status' severity is INFO.
+ * Returns if the status' severity is INFO.
*/
public boolean isInfo() {
return fSeverity == IStatus.INFO;
}
/**
- * Returns if the status' severity is ERROR.
+ * Returns if the status' severity is ERROR.
*/
public boolean isError() {
return fSeverity == IStatus.ERROR;
@@ -77,40 +80,46 @@ public class StatusInfo implements IStatus {
/**
* Sets the status to ERROR.
- * @param The error message (can be empty, but not null)
+ *
+ * @param The
+ * error message (can be empty, but not null)
*/
public void setError(String errorMessage) {
Assert.isNotNull(errorMessage);
- fStatusMessage= errorMessage;
- fSeverity= IStatus.ERROR;
+ fStatusMessage = errorMessage;
+ fSeverity = IStatus.ERROR;
}
/**
* Sets the status to WARNING.
- * @param The warning message (can be empty, but not null)
+ *
+ * @param The
+ * warning message (can be empty, but not null)
*/
public void setWarning(String warningMessage) {
Assert.isNotNull(warningMessage);
- fStatusMessage= warningMessage;
- fSeverity= IStatus.WARNING;
+ fStatusMessage = warningMessage;
+ fSeverity = IStatus.WARNING;
}
/**
* Sets the status to INFO.
- * @param The info message (can be empty, but not null)
+ *
+ * @param The
+ * info message (can be empty, but not null)
*/
public void setInfo(String infoMessage) {
Assert.isNotNull(infoMessage);
- fStatusMessage= infoMessage;
- fSeverity= IStatus.INFO;
+ fStatusMessage = infoMessage;
+ fSeverity = IStatus.INFO;
}
/**
* Sets the status to OK.
*/
public void setOK() {
- fStatusMessage= null;
- fSeverity= IStatus.OK;
+ fStatusMessage = null;
+ fSeverity = IStatus.OK;
}
/*
@@ -122,6 +131,7 @@ public class StatusInfo implements IStatus {
/**
* Returns always false
.
+ *
* @see IStatus#isMultiStatus()
*/
public boolean isMultiStatus() {
@@ -144,6 +154,7 @@ public class StatusInfo implements IStatus {
/**
* Returns always null
.
+ *
* @see IStatus#getException()
*/
public Throwable getException() {
@@ -152,6 +163,7 @@ public class StatusInfo implements IStatus {
/**
* Returns always the error severity.
+ *
* @see IStatus#getCode()
*/
public int getCode() {
@@ -160,6 +172,7 @@ public class StatusInfo implements IStatus {
/**
* Returns always null
.
+ *
* @see IStatus#getChildren()
*/
public IStatus[] getChildren() {
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/TreeAndListGroup.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/TreeAndListGroup.java
index 9da2dea..1255b2f 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/TreeAndListGroup.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/TreeAndListGroup.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.internal.ui;
/**********************************************************************
-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
-**********************************************************************/
+ 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
+ **********************************************************************/
import java.util.Collection;
import java.util.HashSet;
@@ -30,39 +30,59 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Tree;
/**
- * This class was derived from org.eclipse.ui.internal.misc.CheckboxTreeAndListGroup
- *
+ * This class was derived from
+ * org.eclipse.ui.internal.misc.CheckboxTreeAndListGroup
+ *
*/
public class TreeAndListGroup implements ISelectionChangedListener {
private Object root;
+
private Object currentTreeSelection;
+
private Collection listeners = new HashSet();
private ITreeContentProvider treeContentProvider;
+
private IStructuredContentProvider listContentProvider;
+
private ILabelProvider treeLabelProvider;
+
private ILabelProvider listLabelProvider;
// widgets
private TreeViewer treeViewer;
+
private TableViewer listViewer;
- private boolean allowMultiselection= false;
+
+ private boolean allowMultiselection = false;
/**
- * Create an instance of this class. Use this constructor if you wish to specify
- * the width and/or height of the combined widget (to only hardcode one of the
- * sizing dimensions, specify the other dimension's value as -1)
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param style int
- * @param rootObject java.lang.Object
- * @param childPropertyName java.lang.String
- * @param parentPropertyName java.lang.String
- * @param listPropertyName java.lang.String
- * @param width int
- * @param height int
+ * Create an instance of this class. Use this constructor if you wish to
+ * specify the width and/or height of the combined widget (to only hardcode
+ * one of the sizing dimensions, specify the other dimension's value as -1)
+ *
+ * @param parent
+ * org.eclipse.swt.widgets.Composite
+ * @param style
+ * int
+ * @param rootObject
+ * java.lang.Object
+ * @param childPropertyName
+ * java.lang.String
+ * @param parentPropertyName
+ * java.lang.String
+ * @param listPropertyName
+ * java.lang.String
+ * @param width
+ * int
+ * @param height
+ * int
*/
- public TreeAndListGroup(Composite parent, Object rootObject, ITreeContentProvider treeContentProvider, ILabelProvider treeLabelProvider, IStructuredContentProvider listContentProvider, ILabelProvider listLabelProvider, int style, int width, int height) {
+ public TreeAndListGroup(Composite parent, Object rootObject,
+ ITreeContentProvider treeContentProvider,
+ ILabelProvider treeLabelProvider,
+ IStructuredContentProvider listContentProvider,
+ ILabelProvider listLabelProvider, int style, int width, int height) {
root = rootObject;
this.treeContentProvider = treeContentProvider;
@@ -71,13 +91,14 @@ public class TreeAndListGroup implements ISelectionChangedListener {
this.listLabelProvider = listLabelProvider;
createContents(parent, width, height, style);
}
+
/**
* This method must be called just before this window becomes visible.
*/
public void aboutToOpen() {
currentTreeSelection = null;
- //select the first element in the list
+ // select the first element in the list
Object[] elements = treeContentProvider.getElements(root);
Object primary = elements.length > 0 ? elements[0] : null;
if (primary != null) {
@@ -85,35 +106,42 @@ public class TreeAndListGroup implements ISelectionChangedListener {
}
treeViewer.getControl().setFocus();
}
+
/**
- * Add the passed listener to collection of clients
- * that listen for changes to list viewer selection state
- *
- * @param listener ISelectionChangedListener
+ * Add the passed listener to collection of clients that listen for changes
+ * to list viewer selection state
+ *
+ * @param listener
+ * ISelectionChangedListener
*/
public void addSelectionChangedListener(ISelectionChangedListener listener) {
listeners.add(listener);
}
/**
- * Notify all checked state listeners that the passed element
- *has had its checked state changed to the passed state
- */
+ * Notify all checked state listeners that the passed element has had its
+ * checked state changed to the passed state
+ */
protected void notifySelectionListeners(SelectionChangedEvent event) {
Iterator listenersEnum = listeners.iterator();
while (listenersEnum.hasNext()) {
- ((ISelectionChangedListener) listenersEnum.next()).selectionChanged(event);
+ ((ISelectionChangedListener) listenersEnum.next())
+ .selectionChanged(event);
}
}
/**
- * Lay out and initialize self's visual components.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param width int
- * @param height int
+ * Lay out and initialize self's visual components.
+ *
+ * @param parent
+ * org.eclipse.swt.widgets.Composite
+ * @param width
+ * int
+ * @param height
+ * int
*/
- protected void createContents(Composite parent, int width, int height, int style) {
+ protected void createContents(Composite parent, int width, int height,
+ int style) {
// group pane
Composite composite = new Composite(parent, style);
composite.setFont(parent.getFont());
@@ -130,15 +158,16 @@ public class TreeAndListGroup implements ISelectionChangedListener {
initialize();
}
+
/**
- * Create this group's list viewer.
+ * Create this group's list viewer.
*/
protected void createListViewer(Composite parent, int width, int height) {
int style;
if (allowMultiselection) {
- style= SWT.MULTI;
+ style = SWT.MULTI;
} else {
- style= SWT.SINGLE;
+ style = SWT.SINGLE;
}
listViewer = new TableViewer(parent, SWT.BORDER | style);
GridData data = new GridData(GridData.FILL_BOTH);
@@ -154,8 +183,9 @@ public class TreeAndListGroup implements ISelectionChangedListener {
}
});
}
+
/**
- * Create this group's tree viewer.
+ * Create this group's tree viewer.
*/
protected void createTreeViewer(Composite parent, int width, int height) {
Tree tree = new Tree(parent, SWT.BORDER);
@@ -170,31 +200,31 @@ public class TreeAndListGroup implements ISelectionChangedListener {
treeViewer.setLabelProvider(treeLabelProvider);
treeViewer.addSelectionChangedListener(this);
}
-
+
public Table getListTable() {
return listViewer.getTable();
}
-
+
public IStructuredSelection getListTableSelection() {
- ISelection selection= this.listViewer.getSelection();
+ ISelection selection = this.listViewer.getSelection();
if (selection instanceof IStructuredSelection) {
- return (IStructuredSelection)selection;
+ return (IStructuredSelection) selection;
} else {
return StructuredSelection.EMPTY;
}
}
-
+
protected void initialListItem(Object element) {
Object parent = treeContentProvider.getParent(element);
selectAndRevealFolder(parent);
}
-
+
public void selectAndRevealFolder(Object treeElement) {
treeViewer.reveal(treeElement);
IStructuredSelection selection = new StructuredSelection(treeElement);
treeViewer.setSelection(selection);
}
-
+
public void selectAndRevealFile(Object treeElement) {
listViewer.reveal(treeElement);
IStructuredSelection selection = new StructuredSelection(treeElement);
@@ -202,19 +232,21 @@ public class TreeAndListGroup implements ISelectionChangedListener {
}
/**
- * Initialize this group's viewers after they have been laid out.
+ * Initialize this group's viewers after they have been laid out.
*/
protected void initialize() {
treeViewer.setInput(root);
}
/**
- * Handle the selection of an item in the tree viewer
- *
- * @param selection ISelection
+ * Handle the selection of an item in the tree viewer
+ *
+ * @param selection
+ * ISelection
*/
public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ IStructuredSelection selection = (IStructuredSelection) event
+ .getSelection();
Object selectedElement = selection.getFirstElement();
if (selectedElement == null) {
currentTreeSelection = null;
@@ -229,25 +261,32 @@ public class TreeAndListGroup implements ISelectionChangedListener {
currentTreeSelection = selectedElement;
}
+
/**
- * Set the list viewer's providers to those passed
- *
- * @param contentProvider ITreeContentProvider
- * @param labelProvider ILabelProvider
+ * Set the list viewer's providers to those passed
+ *
+ * @param contentProvider
+ * ITreeContentProvider
+ * @param labelProvider
+ * ILabelProvider
*/
- public void setListProviders(IStructuredContentProvider contentProvider, ILabelProvider labelProvider) {
+ public void setListProviders(IStructuredContentProvider contentProvider,
+ ILabelProvider labelProvider) {
listViewer.setContentProvider(contentProvider);
listViewer.setLabelProvider(labelProvider);
}
+
/**
- * Set the sorter that is to be applied to self's list viewer
+ * Set the sorter that is to be applied to self's list viewer
*/
public void setListSorter(ViewerSorter sorter) {
listViewer.setSorter(sorter);
}
+
/**
- * Set the root of the widget to be new Root. Regenerate all of the tables and lists from this
- * value.
+ * Set the root of the widget to be new Root. Regenerate all of the tables
+ * and lists from this value.
+ *
* @param newRoot
*/
public void setRoot(Object newRoot) {
@@ -256,17 +295,21 @@ public class TreeAndListGroup implements ISelectionChangedListener {
}
/**
- * Set the tree viewer's providers to those passed
- *
- * @param contentProvider ITreeContentProvider
- * @param labelProvider ILabelProvider
+ * Set the tree viewer's providers to those passed
+ *
+ * @param contentProvider
+ * ITreeContentProvider
+ * @param labelProvider
+ * ILabelProvider
*/
- public void setTreeProviders(ITreeContentProvider contentProvider, ILabelProvider labelProvider) {
+ public void setTreeProviders(ITreeContentProvider contentProvider,
+ ILabelProvider labelProvider) {
treeViewer.setContentProvider(contentProvider);
treeViewer.setLabelProvider(labelProvider);
}
+
/**
- * Set the sorter that is to be applied to self's tree viewer
+ * Set the sorter that is to be applied to self's tree viewer
*/
public void setTreeSorter(ViewerSorter sorter) {
treeViewer.setSorter(sorter);
@@ -279,9 +322,9 @@ public class TreeAndListGroup implements ISelectionChangedListener {
this.treeViewer.getTree().setFocus();
}
-
+
public void setAllowMultiselection(boolean allowMultiselection) {
- this.allowMultiselection= allowMultiselection;
-
+ this.allowMultiselection = allowMultiselection;
+
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
index 56b3319..39df965 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.launchConfigurations;
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -14,8 +14,8 @@ public class ExternalToolsLaunchConfigurationMessages {
private static final String BUNDLE_NAME = "net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsLaunchConfigurationMessages"; //$NON-NLS-1$
- private static final ResourceBundle RESOURCE_BUNDLE =
- ResourceBundle.getBundle(BUNDLE_NAME);
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
private ExternalToolsLaunchConfigurationMessages() {
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsMainTab.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsMainTab.java
index 49102df..f9a4f9f 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsMainTab.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsMainTab.java
@@ -54,545 +54,620 @@ import org.eclipse.ui.dialogs.SelectionDialog;
public class ExternalToolsMainTab extends AbstractLaunchConfigurationTab {
- protected Combo locationField;
-
- protected Text workDirectoryField;
-
- protected Button fileLocationButton;
-
- protected Button workspaceLocationButton;
-
- protected Button fileWorkingDirectoryButton;
-
- protected Button workspaceWorkingDirectoryButton;
-
- protected Button runBackgroundButton;
-
- protected Text argumentField;
-
- protected Button variableButton;
-
- protected SelectionAdapter selectionAdapter;
-
- protected ModifyListener modifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateLaunchConfigurationDialog();
- }
- };
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite mainComposite = new Composite(parent, SWT.NONE);
- setControl(mainComposite);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- mainComposite.setLayout(layout);
- mainComposite.setLayoutData(gridData);
- mainComposite.setFont(parent.getFont());
- createLocationComponent(mainComposite);
- createWorkDirectoryComponent(mainComposite);
- createArgumentComponent(mainComposite);
- createVerticalSpacer(mainComposite, 2);
- createRunBackgroundComponent(mainComposite);
- }
-
- /**
- * Creates the controls needed to edit the location attribute of an external tool
- *
- * @param parent
- * the composite to create the controls in
- */
- protected void createLocationComponent(Composite parent) {
- Font font = parent.getFont();
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- composite.setLayout(layout);
- composite.setLayoutData(gridData);
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Location___2")); //$NON-NLS-1$
- label.setFont(font);
-
- final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
- locationField = new Combo(composite, SWT.DROP_DOWN | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- locationField.setLayoutData(data);
- locationField.setFont(font);
- locationField.add(store.getString(ExternalToolsPlugin.PHP_RUN_PREF), 0);
- locationField.add(store.getString(ExternalToolsPlugin.APACHE_RUN_PREF), 1);
- locationField.add(store.getString(ExternalToolsPlugin.MYSQL_RUN_PREF), 2);
- locationField.add(store.getString(ExternalToolsPlugin.XAMPP_START_PREF), 3);
- locationField.add(store.getString(ExternalToolsPlugin.XAMPP_STOP_PREF), 4);
- Composite buttonComposite = new Composite(parent, SWT.NONE);
- layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
- buttonComposite.setLayout(layout);
- buttonComposite.setLayoutData(gridData);
- buttonComposite.setFont(font);
-
- createVerticalSpacer(buttonComposite, 1);
-
- workspaceLocationButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsMainTab.&Browse_Workspace..._3"), null); //$NON-NLS-1$
- workspaceLocationButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent evt) {
- handleWorkspaceLocationButtonSelected();
- }
- });
- fileLocationButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsMainTab.Brows&e_File_System..._4"), null); //$NON-NLS-1$
- fileLocationButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent evt) {
- handleLocationButtonSelected();
- }
- });
- }
-
- /**
- * Creates the controls needed to edit the working directory attribute of an external tool
- *
- * @param parent
- * the composite to create the controls in
- */
- protected void createWorkDirectoryComponent(Composite parent) {
- Font font = parent.getFont();
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- composite.setLayout(layout);
- composite.setLayoutData(gridData);
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Working_&Directory__5")); //$NON-NLS-1$
- label.setFont(font);
-
- workDirectoryField = new Text(composite, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- workDirectoryField.setLayoutData(data);
- workDirectoryField.setFont(font);
-
- Composite buttonComposite = new Composite(parent, SWT.NONE);
- layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
- buttonComposite.setLayout(layout);
- buttonComposite.setLayoutData(gridData);
- buttonComposite.setFont(font);
-
- createVerticalSpacer(buttonComposite, 1);
- workspaceWorkingDirectoryButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsMainTab.Browse_Wor&kspace..._6"), null); //$NON-NLS-1$
- workspaceWorkingDirectoryButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent evt) {
- handleWorkspaceWorkingDirectoryButtonSelected();
- }
- });
- fileWorkingDirectoryButton = createPushButton(buttonComposite, ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsMainTab.Browse_F&ile_System..._7"), null); //$NON-NLS-1$
- fileWorkingDirectoryButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent evt) {
- handleFileWorkingDirectoryButtonSelected();
- }
- });
- }
-
- /**
- * Creates the controls needed to edit the argument and prompt for argument attributes of an external tool
- *
- * @param parent
- * the composite to create the controls in
- */
- protected void createArgumentComponent(Composite parent) {
- Font font = parent.getFont();
-
- Label label = new Label(parent, SWT.NONE);
- label.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.&Arguments___1")); //$NON-NLS-1$
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- label.setFont(font);
-
- argumentField = new Text(parent, SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- argumentField.setLayoutData(data);
- argumentField.setFont(font);
- argumentField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateLaunchConfigurationDialog();
- }
- });
-
- variableButton = createPushButton(parent, ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsOptionTab.Varia&bles..._2"), null); //$NON-NLS-1$
- variableButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- VariableSelectionDialog dialog = new VariableSelectionDialog(getShell());
- if (dialog.open() == SelectionDialog.OK) {
- argumentField.insert(dialog.getForm().getSelectedVariable());
- }
- }
- });
-
- Label instruction = new Label(parent, SWT.NONE);
- instruction
- .setText(ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsOptionTab.Note__Enclose_an_argument_containing_spaces_using_double-quotes_(__)._Not_applicable_for_variables._3")); //$NON-NLS-1$
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- instruction.setLayoutData(data);
- instruction.setFont(font);
- }
-
- /**
- * Creates the controls needed to edit the run in background attribute of an external tool
- *
- * @param parent
- * the composite to create the controls in
- */
- protected void createRunBackgroundComponent(Composite parent) {
- runBackgroundButton = new Button(parent, SWT.CHECK);
- runBackgroundButton.setText(ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsOptionTab.Run_tool_in_bac&kground_4")); //$NON-NLS-1$
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- runBackgroundButton.setLayoutData(data);
- runBackgroundButton.setFont(parent.getFont());
- runBackgroundButton.addSelectionListener(getSelectionAdapter());
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, false);
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void initializeFrom(ILaunchConfiguration configuration) {
- updateLocation(configuration);
- updateWorkingDirectory(configuration);
- updateArgument(configuration);
- updateRunBackground(configuration);
- }
-
- protected void updateWorkingDirectory(ILaunchConfiguration configuration) {
- String workingDir = ""; //$NON-NLS-1$
- try {
- workingDir = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, ""); //$NON-NLS-1$
- } catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(
- ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Error_reading_configuration_10"), ce); //$NON-NLS-1$
- }
- workDirectoryField.setText(workingDir);
- workDirectoryField.addModifyListener(modifyListener);
-
- }
-
- protected void updateLocation(ILaunchConfiguration configuration) {
- String location = ""; //$NON-NLS-1$
- try {
- location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, ""); //$NON-NLS-1$
- } catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(
- ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.Error_reading_configuration_10"), ce); //$NON-NLS-1$
- }
- locationField.setText(location);
- locationField.addModifyListener(modifyListener);
- }
-
- protected void updateArgument(ILaunchConfiguration configuration) {
- String arguments = ""; //$NON-NLS-1$
- try {
- arguments = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, ""); //$NON-NLS-1$
- } catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(
- ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Error_reading_configuration_7"), ce); //$NON-NLS-1$
- }
- argumentField.setText(arguments);
- }
-
- protected void updateRunBackground(ILaunchConfiguration configuration) {
- boolean runInBackgroud = true;
- try {
- runInBackgroud = configuration.getAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, false);
- } catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(
- ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Error_reading_configuration_7"), ce); //$NON-NLS-1$
- }
- runBackgroundButton.setSelection(runInBackgroud);
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
- */
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- String location = locationField.getText().trim();
- if (location.length() == 0) {
- configuration.setAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null);
- } else {
- configuration.setAttribute(IExternalToolConstants.ATTR_LOCATION, location);
- }
-
- String workingDirectory = workDirectoryField.getText().trim();
- if (workingDirectory.length() == 0) {
- configuration.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) null);
- } else {
- configuration.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, workingDirectory);
- }
-
- setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, configuration, runBackgroundButton.getSelection(), false);
-
- String arguments = argumentField.getText().trim();
- if (arguments.length() == 0) {
- configuration.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null);
- } else {
- configuration.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments);
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
- */
- public String getName() {
- return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Main_17"); //$NON-NLS-1$
- }
-
- /**
- * @see ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public boolean isValid(ILaunchConfiguration launchConfig) {
- setErrorMessage(null);
- setMessage(null);
- return validateLocation() && validateWorkDirectory();
- }
-
- /**
- * Validates the content of the location field.
- */
- protected boolean validateLocation() {
- String value = locationField.getText().trim();
- if (value.length() < 1) {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsMainTab.External_tool_location_cannot_be_empty_18")); //$NON-NLS-1$
- setMessage(null);
- return false;
- }
-
- // Translate field contents to the actual file location so we
- // can check to ensure the file actually exists.
- MultiStatus multiStatus = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
- value = ToolUtil.expandFileLocation(value, ExpandVariableContext.EMPTY_CONTEXT, multiStatus);
- if (!multiStatus.isOK()) {
- IStatus[] children = multiStatus.getChildren();
- if (children.length > 0) {
- setErrorMessage(children[0].getMessage());
- setMessage(null);
- }
- return false;
- }
-
- File file = new File(value);
- if (!file.exists()) { // The file does not exist.
- setErrorMessage(ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsMainTab.External_tool_location_does_not_exist_19")); //$NON-NLS-1$
- return false;
- }
- if (!file.isFile()) {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsMainTab.External_tool_location_specified_is_not_a_file_20")); //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
- /**
- * Validates the content of the working directory field.
- */
- protected boolean validateWorkDirectory() {
-
- String value = workDirectoryField.getText().trim();
- if (value.length() > 0) {
- // Translate field contents to the actual directory location so we
- // can check to ensure the directory actually exists.
- MultiStatus multiStatus = new MultiStatus(IExternalToolConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
- value = ToolUtil.expandDirectoryLocation(value, ExpandVariableContext.EMPTY_CONTEXT, multiStatus);
- if (!multiStatus.isOK()) {
- IStatus[] children = multiStatus.getChildren();
- if (children.length > 0) {
- setErrorMessage(children[0].getMessage());
- }
- return false;
- }
-
- File file = new File(value);
- if (!file.exists()) { // The directory does not exist.
- setErrorMessage(ExternalToolsLaunchConfigurationMessages
- .getString("ExternalToolsMainTab.External_tool_working_directory_does_not_exist_or_is_invalid_21")); //$NON-NLS-1$
- return false;
- }
- }
- return true;
- }
-
- protected void handleLocationButtonSelected() {
- FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE);
- fileDialog.setFileName(locationField.getText());
- String text = fileDialog.open();
- if (text != null) {
- locationField.setText(text);
- }
- }
-
- /**
- * 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.open();
- Object[] results = dialog.getResult();
- if (results == null || results.length < 1) {
- return;
- }
- IResource resource = (IResource) results[0];
- StringBuffer buf = new StringBuffer();
- ToolUtil.buildVariableTag(IExternalToolConstants.VAR_WORKSPACE_LOC, resource.getFullPath().toString(), buf);
- String text = buf.toString();
- if (text != null) {
- locationField.setText(text);
- }
- }
-
- /**
- * 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.open();
- Object[] resource = containerDialog.getResult();
- String text = null;
- if (resource != null && resource.length > 0) {
- text = ToolUtil.buildVariableTag(IExternalToolConstants.VAR_RESOURCE_LOC, ((IPath) resource[0]).toString());
- }
- if (text != null) {
- workDirectoryField.setText(text);
- }
- }
-
- protected void handleFileWorkingDirectoryButtonSelected() {
- DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SAVE);
- dialog.setMessage(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsMainTab.&Select_a_directory__23")); //$NON-NLS-1$
- dialog.setFilterPath(workDirectoryField.getText());
- String text = dialog.open();
- if (text != null) {
- workDirectoryField.setText(text);
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
- */
- public Image getImage() {
- return ExternalToolsImages.getImage(IExternalToolConstants.IMG_TAB_MAIN);
- }
-
- /**
- * Method getSelectionAdapter.
- *
- * @return SelectionListener
- */
- protected SelectionListener getSelectionAdapter() {
- if (selectionAdapter == null) {
- selectionAdapter = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateLaunchConfigurationDialog();
- }
- };
- }
- return selectionAdapter;
- }
-
- 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.createContents(composite, new IGroupDialogPage() {
- public GridData setButtonGridData(Button button) {
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- button.setLayoutData(data);
- return data;
- }
-
- public void setMessage(String newMessage, int newType) {
- VariableSelectionDialog.this.setMessage(newMessage);
- }
-
- public void updateValidState() {
- }
-
- public int convertHeightHint(int chars) {
- return convertHeightInCharsToPixels(chars);
- }
-
- public String getMessage() {
- if (!form.isValid()) {
- return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsOptionTab.Invalid_selection_12"); //$NON-NLS-1$
- }
- return null;
- }
-
- public int getMessageType() {
- if (!form.isValid()) {
- return IMessageProvider.ERROR;
- }
- return 0;
- }
- });
- return composite;
- }
-
- private ExternalToolVariableForm getForm() {
- return form;
- }
- }
+ protected Combo locationField;
+
+ protected Text workDirectoryField;
+
+ protected Button fileLocationButton;
+
+ protected Button workspaceLocationButton;
+
+ protected Button fileWorkingDirectoryButton;
+
+ protected Button workspaceWorkingDirectoryButton;
+
+ protected Button runBackgroundButton;
+
+ protected Text argumentField;
+
+ protected Button variableButton;
+
+ protected SelectionAdapter selectionAdapter;
+
+ protected ModifyListener modifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ };
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite mainComposite = new Composite(parent, SWT.NONE);
+ setControl(mainComposite);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ mainComposite.setLayout(layout);
+ mainComposite.setLayoutData(gridData);
+ mainComposite.setFont(parent.getFont());
+ createLocationComponent(mainComposite);
+ createWorkDirectoryComponent(mainComposite);
+ createArgumentComponent(mainComposite);
+ createVerticalSpacer(mainComposite, 2);
+ createRunBackgroundComponent(mainComposite);
+ }
+
+ /**
+ * Creates the controls needed to edit the location attribute of an external
+ * tool
+ *
+ * @param parent
+ * the composite to create the controls in
+ */
+ protected void createLocationComponent(Composite parent) {
+ Font font = parent.getFont();
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.numColumns = 1;
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ composite.setLayout(layout);
+ composite.setLayoutData(gridData);
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.&Location___2")); //$NON-NLS-1$
+ label.setFont(font);
+
+ final IPreferenceStore store = ExternalToolsPlugin.getDefault()
+ .getPreferenceStore();
+ locationField = new Combo(composite, SWT.DROP_DOWN | SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
+ locationField.setLayoutData(data);
+ locationField.setFont(font);
+ locationField.add(store.getString(ExternalToolsPlugin.PHP_RUN_PREF), 0);
+ locationField.add(store.getString(ExternalToolsPlugin.APACHE_RUN_PREF),
+ 1);
+ locationField.add(store.getString(ExternalToolsPlugin.MYSQL_RUN_PREF),
+ 2);
+ locationField.add(
+ store.getString(ExternalToolsPlugin.XAMPP_START_PREF), 3);
+ locationField.add(store.getString(ExternalToolsPlugin.XAMPP_STOP_PREF),
+ 4);
+ Composite buttonComposite = new Composite(parent, SWT.NONE);
+ layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.numColumns = 1;
+ gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ buttonComposite.setLayout(layout);
+ buttonComposite.setLayoutData(gridData);
+ buttonComposite.setFont(font);
+
+ createVerticalSpacer(buttonComposite, 1);
+
+ workspaceLocationButton = createPushButton(
+ buttonComposite,
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.&Browse_Workspace..._3"), null); //$NON-NLS-1$
+ workspaceLocationButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ handleWorkspaceLocationButtonSelected();
+ }
+ });
+ fileLocationButton = createPushButton(
+ buttonComposite,
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.Brows&e_File_System..._4"), null); //$NON-NLS-1$
+ fileLocationButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ handleLocationButtonSelected();
+ }
+ });
+ }
+
+ /**
+ * Creates the controls needed to edit the working directory attribute of an
+ * external tool
+ *
+ * @param parent
+ * the composite to create the controls in
+ */
+ protected void createWorkDirectoryComponent(Composite parent) {
+ Font font = parent.getFont();
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.numColumns = 1;
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ composite.setLayout(layout);
+ composite.setLayoutData(gridData);
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.Working_&Directory__5")); //$NON-NLS-1$
+ label.setFont(font);
+
+ workDirectoryField = new Text(composite, SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
+ workDirectoryField.setLayoutData(data);
+ workDirectoryField.setFont(font);
+
+ Composite buttonComposite = new Composite(parent, SWT.NONE);
+ layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.numColumns = 1;
+ gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ buttonComposite.setLayout(layout);
+ buttonComposite.setLayoutData(gridData);
+ buttonComposite.setFont(font);
+
+ createVerticalSpacer(buttonComposite, 1);
+ workspaceWorkingDirectoryButton = createPushButton(
+ buttonComposite,
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.Browse_Wor&kspace..._6"), null); //$NON-NLS-1$
+ workspaceWorkingDirectoryButton
+ .addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ handleWorkspaceWorkingDirectoryButtonSelected();
+ }
+ });
+ fileWorkingDirectoryButton = createPushButton(
+ buttonComposite,
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.Browse_F&ile_System..._7"), null); //$NON-NLS-1$
+ fileWorkingDirectoryButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ handleFileWorkingDirectoryButtonSelected();
+ }
+ });
+ }
+
+ /**
+ * Creates the controls needed to edit the argument and prompt for argument
+ * attributes of an external tool
+ *
+ * @param parent
+ * the composite to create the controls in
+ */
+ protected void createArgumentComponent(Composite parent) {
+ Font font = parent.getFont();
+
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsOptionTab.&Arguments___1")); //$NON-NLS-1$
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+ label.setFont(font);
+
+ argumentField = new Text(parent, SWT.BORDER);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
+ argumentField.setLayoutData(data);
+ argumentField.setFont(font);
+ argumentField.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ variableButton = createPushButton(
+ parent,
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsOptionTab.Varia&bles..._2"), null); //$NON-NLS-1$
+ variableButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ VariableSelectionDialog dialog = new VariableSelectionDialog(
+ getShell());
+ if (dialog.open() == SelectionDialog.OK) {
+ argumentField
+ .insert(dialog.getForm().getSelectedVariable());
+ }
+ }
+ });
+
+ Label instruction = new Label(parent, SWT.NONE);
+ instruction
+ .setText(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsOptionTab.Note__Enclose_an_argument_containing_spaces_using_double-quotes_(__)._Not_applicable_for_variables._3")); //$NON-NLS-1$
+ data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data.horizontalSpan = 2;
+ instruction.setLayoutData(data);
+ instruction.setFont(font);
+ }
+
+ /**
+ * Creates the controls needed to edit the run in background attribute of an
+ * external tool
+ *
+ * @param parent
+ * the composite to create the controls in
+ */
+ protected void createRunBackgroundComponent(Composite parent) {
+ runBackgroundButton = new Button(parent, SWT.CHECK);
+ runBackgroundButton.setText(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsOptionTab.Run_tool_in_bac&kground_4")); //$NON-NLS-1$
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ runBackgroundButton.setLayoutData(data);
+ runBackgroundButton.setFont(parent.getFont());
+ runBackgroundButton.addSelectionListener(getSelectionAdapter());
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+ configuration.setAttribute(
+ IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, false);
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ updateLocation(configuration);
+ updateWorkingDirectory(configuration);
+ updateArgument(configuration);
+ updateRunBackground(configuration);
+ }
+
+ protected void updateWorkingDirectory(ILaunchConfiguration configuration) {
+ String workingDir = ""; //$NON-NLS-1$
+ try {
+ workingDir = configuration.getAttribute(
+ IExternalToolConstants.ATTR_WORKING_DIRECTORY, ""); //$NON-NLS-1$
+ } catch (CoreException ce) {
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.Error_reading_configuration_10"), ce); //$NON-NLS-1$
+ }
+ workDirectoryField.setText(workingDir);
+ workDirectoryField.addModifyListener(modifyListener);
+
+ }
+
+ protected void updateLocation(ILaunchConfiguration configuration) {
+ String location = ""; //$NON-NLS-1$
+ try {
+ location = configuration.getAttribute(
+ IExternalToolConstants.ATTR_LOCATION, ""); //$NON-NLS-1$
+ } catch (CoreException ce) {
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.Error_reading_configuration_10"), ce); //$NON-NLS-1$
+ }
+ locationField.setText(location);
+ locationField.addModifyListener(modifyListener);
+ }
+
+ protected void updateArgument(ILaunchConfiguration configuration) {
+ String arguments = ""; //$NON-NLS-1$
+ try {
+ arguments = configuration.getAttribute(
+ IExternalToolConstants.ATTR_TOOL_ARGUMENTS, ""); //$NON-NLS-1$
+ } catch (CoreException ce) {
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsOptionTab.Error_reading_configuration_7"), ce); //$NON-NLS-1$
+ }
+ argumentField.setText(arguments);
+ }
+
+ protected void updateRunBackground(ILaunchConfiguration configuration) {
+ boolean runInBackgroud = true;
+ try {
+ runInBackgroud = configuration.getAttribute(
+ IExternalToolConstants.ATTR_RUN_IN_BACKGROUND, false);
+ } catch (CoreException ce) {
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsOptionTab.Error_reading_configuration_7"), ce); //$NON-NLS-1$
+ }
+ runBackgroundButton.setSelection(runInBackgroud);
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ String location = locationField.getText().trim();
+ if (location.length() == 0) {
+ configuration.setAttribute(IExternalToolConstants.ATTR_LOCATION,
+ (String) null);
+ } else {
+ configuration.setAttribute(IExternalToolConstants.ATTR_LOCATION,
+ location);
+ }
+
+ String workingDirectory = workDirectoryField.getText().trim();
+ if (workingDirectory.length() == 0) {
+ configuration.setAttribute(
+ IExternalToolConstants.ATTR_WORKING_DIRECTORY,
+ (String) null);
+ } else {
+ configuration.setAttribute(
+ IExternalToolConstants.ATTR_WORKING_DIRECTORY,
+ workingDirectory);
+ }
+
+ setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUND,
+ configuration, runBackgroundButton.getSelection(), false);
+
+ String arguments = argumentField.getText().trim();
+ if (arguments.length() == 0) {
+ configuration.setAttribute(
+ IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null);
+ } else {
+ configuration.setAttribute(
+ IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments);
+ }
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.&Main_17"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public boolean isValid(ILaunchConfiguration launchConfig) {
+ setErrorMessage(null);
+ setMessage(null);
+ return validateLocation() && validateWorkDirectory();
+ }
+
+ /**
+ * Validates the content of the location field.
+ */
+ protected boolean validateLocation() {
+ String value = locationField.getText().trim();
+ if (value.length() < 1) {
+ setErrorMessage(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.External_tool_location_cannot_be_empty_18")); //$NON-NLS-1$
+ setMessage(null);
+ return false;
+ }
+
+ // Translate field contents to the actual file location so we
+ // can check to ensure the file actually exists.
+ MultiStatus multiStatus = new MultiStatus(
+ IExternalToolConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ value = ToolUtil.expandFileLocation(value,
+ ExpandVariableContext.EMPTY_CONTEXT, multiStatus);
+ if (!multiStatus.isOK()) {
+ IStatus[] children = multiStatus.getChildren();
+ if (children.length > 0) {
+ setErrorMessage(children[0].getMessage());
+ setMessage(null);
+ }
+ return false;
+ }
+
+ File file = new File(value);
+ if (!file.exists()) { // The file does not exist.
+ setErrorMessage(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.External_tool_location_does_not_exist_19")); //$NON-NLS-1$
+ return false;
+ }
+ if (!file.isFile()) {
+ setErrorMessage(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.External_tool_location_specified_is_not_a_file_20")); //$NON-NLS-1$
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Validates the content of the working directory field.
+ */
+ protected boolean validateWorkDirectory() {
+
+ String value = workDirectoryField.getText().trim();
+ if (value.length() > 0) {
+ // Translate field contents to the actual directory location so we
+ // can check to ensure the directory actually exists.
+ MultiStatus multiStatus = new MultiStatus(
+ IExternalToolConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ value = ToolUtil.expandDirectoryLocation(value,
+ ExpandVariableContext.EMPTY_CONTEXT, multiStatus);
+ if (!multiStatus.isOK()) {
+ IStatus[] children = multiStatus.getChildren();
+ if (children.length > 0) {
+ setErrorMessage(children[0].getMessage());
+ }
+ return false;
+ }
+
+ File file = new File(value);
+ if (!file.exists()) { // The directory does not exist.
+ setErrorMessage(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.External_tool_working_directory_does_not_exist_or_is_invalid_21")); //$NON-NLS-1$
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected void handleLocationButtonSelected() {
+ FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE);
+ fileDialog.setFileName(locationField.getText());
+ String text = fileDialog.open();
+ if (text != null) {
+ locationField.setText(text);
+ }
+ }
+
+ /**
+ * 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.open();
+ Object[] results = dialog.getResult();
+ if (results == null || results.length < 1) {
+ return;
+ }
+ IResource resource = (IResource) results[0];
+ StringBuffer buf = new StringBuffer();
+ ToolUtil.buildVariableTag(IExternalToolConstants.VAR_WORKSPACE_LOC,
+ resource.getFullPath().toString(), buf);
+ String text = buf.toString();
+ if (text != null) {
+ locationField.setText(text);
+ }
+ }
+
+ /**
+ * 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.open();
+ Object[] resource = containerDialog.getResult();
+ String text = null;
+ if (resource != null && resource.length > 0) {
+ text = ToolUtil.buildVariableTag(
+ IExternalToolConstants.VAR_RESOURCE_LOC,
+ ((IPath) resource[0]).toString());
+ }
+ if (text != null) {
+ workDirectoryField.setText(text);
+ }
+ }
+
+ protected void handleFileWorkingDirectoryButtonSelected() {
+ DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SAVE);
+ dialog.setMessage(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsMainTab.&Select_a_directory__23")); //$NON-NLS-1$
+ dialog.setFilterPath(workDirectoryField.getText());
+ String text = dialog.open();
+ if (text != null) {
+ workDirectoryField.setText(text);
+ }
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
+ */
+ public Image getImage() {
+ return ExternalToolsImages
+ .getImage(IExternalToolConstants.IMG_TAB_MAIN);
+ }
+
+ /**
+ * Method getSelectionAdapter.
+ *
+ * @return SelectionListener
+ */
+ protected SelectionListener getSelectionAdapter() {
+ if (selectionAdapter == null) {
+ selectionAdapter = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ };
+ }
+ return selectionAdapter;
+ }
+
+ 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.createContents(composite, new IGroupDialogPage() {
+ public GridData setButtonGridData(Button button) {
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ data.widthHint = Math.max(widthHint, button.computeSize(
+ SWT.DEFAULT, SWT.DEFAULT, true).x);
+ button.setLayoutData(data);
+ return data;
+ }
+
+ public void setMessage(String newMessage, int newType) {
+ VariableSelectionDialog.this.setMessage(newMessage);
+ }
+
+ public void updateValidState() {
+ }
+
+ public int convertHeightHint(int chars) {
+ return convertHeightInCharsToPixels(chars);
+ }
+
+ public String getMessage() {
+ if (!form.isValid()) {
+ return ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsOptionTab.Invalid_selection_12"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public int getMessageType() {
+ if (!form.isValid()) {
+ return IMessageProvider.ERROR;
+ }
+ return 0;
+ }
+ });
+ return composite;
+ }
+
+ private ExternalToolVariableForm getForm() {
+ return form;
+ }
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsRefreshTab.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsRefreshTab.java
index a097c92..c0a3258 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsRefreshTab.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsRefreshTab.java
@@ -1,11 +1,11 @@
package net.sourceforge.phpdt.externaltools.launchConfigurations;
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import net.sourceforge.phpdt.externaltools.group.IGroupDialogPage;
import net.sourceforge.phpdt.externaltools.internal.dialog.ExternalToolVariableForm;
@@ -29,20 +29,22 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab implements IGroupDialogPage {
+public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab
+ implements IGroupDialogPage {
private ExternalToolVariableForm variableForm;
-
+
protected Button refreshField;
+
protected Button recursiveField;
-
+
/**
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
Composite mainComposite = new Composite(parent, SWT.NONE);
setControl(mainComposite);
-
+
GridLayout layout = new GridLayout();
layout.numColumns = 1;
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
@@ -54,16 +56,19 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
createRecursiveComponent(mainComposite);
createScopeComponent(mainComposite);
}
-
+
/**
- * Creates the controls needed to edit the refresh recursive
- * attribute of an external tool
+ * Creates the controls needed to edit the refresh recursive attribute of an
+ * external tool
*
- * @param parent the composite to create the controls in
+ * @param parent
+ * the composite to create the controls in
*/
protected void createRecursiveComponent(Composite parent) {
recursiveField = new Button(parent, SWT.CHECK);
- recursiveField.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Recursively_&include_sub-folders_1")); //$NON-NLS-1$
+ recursiveField
+ .setText(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsRefreshTab.Recursively_&include_sub-folders_1")); //$NON-NLS-1$
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
recursiveField.setLayoutData(data);
recursiveField.setFont(parent.getFont());
@@ -73,16 +78,19 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
}
});
}
-
+
/**
- * Creates the controls needed to edit the refresh scope
- * attribute of an external tool
+ * Creates the controls needed to edit the refresh scope attribute of an
+ * external tool
*
- * @param parent the composite to create the controls in
+ * @param parent
+ * the composite to create the controls in
*/
protected void createRefreshComponent(Composite parent) {
refreshField = new Button(parent, SWT.CHECK);
- refreshField.setText(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.&Refresh_resources_after_running_tool_1")); //$NON-NLS-1$
+ refreshField
+ .setText(ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsRefreshTab.&Refresh_resources_after_running_tool_1")); //$NON-NLS-1$
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
refreshField.setLayoutData(data);
refreshField.setFont(parent.getFont());
@@ -93,20 +101,22 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
}
});
}
-
+
/**
- * Creates the controls needed to edit the refresh scope variable
- * attribute of an external tool
+ * Creates the controls needed to edit the refresh scope variable attribute
+ * of an external tool
*
- * @param parent the composite to create the controls in
+ * @param parent
+ * the composite to create the controls in
*/
protected void createScopeComponent(Composite parent) {
- String label = ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Choose_scope_v&ariable___2"); //$NON-NLS-1$
- ExternalToolVariable[] vars = ExternalToolsPlugin.getDefault().getRefreshVariableRegistry().getRefreshVariables();
+ String label = ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsRefreshTab.Choose_scope_v&ariable___2"); //$NON-NLS-1$
+ ExternalToolVariable[] vars = ExternalToolsPlugin.getDefault()
+ .getRefreshVariableRegistry().getRefreshVariables();
variableForm = new ExternalToolVariableForm(label, vars);
variableForm.createContents(parent, this);
}
-
/**
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
@@ -122,52 +132,74 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
updateRecursive(configuration);
updateScope(configuration);
}
+
/**
* Method udpateScope.
+ *
* @param configuration
*/
private void updateScope(ILaunchConfiguration configuration) {
String scope = null;
try {
- scope= configuration.getAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, (String)null);
+ scope = configuration.getAttribute(
+ IExternalToolConstants.ATTR_REFRESH_SCOPE, (String) null);
} catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
}
String varName = null;
String varValue = null;
if (scope != null) {
- ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(scope, 0);
+ ToolUtil.VariableDefinition varDef = ToolUtil.extractVariableTag(
+ scope, 0);
varName = varDef.name;
varValue = varDef.argument;
}
variableForm.selectVariable(varName, varValue);
}
+
/**
* Method updateRecursive.
+ *
* @param configuration
*/
private void updateRecursive(ILaunchConfiguration configuration) {
- boolean recursive= true;
+ boolean recursive = true;
try {
- recursive= configuration.getAttribute(IExternalToolConstants.ATTR_REFRESH_RECURSIVE, false);
+ recursive = configuration.getAttribute(
+ IExternalToolConstants.ATTR_REFRESH_RECURSIVE, false);
} catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
}
recursiveField.setSelection(recursive);
}
+
/**
* Method updateRefresh.
+ *
* @param configuration
*/
private void updateRefresh(ILaunchConfiguration configuration) {
- String scope= null;
+ String scope = null;
try {
- scope= configuration.getAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, (String)null);
+ scope = configuration.getAttribute(
+ IExternalToolConstants.ATTR_REFRESH_SCOPE, (String) null);
} catch (CoreException ce) {
- ExternalToolsPlugin.getDefault().log(ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
+ ExternalToolsPlugin
+ .getDefault()
+ .log(
+ ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsRefreshTab.Exception_reading_launch_configuration_3"), ce); //$NON-NLS-1$
}
refreshField.setSelection(scope != null);
- updateEnabledState();
+ updateEnabledState();
}
/**
@@ -176,21 +208,26 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
if (refreshField.getSelection()) {
- configuration.setAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, variableForm.getSelectedVariable());
+ configuration.setAttribute(
+ IExternalToolConstants.ATTR_REFRESH_SCOPE, variableForm
+ .getSelectedVariable());
} else {
- configuration.setAttribute(IExternalToolConstants.ATTR_REFRESH_SCOPE, (String)null);
+ configuration.setAttribute(
+ IExternalToolConstants.ATTR_REFRESH_SCOPE, (String) null);
}
-
- setAttribute(IExternalToolConstants.ATTR_REFRESH_RECURSIVE, configuration, recursiveField.getSelection(), false);
+
+ setAttribute(IExternalToolConstants.ATTR_REFRESH_RECURSIVE,
+ configuration, recursiveField.getSelection(), false);
}
/**
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
public String getName() {
- return ExternalToolsLaunchConfigurationMessages.getString("ExternalToolsRefreshTab.Refres&h_6"); //$NON-NLS-1$
+ return ExternalToolsLaunchConfigurationMessages
+ .getString("ExternalToolsRefreshTab.Refres&h_6"); //$NON-NLS-1$
}
-
+
/**
* Updates the enablement state of the fields.
*/
@@ -204,6 +241,7 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
}
}
}
+
/**
* @see net.sourceforge.phpdt.externaltools.group.IGroupDialogPage#convertHeightHint(int)
*/
@@ -219,7 +257,8 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
}
/**
- * @see net.sourceforge.phpdt.externaltools.group.IGroupDialogPage#setMessage(java.lang.String, int)
+ * @see net.sourceforge.phpdt.externaltools.group.IGroupDialogPage#setMessage(java.lang.String,
+ * int)
*/
public void setMessage(String newMessage, int newType) {
setMessage(newMessage);
@@ -243,11 +282,13 @@ public class ExternalToolsRefreshTab extends AbstractLaunchConfigurationTab impl
}
return IMessageProvider.NONE;
}
+
/**
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
*/
public Image getImage() {
- return ExternalToolsImages.getImage(IExternalToolConstants.IMG_ACTION_REFRESH);
+ return ExternalToolsImages
+ .getImage(IExternalToolConstants.IMG_ACTION_REFRESH);
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsUtil.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsUtil.java
index c5c5555..3d4a295 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsUtil.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/launchConfigurations/ExternalToolsUtil.java
@@ -45,319 +45,389 @@ import org.eclipse.debug.core.ILaunchManager;
*/
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() {
- };
+ /**
+ * 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));
- }
+ /**
+ * 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();
- }
+ /**
+ * 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 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, 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$
- 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$
- abort(msg, null, 0);
- }
- }
- } else {
- throw new CoreException(status);
- }
- }
- // execution will not reach here
- 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,
+ 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$
+ 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$
+ abort(msg, null, 0);
+ }
+ }
+ } else {
+ throw new CoreException(status);
+ }
+ }
+ // execution will not reach here
+ return 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, ExternalToolsModelMessages
- .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 = ExternalToolsModelMessages.format(
- "DefaultRunnerContext.invalidDirectory", new Object[] { configuration.getName() }); //$NON-NLS-1$
- abort(msg, null, 0);
- }
- }
- } else {
- throw new CoreException(status);
- }
- }
- return 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,
+ ExternalToolsModelMessages
+ .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 = ExternalToolsModelMessages
+ .format(
+ "DefaultRunnerContext.invalidDirectory", new Object[] { configuration.getName() }); //$NON-NLS-1$
+ abort(msg, null, 0);
+ }
+ }
+ } else {
+ throw new CoreException(status);
+ }
+ }
+ return null;
+ }
- /**
- * 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, ExternalToolsModelMessages
- .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 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,
+ ExternalToolsModelMessages
+ .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;
+ }
- /**
- * 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);
- }
+ /**
+ * 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);
+ }
- /**
- * 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);
- }
+ /**
+ * 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);
+ }
- /**
- * 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;
+ /**
+ * 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;
- 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$
- abort(msg, null, 0);
- }
+ 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$
+ 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$
- 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$
+ abort(msg, null, 0);
+ }
- int depth = IResource.DEPTH_ZERO;
- if (isRefreshRecursive(configuration))
- depth = IResource.DEPTH_INFINITE;
+ int depth = IResource.DEPTH_ZERO;
+ if (isRefreshRecursive(configuration))
+ depth = IResource.DEPTH_INFINITE;
- if (monitor.isCanceled())
- return;
+ if (monitor.isCanceled())
+ return;
- IResource[] resources = variable.getExpander().getResources(varDef.name, varDef.argument, context);
- if (resources == null || resources.length == 0)
- return;
+ IResource[] resources = variable.getExpander().getResources(
+ varDef.name, varDef.argument, context);
+ if (resources == null || resources.length == 0)
+ return;
- monitor.beginTask(ExternalToolsModelMessages.getString("DefaultRunnerContext.refreshResources"), //$NON-NLS-1$
- resources.length);
+ monitor.beginTask(ExternalToolsModelMessages
+ .getString("DefaultRunnerContext.refreshResources"), //$NON-NLS-1$
+ resources.length);
- 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);
- }
+ 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);
+ }
- monitor.done();
- if (!status.isOK()) {
- throw new CoreException(status);
- }
- }
+ monitor.done();
+ if (!status.isOK()) {
+ throw new CoreException(status);
+ }
+ }
- /**
- * 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);
- }
+ /**
+ * 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);
+ }
- /**
- * 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;
- }
- }
+ /**
+ * 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) {
- 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);
+ /**
+ * 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);
+ }
- ILaunchConfigurationWorkingCopy wc = null;
- try {
- wc = type.newInstance(null, command);
- } catch (CoreException e) {
- //some exception handling
- }
- wc.setAttribute(IExternalToolConstants.ATTR_LOCATION, executable);
- 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);
+ 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);
- // 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) {
- }
+ ILaunchConfigurationWorkingCopy wc = null;
+ try {
+ wc = type.newInstance(null, command);
+ } catch (CoreException e) {
+ // some exception handling
+ }
+ wc.setAttribute(IExternalToolConstants.ATTR_LOCATION, executable);
+ 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
+ ILaunchConfiguration config;
+ try {
+ config = wc.doSave();
+ config.launch(ILaunchManager.RUN_MODE, null);
+ } catch (CoreException e) {
+ }
+
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/IExternalToolConstants.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/IExternalToolConstants.java
index 43bb50a..a7f2dde 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/IExternalToolConstants.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/IExternalToolConstants.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.model;
/**********************************************************************
-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:
+ **********************************************************************/
/**
* Defines the constants available for client use.
@@ -17,7 +17,8 @@ Contributors:
*/
public interface IExternalToolConstants {
/**
- * Plugin identifier for external tools (value org.eclipse.ui.externaltools
).
+ * Plugin identifier for external tools (value
+ * org.eclipse.ui.externaltools
).
*/
public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.externaltools"; //$NON-NLS-1$;
@@ -27,60 +28,61 @@ public interface IExternalToolConstants {
* created when duplicating an existing configuration as a project builder.
*/
public static final String EXTENSION_POINT_CONFIGURATION_DUPLICATION_MAPS = "configurationDuplicationMaps"; //$NON-NLS-1$
+
/**
- * Extension point to declare argument variables
- * (value argumentVariables
).
+ * Extension point to declare argument variables (value
+ * argumentVariables
).
*/
public static final String EXTENSION_POINT_ARGUMENT_VARIABLES = "argumentVariables"; //$NON-NLS-1$
/**
- * Extension point to declare file variables
- * (value fileVariables
).
+ * Extension point to declare file variables (value
+ * fileVariables
).
*/
public static final String EXTENSION_POINT_FILE_VARIABLES = "fileVariables"; //$NON-NLS-1$
/**
- * Extension point to declare directory variables
- * (value directoryVariables
).
+ * Extension point to declare directory variables (value
+ * directoryVariables
).
*/
public static final String EXTENSION_POINT_DIRECTORY_VARIABLES = "directoryVariables"; //$NON-NLS-1$
/**
- * Extension point to declare refresh scope variables
- * (value refreshVariables
).
+ * Extension point to declare refresh scope variables (value
+ * refreshVariables
).
*/
public static final String EXTENSION_POINT_REFRESH_VARIABLES = "refreshVariables"; //$NON-NLS-1$
// ------- Views -------
/**
- * Ant View identifier (value org.eclipse.ui.externaltools.AntView
).
+ * Ant View identifier (value
+ * org.eclipse.ui.externaltools.AntView
).
*/
- //public static final String ANT_VIEW_ID = PLUGIN_ID + ".AntView"; //$NON-NLS-1$
-
+ // public static final String ANT_VIEW_ID = PLUGIN_ID + ".AntView";
+ // //$NON-NLS-1$
// ------- Tool Types -------
/**
- * External tool type for programs such as executables, batch files,
- * shell scripts, etc (value programType
).
+ * External tool type for programs such as executables, batch files, shell
+ * scripts, etc (value programType
).
*/
public static final String TOOL_TYPE_PROGRAM = "programType"; //$NON-NLS-1$;
/**
* External tool type for Ant build files (value antBuildType
).
*/
- //public static final String TOOL_TYPE_ANT_BUILD = "antBuildType"; //$NON-NLS-1$;
-
+ // public static final String TOOL_TYPE_ANT_BUILD = "antBuildType";
+ // //$NON-NLS-1$;
// ------- Variables -------
-
/**
- * Variable that expands to the absolute path on the system's hard drive
- * to the workspace directory (value workspace_loc
).
+ * Variable that expands to the absolute path on the system's hard drive to
+ * the workspace directory (value workspace_loc
).
*/
public static final String VAR_WORKSPACE_LOC = "workspace_loc"; //$NON-NLS-1$
/**
- * Variable that expands to the absolute path on the system's hard drive
- * to a project's directory (value project_loc
).
+ * Variable that expands to the absolute path on the system's hard drive to
+ * a project's directory (value project_loc
).
*/
public static final String VAR_PROJECT_LOC = "project_loc"; //$NON-NLS-1$
@@ -91,13 +93,14 @@ public interface IExternalToolConstants {
public static final String VAR_PROJECT_PATH = "project_path"; //$NON-NLS-1$
/**
- * Variable that expands to the name of a project (value project_name
).
+ * Variable that expands to the name of a project (value
+ * project_name
).
*/
public static final String VAR_PROJECT_NAME = "project_name"; //$NON-NLS-1$
/**
- * Variable that expands to the absolute path on the system's hard drive
- * to a resource's location (value resource_loc
).
+ * Variable that expands to the absolute path on the system's hard drive to
+ * a resource's location (value resource_loc
).
*/
public static final String VAR_RESOURCE_LOC = "resource_loc"; //$NON-NLS-1$
@@ -108,13 +111,14 @@ public interface IExternalToolConstants {
public static final String VAR_RESOURCE_PATH = "resource_path"; //$NON-NLS-1$
/**
- * Variable that expands to the name of a resource (value resource_name
).
+ * Variable that expands to the name of a resource (value
+ * resource_name
).
*/
public static final String VAR_RESOURCE_NAME = "resource_name"; //$NON-NLS-1$
/**
- * Variable that expands to the absolute path on the system's hard drive
- * to a resource's containing directory (value container_loc
).
+ * Variable that expands to the absolute path on the system's hard drive to
+ * a resource's containing directory (value container_loc
).
*/
public static final String VAR_CONTAINER_LOC = "container_loc"; //$NON-NLS-1$
@@ -125,34 +129,39 @@ public interface IExternalToolConstants {
public static final String VAR_CONTAINER_PATH = "container_path"; //$NON-NLS-1$
/**
- * Variable that expands to the name of a resource's parent (value container_name
).
+ * Variable that expands to the name of a resource's parent (value
+ * container_name
).
*/
public static final String VAR_CONTAINER_NAME = "container_name"; //$NON-NLS-1$
/**
- * Variable that expands to the type of build (value build_type
). See
- * BUILD_TYPE_*
constants for possible values.
+ * Variable that expands to the type of build (value build_type
).
+ * See BUILD_TYPE_*
constants for possible values.
*/
public static final String VAR_BUILD_TYPE = "build_type"; //$NON-NLS-1$
/**
- * Variable that expands to the current editor cursor column (value editor_cur_col
).
+ * Variable that expands to the current editor cursor column (value
+ * editor_cur_col
).
*/
public static final String VAR_EDITOR_CUR_COL = "editor_cur_col"; //$NON-NLS-1$
/**
- * Variable that expands to the current editor cursor line (value editor_cur_line
).
+ * Variable that expands to the current editor cursor line (value
+ * editor_cur_line
).
*/
public static final String VAR_EDITOR_CUR_LINE = "editor_cur_line"; //$NON-NLS-1$
/**
- * Variable that expands to the current editor selected text (value editor_sel_text
).
+ * Variable that expands to the current editor selected text (value
+ * editor_sel_text
).
*/
public static final String VAR_EDITOR_SEL_TEXT = "editor_sel_text"; //$NON-NLS-1$
// ------- Refresh Variables -------
/**
- * Variable that expands to the workspace root object (value workspace
).
+ * Variable that expands to the workspace root object (value
+ * workspace
).
*/
public static final String VAR_WORKSPACE = "workspace"; //$NON-NLS-1$
@@ -162,7 +171,8 @@ public interface IExternalToolConstants {
public static final String VAR_PROJECT = "project"; //$NON-NLS-1$
/**
- * Variable that expands to the container resource (value container
).
+ * Variable that expands to the container resource (value
+ * container
).
*/
public static final String VAR_CONTAINER = "container"; //$NON-NLS-1$
@@ -172,32 +182,33 @@ public interface IExternalToolConstants {
public static final String VAR_RESOURCE = "resource"; //$NON-NLS-1$
/**
- * Variable that expands to the working set object (value working_set
).
+ * Variable that expands to the working set object (value
+ * working_set
).
*/
public static final String VAR_WORKING_SET = "working_set"; //$NON-NLS-1$
// ------- Build Types -------
/**
- * Build type indicating an incremental project build request for
- * the external tool running as a builder (value incremental
).
+ * Build type indicating an incremental project build request for the
+ * external tool running as a builder (value incremental
).
*/
public static final String BUILD_TYPE_INCREMENTAL = "incremental"; //$NON-NLS-1$
/**
- * Build type indicating a full project build request for
- * the external tool running as a builder (value full
).
+ * Build type indicating a full project build request for the external tool
+ * running as a builder (value full
).
*/
public static final String BUILD_TYPE_FULL = "full"; //$NON-NLS-1$
/**
- * Build type indicating an automatic project build request for
- * the external tool running as a builder (value incremental
).
+ * Build type indicating an automatic project build request for the external
+ * tool running as a builder (value incremental
).
*/
public static final String BUILD_TYPE_AUTO = "auto"; //$NON-NLS-1$
/**
- * Build type indicating an no project build request for
- * the external tool running as a builder (value none
).
+ * Build type indicating an no project build request for the external tool
+ * running as a builder (value none
).
*/
public static final String BUILD_TYPE_NONE = "none"; //$NON-NLS-1$
@@ -205,12 +216,14 @@ public interface IExternalToolConstants {
/**
* External tools wizard banner image
*/
- public static final String IMG_WIZBAN_EXTERNAL_TOOLS = PLUGIN_ID + ".IMG_WIZBAN_EXTERNAL_TOOLS"; //$NON-NLS-1$
+ public static final String IMG_WIZBAN_EXTERNAL_TOOLS = PLUGIN_ID
+ + ".IMG_WIZBAN_EXTERNAL_TOOLS"; //$NON-NLS-1$
/**
* Refresh action image
*/
- public static final String IMG_ACTION_REFRESH = PLUGIN_ID + ".IMG_ACTION_REFRESH"; //$NON-NLS-1$
+ public static final String IMG_ACTION_REFRESH = PLUGIN_ID
+ + ".IMG_ACTION_REFRESH"; //$NON-NLS-1$
/**
* Main tab image.
@@ -225,30 +238,33 @@ public interface IExternalToolConstants {
/**
* Ant Targets tab image.
*/
- public static final String IMG_TAB_ANT_TARGETS = PLUGIN_ID + ".IMG_TAB_ANT_TARGETS"; //$NON-NLS-1$
+ public static final String IMG_TAB_ANT_TARGETS = PLUGIN_ID
+ + ".IMG_TAB_ANT_TARGETS"; //$NON-NLS-1$
// ------- Launch configuration types --------
/**
* Ant launch configuration type identifier.
*/
-// public static final String ID_ANT_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ant.AntLaunchConfigurationType"; //$NON-NLS-1$
-
+ // public static final String ID_ANT_LAUNCH_CONFIGURATION_TYPE =
+ // "org.eclipse.ant.AntLaunchConfigurationType"; //$NON-NLS-1$
/**
* Ant builder launch configuration type identifier. Ant project builders
* are of this type.
*/
-// public static final String ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ant.AntBuilderLaunchConfigurationType"; //$NON-NLS-1$
-
+ // public static final String ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE =
+ // "org.eclipse.ant.AntBuilderLaunchConfigurationType"; //$NON-NLS-1$
/**
* Program launch configuration type identifier.
*/
- public static final String ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE = PLUGIN_ID + ".ProgramLaunchConfigurationType"; //$NON-NLS-1$
-
+ public static final String ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE = PLUGIN_ID
+ + ".ProgramLaunchConfigurationType"; //$NON-NLS-1$
+
/**
* Program builder launch configuration type identifier. Program project
* builders are of this type.
*/
- public static final String ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE = PLUGIN_ID + ".ProgramBuilderLaunchConfigurationType"; //$NON-NLS-1$
+ public static final String ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE = PLUGIN_ID
+ + ".ProgramBuilderLaunchConfigurationType"; //$NON-NLS-1$
// ------- Launch configuration category --------
/**
@@ -257,6 +273,7 @@ public interface IExternalToolConstants {
* launch configuration dialog should belong to this category.
*/
public static final String ID_EXTERNAL_TOOLS_LAUNCH_CATEGORY = "net.sourceforge.phpdt.externaltools"; //$NON-NLS-1$
+
/**
* Identifier for external tools launch configuration builders category.
* Launch configuration types that can be added as project builders should
@@ -270,19 +287,21 @@ public interface IExternalToolConstants {
* tools launch configuration group corresponds to the external tools
* category in run mode.
*/
- //public static final String ID_EXTERNAL_TOOLS_LAUNCH_GROUP = "net.sourceforge.phpdt.externaltools.launchGroup"; //$NON-NLS-1$
+ // public static final String ID_EXTERNAL_TOOLS_LAUNCH_GROUP =
+ // "net.sourceforge.phpdt.externaltools.launchGroup"; //$NON-NLS-1$
/**
* Identifier for external tools launch configuration group
*/
- //public static final String ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_GROUP = "net.sourceforge.phpdt.externaltools.launchGroup.builder"; //$NON-NLS-1$
-
+ // public static final String ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_GROUP =
+ // "net.sourceforge.phpdt.externaltools.launchGroup.builder"; //$NON-NLS-1$
// ------- Common External Tool Launch Configuration Attributes -------
-
/**
* Boolean attribute indicating if external tool output should be captured.
* Default value is false
.
*/
- public static final String ATTR_CAPTURE_OUTPUT = PLUGIN_ID + ".ATTR_CAPTURE_OUTPUT"; //$NON-NLS-1$
+ public static final String ATTR_CAPTURE_OUTPUT = PLUGIN_ID
+ + ".ATTR_CAPTURE_OUTPUT"; //$NON-NLS-1$
+
/**
* String attribute identifying the location of an external. Default value
* is null
. Encoding is tool specific.
@@ -290,54 +309,63 @@ public interface IExternalToolConstants {
public static final String ATTR_LOCATION = PLUGIN_ID + ".ATTR_LOCATION"; //$NON-NLS-1$
/**
- * Boolean attribute indicating if the user should be prompted for
- * arguments before running a tool. Default value is false
.
+ * Boolean attribute indicating if the user should be prompted for arguments
+ * before running a tool. Default value is false
.
*/
- public static final String ATTR_PROMPT_FOR_ARGUMENTS = PLUGIN_ID + ".ATTR_PROMPT_FOR_ARGUMENTS"; //$NON-NLS-1$
+ public static final String ATTR_PROMPT_FOR_ARGUMENTS = PLUGIN_ID
+ + ".ATTR_PROMPT_FOR_ARGUMENTS"; //$NON-NLS-1$
/**
* Boolean attribute indicating if a refresh scope is recursive. Default
* value is false
.
*/
- public static final String ATTR_REFRESH_RECURSIVE = PLUGIN_ID + ".ATTR_REFRESH_RECURSIVE"; //$NON-NLS-1$
+ public static final String ATTR_REFRESH_RECURSIVE = PLUGIN_ID
+ + ".ATTR_REFRESH_RECURSIVE"; //$NON-NLS-1$
/**
* String attribute identifying the scope of resources that should be
* refreshed after an external tool is run. Default value is
* null
, indicating no refresh. Format is ???
*/
- public static final String ATTR_REFRESH_SCOPE = PLUGIN_ID + ".ATTR_REFRESH_SCOPE"; //$NON-NLS-1$
-
+ public static final String ATTR_REFRESH_SCOPE = PLUGIN_ID
+ + ".ATTR_REFRESH_SCOPE"; //$NON-NLS-1$
+
/**
- * String attribute containing an array of build kinds for which an
- * external tool builder should be run.
+ * String attribute containing an array of build kinds for which an external
+ * tool builder should be run.
*/
- public static final String ATTR_RUN_BUILD_KINDS = PLUGIN_ID + ".ATTR_RUN_BUILD_KINDS"; //$NON-NLS-1$
+ public static final String ATTR_RUN_BUILD_KINDS = PLUGIN_ID
+ + ".ATTR_RUN_BUILD_KINDS"; //$NON-NLS-1$
/**
* Boolean attribute indicating if an external tool should be run in the
* background. Default value is false
.
*/
- public static final String ATTR_RUN_IN_BACKGROUND = PLUGIN_ID + ".ATTR_RUN_IN_BACKGROUND"; //$NON-NLS-1$
-
+ public static final String ATTR_RUN_IN_BACKGROUND = PLUGIN_ID
+ + ".ATTR_RUN_IN_BACKGROUND"; //$NON-NLS-1$
+
/**
* Boolean attribute indicating if the console should be shown on external
* tool output. Default value is false
.
*/
- public static final String ATTR_SHOW_CONSOLE = PLUGIN_ID + ".ATTR_SHOW_CONSOLE"; //$NON-NLS-1$
+ public static final String ATTR_SHOW_CONSOLE = PLUGIN_ID
+ + ".ATTR_SHOW_CONSOLE"; //$NON-NLS-1$
/**
* String attribute containing the arguments that should be passed to the
- * tool. Default value is null
, and encoding is tool specific.
+ * tool. Default value is null
, and encoding is tool
+ * specific.
*/
- public static final String ATTR_TOOL_ARGUMENTS = PLUGIN_ID + ".ATTR_TOOL_ARGUMENTS"; //$NON-NLS-1$
+ public static final String ATTR_TOOL_ARGUMENTS = PLUGIN_ID
+ + ".ATTR_TOOL_ARGUMENTS"; //$NON-NLS-1$
/**
* String attribute identifying the working directory of an external tool.
* Default value is null
, which indicates a default working
* directory, which is tool specific.
*/
- public static final String ATTR_WORKING_DIRECTORY = PLUGIN_ID + ".ATTR_WORKING_DIRECTORY"; //$NON-NLS-1$
+ public static final String ATTR_WORKING_DIRECTORY = PLUGIN_ID
+ + ".ATTR_WORKING_DIRECTORY"; //$NON-NLS-1$
// ------- Common Ant Launch Configuration Attributes -------
/**
@@ -345,40 +373,43 @@ public interface IExternalToolConstants {
* null
which indicates that the default target is to be
* executed. Format is a comma separated listing of targets.
*/
- public static final String ATTR_ANT_TARGETS = PLUGIN_ID + ".ATTR_ANT_TARGETS"; //$NON-NLS-1$
+ public static final String ATTR_ANT_TARGETS = PLUGIN_ID
+ + ".ATTR_ANT_TARGETS"; //$NON-NLS-1$
/**
* Map attribute indicating the Ant properties to be defined during the
* build. Default value is null
which indicates no additional
* properties will be defined.
*/
- public static final String ATTR_ANT_PROPERTIES = PLUGIN_ID + ".ATTR_ANT_PROPERTIES"; //$NON-NLS-1$
+ public static final String ATTR_ANT_PROPERTIES = PLUGIN_ID
+ + ".ATTR_ANT_PROPERTIES"; //$NON-NLS-1$
/**
* String attribute indicating the Ant targets to execute. Default value is
* null
which indicates that no additional property files
* will be defined. Format is a comma separated listing of property files.
*/
- //public static final String ATTR_ANT_PROPERTY_FILES = PLUGIN_ID + ".ATTR_ANT_PROPERTY_FILES"; //$NON-NLS-1$
-
+ // public static final String ATTR_ANT_PROPERTY_FILES = PLUGIN_ID +
+ // ".ATTR_ANT_PROPERTY_FILES"; //$NON-NLS-1$
/**
- * String attribute indicating the custom runtime classpath to use for an Ant
- * build. Default value is null
which indicates that the global
- * classpath is to be used. Format is a comma separated listing of URLs.
- */
- //public static final String ATTR_ANT_CUSTOM_CLASSPATH = PLUGIN_ID + ".ATTR_ANT_CUSTOM_CLASSPATH"; //$NON-NLS-1$
-
+ * String attribute indicating the custom runtime classpath to use for an
+ * Ant build. Default value is null
which indicates that the
+ * global classpath is to be used. Format is a comma separated listing of
+ * URLs.
+ */
+ // public static final String ATTR_ANT_CUSTOM_CLASSPATH = PLUGIN_ID +
+ // ".ATTR_ANT_CUSTOM_CLASSPATH"; //$NON-NLS-1$
/**
* String attribute indicating the custom Ant home to use for an Ant build.
- * Default value is null
which indicates that no Ant homeis to
- * be set
+ * Default value is null
which indicates that no Ant homeis
+ * to be set
*/
- //public static final String ATTR_ANT_HOME = PLUGIN_ID + ".ATTR_ANT_HOME"; //$NON-NLS-1$
-
+ // public static final String ATTR_ANT_HOME = PLUGIN_ID + ".ATTR_ANT_HOME";
+ // //$NON-NLS-1$
/**
- * Identifier for ant processes (value ant
). This identifier is
- * set as the value for the IProcess.ATTR_PROCESS_TYPE
+ * Identifier for ant processes (value ant
). This identifier
+ * is set as the value for the IProcess.ATTR_PROCESS_TYPE
* attribute in processes create by the ant launch delegate.
*/
- //public static final String ID_ANT_PROCESS_TYPE = "ant"; //$NON-NLS-1$
+ // public static final String ID_ANT_PROCESS_TYPE = "ant"; //$NON-NLS-1$
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/IRunnerLog.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/IRunnerLog.java
index 5172569..d3a64ac 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/IRunnerLog.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/IRunnerLog.java
@@ -1,42 +1,46 @@
package net.sourceforge.phpdt.externaltools.model;
/**********************************************************************
-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:
+ **********************************************************************/
/**
- * Provides an API for IExternalToolRunner
implementors
- * to log messages captured from the running tool's output.
+ * Provides an API for IExternalToolRunner
implementors to log
+ * messages captured from the running tool's output.
*
* This interface is not be extended nor implemented by clients.
*
*/
public interface IRunnerLog {
public static final int LEVEL_ERROR = 0;
+
public static final int LEVEL_WARNING = 10;
+
public static final int LEVEL_INFO = 20;
+
public static final int LEVEL_VERBOSE = 30;
+
public static final int LEVEL_DEBUG = 40;
-
+
/**
- * Places the specified message text into the log. Ignored
- * if the specified message level is higher than the
- * current filter level.
+ * Places the specified message text into the log. Ignored if the specified
+ * message level is higher than the current filter level.
*
- * @param message the text to add to the log
- * @param level the message priority
+ * @param message
+ * the text to add to the log
+ * @param level
+ * the message priority
*/
public void append(String message, int level);
-
+
/**
- * Returns the current level used for filtering
- * messages. Any calls to append
with
- * a level greater than this filter value will be
+ * Returns the current level used for filtering messages. Any calls to
+ * append
with a level greater than this filter value will be
* ignored.
*/
public int getFilterLevel();
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/StringMatcher.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/StringMatcher.java
index e4c530b..797be51 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/StringMatcher.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/StringMatcher.java
@@ -1,74 +1,90 @@
package net.sourceforge.phpdt.externaltools.model;
+
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. 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
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. 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
+ **********************************************************************/
import java.util.Vector;
/**
* Copied from net.sourceforge.phpdt.internal.ui.util.StringMatcher
*
- * A string pattern matcher, suppporting * and ? wildcards.
+ * A string pattern matcher, suppporting * and ? wildcards.
*/
public class StringMatcher {
protected String fPattern;
+
protected int fLength; // pattern length
+
protected boolean fIgnoreWildCards;
+
protected boolean fIgnoreCase;
+
protected boolean fHasLeadingStar;
+
protected boolean fHasTrailingStar;
- protected String fSegments[]; //the given pattern is split into * separated segments
- /* boundary value beyond which we don't need to search in the text */
- protected int fBound= 0;
+ protected String fSegments[]; // the given pattern is split into *
+ // separated segments
+ /* boundary value beyond which we don't need to search in the text */
+ protected int fBound = 0;
- protected static final char fSingleWildCard= '\u0000';
+ protected static final char fSingleWildCard = '\u0000';
public static class Position {
- int start; //inclusive
- int end; //exclusive
+ int start; // inclusive
+
+ int end; // exclusive
+
public Position(int start, int end) {
- this.start= start;
- this.end= end;
+ this.start = start;
+ this.end = end;
}
+
public int getStart() {
return start;
}
+
public int getEnd() {
return end;
}
}
+
/**
* StringMatcher constructor takes in a String object that is a simple
- * pattern which may contain �*� for 0 and many characters and
- * �?� for exactly one character.
- *
- * Literal '*' and '?' characters must be escaped in the pattern
- * e.g., "\*" means literal "*", etc.
- *
+ * pattern which may contain �*� for 0 and many characters and �?� for
+ * exactly one character.
+ *
+ * Literal '*' and '?' characters must be escaped in the pattern e.g., "\*"
+ * means literal "*", etc.
+ *
* Escaping any other character (including the escape character itself),
- * just results in that character in the pattern.
- * e.g., "\a" means "a" and "\\" means "\"
- *
+ * just results in that character in the pattern. e.g., "\a" means "a" and
+ * "\\" means "\"
+ *
* If invoking the StringMatcher with string literals in Java, don't forget
* escape characters are represented by "\\".
- *
- * @param pattern the pattern to match text against
- * @param ignoreCase if true, case is ignored
- * @param ignoreWildCards if true, wild cards and their escape sequences are ignored
- * (everything is taken literally).
+ *
+ * @param pattern
+ * the pattern to match text against
+ * @param ignoreCase
+ * if true, case is ignored
+ * @param ignoreWildCards
+ * if true, wild cards and their escape sequences are ignored
+ * (everything is taken literally).
*/
- public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) {
+ public StringMatcher(String pattern, boolean ignoreCase,
+ boolean ignoreWildCards) {
if (pattern == null)
throw new IllegalArgumentException();
- fIgnoreCase= ignoreCase;
- fIgnoreWildCards= ignoreWildCards;
- fPattern= pattern;
- fLength= pattern.length();
+ fIgnoreCase = ignoreCase;
+ fIgnoreWildCards = ignoreWildCards;
+ fPattern = pattern;
+ fLength = pattern.length();
if (fIgnoreWildCards) {
parseNoWildCards();
@@ -76,8 +92,10 @@ public class StringMatcher {
parseWildCards();
}
}
+
/**
- * Find the first occurrence of the pattern between start
start
end(exclusive).
* @param text
, the String object to search in
* @param start
, the starting index of the search range, inclusive
@@ -93,56 +111,64 @@ public class StringMatcher {
if (text == null)
throw new IllegalArgumentException();
- int tlen= text.length();
+ int tlen = text.length();
if (start < 0)
- start= 0;
+ start = 0;
if (end > tlen)
- end= tlen;
- if (end < 0 ||start >= end )
+ end = tlen;
+ if (end < 0 || start >= end)
return null;
if (fLength == 0)
return new Position(start, start);
if (fIgnoreWildCards) {
- int x= posIn(text, start, end);
+ int x = posIn(text, start, end);
if (x < 0)
return null;
- return new Position(x, x+fLength);
+ return new Position(x, x + fLength);
}
- int segCount= fSegments.length;
- if (segCount == 0)//pattern contains only '*'(s)
- return new Position (start, end);
+ int segCount = fSegments.length;
+ if (segCount == 0)// pattern contains only '*'(s)
+ return new Position(start, end);
- int curPos= start;
- int matchStart= -1;
+ int curPos = start;
+ int matchStart = -1;
int i;
- for (i= 0; i < segCount && curPos < end; ++i) {
- String current= fSegments[i];
- int nextMatch= regExpPosIn(text, curPos, end, current);
- if (nextMatch < 0 )
+ for (i = 0; i < segCount && curPos < end; ++i) {
+ String current = fSegments[i];
+ int nextMatch = regExpPosIn(text, curPos, end, current);
+ if (nextMatch < 0)
return null;
- if(i == 0)
- matchStart= nextMatch;
- curPos= nextMatch + current.length();
+ if (i == 0)
+ matchStart = nextMatch;
+ curPos = nextMatch + current.length();
}
if (i < segCount)
return null;
return new Position(matchStart, curPos);
}
+
/**
* match the given text
with the pattern
+ *
* @return true if matched eitherwise false
* @param text
, a String object
*/
public boolean match(String text) {
return match(text, 0, text.length());
}
+
/**
- * Given the starting (inclusive) and the ending (exclusive) positions in the
- * text
, determine if the given substring matches with aPattern
+ * Given the starting (inclusive) and the ending (exclusive) positions in
+ * the text
, determine if the given substring matches with
+ * aPattern
+ *
* @return true if the specified portion of the text matches the pattern
- * @param String text
, a String object that contains the substring to match
- * @param int start marks the starting position (inclusive) of the substring
+ * @param String
+ * text
, a String object that contains the
+ * substring to match
+ * @param int
+ * start marks the starting position (inclusive) of the substring
* @param int end marks the ending index (exclusive) of the substring
*/
public boolean match(String text, int start, int end) {
@@ -153,123 +179,135 @@ public class StringMatcher {
return false;
if (fIgnoreWildCards)
- return (end - start == fLength) && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength);
- int segCount= fSegments.length;
- if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) // pattern contains only '*'(s)
+ return (end - start == fLength)
+ && fPattern.regionMatches(fIgnoreCase, 0, text, start,
+ fLength);
+ int segCount = fSegments.length;
+ if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) // pattern
+ // contains
+ // only
+ // '*'(s)
return true;
if (start == end)
return fLength == 0;
if (fLength == 0)
return start == end;
- int tlen= text.length();
+ int tlen = text.length();
if (start < 0)
- start= 0;
+ start = 0;
if (end > tlen)
- end= tlen;
+ end = tlen;
- int tCurPos= start;
- int bound= end - fBound;
- if ( bound < 0)
+ int tCurPos = start;
+ int bound = end - fBound;
+ if (bound < 0)
return false;
- int i=0;
- String current= fSegments[i];
- int segLength= current.length();
+ int i = 0;
+ String current = fSegments[i];
+ int segLength = current.length();
/* process first segment */
- if (!fHasLeadingStar){
- if(!regExpRegionMatches(text, start, current, 0, segLength)) {
+ if (!fHasLeadingStar) {
+ if (!regExpRegionMatches(text, start, current, 0, segLength)) {
return false;
} else {
++i;
- tCurPos= tCurPos + segLength;
+ tCurPos = tCurPos + segLength;
}
}
/* process middle segments */
while (i < segCount) {
- current= fSegments[i];
+ current = fSegments[i];
int currentMatch;
- int k= current.indexOf(fSingleWildCard);
+ int k = current.indexOf(fSingleWildCard);
if (k < 0) {
- currentMatch= textPosIn(text, tCurPos, end, current);
+ currentMatch = textPosIn(text, tCurPos, end, current);
if (currentMatch < 0)
return false;
} else {
- currentMatch= regExpPosIn(text, tCurPos, end, current);
+ currentMatch = regExpPosIn(text, tCurPos, end, current);
if (currentMatch < 0)
return false;
}
- tCurPos= currentMatch + current.length();
+ tCurPos = currentMatch + current.length();
i++;
}
/* process final segment */
if (!fHasTrailingStar && tCurPos != end) {
- int clen= current.length();
+ int clen = current.length();
return regExpRegionMatches(text, end - clen, current, 0, clen);
}
- return i == segCount ;
+ return i == segCount;
}
+
/**
- * This method parses the given pattern into segments seperated by wildcard '*' characters.
- * Since wildcards are not being used in this case, the pattern consists of a single segment.
+ * This method parses the given pattern into segments seperated by wildcard
+ * '*' characters. Since wildcards are not being used in this case, the
+ * pattern consists of a single segment.
*/
private void parseNoWildCards() {
- fSegments= new String[1];
- fSegments[0]= fPattern;
- fBound= fLength;
+ fSegments = new String[1];
+ fSegments[0] = fPattern;
+ fBound = fLength;
}
+
/**
- * Parses the given pattern into segments seperated by wildcard '*' characters.
- * @param p, a String object that is a simple regular expression with �*� and/or �?�
+ * Parses the given pattern into segments seperated by wildcard '*'
+ * characters.
+ *
+ * @param p,
+ * a String object that is a simple regular expression with �*�
+ * and/or �?�
*/
private void parseWildCards() {
- if(fPattern.startsWith("*"))//$NON-NLS-1$
- fHasLeadingStar= true;
- if(fPattern.endsWith("*")) {//$NON-NLS-1$
+ if (fPattern.startsWith("*"))//$NON-NLS-1$
+ fHasLeadingStar = true;
+ if (fPattern.endsWith("*")) {//$NON-NLS-1$
/* make sure it's not an escaped wildcard */
if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
- fHasTrailingStar= true;
+ fHasTrailingStar = true;
}
}
- Vector temp= new Vector();
+ Vector temp = new Vector();
- int pos= 0;
- StringBuffer buf= new StringBuffer();
+ int pos = 0;
+ StringBuffer buf = new StringBuffer();
while (pos < fLength) {
- char c= fPattern.charAt(pos++);
+ char c = fPattern.charAt(pos++);
switch (c) {
- case '\\':
- if (pos >= fLength) {
- buf.append(c);
+ case '\\':
+ if (pos >= fLength) {
+ buf.append(c);
+ } else {
+ char next = fPattern.charAt(pos++);
+ /* if it's an escape sequence */
+ if (next == '*' || next == '?' || next == '\\') {
+ buf.append(next);
} else {
- char next= fPattern.charAt(pos++);
- /* if it's an escape sequence */
- if (next == '*' || next == '?' || next == '\\') {
- buf.append(next);
- } else {
- /* not an escape sequence, just insert literally */
- buf.append(c);
- buf.append(next);
- }
+ /* not an escape sequence, just insert literally */
+ buf.append(c);
+ buf.append(next);
}
+ }
break;
- case '*':
- if (buf.length() > 0) {
- /* new segment */
- temp.addElement(buf.toString());
- fBound += buf.length();
- buf.setLength(0);
- }
+ case '*':
+ if (buf.length() > 0) {
+ /* new segment */
+ temp.addElement(buf.toString());
+ fBound += buf.length();
+ buf.setLength(0);
+ }
break;
- case '?':
- /* append special character representing single match wildcard */
- buf.append(fSingleWildCard);
+ case '?':
+ /* append special character representing single match wildcard */
+ buf.append(fSingleWildCard);
break;
- default:
- buf.append(c);
+ default:
+ buf.append(c);
}
}
@@ -279,63 +317,77 @@ public class StringMatcher {
fBound += buf.length();
}
- fSegments= new String[temp.size()];
+ fSegments = new String[temp.size()];
temp.copyInto(fSegments);
}
+
/**
* @param text
, a string which contains no wildcard
- * @param start
, the starting index in the text for search, inclusive
+ * @param start
, the starting index in the text for search,
+ * inclusive
* @param end
, the stopping point of search, exclusive
- * @return the starting index in the text of the pattern , or -1 if not found
+ * @return the starting index in the text of the pattern , or -1 if not
+ * found
*/
- protected int posIn(String text, int start, int end) {//no wild card in pattern
- int max= end - fLength;
+ protected int posIn(String text, int start, int end) {// no wild card in
+ // pattern
+ int max = end - fLength;
if (!fIgnoreCase) {
- int i= text.indexOf(fPattern, start);
+ int i = text.indexOf(fPattern, start);
if (i == -1 || i > max)
return -1;
return i;
}
- for (int i= start; i <= max; ++i) {
+ for (int i = start; i <= max; ++i) {
if (text.regionMatches(true, i, fPattern, 0, fLength))
return i;
}
return -1;
}
+
/**
- * @param text
, a simple regular expression that may only contain '?'(s)
- * @param start
, the starting index in the text for search, inclusive
+ * @param text
, a simple regular expression that may only
+ * contain '?'(s)
+ * @param start
, the starting index in the text for search,
+ * inclusive
* @param end
, the stopping point of search, exclusive
* @param p
, a simple regular expression that may contains '?'
* @param caseIgnored
, wether the pattern is not casesensitive
- * @return the starting index in the text of the pattern , or -1 if not found
+ * @return the starting index in the text of the pattern , or -1 if not
+ * found
*/
protected int regExpPosIn(String text, int start, int end, String p) {
- int plen= p.length();
+ int plen = p.length();
- int max= end - plen;
- for (int i= start; i <= max; ++i) {
+ int max = end - plen;
+ for (int i = start; i <= max; ++i) {
if (regExpRegionMatches(text, i, p, 0, plen))
return i;
}
return -1;
}
+
/**
- *
+ *
* @return boolean
* @param text
, a String to match
- * @param start
, int that indicates the starting index of match, inclusive
- * @param end
int that indicates the ending index of match, exclusive
- * @param p
, String, String, a simple regular expression that may contain '?'
- * @param ignoreCase
, boolean indicating wether code>p
is case sensitive
+ * @param start
, int that indicates the starting index of
+ * match, inclusive
+ * @param end
int that indicates the ending index of match,
+ * exclusive
+ * @param p
, String, String, a simple regular expression that
+ * may contain '?'
+ * @param ignoreCase
, boolean indicating wether code>p
+ * is case sensitive
*/
- protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
+ protected boolean regExpRegionMatches(String text, int tStart, String p,
+ int pStart, int plen) {
while (plen-- > 0) {
- char tchar= text.charAt(tStart++);
- char pchar= p.charAt(pStart++);
+ char tchar = text.charAt(tStart++);
+ char pchar = p.charAt(pStart++);
/* process wild cards */
if (!fIgnoreWildCards) {
@@ -347,38 +399,47 @@ public class StringMatcher {
if (pchar == tchar)
continue;
if (fIgnoreCase) {
- if (Character.toUpperCase(tchar) == Character.toUpperCase(pchar))
+ if (Character.toUpperCase(tchar) == Character
+ .toUpperCase(pchar))
continue;
- // comparing after converting to upper case doesn't handle all cases;
+ // comparing after converting to upper case doesn't handle all
+ // cases;
// also compare after converting to lower case
- if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar))
+ if (Character.toLowerCase(tchar) == Character
+ .toLowerCase(pchar))
continue;
}
return false;
}
return true;
}
+
/**
* @param text
, the string to match
- * @param start
, the starting index in the text for search, inclusive
+ * @param start
, the starting index in the text for search,
+ * inclusive
* @param end
, the stopping point of search, exclusive
- * @param code>p
, a string that has no wildcard
- * @param ignoreCase
, boolean indicating wether code>p
is case sensitive
- * @return the starting index in the text of the pattern , or -1 if not found
+ * @param code>p
+ *
, a string that has no wildcard
+ * @param
+ * ignoreCase
, boolean indicating wether code>p
+ * is case sensitive
+ * @return the starting index in the text of the pattern , or -1 if not
+ * found
*/
protected int textPosIn(String text, int start, int end, String p) {
- int plen= p.length();
- int max= end - plen;
+ int plen = p.length();
+ int max = end - plen;
if (!fIgnoreCase) {
- int i= text.indexOf(p, start);
+ int i = text.indexOf(p, start);
if (i == -1 || i > max)
return -1;
return i;
}
- for (int i= start; i <= max; ++i) {
+ for (int i = start; i <= max; ++i) {
if (text.regionMatches(true, i, p, 0, plen))
return i;
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/ToolUtil.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/ToolUtil.java
index 13d90a6..88002f5 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/ToolUtil.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/model/ToolUtil.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.model;
/**********************************************************************
-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.util.ArrayList;
@@ -30,16 +30,22 @@ public final class ToolUtil {
* Argument parsing constants
*/
private static final char ARG_DELIMITER = ' '; //$NON-NLS-1$
+
private static final char ARG_DBL_QUOTE = '"'; //$NON-NLS-1$
-
+
/**
* Variable tag indentifiers
*/
private static final char VAR_TAG_START_CHAR1 = '$'; //$NON-NLS-1$
+
private static final char VAR_TAG_START_CHAR2 = '{'; //$NON-NLS-1$
+
private static final char VAR_TAG_END_CHAR1 = '}'; //$NON-NLS-1$
+
private static final String VAR_TAG_START = "${"; //$NON-NLS-1$
+
private static final String VAR_TAG_END = "}"; //$NON-NLS-1$
+
private static final String VAR_TAG_SEP = ":"; //$NON-NLS-1$
/**
@@ -50,27 +56,35 @@ public final class ToolUtil {
}
/**
- * Builds a variable tag that will be auto-expanded before
- * the tool is run.
+ * Builds a variable tag that will be auto-expanded before the tool is run.
*
- * @param varName the name of a known variable (one of the VAR_* constants for instance)
- * @param varArgument an optional argument for the variable, null
if none
+ * @param varName
+ * the name of a known variable (one of the VAR_* constants for
+ * instance)
+ * @param varArgument
+ * an optional argument for the variable, null
if
+ * none
*/
public static String buildVariableTag(String varName, String varArgument) {
StringBuffer buf = new StringBuffer();
- buildVariableTag(varName,varArgument, buf);
+ buildVariableTag(varName, varArgument, buf);
return buf.toString();
}
-
+
/**
- * Builds a variable tag that will be auto-expanded before
- * the tool is run.
+ * Builds a variable tag that will be auto-expanded before the tool is run.
*
- * @param varName the name of a known variable (one of the VAR_* constants for instance)
- * @param varArgument an optional argument for the variable, null
if none
- * @param buffer the buffer to write the constructed variable tag
+ * @param varName
+ * the name of a known variable (one of the VAR_* constants for
+ * instance)
+ * @param varArgument
+ * an optional argument for the variable, null
if
+ * none
+ * @param buffer
+ * the buffer to write the constructed variable tag
*/
- public static void buildVariableTag(String varName, String varArgument, StringBuffer buffer) {
+ public static void buildVariableTag(String varName, String varArgument,
+ StringBuffer buffer) {
buffer.append(VAR_TAG_START);
buffer.append(varName);
if (varArgument != null && varArgument.length() > 0) {
@@ -79,23 +93,27 @@ public final class ToolUtil {
}
buffer.append(VAR_TAG_END);
}
-
+
/**
- * Expands all the variables found in an individual
- * argument text.
+ * Expands all the variables found in an individual argument text.
*
- * @param argument one of the argument text in the list of arguments
- * @param context the context to use for expanding variables
- * @param status multi status to report any problems expanding variables
- * @return the argument text with all variables expanded, or null
if not possible
+ * @param argument
+ * one of the argument text in the list of arguments
+ * @param context
+ * the context to use for expanding variables
+ * @param status
+ * multi status to report any problems expanding variables
+ * @return the argument text with all variables expanded, or
+ * null
if not possible
*/
- public static String expandArgument(String argument, ExpandVariableContext context, MultiStatus status) {
+ public static String expandArgument(String argument,
+ ExpandVariableContext context, MultiStatus status) {
StringBuffer buffer = new StringBuffer();
-
+
int start = 0;
while (true) {
VariableDefinition varDef = extractVariableTag(argument, start);
-
+
// No more variables found...
if (varDef.start == -1) {
if (start == 0)
@@ -106,74 +124,92 @@ public final class ToolUtil {
}
// Invalid variable format
- if (varDef.end == -1 || varDef.name == null || varDef.name.length() == 0) {
- String msg = ExternalToolsModelMessages.getString("ToolUtil.argumentVarFormatWrong"); //$NON-NLS-1$
+ if (varDef.end == -1 || varDef.name == null
+ || varDef.name.length() == 0) {
+ String msg = ExternalToolsModelMessages
+ .getString("ToolUtil.argumentVarFormatWrong"); //$NON-NLS-1$
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
- // Copy text between start and variable.
+ // Copy text between start and variable.
if (varDef.start > start)
buffer.append(argument.substring(start, varDef.start));
start = varDef.end;
-
+
// Lookup the variable if it exist
ArgumentVariableRegistry registry;
- registry = ExternalToolsPlugin.getDefault().getArgumentVariableRegistry();
- ArgumentVariable variable = registry.getArgumentVariable(varDef.name);
+ registry = ExternalToolsPlugin.getDefault()
+ .getArgumentVariableRegistry();
+ ArgumentVariable variable = registry
+ .getArgumentVariable(varDef.name);
if (variable == null) {
- String msg = ExternalToolsModelMessages.format("ToolUtil.argumentVarMissing", new Object[] {varDef.name}); //$NON-NLS-1$
+ String msg = ExternalToolsModelMessages
+ .format(
+ "ToolUtil.argumentVarMissing", new Object[] { varDef.name }); //$NON-NLS-1$
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
-
+
// Expand the variable as text if possible
- String text = variable.getExpander().getText(varDef.name, varDef.argument, context);
+ String text = variable.getExpander().getText(varDef.name,
+ varDef.argument, context);
if (text == null) {
- String msg = ExternalToolsModelMessages.format("ToolUtil.argumentVarExpandFailed", new Object[] {varDef.name}); //$NON-NLS-1$
+ String msg = ExternalToolsModelMessages
+ .format(
+ "ToolUtil.argumentVarExpandFailed", new Object[] { varDef.name }); //$NON-NLS-1$
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
buffer.append(text);
}
-
+
return buffer.toString();
}
-
+
/**
- * Returns a list of individual arguments where all
- * variables have been expanded.
+ * Returns a list of individual arguments where all variables have been
+ * expanded.
*
- * @param arguments the arguments with leading and trailing
- * spaces already removed.
- * @param context the context used to expand the variable(s)
- * @param status multi status to report any problems expanding variables
- * @return the list of individual arguments where some elements in the
- * list maybe null
if problems expanding variable(s).
+ * @param arguments
+ * the arguments with leading and trailing spaces already
+ * removed.
+ * @param context
+ * the context used to expand the variable(s)
+ * @param status
+ * multi status to report any problems expanding variables
+ * @return the list of individual arguments where some elements in the list
+ * maybe null
if problems expanding variable(s).
*/
- public static String[] expandArguments(String arguments, ExpandVariableContext context, MultiStatus status) {
+ public static String[] expandArguments(String arguments,
+ ExpandVariableContext context, MultiStatus status) {
if (arguments == null || arguments.length() == 0)
return new String[0];
String[] argList = parseArgumentsIntoList(arguments);
for (int i = 0; i < argList.length; i++)
argList[i] = expandArgument(argList[i], context, status);
-
+
return argList;
}
-
+
/**
- * Returns the expanded directory location if represented by a
- * directory variable. Otherwise, the directory location given is
- * return unless an unknown variable was detected.
+ * Returns the expanded directory location if represented by a directory
+ * variable. Otherwise, the directory location given is return unless an
+ * unknown variable was detected.
*
- * @param dirLocation a directory location either as a path or a variable
- * with leading and trailing spaces already removed.
- * @param context the context used to expand the variable
- * @param status multi status to report any problems expanding variables
- * @return the directory location as a string or null
if not possible
+ * @param dirLocation
+ * a directory location either as a path or a variable with
+ * leading and trailing spaces already removed.
+ * @param context
+ * the context used to expand the variable
+ * @param status
+ * multi status to report any problems expanding variables
+ * @return the directory location as a string or null
if not
+ * possible
*/
- public static String expandDirectoryLocation(String dirLocation, ExpandVariableContext context, MultiStatus status) {
+ public static String expandDirectoryLocation(String dirLocation,
+ ExpandVariableContext context, MultiStatus status) {
if (dirLocation == null || dirLocation.length() == 0)
return ""; //$NON-NLS-1$
@@ -181,54 +217,69 @@ public final class ToolUtil {
// Return if no variable found
if (varDef.start < 0)
return dirLocation;
-
+
// Disallow text before/after variable
- if (varDef.start != 0 || (varDef.end < dirLocation.length() && varDef.end != -1)) {
- String msg = ExternalToolsModelMessages.getString("ToolUtil.dirLocVarBetweenText"); //$NON-NLS-1$
+ if (varDef.start != 0
+ || (varDef.end < dirLocation.length() && varDef.end != -1)) {
+ String msg = ExternalToolsModelMessages
+ .getString("ToolUtil.dirLocVarBetweenText"); //$NON-NLS-1$
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
-
+
// Invalid variable format
- if (varDef.name == null || varDef.name.length() == 0 || varDef.end == -1) {
- String msg = ExternalToolsModelMessages.getString("ToolUtil.dirLocVarFormatWrong"); //$NON-NLS-1$
+ if (varDef.name == null || varDef.name.length() == 0
+ || varDef.end == -1) {
+ String msg = ExternalToolsModelMessages
+ .getString("ToolUtil.dirLocVarFormatWrong"); //$NON-NLS-1$
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
-
+
// Lookup the variable if it exist
PathLocationVariableRegistry registry;
- registry = ExternalToolsPlugin.getDefault().getDirectoryLocationVariableRegistry();
- PathLocationVariable variable = registry.getPathLocationVariable(varDef.name);
+ registry = ExternalToolsPlugin.getDefault()
+ .getDirectoryLocationVariableRegistry();
+ PathLocationVariable variable = registry
+ .getPathLocationVariable(varDef.name);
if (variable == null) {
- String msg = ExternalToolsModelMessages.format("ToolUtil.dirLocVarMissing", new Object[] {varDef.name}); //$NON-NLS-1$
+ String msg = ExternalToolsModelMessages.format(
+ "ToolUtil.dirLocVarMissing", new Object[] { varDef.name }); //$NON-NLS-1$
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
-
+
// Expand the variable into a IPath if possible
- IPath path = variable.getExpander().getPath(varDef.name, varDef.argument, context);
+ IPath path = variable.getExpander().getPath(varDef.name,
+ varDef.argument, context);
if (path == null) {
- String msg = ExternalToolsModelMessages.format("ToolUtil.dirLocVarExpandFailed", new Object[] {varDef.name}); //$NON-NLS-1$
+ String msg = ExternalToolsModelMessages
+ .format(
+ "ToolUtil.dirLocVarExpandFailed", new Object[] { varDef.name }); //$NON-NLS-1$
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
-
+
return path.toOSString();
}
-
+
/**
- * Returns the expanded file location if represented by a
- * file variable. Otherwise, the file location given is
- * return unless an unknown variable was detected.
+ * Returns the expanded file location if represented by a file variable.
+ * Otherwise, the file location given is return unless an unknown variable
+ * was detected.
*
- * @param fileLocation a file location either as a path or a variable
- * with leading and trailing spaces already removed.
- * @param context the context used to expand the variable
- * @param status multi status to report any problems expanding variables
- * @return the file location as a string or null
if not possible
+ * @param fileLocation
+ * a file location either as a path or a variable with leading
+ * and trailing spaces already removed.
+ * @param context
+ * the context used to expand the variable
+ * @param status
+ * multi status to report any problems expanding variables
+ * @return the file location as a string or null
if not
+ * possible
*/
- public static String expandFileLocation(String fileLocation, ExpandVariableContext context, MultiStatus status) {
+ public static String expandFileLocation(String fileLocation,
+ ExpandVariableContext context, MultiStatus status) {
if (fileLocation == null || fileLocation.length() == 0)
return ""; //$NON-NLS-1$
@@ -236,65 +287,77 @@ public final class ToolUtil {
// Return if no variable found
if (varDef.start < 0)
return fileLocation;
-
+
// Disallow text before/after variable
- if (varDef.start != 0 || (varDef.end < fileLocation.length() && varDef.end != -1)) {
- String msg = ExternalToolsModelMessages.getString("ToolUtil.fileLocVarBetweenText"); //$NON-NLS-1$
+ if (varDef.start != 0
+ || (varDef.end < fileLocation.length() && varDef.end != -1)) {
+ String msg = ExternalToolsModelMessages
+ .getString("ToolUtil.fileLocVarBetweenText"); //$NON-NLS-1$
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
-
+
// Invalid variable format
- if (varDef.name == null || varDef.name.length() == 0 || varDef.end == -1) {
- String msg = ExternalToolsModelMessages.getString("ToolUtil.fileLocVarFormatWrong"); //$NON-NLS-1$
+ if (varDef.name == null || varDef.name.length() == 0
+ || varDef.end == -1) {
+ String msg = ExternalToolsModelMessages
+ .getString("ToolUtil.fileLocVarFormatWrong"); //$NON-NLS-1$
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
-
+
// Lookup the variable if it exist
PathLocationVariableRegistry registry;
- registry = ExternalToolsPlugin.getDefault().getFileLocationVariableRegistry();
- PathLocationVariable variable = registry.getPathLocationVariable(varDef.name);
+ registry = ExternalToolsPlugin.getDefault()
+ .getFileLocationVariableRegistry();
+ PathLocationVariable variable = registry
+ .getPathLocationVariable(varDef.name);
if (variable == null) {
- String msg = ExternalToolsModelMessages.format("ToolUtil.fileLocVarMissing", new Object[] {varDef.name}); //$NON-NLS-1$
+ String msg = ExternalToolsModelMessages.format(
+ "ToolUtil.fileLocVarMissing", new Object[] { varDef.name }); //$NON-NLS-1$
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
-
+
// Expand the variable into a IPath if possible
- IPath path = variable.getExpander().getPath(varDef.name, varDef.argument, context);
+ IPath path = variable.getExpander().getPath(varDef.name,
+ varDef.argument, context);
if (path == null) {
- String msg = ExternalToolsModelMessages.format("The variable {0} with argument {1} could not be expanded to a valid path.", new Object[] {varDef.name, varDef.argument});
+ String msg = ExternalToolsModelMessages
+ .format(
+ "The variable {0} with argument {1} could not be expanded to a valid path.",
+ new Object[] { varDef.name, varDef.argument });
status.merge(ExternalToolsPlugin.newErrorStatus(msg, null));
return null;
}
-
+
return path.toString();
}
-
+
/**
- * Extracts from the source text the variable tag's name
- * and argument.
+ * Extracts from the source text the variable tag's name and argument.
*
- * @param text the source text to parse for a variable tag
- * @param start the index in the string to start the search
+ * @param text
+ * the source text to parse for a variable tag
+ * @param start
+ * the index in the string to start the search
* @return the variable definition
*/
public static VariableDefinition extractVariableTag(String text, int start) {
VariableDefinition varDef = new VariableDefinition();
-
+
varDef.start = text.indexOf(VAR_TAG_START, start);
if (varDef.start < 0)
return varDef;
start = varDef.start + VAR_TAG_START.length();
-
+
int end = text.indexOf(VAR_TAG_END, start);
if (end < 0)
return varDef;
varDef.end = end + VAR_TAG_END.length();
if (end == start)
return varDef;
-
+
int mid = text.indexOf(VAR_TAG_SEP, start);
if (mid < 0 || mid > end) {
varDef.name = text.substring(start, end);
@@ -305,140 +368,135 @@ public final class ToolUtil {
if (mid < end)
varDef.argument = text.substring(mid, end);
}
-
+
return varDef;
}
-
+
/**
- * Parses the argument text into an array of individual
- * arguments using the space character as the delimiter.
- * An individual argument containing spaces must have a
- * double quote (") at the start and end. Two double
- * quotes together is taken to mean an embedded double
- * quote in the argument text. Variables are treated as
- * a single unit and therefore spaces and double quotes
- * inside a variable are copied as is and not parsed.
+ * Parses the argument text into an array of individual arguments using the
+ * space character as the delimiter. An individual argument containing
+ * spaces must have a double quote (") at the start and end. Two double
+ * quotes together is taken to mean an embedded double quote in the argument
+ * text. Variables are treated as a single unit and therefore spaces and
+ * double quotes inside a variable are copied as is and not parsed.
*
- * @param arguments the arguments as one string
+ * @param arguments
+ * the arguments as one string
* @return the array of arguments
*/
public static String[] parseArgumentsIntoList(String arguments) {
if (arguments == null || arguments.length() == 0)
return new String[0];
-
+
ArrayList list = new ArrayList(10);
boolean inQuotes = false;
boolean inVar = false;
int start = 0;
int end = arguments.length();
StringBuffer buffer = new StringBuffer(end);
-
+
while (start < end) {
char ch = arguments.charAt(start);
start++;
-
+
switch (ch) {
- case ARG_DELIMITER :
- if (inQuotes || inVar) {
- buffer.append(ch);
- } else {
- if (buffer.length() > 0) {
- list.add(buffer.toString());
- buffer.setLength(0);
- }
+ case ARG_DELIMITER:
+ if (inQuotes || inVar) {
+ buffer.append(ch);
+ } else {
+ if (buffer.length() > 0) {
+ list.add(buffer.toString());
+ buffer.setLength(0);
}
- break;
+ }
+ break;
- case ARG_DBL_QUOTE :
- if (inVar) {
- buffer.append(ch);
- } else {
- if (start < end) {
- if (arguments.charAt(start) == ARG_DBL_QUOTE) {
- // Two quotes together represents one quote
- buffer.append(ch);
- start++;
- } else {
- inQuotes = !inQuotes;
- }
- } else {
- // A lone quote at the end, just drop it.
- inQuotes = false;
- }
- }
- break;
-
- case VAR_TAG_START_CHAR1 :
+ case ARG_DBL_QUOTE:
+ if (inVar) {
buffer.append(ch);
- if (!inVar && start < end) {
- if (arguments.charAt(start) == VAR_TAG_START_CHAR2) {
- buffer.append(VAR_TAG_START_CHAR2);
- inVar = true;
+ } else {
+ if (start < end) {
+ if (arguments.charAt(start) == ARG_DBL_QUOTE) {
+ // Two quotes together represents one quote
+ buffer.append(ch);
start++;
+ } else {
+ inQuotes = !inQuotes;
}
+ } else {
+ // A lone quote at the end, just drop it.
+ inQuotes = false;
+ }
+ }
+ break;
+
+ case VAR_TAG_START_CHAR1:
+ buffer.append(ch);
+ if (!inVar && start < end) {
+ if (arguments.charAt(start) == VAR_TAG_START_CHAR2) {
+ buffer.append(VAR_TAG_START_CHAR2);
+ inVar = true;
+ start++;
}
- break;
+ }
+ break;
- case VAR_TAG_END_CHAR1 :
- buffer.append(ch);
- inVar = false;
- break;
+ case VAR_TAG_END_CHAR1:
+ buffer.append(ch);
+ inVar = false;
+ break;
- default :
- buffer.append(ch);
- break;
+ default:
+ buffer.append(ch);
+ break;
}
-
+
}
-
+
if (buffer.length() > 0)
list.add(buffer.toString());
-
+
String[] results = new String[list.size()];
list.toArray(results);
return results;
}
-
/**
- * Structure to represent a variable definition within a
- * source string.
+ * Structure to represent a variable definition within a source string.
*/
public static final class VariableDefinition {
/**
- * Index in the source text where the variable started
- * or -1
if no valid variable start tag
- * identifier found.
+ * Index in the source text where the variable started or
+ * -1
if no valid variable start tag identifier found.
*/
public int start = -1;
-
+
/**
- * Index in the source text of the character following
- * the end of the variable or -1
if no
- * valid variable end tag found.
+ * Index in the source text of the character following the end of the
+ * variable or -1
if no valid variable end tag found.
*/
public int end = -1;
-
+
/**
- * The variable's name found in the source text, or
- * null
if no valid variable found.
+ * The variable's name found in the source text, or null
+ * if no valid variable found.
*/
public String name = null;
-
+
/**
* The variable's argument found in the source text, or
- * null
if no valid variable found or if
- * the variable did not specify an argument
+ * null
if no valid variable found or if the variable did
+ * not specify an argument
*/
public String argument = null;
-
+
/**
* Create an initialized variable definition.
*/
private VariableDefinition() {
super();
}
-
+
/**
* Create an initialized variable definition.
*/
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/ApachePrefencePage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/ApachePrefencePage.java
index 1f410f3..6cd1984 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/ApachePrefencePage.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/ApachePrefencePage.java
@@ -51,7 +51,7 @@ public class ApachePrefencePage extends PreferencePage implements
apacheStartSFE = new StringFieldEditor(
ExternalToolsPlugin.APACHE_START_PREF, PHPPreferencesMessages
.getString("PHPBasePreferencePage.apacheGroup.start"),
- composite);
+ composite);
apacheStartSFE.setPage(this);
apacheStartSFE.setPreferenceStore(getPreferenceStore());
apacheStartSFE.load();
@@ -62,17 +62,16 @@ public class ApachePrefencePage extends PreferencePage implements
ExternalToolsPlugin.APACHE_START_BACKGROUND,
PHPPreferencesMessages
.getString("PHPBasePreferencePage.apacheGroup.start_background"),
- composite);
+ composite);
apacheStartBFE.setPage(this);
apacheStartBFE.setPreferenceStore(getPreferenceStore());
apacheStartBFE.load();
new Label(composite, SWT.NONE);
-
apacheStopSFE = new StringFieldEditor(
ExternalToolsPlugin.APACHE_STOP_PREF, PHPPreferencesMessages
.getString("PHPBasePreferencePage.apacheGroup.stop"),
- composite);
+ composite);
apacheStopSFE.setPage(this);
apacheStopSFE.setPreferenceStore(getPreferenceStore());
apacheStopSFE.load();
@@ -83,18 +82,17 @@ public class ApachePrefencePage extends PreferencePage implements
ExternalToolsPlugin.APACHE_STOP_BACKGROUND,
PHPPreferencesMessages
.getString("PHPBasePreferencePage.apacheGroup.stop_background"),
- composite);
+ composite);
apacheStopBFE.setPage(this);
apacheStopBFE.setPreferenceStore(getPreferenceStore());
apacheStopBFE.load();
new Label(composite, SWT.NONE);
-
apacheRestartSFE = new StringFieldEditor(
ExternalToolsPlugin.APACHE_RESTART_PREF,
PHPPreferencesMessages
.getString("PHPBasePreferencePage.apacheGroup.restart"),
- composite);
+ composite);
apacheRestartSFE.setPage(this);
apacheRestartSFE.setPreferenceStore(getPreferenceStore());
apacheRestartSFE.load();
@@ -105,17 +103,16 @@ public class ApachePrefencePage extends PreferencePage implements
ExternalToolsPlugin.APACHE_RESTART_BACKGROUND,
PHPPreferencesMessages
.getString("PHPBasePreferencePage.apacheGroup.restart_background"),
- composite);
+ composite);
apacheRestartBFE.setPage(this);
apacheRestartBFE.setPreferenceStore(getPreferenceStore());
apacheRestartBFE.load();
new Label(composite, SWT.NONE);
-
apacheRunFFE = new FileFieldEditor(ExternalToolsPlugin.APACHE_RUN_PREF,
PHPPreferencesMessages
.getString("PHPBasePreferencePage.apacheGroup.run"),
- composite);
+ composite);
apacheRunFFE.setPage(this);
apacheRunFFE.setPreferenceStore(getPreferenceStore());
apacheRunFFE.load();
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/MySQLPreferencePage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/MySQLPreferencePage.java
index 11875a3..cf0c8aa 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/MySQLPreferencePage.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/MySQLPreferencePage.java
@@ -40,7 +40,7 @@ public class MySQLPreferencePage extends PreferencePage implements
ExternalToolsPlugin.MYSQL_START_BACKGROUND,
PHPPreferencesMessages
.getString("PHPBasePreferencePage.mySQLGroup.start_background"),
- composite);
+ composite);
mysqlStartBFE.setPage(this);
mysqlStartBFE.setPreferenceStore(getPreferenceStore());
mysqlStartBFE.load();
@@ -50,7 +50,7 @@ public class MySQLPreferencePage extends PreferencePage implements
mySQLCommandSFE = new StringFieldEditor(ExternalToolsPlugin.MYSQL_PREF,
PHPPreferencesMessages
.getString("PHPBasePreferencePage.mySQLGroup.command"),
- composite);
+ composite);
mySQLCommandSFE.setPage(this);
mySQLCommandSFE.setPreferenceStore(getPreferenceStore());
mySQLCommandSFE.load();
@@ -59,7 +59,7 @@ public class MySQLPreferencePage extends PreferencePage implements
mysqlRunFFE = new FileFieldEditor(ExternalToolsPlugin.MYSQL_RUN_PREF,
PHPPreferencesMessages
.getString("PHPBasePreferencePage.mySQLGroup.run"),
- composite);
+ composite);
mysqlRunFFE.setPage(this);
mysqlRunFFE.setPreferenceStore(getPreferenceStore());
mysqlRunFFE.load();
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java
index f730439..ec95211 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPExternalToolsPreferencePage.java
@@ -65,7 +65,7 @@ public class PHPExternalToolsPreferencePage extends PreferencePage implements
externalParserSFE.load();
new Label(composite, SWT.NONE);
- composite.setLayout(new GridLayout(3,false));
+ composite.setLayout(new GridLayout(3, false));
return composite;
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPPreferencesMessages.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPPreferencesMessages.java
index 6eecbdc..c1dbe52 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPPreferencesMessages.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/PHPPreferencesMessages.java
@@ -6,8 +6,11 @@ import java.util.ResourceBundle;
public class PHPPreferencesMessages {
- private static final String RESOURCE_BUNDLE= PHPPreferencesMessages.class.getName();
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ private static final String RESOURCE_BUNDLE = PHPPreferencesMessages.class
+ .getName();
+
+ private static ResourceBundle fgResourceBundle = ResourceBundle
+ .getBundle(RESOURCE_BUNDLE);
private PHPPreferencesMessages() {
}
@@ -19,20 +22,20 @@ public class PHPPreferencesMessages {
return '!' + key + '!';
}
}
-
+
/**
* Gets a string from the resource bundle and formats it with the argument
*
- * @param key the string used to get the bundle value, must not be null
+ * @param key
+ * the string used to get the bundle value, must not be null
*/
public static String getFormattedString(String key, Object arg) {
return MessageFormat.format(getString(key), new Object[] { arg });
}
-
/**
* Gets a string from the resource bundle and formats it with arguments
- */
+ */
public static String getFormattedString(String key, Object[] args) {
return MessageFormat.format(getString(key), args);
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/XamppPrefencePage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/XamppPrefencePage.java
index a6c001f..af1fefa 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/XamppPrefencePage.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/preferences/XamppPrefencePage.java
@@ -44,7 +44,7 @@ public class XamppPrefencePage extends PreferencePage implements
ExternalToolsPlugin.XAMPP_STOP_PREF,
PHPPreferencesMessages
.getString("PHPBasePreferencePage.apacheGroup.xampp_stop"),
- composite);
+ composite);
xamppStopSFE.setPage(this);
xamppStopSFE.setPreferenceStore(getPreferenceStore());
xamppStopSFE.load();
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/util/StringUtil.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/util/StringUtil.java
index c5ef81d..75bc572 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/util/StringUtil.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/util/StringUtil.java
@@ -6,29 +6,33 @@ package net.sourceforge.phpdt.externaltools.util;
/**
* some string utilities
- *
+ *
*/
public class StringUtil {
- /**
- * Replace each substring of str which matches findStr with replaceStr
- *
- * @param str the string the substrings should be replaced in
- * @param findStr the substring to be replaced
- * @param replaceStr the replacement
- * @return the resultstring
- */
- public static final String replaceAll(String str, String findStr, String replaceStr) {
- StringBuffer buf = new StringBuffer();
+ /**
+ * Replace each substring of str which matches findStr with replaceStr
+ *
+ * @param str
+ * the string the substrings should be replaced in
+ * @param findStr
+ * the substring to be replaced
+ * @param replaceStr
+ * the replacement
+ * @return the resultstring
+ */
+ public static final String replaceAll(String str, String findStr,
+ String replaceStr) {
+ StringBuffer buf = new StringBuffer();
+
+ int lastindex = 0;
+ int indexOf = 0;
+ while ((indexOf = str.indexOf(findStr, lastindex)) != -1) {
+ buf.append(str.substring(lastindex, indexOf)).append(replaceStr);
+ lastindex = indexOf + findStr.length();
+ }
+ buf.append(str.substring(lastindex));
+ return buf.toString();
+ }
- int lastindex = 0;
- int indexOf = 0;
- while ((indexOf=str.indexOf(findStr, lastindex)) != -1) {
- buf.append(str.substring(lastindex, indexOf)).append(replaceStr);
- lastindex = indexOf + findStr.length();
- }
- buf.append(str.substring(lastindex));
- return buf.toString();
- }
-
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/BuildTypeExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/BuildTypeExpander.java
index 306d459..7da48fd 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/BuildTypeExpander.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/BuildTypeExpander.java
@@ -2,7 +2,8 @@ package net.sourceforge.phpdt.externaltools.variable;
public class BuildTypeExpander implements IVariableTextExpander {
- public String getText(String varTag, String varValue, ExpandVariableContext context) {
+ public String getText(String varTag, String varValue,
+ ExpandVariableContext context) {
return context.getBuildType();
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ExpandVariableContext.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ExpandVariableContext.java
index b5eeb46..bfbf30e 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ExpandVariableContext.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ExpandVariableContext.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.variable;
/**********************************************************************
-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 net.sourceforge.phpdt.externaltools.model.IExternalToolConstants;
@@ -16,49 +16,55 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IncrementalProjectBuilder;
/**
- * Represents the context the external tool is running in
- * that a variable uses to expand itself.
+ * Represents the context the external tool is running in that a variable uses
+ * to expand itself.
*/
public final class ExpandVariableContext {
- public static final ExpandVariableContext EMPTY_CONTEXT = new ExpandVariableContext(null);
-
+ public static final ExpandVariableContext EMPTY_CONTEXT = new ExpandVariableContext(
+ null);
+
private IProject project = null;
+
private IResource selectedResource = null;
+
private String buildType = IExternalToolConstants.BUILD_TYPE_NONE;
-
+
/**
- * Create a context for an external tool running
- * as a builder on the given project.
+ * Create a context for an external tool running as a builder on the given
+ * project.
*
- * @param project the IProject
being built.
- * @param buildKind the kind of build being performed
- * (see IncrementalProjectBuilder
).
+ * @param project
+ * the IProject
being built.
+ * @param buildKind
+ * the kind of build being performed (see
+ * IncrementalProjectBuilder
).
*/
public ExpandVariableContext(IProject project, int buildKind) {
super();
this.project = project;
switch (buildKind) {
- case IncrementalProjectBuilder.INCREMENTAL_BUILD :
- this.buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL;
- break;
- case IncrementalProjectBuilder.FULL_BUILD :
- this.buildType = IExternalToolConstants.BUILD_TYPE_FULL;
- break;
- case IncrementalProjectBuilder.AUTO_BUILD :
- this.buildType = IExternalToolConstants.BUILD_TYPE_AUTO;
- break;
- default :
- this.buildType = IExternalToolConstants.BUILD_TYPE_NONE;
- break;
+ case IncrementalProjectBuilder.INCREMENTAL_BUILD:
+ this.buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL;
+ break;
+ case IncrementalProjectBuilder.FULL_BUILD:
+ this.buildType = IExternalToolConstants.BUILD_TYPE_FULL;
+ break;
+ case IncrementalProjectBuilder.AUTO_BUILD:
+ this.buildType = IExternalToolConstants.BUILD_TYPE_AUTO;
+ break;
+ default:
+ this.buildType = IExternalToolConstants.BUILD_TYPE_NONE;
+ break;
}
}
-
+
/**
- * Create a context for an external tool running
- * with the given resource selected.
+ * Create a context for an external tool running with the given resource
+ * selected.
*
- * @param selectedResource the IResource
selected
- * or null
if none.
+ * @param selectedResource
+ * the IResource
selected or null
+ * if none.
*/
public ExpandVariableContext(IResource selectedResource) {
super();
@@ -67,34 +73,35 @@ public final class ExpandVariableContext {
this.project = selectedResource.getProject();
}
}
-
+
/**
- * Returns the build type being performed if the
- * external tool is being run as a project builder.
+ * Returns the build type being performed if the external tool is being run
+ * as a project builder.
*
- * @return one of the IExternalToolConstants.BUILD_TYPE_*
constants.
+ * @return one of the IExternalToolConstants.BUILD_TYPE_*
+ * constants.
*/
public String getBuildType() {
return buildType;
}
-
+
/**
- * Returns the project which the variable can use. This
- * will the the project being built if the tool is being
- * run as a builder. Otherwise, it is the project of the
- * selected resource, or null
if none.
+ * Returns the project which the variable can use. This will the the project
+ * being built if the tool is being run as a builder. Otherwise, it is the
+ * project of the selected resource, or null
if none.
*
* @return the IProject
or null
if none
*/
public IProject getProject() {
return project;
}
-
+
/**
- * Returns the resource selected at the time the tool
- * is run, or null
if none selected.
+ * Returns the resource selected at the time the tool is run, or
+ * null
if none selected.
*
- * @return the IResource
selected, or null
if none
+ * @return the IResource
selected, or null
if
+ * none
*/
public IResource getSelectedResource() {
return selectedResource;
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/FileExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/FileExpander.java
index 17779cb..2313ea4 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/FileExpander.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/FileExpander.java
@@ -3,32 +3,35 @@ package net.sourceforge.phpdt.externaltools.variable;
import org.eclipse.core.runtime.IPath;
/**
- * Expands a variable into the last opened PHP file
+ * Expands a variable into the last opened PHP file
* * This class is not intended to be extended by clients. *
*/ -public class FileExpander extends ResourceExpander { //implements IVariableTextExpander { +public class FileExpander extends ResourceExpander { // implements + // IVariableTextExpander + // { - /** - * Create an instance - */ - public FileExpander() { - super(); - } + /** + * Create an instance + */ + public FileExpander() { + super(); + } - /** - * Returns a string representation of the path to a file or directory - * for the given variable tag and value ornull
.
- *
- * @see IVariableTextExpander#getText(String, String, ExpandVariableContext)
- */
- public String getText(String varTag, String varValue, ExpandVariableContext context) {
- IPath path = getPath(varTag, varValue, context);
- if (path != null) {
- return path.toString();
- }
- return "null
.
+ *
+ * @see IVariableTextExpander#getText(String, String, ExpandVariableContext)
+ */
+ public String getText(String varTag, String varValue,
+ ExpandVariableContext context) {
+ IPath path = getPath(varTag, varValue, context);
+ if (path != null) {
+ return path.toString();
+ }
+ return "- * This interface is not to be extended by clients. Clients - * may implement this interface. + * This interface is not to be extended by clients. Clients may implement this + * interface. *
*/ public interface IVariableComponent { /** - * Returns the control to edit the variable - * value, otherwisenull
if no editing
- * supported or if createContents
has
- * not been called yet
+ * Returns the control to edit the variable value, otherwise
+ * null
if no editing supported or if
+ * createContents
has not been called yet
*
- * @return the main control for the variable component
- * or null
if none
+ * @return the main control for the variable component or null
+ * if none
*/
public Control getControl();
-
+
/**
- * Creates the control to edit the variable. Does nothing
- * if no editing supported.
+ * Creates the control to edit the variable. Does nothing if no editing
+ * supported.
*
- * @param parent the composite to parent all controls to
- * @param varTag the variable tag name to create the controls for
- * @param page the dialog page this visual component will be part of
+ * @param parent
+ * the composite to parent all controls to
+ * @param varTag
+ * the variable tag name to create the controls for
+ * @param page
+ * the dialog page this visual component will be part of
*/
- public void createContents(Composite parent, String varTag, IGroupDialogPage page);
+ public void createContents(Composite parent, String varTag,
+ IGroupDialogPage page);
/**
- * Returns the variable value as specified by
- * the user thru the visual component.
+ * Returns the variable value as specified by the user thru the visual
+ * component.
*
* @return the variable value as indicated by the visual component
*/
public String getVariableValue();
/**
- * Returns whether the variable's visual component has an
- * acceptable value.
+ * Returns whether the variable's visual component has an acceptable value.
*
- * @return true
if all value acceptable, or false
otherwise
+ * @return true
if all value acceptable, or
+ * false
otherwise
*/
public boolean isValid();
/**
- * Sets the visual component to represent the
- * given variable value.
+ * Sets the visual component to represent the given variable value.
*
- * @param varValue the variable value the visual component should indicate
+ * @param varValue
+ * the variable value the visual component should indicate
*/
public void setVariableValue(String varValue);
/**
- * Validates visual component current values entered by the
- * user and updates it's valid state if needed
+ * Validates visual component current values entered by the user and updates
+ * it's valid state if needed
*/
public void validate();
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableLocationExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableLocationExpander.java
index 0a79960..c2b6b3c 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableLocationExpander.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableLocationExpander.java
@@ -1,39 +1,42 @@
package net.sourceforge.phpdt.externaltools.variable;
/**********************************************************************
-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 org.eclipse.core.runtime.IPath;
/**
- * Responsible for expanding a variable into the location
- * path of a file or directory.
+ * Responsible for expanding a variable into the location path of a file or
+ * directory.
* - * Implementation of this interface will be treated like - * a singleton. That is, only one instance will be created - * per variable extension. - *
- * This interface is not to be extended by clients. Clients - * may implement this interface. + * Implementation of this interface will be treated like a singleton. That is, + * only one instance will be created per variable extension. + *
+ *+ * This interface is not to be extended by clients. Clients may implement this + * interface. *
*/ public interface IVariableLocationExpander { /** - * Returns the path location to a file or directory - * for the given variable tag and value. The path does - * not need to exist. + * Returns the path location to a file or directory for the given variable + * tag and value. The path does not need to exist. * - * @param varTag the variable tag name - * @param varValue the value for the variable - * @param context the context the variable should use to expand itself - * @return theIPath
to a file/directory
- * or null
if not possible
+ * @param varTag
+ * the variable tag name
+ * @param varValue
+ * the value for the variable
+ * @param context
+ * the context the variable should use to expand itself
+ * @return the IPath
to a file/directory or null
+ * if not possible
*/
- public IPath getPath(String varTag, String varValue, ExpandVariableContext context);
+ public IPath getPath(String varTag, String varValue,
+ ExpandVariableContext context);
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableResourceExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableResourceExpander.java
index a1aac20..c044e1c 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableResourceExpander.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableResourceExpander.java
@@ -1,38 +1,41 @@
package net.sourceforge.phpdt.externaltools.variable;
/**********************************************************************
-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 org.eclipse.core.resources.IResource;
/**
- * Responsible for expanding a variable into a list of
- * IResource
.
+ * Responsible for expanding a variable into a list of IResource
.
* - * Implementation of this interface will be treated like - * a singleton. That is, only one instance will be created - * per variable extension. - *
- * This interface is not to be extended by clients. Clients - * may implement this interface. + * Implementation of this interface will be treated like a singleton. That is, + * only one instance will be created per variable extension. + *
+ *+ * This interface is not to be extended by clients. Clients may implement this + * interface. *
*/ public interface IVariableResourceExpander { /** - * Returns theIResource
list
- * for the given variable tag and value.
+ * Returns the IResource
list for the given variable tag and
+ * value.
*
- * @param varTag the variable tag name
- * @param varValue the value for the variable
- * @param context the context the variable should use to expand itself
- * @return the list of IResource
or null
if not
- * possible (note, elements of the list can be null
)
+ * @param varTag
+ * the variable tag name
+ * @param varValue
+ * the value for the variable
+ * @param context
+ * the context the variable should use to expand itself
+ * @return the list of IResource
or null
if
+ * not possible (note, elements of the list can be null
)
*/
- public IResource[] getResources(String varTag, String varValue, ExpandVariableContext context);
+ public IResource[] getResources(String varTag, String varValue,
+ ExpandVariableContext context);
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableTextExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableTextExpander.java
index 16ee242..77c13ec 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableTextExpander.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableTextExpander.java
@@ -1,35 +1,38 @@
package net.sourceforge.phpdt.externaltools.variable;
/**********************************************************************
-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:
+ **********************************************************************/
/**
* Responsible for expanding a variable into text format.
* - * Implementation of this interface will be treated like - * a singleton. That is, only one instance will be created - * per variable extension. - *
- * This interface is not to be extended by clients. Clients - * may implement this interface. + * Implementation of this interface will be treated like a singleton. That is, + * only one instance will be created per variable extension. + *
+ *+ * This interface is not to be extended by clients. Clients may implement this + * interface. *
*/ public interface IVariableTextExpander { /** - * Returns the expanded text for the given variable - * tag and value. + * Returns the expanded text for the given variable tag and value. * - * @param varTag the variable tag name - * @param varValue the value for the variable - * @param context the context the variable should use to expand itself - * @return the text of the expanded variable - * ornull
if not possible
+ * @param varTag
+ * the variable tag name
+ * @param varValue
+ * the value for the variable
+ * @param context
+ * the context the variable should use to expand itself
+ * @return the text of the expanded variable or null
if not
+ * possible
*/
- public String getText(String varTag, String varValue, ExpandVariableContext context);
+ public String getText(String varTag, String varValue,
+ ExpandVariableContext context);
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/LocalhostExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/LocalhostExpander.java
index 857168b..b4883d6 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/LocalhostExpander.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/LocalhostExpander.java
@@ -12,9 +12,11 @@ import org.eclipse.jface.preference.IPreferenceStore;
*/
public class LocalhostExpander implements IVariableTextExpander {
- public String getText(String varTag, String varValue, ExpandVariableContext context) {
- final IPreferenceStore webUIStore = WebUI.getDefault().getPreferenceStore();
- return webUIStore.getString(WebUI.PHP_LOCALHOST_PREF);
- }
+ public String getText(String varTag, String varValue,
+ ExpandVariableContext context) {
+ final IPreferenceStore webUIStore = WebUI.getDefault()
+ .getPreferenceStore();
+ return webUIStore.getString(WebUI.PHP_LOCALHOST_PREF);
+ }
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ProjectNameExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ProjectNameExpander.java
index 11fe671..df87812 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ProjectNameExpander.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ProjectNameExpander.java
@@ -8,11 +8,12 @@ import org.eclipse.core.resources.IProject;
public class ProjectNameExpander implements IVariableTextExpander {
/**
- * Returns the name of the project in the given context or
- * null
if there is no project in the context.
+ * Returns the name of the project in the given context or null
+ * if there is no project in the context.
*/
- public String getText(String varTag, String varValue, ExpandVariableContext context) {
- IProject project= context.getProject();
+ public String getText(String varTag, String varValue,
+ ExpandVariableContext context) {
+ IProject project = context.getProject();
if (project != null) {
return project.getName();
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceComponent.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceComponent.java
index 143a6e6..a4b422b 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceComponent.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceComponent.java
@@ -1,13 +1,13 @@
package net.sourceforge.phpdt.externaltools.variable;
/**********************************************************************
-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 net.sourceforge.phpdt.externaltools.group.IGroupDialogPage;
import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages;
@@ -35,22 +35,26 @@ import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
/**
- * Visual component to edit the resource type variable
- * value.
+ * Visual component to edit the resource type variable value.
* * This class is not intended to be extended by clients. *
*/ public class ResourceComponent implements IVariableComponent { private IGroupDialogPage page; + private boolean isValid = true; - + protected Group mainGroup; + protected Button selectedResourceButton; + protected Button specificResourceButton; + protected TreeViewer resourceList; + private IResource selectedResource; - + /** * Creates the component */ @@ -58,12 +62,13 @@ public class ResourceComponent implements IVariableComponent { super(); } - /* (non-Javadoc) - * Method declared on IVariableComponent. + /* + * (non-Javadoc) Method declared on IVariableComponent. */ - public void createContents(Composite parent, String varTag, IGroupDialogPage page) { + public void createContents(Composite parent, String varTag, + IGroupDialogPage page) { this.page = page; - + // main composite mainGroup = new Group(parent, SWT.NONE); GridLayout layout = new GridLayout(); @@ -75,11 +80,11 @@ public class ResourceComponent implements IVariableComponent { mainGroup.setLayoutData(gridData); mainGroup.setFont(parent.getFont()); mainGroup.setText(ToolUtil.buildVariableTag(varTag, null)); - + createSelectedResourceOption(); createSpecificResourceOption(); createResourceList(); - + updateResourceListEnablement(); } @@ -92,53 +97,55 @@ public class ResourceComponent implements IVariableComponent { data.heightHint = tree.getItemHeight() * getInitialVisibleItemCount(); tree.setLayoutData(data); tree.setFont(mainGroup.getFont()); - + resourceList = new TreeViewer(tree); - resourceList.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - validateResourceListSelection(); - selectedResource= (IResource) ((IStructuredSelection)event.getSelection()).getFirstElement(); - } - }); + resourceList + .addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + validateResourceListSelection(); + selectedResource = (IResource) ((IStructuredSelection) event + .getSelection()).getFirstElement(); + } + }); resourceList.setContentProvider(new WorkbenchContentProvider()); resourceList.setLabelProvider(new WorkbenchLabelProvider()); resourceList.setInput(ResourcesPlugin.getWorkspace().getRoot()); } - + /** - * Creates the option button for using the selected - * resource. + * Creates the option button for using the selected resource. */ protected void createSelectedResourceOption() { selectedResourceButton = new Button(mainGroup, SWT.RADIO); - selectedResourceButton.setText(ExternalToolsModelMessages.getString("ResourceComponent.selectedResLabel")); //$NON-NLS-1$ + selectedResourceButton.setText(ExternalToolsModelMessages + .getString("ResourceComponent.selectedResLabel")); //$NON-NLS-1$ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); selectedResourceButton.setLayoutData(data); selectedResourceButton.setFont(mainGroup.getFont()); selectedResourceButton.setSelection(true); } - + /** - * Creates the option button for using a specific - * resource. + * Creates the option button for using a specific resource. */ protected void createSpecificResourceOption() { specificResourceButton = new Button(mainGroup, SWT.RADIO); - specificResourceButton.setText(ExternalToolsModelMessages.getString("ResourceComponent.specificResLabel")); //$NON-NLS-1$ + specificResourceButton.setText(ExternalToolsModelMessages + .getString("ResourceComponent.specificResLabel")); //$NON-NLS-1$ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); specificResourceButton.setLayoutData(data); specificResourceButton.setFont(mainGroup.getFont()); specificResourceButton.setSelection(false); - + specificResourceButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateResourceListEnablement(); } }); } - - /* (non-Javadoc) - * Method declared on IVariableComponent. + + /* + * (non-Javadoc) Method declared on IVariableComponent. */ public Control getControl() { return mainGroup; @@ -150,44 +157,46 @@ public class ResourceComponent implements IVariableComponent { protected final IGroupDialogPage getPage() { return page; } - - /* (non-Javadoc) - * Method declared on IVariableComponent. + + /* + * (non-Javadoc) Method declared on IVariableComponent. */ public String getVariableValue() { - if (selectedResourceButton != null && selectedResourceButton.getSelection()) + if (selectedResourceButton != null + && selectedResourceButton.getSelection()) return null; - + if (resourceList != null) { if (selectedResource != null) return selectedResource.getFullPath().toString(); } - + return null; } /** - * Returns the number of items to be visible in the - * resource list. This will determine the initial height. + * Returns the number of items to be visible in the resource list. This will + * determine the initial height. */ protected int getInitialVisibleItemCount() { return 10; } - - /* (non-Javadoc) - * Method declared on IVariableComponent. + + /* + * (non-Javadoc) Method declared on IVariableComponent. */ public boolean isValid() { return isValid; } /** - * Sets whether the component's values are all valid. - * Updates the components's page valid state. No action - * taken if new valid state same as current one. + * Sets whether the component's values are all valid. Updates the + * components's page valid state. No action taken if new valid state same as + * current one. * - * @param isValidtrue
if all values valid,
- * false
otherwise
+ * @param isValid
+ * true
if all values valid, false
+ * otherwise
*/
protected final void setIsValid(boolean isValid) {
if (this.isValid != isValid) {
@@ -195,17 +204,18 @@ public class ResourceComponent implements IVariableComponent {
this.page.updateValidState();
}
}
-
+
/**
* Updates the enablement of the resource list if needed
*/
protected void updateResourceListEnablement() {
if (specificResourceButton != null && resourceList != null)
- resourceList.getTree().setEnabled(specificResourceButton.getSelection());
+ resourceList.getTree().setEnabled(
+ specificResourceButton.getSelection());
}
-
- /* (non-Javadoc)
- * Method declared on IVariableComponent.
+
+ /*
+ * (non-Javadoc) Method declared on IVariableComponent.
*/
public void setVariableValue(String varValue) {
if (varValue == null || varValue.length() == 0) {
@@ -222,20 +232,23 @@ public class ResourceComponent implements IVariableComponent {
specificResourceButton.setSelection(true);
if (resourceList != null) {
resourceList.getTree().setEnabled(true);
- IResource member = ResourcesPlugin.getWorkspace().getRoot().findMember(varValue);
+ IResource member = ResourcesPlugin.getWorkspace().getRoot()
+ .findMember(varValue);
if (member != null)
- resourceList.setSelection(new StructuredSelection(member), true);
+ resourceList.setSelection(new StructuredSelection(member),
+ true);
else
resourceList.setSelection(StructuredSelection.EMPTY);
}
}
}
-
- /* (non-Javadoc)
- * Method declared on IVariableComponent.
+
+ /*
+ * (non-Javadoc) Method declared on IVariableComponent.
*/
public void validate() {
- if (specificResourceButton != null && specificResourceButton.getSelection()) {
+ if (specificResourceButton != null
+ && specificResourceButton.getSelection()) {
validateResourceListSelection();
}
@@ -244,22 +257,25 @@ public class ResourceComponent implements IVariableComponent {
}
/**
- * Returns whether that the resource list selection is valid.
- * If the list was not created, returns true
.
+ * Returns whether that the resource list selection is valid. If the list
+ * was not created, returns true
.
*
- * @return true
to continue validating other
- * fields, false
to stop.
+ * @return true
to continue validating other fields,
+ * false
to stop.
*/
protected boolean validateResourceListSelection() {
if (resourceList == null)
return true;
if (resourceList.getSelection().isEmpty()) {
- getPage().setMessage(ExternalToolsModelMessages.getString("ResourceComponent.selectionRequired"), IMessageProvider.WARNING); //$NON-NLS-1$
+ getPage()
+ .setMessage(
+ ExternalToolsModelMessages
+ .getString("ResourceComponent.selectionRequired"), IMessageProvider.WARNING); //$NON-NLS-1$
setIsValid(false);
return false;
}
-
+
return true;
}
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceContainerExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceContainerExpander.java
index 5e8bf04..837c8bd 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceContainerExpander.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceContainerExpander.java
@@ -1,19 +1,18 @@
package net.sourceforge.phpdt.externaltools.variable;
/**********************************************************************
-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 org.eclipse.core.resources.IResource;
/**
- * Expands a resource's container type variable into the desired
- * result format.
+ * Expands a resource's container type variable into the desired result format.
* * This class is not intended to be extended by clients. *
@@ -27,10 +26,10 @@ public class ResourceContainerExpander extends ResourceExpander { super(); } - /* (non-Javadoc) - * Method declared on ResourceExpander. + /* + * (non-Javadoc) Method declared on ResourceExpander. */ - /*package*/ IResource expand(String varValue, ExpandVariableContext context) { + /* package */IResource expand(String varValue, ExpandVariableContext context) { IResource resource = super.expand(varValue, context); if (resource != null) return resource.getParent(); diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceExpander.java index fe5cfa8..5fef23e 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceExpander.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceExpander.java @@ -1,13 +1,13 @@ package net.sourceforge.phpdt.externaltools.variable; /********************************************************************** -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 net.sourceforge.phpdt.externaltools.model.IExternalToolConstants; @@ -17,13 +17,13 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; /** - * Expands a resource type variable into the desired - * result format. + * Expands a resource type variable into the desired result format. ** This class is not intended to be extended by clients. *
*/ -public class ResourceExpander implements IVariableLocationExpander, IVariableResourceExpander, IVariableTextExpander { +public class ResourceExpander implements IVariableLocationExpander, + IVariableResourceExpander, IVariableTextExpander { /** * Create an instance @@ -35,36 +35,36 @@ public class ResourceExpander implements IVariableLocationExpander, IVariableRes /** * Expands the variable to a resource. */ - /*package*/ IResource expand(String varValue, ExpandVariableContext context) { + /* package */IResource expand(String varValue, ExpandVariableContext context) { if (varValue != null && varValue.length() > 0) { return expandToMember(varValue); } else { return expandUsingContext(context); } } - + /** - * Expands using the current context information. - * By default, return the selected resource of the - * context. + * Expands using the current context information. By default, return the + * selected resource of the context. */ - /*package*/ IResource expandUsingContext(ExpandVariableContext context) { + /* package */IResource expandUsingContext(ExpandVariableContext context) { return context.getSelectedResource(); } - + /** - * Expands the variable value to a resource. The value - * will not benull
nor empty. By default,
- * lookup the member from the workspace root.
+ * Expands the variable value to a resource. The value will not be
+ * null
nor empty. By default, lookup the member from the
+ * workspace root.
*/
- /*package*/ IResource expandToMember(String varValue) {
+ /* package */IResource expandToMember(String varValue) {
return getWorkspaceRoot().findMember(varValue);
}
-
- /* (non-Javadoc)
- * Method declared on IVariableLocationExpander.
+
+ /*
+ * (non-Javadoc) Method declared on IVariableLocationExpander.
*/
- public IPath getPath(String varTag, String varValue, ExpandVariableContext context) {
+ public IPath getPath(String varTag, String varValue,
+ ExpandVariableContext context) {
IResource resource = expand(varValue, context);
if (resource != null) {
if (isPathVariable(varTag)) {
@@ -76,45 +76,47 @@ public class ResourceExpander implements IVariableLocationExpander, IVariableRes
return null;
}
}
-
+
/**
- * Returns whether the given variable tag is a known path
- * variable tag. Path variable tags represent variables that
- * expand to paths relative to the workspace root.
+ * Returns whether the given variable tag is a known path variable tag. Path
+ * variable tags represent variables that expand to paths relative to the
+ * workspace root.
*/
private boolean isPathVariable(String varTag) {
- return varTag.equals(IExternalToolConstants.VAR_CONTAINER_PATH) ||
- varTag.equals(IExternalToolConstants.VAR_PROJECT_PATH) ||
- varTag.equals(IExternalToolConstants.VAR_RESOURCE_PATH);
+ return varTag.equals(IExternalToolConstants.VAR_CONTAINER_PATH)
+ || varTag.equals(IExternalToolConstants.VAR_PROJECT_PATH)
+ || varTag.equals(IExternalToolConstants.VAR_RESOURCE_PATH);
}
- /* (non-Javadoc)
- * Method declared on IVariableResourceExpander.
+ /*
+ * (non-Javadoc) Method declared on IVariableResourceExpander.
*/
- public IResource[] getResources(String varTag, String varValue, ExpandVariableContext context) {
+ public IResource[] getResources(String varTag, String varValue,
+ ExpandVariableContext context) {
IResource resource = expand(varValue, context);
if (resource != null) {
- return new IResource[] {resource};
+ return new IResource[] { resource };
} else {
return null;
}
}
-
+
/**
* Returns the workspace root resource.
*/
protected final IWorkspaceRoot getWorkspaceRoot() {
return ResourcesPlugin.getWorkspace().getRoot();
}
-
+
/**
- * Returns a string representation of the path to a file or directory
- * for the given variable tag and value or null
.
+ * Returns a string representation of the path to a file or directory for
+ * the given variable tag and value or null
.
*
* @see IVariableTextExpander#getText(String, String, ExpandVariableContext)
*/
- public String getText(String varTag, String varValue, ExpandVariableContext context) {
- IPath path= getPath(varTag, varValue, context);
+ public String getText(String varTag, String varValue,
+ ExpandVariableContext context) {
+ IPath path = getPath(varTag, varValue, context);
if (path != null) {
return path.toString();
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceProjectExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceProjectExpander.java
index 9df7758..fd9014a 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceProjectExpander.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/ResourceProjectExpander.java
@@ -1,19 +1,18 @@
package net.sourceforge.phpdt.externaltools.variable;
/**********************************************************************
-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 org.eclipse.core.resources.IResource;
/**
- * Expands a resource's project type variable into the desired
- * result format.
+ * Expands a resource's project type variable into the desired result format.
* * This class is not intended to be extended by clients. *
@@ -27,17 +26,17 @@ public class ResourceProjectExpander extends ResourceExpander { super(); } - /* (non-Javadoc) - * Method declared on ResourceExpander. + /* + * (non-Javadoc) Method declared on ResourceExpander. */ - /*package*/ IResource expandUsingContext(ExpandVariableContext context) { + /* package */IResource expandUsingContext(ExpandVariableContext context) { return context.getProject(); } - - /* (non-Javadoc) - * Method declared on ResourceExpander. + + /* + * (non-Javadoc) Method declared on ResourceExpander. */ - /*package*/ IResource expandToMember(String varValue) { + /* package */IResource expandToMember(String varValue) { IResource member = super.expandToMember(varValue); if (member != null) return member.getProject(); diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/SpecificFileResourceComponent.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/SpecificFileResourceComponent.java index cdeb292..72bb34a 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/SpecificFileResourceComponent.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/SpecificFileResourceComponent.java @@ -1,13 +1,13 @@ package net.sourceforge.phpdt.externaltools.variable; /********************************************************************** -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 net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages; @@ -19,9 +19,8 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Label; /** - * Visual component to edit the resource type variable - * value for the file location. Variable is limited to a specific - *IFile
resource.
+ * Visual component to edit the resource type variable value for the file
+ * location. Variable is limited to a specific IFile
resource.
* * This class is not intended to be extended by clients. *
@@ -35,39 +34,44 @@ public class SpecificFileResourceComponent extends ResourceComponent { super(); } - /* (non-Javadoc) - * Method declared on ResourceComponent. + /* + * (non-Javadoc) Method declared on ResourceComponent. */ protected void createSelectedResourceOption() { // Do not present this option... } - - /* (non-Javadoc) - * Method declared on ResourceComponent. + + /* + * (non-Javadoc) Method declared on ResourceComponent. */ protected void createSpecificResourceOption() { Label label = new Label(mainGroup, SWT.NONE); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); label.setLayoutData(data); label.setFont(mainGroup.getFont()); - label.setText(ExternalToolsModelMessages.getString("ResourceComponent.specificResLabel")); //$NON-NLS-1$ + label.setText(ExternalToolsModelMessages + .getString("ResourceComponent.specificResLabel")); //$NON-NLS-1$ } - /* (non-Javadoc) - * Method declared on ResourceComponent. + /* + * (non-Javadoc) Method declared on ResourceComponent. */ protected boolean validateResourceListSelection() { if (resourceList == null) return true; - - IStructuredSelection sel = (IStructuredSelection) resourceList.getSelection(); + + IStructuredSelection sel = (IStructuredSelection) resourceList + .getSelection(); IResource resource = (IResource) sel.getFirstElement(); if (resource == null || resource.getType() != IResource.FILE) { - getPage().setMessage(ExternalToolsModelMessages.getString("ResourceComponent.selectionRequired"), IMessageProvider.WARNING); //$NON-NLS-1$ + getPage() + .setMessage( + ExternalToolsModelMessages + .getString("ResourceComponent.selectionRequired"), IMessageProvider.WARNING); //$NON-NLS-1$ setIsValid(false); return false; } - + return true; } } diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/SpecificFolderResourceComponent.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/SpecificFolderResourceComponent.java index e0b4aa7..b217d5c 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/SpecificFolderResourceComponent.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/SpecificFolderResourceComponent.java @@ -1,13 +1,13 @@ package net.sourceforge.phpdt.externaltools.variable; /********************************************************************** -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 net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages; @@ -22,9 +22,9 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Label; /** - * Visual component to edit the resource type variable - * value for the working directory. Variable is limited to a specific - *IContainer
resource.
+ * Visual component to edit the resource type variable value for the working
+ * directory. Variable is limited to a specific IContainer
+ * resource.
* * This class is not intended to be extended by clients. *
@@ -38,15 +38,15 @@ public class SpecificFolderResourceComponent extends ResourceComponent { super(); } - /* (non-Javadoc) - * Method declared on ResourceComponent. + /* + * (non-Javadoc) Method declared on ResourceComponent. */ protected void createSelectedResourceOption() { // Do not present this option... } - - /* (non-Javadoc) - * Method declared on ResourceComponent. + + /* + * (non-Javadoc) Method declared on ResourceComponent. */ protected void createResourceList() { super.createResourceList(); @@ -54,54 +54,60 @@ public class SpecificFolderResourceComponent extends ResourceComponent { resourceList.addFilter(new FileFilter()); } - /* (non-Javadoc) - * Method declared on ResourceComponent. + /* + * (non-Javadoc) Method declared on ResourceComponent. */ protected void createSpecificResourceOption() { Label label = new Label(mainGroup, SWT.NONE); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); label.setLayoutData(data); label.setFont(mainGroup.getFont()); - label.setText(ExternalToolsModelMessages.getString("ResourceComponent.specificResLabel")); //$NON-NLS-1$ + label.setText(ExternalToolsModelMessages + .getString("ResourceComponent.specificResLabel")); //$NON-NLS-1$ } - /* (non-Javadoc) - * Method declared on ResourceComponent. + /* + * (non-Javadoc) Method declared on ResourceComponent. */ protected boolean validateResourceListSelection() { if (resourceList == null) return true; - - IStructuredSelection sel = (IStructuredSelection) resourceList.getSelection(); + + IStructuredSelection sel = (IStructuredSelection) resourceList + .getSelection(); IResource resource = (IResource) sel.getFirstElement(); if (resource == null || resource.getType() == IResource.FILE) { - getPage().setMessage(ExternalToolsModelMessages.getString("ResourceComponent.selectionRequired"), IMessageProvider.WARNING); //$NON-NLS-1$ + getPage() + .setMessage( + ExternalToolsModelMessages + .getString("ResourceComponent.selectionRequired"), IMessageProvider.WARNING); //$NON-NLS-1$ setIsValid(false); return false; } - + return true; } - - + /** * Filter to remove any IFile resources. */ private static final class FileFilter extends ViewerFilter { - /* (non-Javadoc) - * Method declared on ViewerFilter. + /* + * (non-Javadoc) Method declared on ViewerFilter. */ - public boolean select(Viewer viewer, Object parentElement, Object element) { + public boolean select(Viewer viewer, Object parentElement, + Object element) { IResource resource = null; if (element instanceof IResource) { resource = (IResource) element; } else { if (element instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) element; - resource = (IResource) adaptable.getAdapter(IResource.class); + resource = (IResource) adaptable + .getAdapter(IResource.class); } } - + if (resource != null) return resource.getType() != IResource.FILE; else diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/UrlExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/UrlExpander.java index 5971985..88c6d42 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/UrlExpander.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/UrlExpander.java @@ -7,43 +7,47 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.jface.preference.IPreferenceStore; /** - * Expands a variable into a localhost/documentRoot URL string + * Expands a variable into a localhost/documentRoot URL string ** This class is not intended to be extended by clients. *
*/ -public class UrlExpander extends ResourceExpander { //implements IVariableTextExpander { +public class UrlExpander extends ResourceExpander { // implements + // IVariableTextExpander { - /** - * Create an instance - */ - public UrlExpander() { - super(); - } + /** + * Create an instance + */ + public UrlExpander() { + super(); + } - /** - * Returns a string representation to a localhost/documentRoot URL - * for the given variable tag and value ornull
.
- *
- * @see IVariableTextExpander#getText(String, String, ExpandVariableContext)
- */
- public String getText(String varTag, String varValue, ExpandVariableContext context) {
- IPath path = getPath(varTag, varValue, context);
- if (path != null) {
- IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
- String localhostURL = path.toString();
- String lowerCaseFileName = localhostURL.toLowerCase();
- String documentRoot = store.getString(WebUI.PHP_DOCUMENTROOT_PREF);
- documentRoot = documentRoot.replace('\\', '/');
- documentRoot = documentRoot.toLowerCase();
+ /**
+ * Returns a string representation to a localhost/documentRoot URL for the
+ * given variable tag and value or null
.
+ *
+ * @see IVariableTextExpander#getText(String, String, ExpandVariableContext)
+ */
+ public String getText(String varTag, String varValue,
+ ExpandVariableContext context) {
+ IPath path = getPath(varTag, varValue, context);
+ if (path != null) {
+ IPreferenceStore store = ExternalToolsPlugin.getDefault()
+ .getPreferenceStore();
+ String localhostURL = path.toString();
+ String lowerCaseFileName = localhostURL.toLowerCase();
+ String documentRoot = store.getString(WebUI.PHP_DOCUMENTROOT_PREF);
+ documentRoot = documentRoot.replace('\\', '/');
+ documentRoot = documentRoot.toLowerCase();
- if (lowerCaseFileName.startsWith(documentRoot)) {
- localhostURL = localhostURL.substring(documentRoot.length());
- localhostURL = store.getString(WebUI.PHP_LOCALHOST_PREF)+ localhostURL;
- }
- return localhostURL;
- }
- return "* This class is not intended to be extended by clients. *
@@ -30,17 +29,19 @@ public class WorkingSetExpander implements IVariableResourceExpander { super(); } - /* (non-Javadoc) - * Method declared on IVariableResourceExpander. + /* + * (non-Javadoc) Method declared on IVariableResourceExpander. */ - public IResource[] getResources(String varTag, String varValue, ExpandVariableContext context) { + public IResource[] getResources(String varTag, String varValue, + ExpandVariableContext context) { if (varValue == null || varValue.length() == 0) return null; - IWorkingSet set = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(varValue); + IWorkingSet set = PlatformUI.getWorkbench().getWorkingSetManager() + .getWorkingSet(varValue); if (set == null) return null; - + IAdaptable[] elements = set.getElements(); IResource[] resources = new IResource[elements.length]; for (int i = 0; i < elements.length; i++) { @@ -48,9 +49,10 @@ public class WorkingSetExpander implements IVariableResourceExpander { if (adaptable instanceof IResource) resources[i] = (IResource) adaptable; else - resources[i] = (IResource) adaptable.getAdapter(IResource.class); + resources[i] = (IResource) adaptable + .getAdapter(IResource.class); } - + return resources; } } diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/WorkspaceExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/WorkspaceExpander.java index cf2ab3c..5c18add 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/WorkspaceExpander.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/WorkspaceExpander.java @@ -1,19 +1,18 @@ package net.sourceforge.phpdt.externaltools.variable; /********************************************************************** -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 org.eclipse.core.resources.IResource; /** - * Expands a workspace variable into the desired - * result format. + * Expands a workspace variable into the desired result format. ** This class is not intended to be extended by clients. *
@@ -27,10 +26,10 @@ public class WorkspaceExpander extends ResourceExpander { super(); } - /* (non-Javadoc) - * Method declared on ResourceExpander. + /* + * (non-Javadoc) Method declared on ResourceExpander. */ - /*package*/ IResource expandUsingContext(ExpandVariableContext context) { + /* package */IResource expandUsingContext(ExpandVariableContext context) { return getWorkspaceRoot(); } } diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/ExternalToolsPlugin.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/ExternalToolsPlugin.java index df3f577..8283e94 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/ExternalToolsPlugin.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/ExternalToolsPlugin.java @@ -43,242 +43,271 @@ import org.osgi.framework.BundleContext; * External tools plug-in class */ public final class ExternalToolsPlugin extends AbstractUIPlugin { - public static final String XAMPP_START_PREF = "_xampp_start_pref"; + public static final String XAMPP_START_PREF = "_xampp_start_pref"; - public static final String XAMPP_STOP_PREF = "_xampp_stop_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_RUN_PREF = "_mysql_run_pref"; - public static final String MYSQL_START_BACKGROUND = "_mysql_start_background"; + public static final String MYSQL_START_BACKGROUND = "_mysql_start_background"; - public static final String MYSQL_PREF = "__mysql_start"; + public static final String MYSQL_PREF = "__mysql_start"; - public static final String APACHE_RUN_PREF = "_apache_run_pref"; + 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_BACKGROUND = "_apache_start_background"; - public static final String APACHE_START_PREF = "__apache_start"; + 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_BACKGROUND = "_apache_stop_background"; - public static final String APACHE_STOP_PREF = "__apache_stop"; + 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_BACKGROUND = "_apache_restart_background"; - public static final String APACHE_RESTART_PREF = "__apache_restart"; + public static final String APACHE_RESTART_PREF = "__apache_restart"; - public static final String HTTPD_CONF_PATH_PREF = "__httpd_conf_path"; + public static final String HTTPD_CONF_PATH_PREF = "__httpd_conf_path"; - public static final String ETC_HOSTS_PATH_PREF = "__etc_hosts_path"; - // public static final String SHOW_OUTPUT_IN_CONSOLE = "_show_output_in_console"; + public static final String ETC_HOSTS_PATH_PREF = "__etc_hosts_path"; - public static final String PHP_RUN_PREF = "_php_run_pref"; + // public static final String SHOW_OUTPUT_IN_CONSOLE = + // "_show_output_in_console"; - public static final String EXTERNAL_PARSER_PREF = "_external_parser"; + public static final String PHP_RUN_PREF = "_php_run_pref"; - /** - * Status representing no problems encountered during operation. - */ - public static final IStatus OK_STATUS = new Status(IStatus.OK, IExternalToolConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$ - - private static ExternalToolsPlugin plugin; - - private RefreshScopeVariableRegistry refreshVarRegistry; - - private PathLocationVariableRegistry fileLocVarRegistry; - - private PathLocationVariableRegistry dirLocVarRegistry; - - private ArgumentVariableRegistry argumentVarRegistry; - - - /** - * This version is recommended for eclipse3.0 and above - */ - public ExternalToolsPlugin() { - super(); - plugin = this; - } - - /** - * Returns the default instance of the receiver. This represents the runtime plugin. - */ - public static ExternalToolsPlugin getDefault() { - return plugin; - } - - /** - * Returns a newIStatus
for this plug-in
- */
- public static IStatus newErrorStatus(String message, Throwable exception) {
- return new Status(Status.ERROR, IExternalToolConstants.PLUGIN_ID, 0, message, exception);
- }
-
- /**
- * Returns a new CoreException
for this plug-in
- */
- public static CoreException newError(String message, Throwable exception) {
- return new CoreException(new Status(Status.ERROR, IExternalToolConstants.PLUGIN_ID, 0, message, exception));
- }
-
- /**
- * Returns the registry of refresh scope variables.
- */
- public ArgumentVariableRegistry getArgumentVariableRegistry() {
- if (argumentVarRegistry == null)
- argumentVarRegistry = new ArgumentVariableRegistry();
- return argumentVarRegistry;
- }
-
- /**
- * Returns the registry of directory location variables.
- */
- public PathLocationVariableRegistry getDirectoryLocationVariableRegistry() {
- if (dirLocVarRegistry == null)
- dirLocVarRegistry = new PathLocationVariableRegistry(IExternalToolConstants.EXTENSION_POINT_DIRECTORY_VARIABLES);
- return dirLocVarRegistry;
- }
-
- /**
- * Returns the registry of file location variables.
- */
- public PathLocationVariableRegistry getFileLocationVariableRegistry() {
- if (fileLocVarRegistry == null)
- fileLocVarRegistry = new PathLocationVariableRegistry(IExternalToolConstants.EXTENSION_POINT_FILE_VARIABLES);
- return fileLocVarRegistry;
- }
-
- /**
- * Returns the registry of refresh scope variables.
- */
- public RefreshScopeVariableRegistry getRefreshVariableRegistry() {
- if (refreshVarRegistry == null)
- refreshVarRegistry = new RefreshScopeVariableRegistry();
- return refreshVarRegistry;
- }
-
- /**
- * Writes the message to the plug-in's log
- *
- * @param message
- * the text to write to the log
- */
- public void log(String message, Throwable exception) {
- IStatus status = newErrorStatus(message, exception);
- // getLog().log(status);
- ExternalToolsPlugin.log(status);
- }
-
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- /**
- * Returns the ImageDescriptor for the icon with the given path
- *
- * @return the ImageDescriptor object
- */
- public ImageDescriptor getImageDescriptor(String path) {
- try {
- Bundle bundle = ExternalToolsPlugin.getDefault().getBundle();
- URL installURL = bundle.getEntry("/"); //$NON-NLS-1$
- URL url = new URL(installURL, path);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- return null;
+ public static final String EXTERNAL_PARSER_PREF = "_external_parser";
+
+ /**
+ * Status representing no problems encountered during operation.
+ */
+ public static final IStatus OK_STATUS = new Status(IStatus.OK,
+ IExternalToolConstants.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+
+ private static ExternalToolsPlugin plugin;
+
+ private RefreshScopeVariableRegistry refreshVarRegistry;
+
+ private PathLocationVariableRegistry fileLocVarRegistry;
+
+ private PathLocationVariableRegistry dirLocVarRegistry;
+
+ private ArgumentVariableRegistry argumentVarRegistry;
+
+ /**
+ * This version is recommended for eclipse3.0 and above
+ */
+ public ExternalToolsPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * Returns the default instance of the receiver. This represents the runtime
+ * plugin.
+ */
+ public static ExternalToolsPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns a new IStatus
for this plug-in
+ */
+ public static IStatus newErrorStatus(String message, Throwable exception) {
+ return new Status(Status.ERROR, IExternalToolConstants.PLUGIN_ID, 0,
+ message, exception);
+ }
+
+ /**
+ * Returns a new CoreException
for this plug-in
+ */
+ public static CoreException newError(String message, Throwable exception) {
+ return new CoreException(new Status(Status.ERROR,
+ IExternalToolConstants.PLUGIN_ID, 0, message, exception));
+ }
+
+ /**
+ * Returns the registry of refresh scope variables.
+ */
+ public ArgumentVariableRegistry getArgumentVariableRegistry() {
+ if (argumentVarRegistry == null)
+ argumentVarRegistry = new ArgumentVariableRegistry();
+ return argumentVarRegistry;
+ }
+
+ /**
+ * Returns the registry of directory location variables.
+ */
+ public PathLocationVariableRegistry getDirectoryLocationVariableRegistry() {
+ if (dirLocVarRegistry == null)
+ dirLocVarRegistry = new PathLocationVariableRegistry(
+ IExternalToolConstants.EXTENSION_POINT_DIRECTORY_VARIABLES);
+ return dirLocVarRegistry;
}
- }
-
- /*
- * (non-Javadoc) Method declared in AbstractUIPlugin.
- */
-
- protected void initializeDefaultPreferences(IPreferenceStore store) {
- String operatingSystem = Platform.getOS();
- // maxosx, linux, solaris, win32,...
- try {
- InputStream is = getDefault().openStream(new Path("prefs/default_" + operatingSystem + ".properties"));
- PropertyResourceBundle resourceBundle = new PropertyResourceBundle(is);
- Enumeration e = resourceBundle.getKeys();
- String key;
- while (e.hasMoreElements()) {
- key = (String) e.nextElement();
- store.setDefault(key, resourceBundle.getString(key));
- }
- } catch (Exception e) {
- // no default properties found
- if (operatingSystem.equals(Platform.OS_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_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");
- store.setDefault(ETC_HOSTS_PATH_PREF, "c:\\windows\\system32\\drivers\\etc\\hosts");
- } 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}\"\"");
- 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");
+
+ /**
+ * Returns the registry of file location variables.
+ */
+ public PathLocationVariableRegistry getFileLocationVariableRegistry() {
+ if (fileLocVarRegistry == null)
+ fileLocVarRegistry = new PathLocationVariableRegistry(
+ IExternalToolConstants.EXTENSION_POINT_FILE_VARIABLES);
+ return fileLocVarRegistry;
+ }
+
+ /**
+ * Returns the registry of refresh scope variables.
+ */
+ public RefreshScopeVariableRegistry getRefreshVariableRegistry() {
+ if (refreshVarRegistry == null)
+ refreshVarRegistry = new RefreshScopeVariableRegistry();
+ return refreshVarRegistry;
+ }
+
+ /**
+ * Writes the message to the plug-in's log
+ *
+ * @param message
+ * the text to write to the log
+ */
+ public void log(String message, Throwable exception) {
+ IStatus status = newErrorStatus(message, exception);
+ // getLog().log(status);
+ ExternalToolsPlugin.log(status);
+ }
+
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ /**
+ * Returns the ImageDescriptor for the icon with the given path
+ *
+ * @return the ImageDescriptor object
+ */
+ public ImageDescriptor getImageDescriptor(String path) {
+ try {
+ Bundle bundle = ExternalToolsPlugin.getDefault().getBundle();
+ URL installURL = bundle.getEntry("/"); //$NON-NLS-1$
+ URL url = new URL(installURL, path);
+ return ImageDescriptor.createFromURL(url);
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+
+ /*
+ * (non-Javadoc) Method declared in AbstractUIPlugin.
+ */
+
+ protected void initializeDefaultPreferences(IPreferenceStore store) {
+ String operatingSystem = Platform.getOS();
+ // maxosx, linux, solaris, win32,...
+ try {
+ InputStream is = getDefault()
+ .openStream(
+ new Path("prefs/default_" + operatingSystem
+ + ".properties"));
+ PropertyResourceBundle resourceBundle = new PropertyResourceBundle(
+ is);
+ Enumeration e = resourceBundle.getKeys();
+ String key;
+ while (e.hasMoreElements()) {
+ key = (String) e.nextElement();
+ store.setDefault(key, resourceBundle.getString(key));
+ }
+ } catch (Exception e) {
+ // no default properties found
+ if (operatingSystem.equals(Platform.OS_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_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");
+ store.setDefault(ETC_HOSTS_PATH_PREF,
+ "c:\\windows\\system32\\drivers\\etc\\hosts");
+ } 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}\"\"");
+ 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(SHOW_OUTPUT_IN_CONSOLE, "true");
+
+ store.setDefault(IPreferenceConstants.PROMPT_FOR_MIGRATION, true);
+
+ PreferenceConverter.setDefault(store,
+ IPreferenceConstants.CONSOLE_ERROR_RGB, new RGB(255, 0, 0)); // red
+ // -
+ // exactly
+ // the
+ // same
+ // as
+ // debug Console
+ PreferenceConverter.setDefault(store,
+ IPreferenceConstants.CONSOLE_WARNING_RGB, new RGB(255, 100, 0)); // orange
+ PreferenceConverter.setDefault(store,
+ IPreferenceConstants.CONSOLE_INFO_RGB, new RGB(0, 0, 255)); // blue
+ PreferenceConverter.setDefault(store,
+ IPreferenceConstants.CONSOLE_VERBOSE_RGB, new RGB(0, 200, 125)); // green
+ PreferenceConverter.setDefault(store,
+ IPreferenceConstants.CONSOLE_DEBUG_RGB, new RGB(0, 0, 0)); // black
+ }
+
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return ExternalToolsPlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow();
+ }
+
+ /**
+ * Returns the standard display to be used. The method first checks, if the
+ * thread calling this method has an associated display. If so, this display
+ * is returned. Otherwise the method returns the default display.
+ */
+ public static Display getStandardDisplay() {
+ Display display = Display.getCurrent();
+ if (display == null) {
+ display = Display.getDefault();
+ }
+ return display;
+ }
+
+ /**
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#createImageRegistry()
+ */
+ protected ImageRegistry createImageRegistry() {
+ return ExternalToolsImages.initializeImageRegistry();
}
- // store.setDefault(SHOW_OUTPUT_IN_CONSOLE, "true");
-
- store.setDefault(IPreferenceConstants.PROMPT_FOR_MIGRATION, true);
-
- PreferenceConverter.setDefault(store, IPreferenceConstants.CONSOLE_ERROR_RGB, new RGB(255, 0, 0)); // red - exactly the same as
- // debug Console
- PreferenceConverter.setDefault(store, IPreferenceConstants.CONSOLE_WARNING_RGB, new RGB(255, 100, 0)); // orange
- PreferenceConverter.setDefault(store, IPreferenceConstants.CONSOLE_INFO_RGB, new RGB(0, 0, 255)); // blue
- PreferenceConverter.setDefault(store, IPreferenceConstants.CONSOLE_VERBOSE_RGB, new RGB(0, 200, 125)); // green
- PreferenceConverter.setDefault(store, IPreferenceConstants.CONSOLE_DEBUG_RGB, new RGB(0, 0, 0)); // black
- }
-
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return ExternalToolsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
- }
-
- /**
- * Returns the standard display to be used. The method first checks, if the thread calling this method has an associated display.
- * If so, this display is returned. Otherwise the method returns the default display.
- */
- public static Display getStandardDisplay() {
- Display display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
+ /**
+ * @throws Exception
+ * @see org.eclipse.core.runtime.Plugin#start(BundleContext context)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ getStandardDisplay().asyncExec(new Runnable() {
+ public void run() {
+ // initialize the variable context manager
+ VariableContextManager.getDefault();
+ }
+ });
}
- return display;
- }
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#createImageRegistry()
- */
- protected ImageRegistry createImageRegistry() {
- return ExternalToolsImages.initializeImageRegistry();
- }
-
- /**
- * @throws Exception
- * @see org.eclipse.core.runtime.Plugin#start(BundleContext context)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- //initialize the variable context manager
- VariableContextManager.getDefault();
- }
- });
- }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/PHPConsole.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/PHPConsole.java
index 817ec47..a5f1820 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/PHPConsole.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpeclipse/externaltools/PHPConsole.java
@@ -10,98 +10,102 @@ import org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.console.MessageConsoleStream;
public class PHPConsole {
- private MessageConsole myConsole;
+ private MessageConsole myConsole;
- private MessageConsoleStream stream;
+ private MessageConsoleStream stream;
- private boolean hasMessages;
+ private boolean hasMessages;
- public PHPConsole() {
- hasMessages = false;
- myConsole = new MessageConsole("PHPeclipse Console", null);
- ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { myConsole });
- ConsolePlugin.getDefault().getConsoleManager().showConsoleView(myConsole);
- // layout.addView(IConsoleConstants.ID_CONSOLE_VIEW, IPageLayout.BOTTOM, .5f,IPageLayout.ID_EDITOR_AREA);
- stream = myConsole.newMessageStream();
- }
+ public PHPConsole() {
+ hasMessages = false;
+ myConsole = new MessageConsole("PHPeclipse Console", null);
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(
+ new IConsole[] { myConsole });
+ ConsolePlugin.getDefault().getConsoleManager().showConsoleView(
+ myConsole);
+ // layout.addView(IConsoleConstants.ID_CONSOLE_VIEW, IPageLayout.BOTTOM,
+ // .5f,IPageLayout.ID_EDITOR_AREA);
+ stream = myConsole.newMessageStream();
+ }
- /**
- * @return
- */
- public Color getColor() {
- return stream.getColor();
- }
+ /**
+ * @return
+ */
+ public Color getColor() {
+ return stream.getColor();
+ }
- /**
- * @return
- */
- public MessageConsole getConsole() {
- return stream.getConsole();
- }
+ /**
+ * @return
+ */
+ public MessageConsole getConsole() {
+ return stream.getConsole();
+ }
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return stream.hashCode();
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return stream.hashCode();
+ }
- /**
- * @param message
- */
- public void print(String message) {
- hasMessages = true;
- stream.print(message);
- }
+ /**
+ * @param message
+ */
+ public void print(String message) {
+ hasMessages = true;
+ stream.print(message);
+ }
- /**
- *
- */
- public void println() {
- hasMessages = true;
- stream.println();
- }
+ /**
+ *
+ */
+ public void println() {
+ hasMessages = true;
+ stream.println();
+ }
- /**
- * @param message
- */
- public void println(String message) {
- hasMessages = true;
- stream.println(message);
- }
+ /**
+ * @param message
+ */
+ public void println(String message) {
+ hasMessages = true;
+ stream.println(message);
+ }
- /**
- * @param color
- */
- public void setColor(Color color) {
- stream.setColor(color);
- }
+ /**
+ * @param color
+ */
+ public void setColor(Color color) {
+ stream.setColor(color);
+ }
- // public void reportError(String title, String message) {
- // if (hasMessages) {
- // WikiEditorPlugin.getDefault().reportError(title, message);
- // }
- // }
+ // public void reportError(String title, String message) {
+ // if (hasMessages) {
+ // WikiEditorPlugin.getDefault().reportError(title, message);
+ // }
+ // }
- // public void reportError() {
- // reportError("Problems listed", "Open console view for problems log!");
- // }
- /**
- * Creates a string buffer from the given input stream
- */
- public static String getStringFromStream(InputStream stream) throws IOException {
- StringBuffer buffer = new StringBuffer();
- byte[] b = new byte[100];
- int finished = 0;
- while (finished != -1) {
- finished = stream.read(b);
- if (finished != -1) {
- String current = new String(b, 0, finished);
- buffer.append(current);
- }
- }
- return buffer.toString();
- }
+ // public void reportError() {
+ // reportError("Problems listed", "Open console view for problems log!");
+ // }
+ /**
+ * Creates a string buffer from the given input stream
+ */
+ public static String getStringFromStream(InputStream stream)
+ throws IOException {
+ StringBuffer buffer = new StringBuffer();
+ byte[] b = new byte[100];
+ int finished = 0;
+ while (finished != -1) {
+ finished = stream.read(b);
+ if (finished != -1) {
+ String current = new String(b, 0, finished);
+ buffer.append(current);
+ }
+ }
+ return buffer.toString();
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/ConsoleLineTracker.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/ConsoleLineTracker.java
index 5eb4656..49d1b3c 100644
--- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/ConsoleLineTracker.java
+++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/ConsoleLineTracker.java
@@ -8,7 +8,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.ui.console.IConsole;
-// TODO XXX Disabled for 3.1 import org.eclipse.debug.ui.console.IConsoleHyperlink;
import org.eclipse.debug.ui.console.IConsoleLineTracker;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -17,41 +16,53 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.texteditor.ITextEditor;
-
public class ConsoleLineTracker implements IConsoleLineTracker {
-
- private static class JavadocConsoleHyperLink /* TODO XXX Disabled for 3.1 implements IConsoleHyperlink */ {
-
+
+ private static class JavadocConsoleHyperLink /*
+ * TODO XXX Disabled for 3.1
+ * implements
+ * IConsoleHyperlink
+ */{
+
private IPath fExternalPath;
+
private int fLineNumber;
public JavadocConsoleHyperLink(IPath externalPath, int lineNumber) {
- fExternalPath= externalPath;
- fLineNumber= lineNumber;
+ fExternalPath = externalPath;
+ fLineNumber = lineNumber;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkEntered()
*/
public void linkEntered() {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkExited()
*/
public void linkExited() {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkActivated()
*/
public void linkActivated() {
try {
- IFile[] files= ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(fExternalPath);
+ IFile[] files = ResourcesPlugin.getWorkspace().getRoot()
+ .findFilesForLocation(fExternalPath);
if (files.length > 0) {
for (int i = 0; i < files.length; i++) {
- IFile curr= files[0];
- IEditorPart part= EditorUtility.openInEditor(curr, true);
+ IFile curr = files[0];
+ IEditorPart part = EditorUtility.openInEditor(curr,
+ true);
if (part != null) {
if (part instanceof ITextEditor) {
revealLine((ITextEditor) part, fLineNumber);
@@ -59,39 +70,44 @@ public class ConsoleLineTracker implements IConsoleLineTracker {
return;
}
}
- }
+ }
} catch (BadLocationException e) {
PHPLaunchingPlugin.log(e);
} catch (PartInitException e) {
- PHPLaunchingPlugin.log(e);
+ PHPLaunchingPlugin.log(e);
} catch (JavaModelException e) {
- PHPLaunchingPlugin.log(e);
+ PHPLaunchingPlugin.log(e);
}
}
-
- private void revealLine(ITextEditor editor, int lineNumber) throws BadLocationException {
- IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput());
- IRegion region= document.getLineInformation(lineNumber - 1);
+
+ private void revealLine(ITextEditor editor, int lineNumber)
+ throws BadLocationException {
+ IDocument document = editor.getDocumentProvider().getDocument(
+ editor.getEditorInput());
+ IRegion region = document.getLineInformation(lineNumber - 1);
editor.selectAndReveal(region.getOffset(), 0);
}
-
+
}
-
private IConsole fConsole;
-
+
public ConsoleLineTracker() {
- super();
+ super();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.console.IConsoleLineTracker#init(org.eclipse.debug.ui.console.IConsole)
*/
public void init(IConsole console) {
- fConsole= console;
+ fConsole = console;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.console.IConsoleLineTracker#lineAppended(org.eclipse.jface.text.IRegion)
*/
public void lineAppended(IRegion line) {
@@ -99,32 +115,34 @@ public class ConsoleLineTracker implements IConsoleLineTracker {
int offset = line.getOffset();
int length = line.getLength();
String text = fConsole.getDocument().get(offset, length);
-
- int index1= text.indexOf(':');
+
+ int index1 = text.indexOf(':');
if (index1 == -1) {
return;
}
-
- int lineNumber= -1;
- IPath path= null;
- int index2= text.indexOf(':', index1 + 1);
+
+ int lineNumber = -1;
+ IPath path = null;
+ int index2 = text.indexOf(':', index1 + 1);
while ((index2 != -1) && (path == null)) {
if (index1 < index2) {
try {
- String substr= text.substring(index1 + 1, index2);
- lineNumber= Integer.parseInt(substr);
- path= new Path(text.substring(0, index1));
+ String substr = text.substring(index1 + 1, index2);
+ lineNumber = Integer.parseInt(substr);
+ path = new Path(text.substring(0, index1));
} catch (NumberFormatException e) {
// ignore
}
}
- index1= index2;
- index2= text.indexOf(':', index1 + 1);
+ index1 = index2;
+ index2 = text.indexOf(':', index1 + 1);
}
-
+
if (lineNumber != -1) {
- JavadocConsoleHyperLink link= new JavadocConsoleHyperLink(path, lineNumber);
- // TODO XXX Disabled for 3.1 fConsole.addLink(link, line.getOffset(), index1);
+ JavadocConsoleHyperLink link = new JavadocConsoleHyperLink(
+ path, lineNumber);
+ // TODO XXX Disabled for 3.1 fConsole.addLink(link,
+ // line.getOffset(), index1);
}
} catch (BadLocationException e) {
@@ -132,9 +150,9 @@ public class ConsoleLineTracker implements IConsoleLineTracker {
}
}
-
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.console.IConsoleLineTracker#dispose()
*/
public void dispose() {
diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java
index 9a2f1af..ffb100b 100644
--- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java
+++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/DebuggerRunner.java
@@ -20,94 +20,107 @@ import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.swt.widgets.Display;
-//import net.sourceforge.phpeclipse.resourcesview.PHPProject;
+// import net.sourceforge.phpeclipse.resourcesview.PHPProject;
public class DebuggerRunner extends InterpreterRunner {
- public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) {
- String[] env;
- String name, value;
- PHPDBGProxy newPHPDBGProxy = new PHPDBGProxy(configuration.useRemoteDebugger(), configuration.getRemoteSourcePath(),
- configuration.usePathTranslation(),configuration.getPathMap());
- int pos;
-
- IProcess process = null;
- PHPDebugTarget debugTarget = new PHPDebugTarget(launch, process);
- newPHPDBGProxy.setDebugTarget(debugTarget);
- newPHPDBGProxy.start();
- if (configuration.useRemoteDebugger()) {
- // listener for remote debuger is started
- if (configuration.useDBGSessionInBrowser()) {
- activateDBGSESSIDPreview(configuration,newPHPDBGProxy.getPort());
- }
- } else {
- setEnvironmentVariables(configuration, newPHPDBGProxy.getPort());
- // env=configuration.getEnvironment();
- process = super.run(configuration, launch);
- debugTarget.setProcess(process);
- }
- launch.addDebugTarget(debugTarget);
-
- return process;
- }
-
- /**
- * Open the browser in the UI thread with the current debugger URL
- *
- * @param configuration
- * @param port
- */
- protected static void activateDBGSESSIDPreview(final InterpreterRunnerConfiguration configuration, final int port) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- String fileName = configuration.getFileName();
- JavaProject jproject = configuration.getProject();
- IProject project = jproject.getProject();
- IFile file = project.getFile(fileName);
- BrowserUtil.showPreview(file, true, "?DBGSESSID=1@clienthost:"+port);
- }
- });
- }
- protected void setEnvironmentVariables(InterpreterRunnerConfiguration configuration, int listenPort) {
- String DBGSessID;
- String env[] = new String[18];
- long id = Math.round(Math.random() * 100000);
-
- DBGSessID = "DBGSESSID=" + id + "@clienthost:" + listenPort;
- configuration.addEnvironmentValue("HTTP_COOKIE", DBGSessID, false);
- /*
- * configuration.addEnvironmentValue("REDIRECT_URL",OSFilePath,true);
- * configuration.addEnvironmentValue("REQUEST_URI",OSFilePath,true);
- * configuration.addEnvironmentValue("PATH_INFO",OSFilePath,true);
- * configuration.addEnvironmentValue("PATH_TRANSLATED",OSFilePath,true);
- * configuration.addEnvironmentValue("SCRIPT_FILENAME",interpreter,true);
- * configuration.addEnvironmentValue("SERVER_PROTOCOL","HTTP / 1.1",true);
- */
- /*
- * env[0]= "HTTP_COOKIE=" + DBGSessID; env[1]= "REDIRECT_QUERY_STRING="; env[2]= "REDIRECT_STATUS=200"; env[3]= "REDIRECT_URL=" +
- * OSFilePath; env[4]= "SERVER_SOFTWARE=DBG / 2.1"; env[5]= "SERVER_NAME=localhost"; env[6]= "SERVER_ADDR=127.0.0.1"; env[7]=
- * "SERVER_PORT=80"; env[8]= "REMOTE_ADDR=127.0.0.1"; env[9]= "SCRIPT_FILENAME=" + interpreter; env[10]= "GATEWAY_INTERFACE=CGI /
- * 1.1"; env[11]= "SERVER_PROTOCOL=HTTP / 1.1"; env[12]= "REQUEST_METHOD=GET"; env[13]= "QUERY_STRING=test=1"; env[14]=
- * "REQUEST_URI=" + OSFilePath; env[15]= "PATH_INFO=" + OSFilePath; env[16]= "PATH_TRANSLATED=" + OSFilePath; env[17]=
- * "SystemRoot=" + Environment.getenv("SystemRoot");
- */
- // return env;
- }
-
- protected String getDebugCommandLineArgument() {
- return "";
- }
-
- protected String renderLoadPath(InterpreterRunnerConfiguration configuration) {
- StringBuffer loadPath = new StringBuffer();
-
- JavaProject project = configuration.getProject();
- addToLoadPath(loadPath, project.getProject());
-
- Iterator referencedProjects = project.getReferencedProjects().iterator();
- while (referencedProjects.hasNext())
- addToLoadPath(loadPath, (IProject) referencedProjects.next());
-
- return loadPath.toString();
- }
+ public IProcess run(InterpreterRunnerConfiguration configuration,
+ ILaunch launch) {
+ String[] env;
+ String name, value;
+ PHPDBGProxy newPHPDBGProxy = new PHPDBGProxy(configuration
+ .useRemoteDebugger(), configuration.getRemoteSourcePath(),
+ configuration.usePathTranslation(), configuration.getPathMap());
+ int pos;
+
+ IProcess process = null;
+ PHPDebugTarget debugTarget = new PHPDebugTarget(launch, process);
+ newPHPDBGProxy.setDebugTarget(debugTarget);
+ newPHPDBGProxy.start();
+ if (configuration.useRemoteDebugger()) {
+ // listener for remote debuger is started
+ if (configuration.useDBGSessionInBrowser()) {
+ activateDBGSESSIDPreview(configuration, newPHPDBGProxy
+ .getPort());
+ }
+ } else {
+ setEnvironmentVariables(configuration, newPHPDBGProxy.getPort());
+ // env=configuration.getEnvironment();
+ process = super.run(configuration, launch);
+ debugTarget.setProcess(process);
+ }
+ launch.addDebugTarget(debugTarget);
+
+ return process;
+ }
+
+ /**
+ * Open the browser in the UI thread with the current debugger URL
+ *
+ * @param configuration
+ * @param port
+ */
+ protected static void activateDBGSESSIDPreview(
+ final InterpreterRunnerConfiguration configuration, final int port) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ String fileName = configuration.getFileName();
+ JavaProject jproject = configuration.getProject();
+ IProject project = jproject.getProject();
+ IFile file = project.getFile(fileName);
+ BrowserUtil.showPreview(file, true, "?DBGSESSID=1@clienthost:"
+ + port);
+ }
+ });
+ }
+
+ protected void setEnvironmentVariables(
+ InterpreterRunnerConfiguration configuration, int listenPort) {
+ String DBGSessID;
+ String env[] = new String[18];
+ long id = Math.round(Math.random() * 100000);
+
+ DBGSessID = "DBGSESSID=" + id + "@clienthost:" + listenPort;
+ configuration.addEnvironmentValue("HTTP_COOKIE", DBGSessID, false);
+ /*
+ * configuration.addEnvironmentValue("REDIRECT_URL",OSFilePath,true);
+ * configuration.addEnvironmentValue("REQUEST_URI",OSFilePath,true);
+ * configuration.addEnvironmentValue("PATH_INFO",OSFilePath,true);
+ * configuration.addEnvironmentValue("PATH_TRANSLATED",OSFilePath,true);
+ * configuration.addEnvironmentValue("SCRIPT_FILENAME",interpreter,true);
+ * configuration.addEnvironmentValue("SERVER_PROTOCOL","HTTP /
+ * 1.1",true);
+ */
+ /*
+ * env[0]= "HTTP_COOKIE=" + DBGSessID; env[1]= "REDIRECT_QUERY_STRING=";
+ * env[2]= "REDIRECT_STATUS=200"; env[3]= "REDIRECT_URL=" + OSFilePath;
+ * env[4]= "SERVER_SOFTWARE=DBG / 2.1"; env[5]= "SERVER_NAME=localhost";
+ * env[6]= "SERVER_ADDR=127.0.0.1"; env[7]= "SERVER_PORT=80"; env[8]=
+ * "REMOTE_ADDR=127.0.0.1"; env[9]= "SCRIPT_FILENAME=" + interpreter;
+ * env[10]= "GATEWAY_INTERFACE=CGI / 1.1"; env[11]=
+ * "SERVER_PROTOCOL=HTTP / 1.1"; env[12]= "REQUEST_METHOD=GET"; env[13]=
+ * "QUERY_STRING=test=1"; env[14]= "REQUEST_URI=" + OSFilePath; env[15]=
+ * "PATH_INFO=" + OSFilePath; env[16]= "PATH_TRANSLATED=" + OSFilePath;
+ * env[17]= "SystemRoot=" + Environment.getenv("SystemRoot");
+ */
+ // return env;
+ }
+
+ protected String getDebugCommandLineArgument() {
+ return "";
+ }
+
+ protected String renderLoadPath(InterpreterRunnerConfiguration configuration) {
+ StringBuffer loadPath = new StringBuffer();
+
+ JavaProject project = configuration.getProject();
+ addToLoadPath(loadPath, project.getProject());
+
+ Iterator referencedProjects = project.getReferencedProjects()
+ .iterator();
+ while (referencedProjects.hasNext())
+ addToLoadPath(loadPath, (IProject) referencedProjects.next());
+
+ return loadPath.toString();
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunner.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunner.java
index cf8141a..6aa5738 100644
--- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunner.java
+++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunner.java
@@ -20,7 +20,8 @@ public class InterpreterRunner {
public InterpreterRunner() {
}
- public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) {
+ public IProcess run(InterpreterRunnerConfiguration configuration,
+ ILaunch launch) {
String commandLine = renderCommandLine(configuration);
File workingDirectory = configuration.getAbsoluteWorkingDirectory();
@@ -28,16 +29,22 @@ public class InterpreterRunner {
String[] env = configuration.getEnvironment();
Process nativePHPProcess = null;
try {
- nativePHPProcess = configuration.getInterpreter().exec(commandLine, workingDirectory, env);
+ nativePHPProcess = configuration.getInterpreter().exec(commandLine,
+ workingDirectory, env);
} catch (IOException e) {
- throw new RuntimeException("Unable to execute interpreter: " + commandLine + workingDirectory);
+ throw new RuntimeException("Unable to execute interpreter: "
+ + commandLine + workingDirectory);
}
- IProcess process = DebugPlugin.newProcess(launch, nativePHPProcess, renderLabel(configuration));
- process.setAttribute(PHPLaunchingPlugin.PLUGIN_ID + ".launcher.cmdline", commandLine);
- process.setAttribute(IProcess.ATTR_PROCESS_TYPE, PHPLaunchConfigurationAttribute.PHP_LAUNCH_PROCESS_TYPE);
+ IProcess process = DebugPlugin.newProcess(launch, nativePHPProcess,
+ renderLabel(configuration));
+ process
+ .setAttribute(PHPLaunchingPlugin.PLUGIN_ID
+ + ".launcher.cmdline", commandLine);
+ process.setAttribute(IProcess.ATTR_PROCESS_TYPE,
+ PHPLaunchConfigurationAttribute.PHP_LAUNCH_PROCESS_TYPE);
- return process ;
+ return process;
}
protected String renderLabel(InterpreterRunnerConfiguration configuration) {
@@ -52,44 +59,52 @@ public class InterpreterRunner {
return buffer.toString();
}
- protected String renderCommandLine(InterpreterRunnerConfiguration configuration) {
+ protected String renderCommandLine(
+ InterpreterRunnerConfiguration configuration) {
PHPInterpreter interpreter = configuration.getInterpreter();
StringBuffer buffer = new StringBuffer();
buffer.append(this.getDebugCommandLineArgument());
- // buffer.append(renderLoadPath(configuration));
+ // buffer.append(renderLoadPath(configuration));
buffer.append(" " + configuration.getInterpreterArguments());
- // buffer.append(interpreter.endOfOptionsDelimeter);
- buffer.append(" " + osDependentPath(configuration.getAbsoluteFileName()));
+ // buffer.append(interpreter.endOfOptionsDelimeter);
+ buffer.append(" "
+ + osDependentPath(configuration.getAbsoluteFileName()));
buffer.append(" " + configuration.getProgramArguments());
return buffer.toString();
}
- protected void setEnvironmentVariables(InterpreterRunnerConfiguration configuration) {
- IPath FilePath= new Path(configuration.getAbsoluteFileName());
- String OSFilePath= FilePath.toOSString();
- configuration.addEnvironmentValue("REDIRECT_URL",OSFilePath,true);
- configuration.addEnvironmentValue("REQUEST_URI",OSFilePath,true);
- configuration.addEnvironmentValue("PATH_INFO",OSFilePath,true);
- configuration.addEnvironmentValue("PATH_TRANSLATED",OSFilePath,true);
- configuration.addEnvironmentValue("SCRIPT_FILENAME",configuration.getInterpreter().getCommand(),true);
- configuration.addEnvironmentValue("SERVER_PROTOCOL","HTTP / 1.1",true);
-
- configuration.addEnvironmentValue("REDIRECT_QUERY_STRING","",true);
- configuration.addEnvironmentValue("REDIRECT_STATUS","200",true);
- configuration.addEnvironmentValue("SERVER_SOFTWARE","DBG / 2.1",true);
- configuration.addEnvironmentValue("SERVER_NAME","localhost",true);
- configuration.addEnvironmentValue("SERVER_ADDR","127.0.0.1",true);
- configuration.addEnvironmentValue("SERVER_PORT","80",true);
- configuration.addEnvironmentValue("REMOTE_ADDR","127.0.0.1",true);
-
- configuration.addEnvironmentValue("GATEWAY_INTERFACE","CGI / 1.1",true);
- configuration.addEnvironmentValue("REQUEST_METHOD","GET",true);
-
- Map stringVars = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment();
+ protected void setEnvironmentVariables(
+ InterpreterRunnerConfiguration configuration) {
+ IPath FilePath = new Path(configuration.getAbsoluteFileName());
+ String OSFilePath = FilePath.toOSString();
+ configuration.addEnvironmentValue("REDIRECT_URL", OSFilePath, true);
+ configuration.addEnvironmentValue("REQUEST_URI", OSFilePath, true);
+ configuration.addEnvironmentValue("PATH_INFO", OSFilePath, true);
+ configuration.addEnvironmentValue("PATH_TRANSLATED", OSFilePath, true);
+ configuration.addEnvironmentValue("SCRIPT_FILENAME", configuration
+ .getInterpreter().getCommand(), true);
+ configuration
+ .addEnvironmentValue("SERVER_PROTOCOL", "HTTP / 1.1", true);
+
+ configuration.addEnvironmentValue("REDIRECT_QUERY_STRING", "", true);
+ configuration.addEnvironmentValue("REDIRECT_STATUS", "200", true);
+ configuration.addEnvironmentValue("SERVER_SOFTWARE", "DBG / 2.1", true);
+ configuration.addEnvironmentValue("SERVER_NAME", "localhost", true);
+ configuration.addEnvironmentValue("SERVER_ADDR", "127.0.0.1", true);
+ configuration.addEnvironmentValue("SERVER_PORT", "80", true);
+ configuration.addEnvironmentValue("REMOTE_ADDR", "127.0.0.1", true);
+
+ configuration.addEnvironmentValue("GATEWAY_INTERFACE", "CGI / 1.1",
+ true);
+ configuration.addEnvironmentValue("REQUEST_METHOD", "GET", true);
+
+ Map stringVars = DebugPlugin.getDefault().getLaunchManager()
+ .getNativeEnvironment();
if (stringVars.containsKey("SYSTEMROOT"))
- configuration.addEnvironmentValue("SYSTEMROOT",(String) stringVars.get("SYSTEMROOT"),true);
+ configuration.addEnvironmentValue("SYSTEMROOT", (String) stringVars
+ .get("SYSTEMROOT"), true);
}
@@ -99,7 +114,8 @@ public class InterpreterRunner {
JavaProject project = configuration.getProject();
addToLoadPath(loadPath, project.getProject());
- Iterator referencedProjects = project.getReferencedProjects().iterator();
+ Iterator referencedProjects = project.getReferencedProjects()
+ .iterator();
while (referencedProjects.hasNext())
addToLoadPath(loadPath, (IProject) referencedProjects.next());
@@ -107,7 +123,8 @@ public class InterpreterRunner {
}
protected void addToLoadPath(StringBuffer loadPath, IProject project) {
- loadPath.append(" -I " + osDependentPath(project.getLocation().toOSString()));
+ loadPath.append(" -I "
+ + osDependentPath(project.getLocation().toOSString()));
}
protected String osDependentPath(String aPath) {
@@ -118,6 +135,6 @@ public class InterpreterRunner {
}
protected String getDebugCommandLineArgument() {
- return "" ;
+ return "";
}
}
diff --git a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java
index cd25d13..52fa78a 100644
--- a/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java
+++ b/net.sourceforge.phpeclipse.launching/src/net/sourceforge/phpdt/internal/launching/InterpreterRunnerConfiguration.java
@@ -16,174 +16,190 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.internal.ui.launchConfigurations.EnvironmentVariable;
-
public class InterpreterRunnerConfiguration {
protected ILaunchConfiguration configuration;
+
private HashMap fEnvironment;
public InterpreterRunnerConfiguration(ILaunchConfiguration aConfiguration) {
configuration = aConfiguration;
- fEnvironment= new HashMap();
+ fEnvironment = new HashMap();
}
-
+
public String getAbsoluteFileName() {
IPath path = new Path(getFileName());
IProject project = getProject().getProject();
return project.getLocation().toOSString() + "/" + getFileName();
}
-
+
public String getFileName() {
String fileName = "";
try {
- fileName = configuration.getAttribute(PHPLaunchConfigurationAttribute.FILE_NAME, "No file specified in configuration");
- } catch(CoreException e) {}
-
+ fileName = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.FILE_NAME,
+ "No file specified in configuration");
+ } catch (CoreException e) {
+ }
+
return fileName.replace('\\', '/');
- }
-
+ }
+
public JavaProject getProject() {
String projectName = "";
-
+
try {
- projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
- } catch(CoreException e) {
+ projectName = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
+ } catch (CoreException e) {
PHPLaunchingPlugin.log(e);
}
- IProject project = PHPLaunchingPlugin.getWorkspace().getRoot().getProject(projectName);
+ IProject project = PHPLaunchingPlugin.getWorkspace().getRoot()
+ .getProject(projectName);
JavaProject phpProject = new JavaProject();
phpProject.setProject(project);
return phpProject;
}
-
+
public File getAbsoluteWorkingDirectory() {
String file = null;
try {
- file = configuration.getAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
- } catch(CoreException e) {
+ file = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
+ } catch (CoreException e) {
PHPLaunchingPlugin.log(e);
}
return new File(file);
}
-
+
public String getInterpreterArguments() {
try {
- return configuration.getAttribute(PHPLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS, "");
- } catch(CoreException e) {}
-
+ return configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS, "");
+ } catch (CoreException e) {
+ }
+
return "";
}
-
+
public String getProgramArguments() {
try {
- return configuration.getAttribute(PHPLaunchConfigurationAttribute.PROGRAM_ARGUMENTS, "");
- } catch (CoreException e) {}
-
+ return configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.PROGRAM_ARGUMENTS, "");
+ } catch (CoreException e) {
+ }
+
return "";
}
public PHPInterpreter getInterpreter() {
String selectedInterpreter = null;
try {
- selectedInterpreter = configuration.getAttribute(PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
- } catch(CoreException e) {}
+ selectedInterpreter = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
+ } catch (CoreException e) {
+ }
return PHPRuntime.getDefault().getInterpreter(selectedInterpreter);
}
-
+
public boolean useRemoteDebugger() {
try {
- return configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG, false);
- } catch(CoreException e) {
+ return configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.REMOTE_DEBUG, false);
+ } catch (CoreException e) {
PHPLaunchingPlugin.log(e);
}
return false;
}
-
+
public boolean usePathTranslation() {
try {
- return configuration.getAttribute(PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE, false);
- } catch(CoreException e) {
+ return configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.REMOTE_DEBUG_TRANSLATE,
+ false);
+ } catch (CoreException e) {
PHPLaunchingPlugin.log(e);
}
return false;
}
-
- public Map getPathMap() {
+
+ public Map getPathMap() {
try {
- return configuration.getAttribute(PHPLaunchConfigurationAttribute.FILE_MAP, (Map) null);
- } catch(CoreException e) {
- PHPLaunchingPlugin.log(e);
+ return configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.FILE_MAP, (Map) null);
+ } catch (CoreException e) {
+ PHPLaunchingPlugin.log(e);
}
return (Map) null;
}
-
+
public boolean useDBGSessionInBrowser() {
try {
- return configuration.getAttribute(PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER, true);
- } catch(CoreException e) {
+ return configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.OPEN_DBGSESSION_IN_BROWSER,
+ true);
+ } catch (CoreException e) {
PHPLaunchingPlugin.log(e);
}
return false;
}
-
- public void setEnvironment(String[] envp)
- {
- if (envp== null)
+
+ public void setEnvironment(String[] envp) {
+ if (envp == null)
return;
- for (int i = 0; inet.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin.HTTP_QUERY
- *
- */
- public Configuration() {
- this(PHPHelpPlugin.HTTP_QUERY); // default type
- }
-
- /**
- * Construct a Configuration with a type
- * @param type Example: net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin.HTTP_QUERY
- *
- * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin
- */
- public Configuration(String type) {
- this.fType = type;
- }
-
- public String getId() {
- return fId;
- }
-
- public String getName() {
- return fName;
- }
-
- public String getURL() {
- return fUrl;
- }
-
- public String getPassword() {
- return fPassword;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.monitor.internal.IConfiguration#getLocalPort()
- */
- public String getUser() {
- return fUser;
- }
-
- /**
- */
- public String getType() {
- return fType;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.monitor.internal.IConfiguration#isRunning()
- */
- public boolean isActive() {
- return ConfigurationManager.getInstance().isActive(this);
- }
-
- public void delete() {
- ConfigurationManager.getInstance().removeConfiguration(this);
- }
-
- public boolean isWorkingCopy() {
- return false;
- }
-
- public IConfigurationWorkingCopy getWorkingCopy() {
- return new ConfigurationWorkingCopy(this);
- }
-
- protected void setInternal(IConfiguration monitor) {
- fId = monitor.getId();
- fName = monitor.getName();
- fUrl = monitor.getURL();
- fPassword = monitor.getPassword();
- fUser = monitor.getUser();
- fType = monitor.getType();
- }
-
- protected void save(IMemento memento) {
- memento.putString(MEMENTO_ID, fId);
- memento.putString(MEMENTO_NAME, fName);
- memento.putString(MEMENTO_TYPE_ID, fType);
- memento.putString(MEMENTO_USER, fUser);
- memento.putString(MEMENTO_URL, fUrl);
- String result = 'A' + scramblePassword(fPassword);
- memento.putString(MEMENTO_PASSWORD, result);
- }
-
- protected void load(IMemento memento) {
- fId = memento.getString(MEMENTO_ID);
- if (fId == null) {
- fId = "";
- }
- fName = memento.getString(MEMENTO_NAME);
- if (fName == null) {
- fName = "";
- }
- fType = memento.getString(MEMENTO_TYPE_ID);
- if (fType == null) {
- fType = "";
- }
- fUser = memento.getString(MEMENTO_USER);
- if (fUser == null) {
- fUser = "";
- }
- fUrl = memento.getString(MEMENTO_URL);
- if (fUrl == null) {
- fUrl = "";
- }
- String result = memento.getString(MEMENTO_PASSWORD);
-
- if (result == null) {
- fPassword = "";
- } else {
- fPassword = scramblePassword(result.substring(1));
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append(fName);
- buffer.append(" - ");
- buffer.append(fUser);
- buffer.append(" - ");
- buffer.append(fUrl);
- buffer.append(" - ");
- buffer.append(fType);
- return buffer.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object o) {
- if (o instanceof IConfiguration) {
- return fName.compareTo(((IConfiguration) o).getName());
- }
- return 1;
- }
-
- private static String scramblePassword(String password) {
- int length = password.length();
- char[] out = new char[length];
- for (int i = 0; i < length; i++) {
- char value = password.charAt(i);
- out[i] = SCRAMBLING_TABLE[value];
- }
- return new String(out);
- }
-
- public boolean isUserComplete() {
- if (fUser == null || fUser.equals("")) {
- return false;
- }
- if (fPassword == null || fPassword.equals("")) {
- return false;
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof Configuration) {
- if (fName == null || ((Configuration) obj).fName == null) {
- return false;
- }
- return fName.equals(((Configuration) obj).fName);
- }
- return false;
- }
+ private static final String MEMENTO_ID = "id";
+
+ private static final String MEMENTO_NAME = "name";
+
+ private static final String MEMENTO_USER = "user";
+
+ private static final String MEMENTO_URL = "url";
+
+ private static final String MEMENTO_PASSWORD = "password";
+
+ private static final String MEMENTO_TYPE_ID = "type-id";
+
+ protected String fId = "";
+
+ protected String fName = "";
+
+ protected String fUrl = "";
+
+ protected String fPassword = "";
+
+ protected String fUser = "";
+
+ protected String fType = "";
+
+ private static final char[] SCRAMBLING_TABLE = new char[] { 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 114, 120, 53, 79, 96, 109, 72,
+ 108, 70, 64, 76, 67, 116, 74, 68, 87, 111, 52, 75, 119, 49, 34, 82,
+ 81, 95, 65, 112, 86, 118, 110, 122, 105, 41, 57, 83, 43, 46, 102,
+ 40, 89, 38, 103, 45, 50, 42, 123, 91, 35, 125, 55, 54, 66, 124,
+ 126, 59, 47, 92, 71, 115, 78, 88, 107, 106, 56, 36, 121, 117, 104,
+ 101, 100, 69, 73, 99, 63, 94, 93, 39, 37, 61, 48, 58, 113, 32, 90,
+ 44, 98, 60, 51, 33, 97, 62, 77, 84, 80, 85, 223, 225, 216, 187,
+ 166, 229, 189, 222, 188, 141, 249, 148, 200, 184, 136, 248, 190,
+ 199, 170, 181, 204, 138, 232, 218, 183, 255, 234, 220, 247, 213,
+ 203, 226, 193, 174, 172, 228, 252, 217, 201, 131, 230, 197, 211,
+ 145, 238, 161, 179, 160, 212, 207, 221, 254, 173, 202, 146, 224,
+ 151, 140, 196, 205, 130, 135, 133, 143, 246, 192, 159, 244, 239,
+ 185, 168, 215, 144, 139, 165, 180, 157, 147, 186, 214, 176, 227,
+ 231, 219, 169, 175, 156, 206, 198, 129, 164, 150, 210, 154, 177,
+ 134, 127, 182, 128, 158, 208, 162, 132, 167, 209, 149, 241, 153,
+ 251, 237, 236, 171, 195, 243, 233, 253, 240, 194, 250, 191, 155,
+ 142, 137, 245, 235, 163, 242, 178, 152 };
+
+ /**
+ * Construct a Configuration with the defult type:
+ * net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin.HTTP_QUERY
+ *
+ */
+ public Configuration() {
+ this(PHPHelpPlugin.HTTP_QUERY); // default type
+ }
+
+ /**
+ * Construct a Configuration with a type
+ *
+ * @param type
+ * Example:
+ * net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin.HTTP_QUERY
+ *
+ * @see net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin
+ */
+ public Configuration(String type) {
+ this.fType = type;
+ }
+
+ public String getId() {
+ return fId;
+ }
+
+ public String getName() {
+ return fName;
+ }
+
+ public String getURL() {
+ return fUrl;
+ }
+
+ public String getPassword() {
+ return fPassword;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.monitor.internal.IConfiguration#getLocalPort()
+ */
+ public String getUser() {
+ return fUser;
+ }
+
+ /**
+ */
+ public String getType() {
+ return fType;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.monitor.internal.IConfiguration#isRunning()
+ */
+ public boolean isActive() {
+ return ConfigurationManager.getInstance().isActive(this);
+ }
+
+ public void delete() {
+ ConfigurationManager.getInstance().removeConfiguration(this);
+ }
+
+ public boolean isWorkingCopy() {
+ return false;
+ }
+
+ public IConfigurationWorkingCopy getWorkingCopy() {
+ return new ConfigurationWorkingCopy(this);
+ }
+
+ protected void setInternal(IConfiguration monitor) {
+ fId = monitor.getId();
+ fName = monitor.getName();
+ fUrl = monitor.getURL();
+ fPassword = monitor.getPassword();
+ fUser = monitor.getUser();
+ fType = monitor.getType();
+ }
+
+ protected void save(IMemento memento) {
+ memento.putString(MEMENTO_ID, fId);
+ memento.putString(MEMENTO_NAME, fName);
+ memento.putString(MEMENTO_TYPE_ID, fType);
+ memento.putString(MEMENTO_USER, fUser);
+ memento.putString(MEMENTO_URL, fUrl);
+ String result = 'A' + scramblePassword(fPassword);
+ memento.putString(MEMENTO_PASSWORD, result);
+ }
+
+ protected void load(IMemento memento) {
+ fId = memento.getString(MEMENTO_ID);
+ if (fId == null) {
+ fId = "";
+ }
+ fName = memento.getString(MEMENTO_NAME);
+ if (fName == null) {
+ fName = "";
+ }
+ fType = memento.getString(MEMENTO_TYPE_ID);
+ if (fType == null) {
+ fType = "";
+ }
+ fUser = memento.getString(MEMENTO_USER);
+ if (fUser == null) {
+ fUser = "";
+ }
+ fUrl = memento.getString(MEMENTO_URL);
+ if (fUrl == null) {
+ fUrl = "";
+ }
+ String result = memento.getString(MEMENTO_PASSWORD);
+
+ if (result == null) {
+ fPassword = "";
+ } else {
+ fPassword = scramblePassword(result.substring(1));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(fName);
+ buffer.append(" - ");
+ buffer.append(fUser);
+ buffer.append(" - ");
+ buffer.append(fUrl);
+ buffer.append(" - ");
+ buffer.append(fType);
+ return buffer.toString();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object o) {
+ if (o instanceof IConfiguration) {
+ return fName.compareTo(((IConfiguration) o).getName());
+ }
+ return 1;
+ }
+
+ private static String scramblePassword(String password) {
+ int length = password.length();
+ char[] out = new char[length];
+ for (int i = 0; i < length; i++) {
+ char value = password.charAt(i);
+ out[i] = SCRAMBLING_TABLE[value];
+ }
+ return new String(out);
+ }
+
+ public boolean isUserComplete() {
+ if (fUser == null || fUser.equals("")) {
+ return false;
+ }
+ if (fPassword == null || fPassword.equals("")) {
+ return false;
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Configuration) {
+ if (fName == null || ((Configuration) obj).fName == null) {
+ return false;
+ }
+ return fName.equals(((Configuration) obj).fName);
+ }
+ return false;
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/ConfigurationManager.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/ConfigurationManager.java
index 2b23dea..8c75aac 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/ConfigurationManager.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/ConfigurationManager.java
@@ -4,7 +4,7 @@
* 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 - Initial API and implementation
**********************************************************************/
@@ -20,21 +20,26 @@ import java.util.Map;
import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
import org.eclipse.core.runtime.Preferences;
+
/**
- *
+ *
*/
public class ConfigurationManager {
private static final int ADD = 0;
+
private static final int CHANGE = 1;
+
private static final int REMOVE = 2;
// configurations
protected List configurations;
+
protected Map threads = new HashMap();
protected List configurationListeners = new ArrayList();
private Preferences.IPropertyChangeListener pcl;
+
protected boolean ignorePreferenceChanges = false;
protected static ConfigurationManager instance;
@@ -59,11 +64,13 @@ public class ConfigurationManager {
}
};
- PHPHelpPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(pcl);
+ PHPHelpPlugin.getDefault().getPluginPreferences()
+ .addPropertyChangeListener(pcl);
}
protected void dispose() {
- PHPHelpPlugin.getDefault().getPluginPreferences().removePropertyChangeListener(pcl);
+ PHPHelpPlugin.getDefault().getPluginPreferences()
+ .removePropertyChangeListener(pcl);
}
public IConfigurationWorkingCopy createConfiguration() {
@@ -98,7 +105,7 @@ public class ConfigurationManager {
/**
* Add monitor listener.
- *
+ *
* @param listener
*/
public void addConfigurationListener(IConfigurationListener listener) {
@@ -107,7 +114,7 @@ public class ConfigurationManager {
/**
* Remove monitor listener.
- *
+ *
* @param listener
*/
public void removeConfigurationListener(IConfigurationListener listener) {
@@ -116,6 +123,7 @@ public class ConfigurationManager {
/**
* Fire a monitor event.
+ *
* @param rr
* @param fType
*/
@@ -134,17 +142,16 @@ public class ConfigurationManager {
}
}
-
-
-
protected void loadConfigurations() {
configurations = new ArrayList();
Preferences prefs = PHPHelpPlugin.getDefault().getPluginPreferences();
- String xmlString = prefs.getString(PHPHelpPlugin.PREF_STRING_CONFIGURATIONS);
+ String xmlString = prefs
+ .getString(PHPHelpPlugin.PREF_STRING_CONFIGURATIONS);
if (xmlString != null && xmlString.length() > 0) {
try {
- ByteArrayInputStream in = new ByteArrayInputStream(xmlString.getBytes());
+ ByteArrayInputStream in = new ByteArrayInputStream(xmlString
+ .getBytes());
IMemento memento = XMLMemento.loadMemento(in);
IMemento[] children = memento.getChildren("config");
@@ -164,7 +171,8 @@ public class ConfigurationManager {
protected void saveConfigurations() {
try {
ignorePreferenceChanges = true;
- XMLMemento memento = XMLMemento.createWriteRoot(PHPHelpPlugin.PREF_STRING_CONFIGURATIONS);
+ XMLMemento memento = XMLMemento
+ .createWriteRoot(PHPHelpPlugin.PREF_STRING_CONFIGURATIONS);
Iterator iterator = configurations.iterator();
while (iterator.hasNext()) {
@@ -174,7 +182,8 @@ public class ConfigurationManager {
}
String xmlString = memento.saveToString();
- Preferences prefs = PHPHelpPlugin.getDefault().getPluginPreferences();
+ Preferences prefs = PHPHelpPlugin.getDefault()
+ .getPluginPreferences();
prefs.setValue(PHPHelpPlugin.PREF_STRING_CONFIGURATIONS, xmlString);
PHPHelpPlugin.getDefault().savePluginPreferences();
} catch (Exception e) {
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/ConfigurationWorkingCopy.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/ConfigurationWorkingCopy.java
index 97742a3..8556ee6 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/ConfigurationWorkingCopy.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/ConfigurationWorkingCopy.java
@@ -4,20 +4,22 @@
* 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 - Initial API and implementation
**********************************************************************/
package net.sourceforge.phpdt.httpquery.config;
/**
- *
+ *
*/
-public class ConfigurationWorkingCopy extends Configuration implements IConfigurationWorkingCopy {
+public class ConfigurationWorkingCopy extends Configuration implements
+ IConfigurationWorkingCopy {
protected Configuration configuration;
// creation
- public ConfigurationWorkingCopy() { }
+ public ConfigurationWorkingCopy() {
+ }
// working copy
public ConfigurationWorkingCopy(Configuration configuration) {
@@ -33,22 +35,18 @@ public class ConfigurationWorkingCopy extends Configuration implements IConfigur
fName = name;
}
-
public void setURL(String url) {
fUrl = url;
}
-
public void setPassword(String password) {
fPassword = password;
}
-
public void setUser(String user) {
fUser = user;
}
-
public void setType(String t) {
fType = t;
}
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfiguration.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfiguration.java
index c6d44bf..b96e918 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfiguration.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfiguration.java
@@ -4,13 +4,14 @@
* 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 - Initial API and implementation
**********************************************************************/
package net.sourceforge.phpdt.httpquery.config;
+
/**
- *
+ *
*/
public interface IConfiguration {
public String getId();
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfigurationListener.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfigurationListener.java
index e44b5f6..55e2c3b 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfigurationListener.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfigurationListener.java
@@ -4,13 +4,14 @@
* 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 - Initial API and implementation
**********************************************************************/
package net.sourceforge.phpdt.httpquery.config;
+
/**
- *
+ *
*/
public interface IConfigurationListener {
public void configurationAdded(IConfiguration monitor);
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfigurationWorkingCopy.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfigurationWorkingCopy.java
index 1da0389..e410182 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfigurationWorkingCopy.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IConfigurationWorkingCopy.java
@@ -4,13 +4,14 @@
* 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 - Initial API and implementation
**********************************************************************/
package net.sourceforge.phpdt.httpquery.config;
+
/**
- *
+ *
*/
public interface IConfigurationWorkingCopy extends IConfiguration {
public void setId(String id);
@@ -23,7 +24,7 @@ public interface IConfigurationWorkingCopy extends IConfiguration {
public void setUser(String port);
- public void setType(String type);
+ public void setType(String type);
public IConfiguration save();
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IMemento.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IMemento.java
index 2b6a743..43f9ead 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IMemento.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/IMemento.java
@@ -4,7 +4,7 @@
* 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 API and implementation
**********************************************************************/
@@ -14,41 +14,44 @@ import java.util.List;
import org.eclipse.ui.IElementFactory;
import org.eclipse.ui.IPersistableElement;
+
/**
- * Interface to a memento used for saving the important state of an object
- * in a form that can be persisted in the file system.
+ * Interface to a memento used for saving the important state of an object in a
+ * form that can be persisted in the file system.
* * Mementos were designed with the following requirements in mind: *
- * Mementos meet these requirements by providing support for storing a - * mapping of arbitrary string keys to primitive values, and by allowing - * mementos to have other mementos as children (arranged into a tree). - * A robust external storage format based on XML is used. - *
- * The key for an attribute may be any alpha numeric value. However, the
- * value of TAG_ID
is reserved for internal use.
- *
+ * Mementos meet these requirements by providing support for storing a mapping + * of arbitrary string keys to primitive values, and by allowing mementos to + * have other mementos as children (arranged into a tree). A robust external + * storage format based on XML is used. + *
+ *
+ * The key for an attribute may be any alpha numeric value. However, the value
+ * of TAG_ID
is reserved for internal use.
+ *
* This interface is not intended to be implemented by clients. *
- * + * * @see IPersistableElement * @see IElementFactory */ public interface IMemento { /** - * Special reserved key used to store the memento id - * (value"org.eclipse.ui.id"
).
- *
+ * Special reserved key used to store the memento id (value
+ * "org.eclipse.ui.id"
).
+ *
* @see #getId
*/
public static final String TAG_ID = "IMemento.internal.id"; //$NON-NLS-1$
@@ -56,11 +59,12 @@ public interface IMemento {
/**
* Creates a new child of this memento with the given fType.
*
- * The getChild
and getChildren
methods
- * are used to retrieve children of a given fType.
+ * The getChild
and getChildren
methods are
+ * used to retrieve children of a given fType.
*
TAG_ID
) and can be retrieved using getId
.
+ * Creates a new child of this memento with the given fType and id. The id
+ * is stored in the child memento (using a special reserved key,
+ * TAG_ID
) and can be retrieved using getId
.
*
- * The getChild
and getChildren
methods
- * are used to retrieve children of a given fType.
+ * The getChild
and getChildren
methods are
+ * used to retrieve children of a given fType.
*
null
if the key was not found or was found
- * but was not a floating point number
+ *
+ * @param key
+ * the key
+ * @return the value, or null
if the key was not found or was
+ * found but was not a floating point number
*/
public Float getFloat(String key);
/**
* Returns the id for this memento.
- *
+ *
* @return the memento id, or null
if none
* @see #createChild(java.lang.String,java.lang.String)
*/
@@ -118,7 +127,7 @@ public interface IMemento {
/**
* Returns the name for this memento.
- *
+ *
* @return the memento name, or null
if none
* @see #createChild(java.lang.String,java.lang.String)
*/
@@ -126,28 +135,31 @@ public interface IMemento {
/**
* Returns the integer value of the given key.
- *
- * @param key the key
- * @return the value, or null
if the key was not found or was found
- * but was not an integer
+ *
+ * @param key
+ * the key
+ * @return the value, or null
if the key was not found or was
+ * found but was not an integer
*/
public Integer getInteger(String key);
/**
* Returns the string value of the given key.
- *
- * @param key the key
- * @return the value, or null
if the key was not found or was found
- * but was not an integer
+ *
+ * @param key
+ * the key
+ * @return the value, or null
if the key was not found or was
+ * found but was not an integer
*/
public String getString(String key);
/**
* Returns the boolean value of the given key.
- *
- * @param key the key
- * @return the value, or null
if the key was not found or was found
- * but was not a boolean
+ *
+ * @param key
+ * the key
+ * @return the value, or null
if the key was not found or was
+ * found but was not a boolean
*/
public Boolean getBoolean(String key);
@@ -155,41 +167,50 @@ public interface IMemento {
/**
* Sets the value of the given key to the given floating point number.
- *
- * @param key the key
- * @param value the value
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value
*/
public void putFloat(String key, float value);
/**
* Sets the value of the given key to the given integer.
- *
- * @param key the key
- * @param value the value
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value
*/
public void putInteger(String key, int value);
/**
* Sets the value of the given key to the given boolean value.
- *
- * @param key the key
- * @param value the value
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value
*/
public void putBoolean(String key, boolean value);
/**
- * Copy the attributes and children from memento
- * to the receiver.
- *
- * @param memento the IMemento to be copied.
+ * Copy the attributes and children from memento
to the
+ * receiver.
+ *
+ * @param memento
+ * the IMemento to be copied.
*/
public void putMemento(IMemento memento);
/**
* Sets the value of the given key to the given string.
- *
- * @param key the key
- * @param value the value
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value
*/
public void putString(String key, String value);
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/XMLMemento.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/XMLMemento.java
index dc1954d..d9d80df 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/XMLMemento.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/XMLMemento.java
@@ -4,7 +4,7 @@
* 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 API and implementation
**********************************************************************/
@@ -43,30 +43,31 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+
/**
- * A Memento is a class independent container for persistence
- * info. It is a reflection of 3 storage requirements.
- *
- * 1) We need the ability to persist an object and restore it.
- * 2) The class for an object may be absent. If so we would
- * like to skip the object and keep reading.
- * 3) The class for an object may change. If so the new class
- * should be able to read the old persistence info.
- *
- * We could ask the objects to serialize themselves into an
- * ObjectOutputStream, DataOutputStream, or Hashtable. However
- * all of these approaches fail to meet the second requirement.
- *
+ * A Memento is a class independent container for persistence info. It is a
+ * reflection of 3 storage requirements.
+ *
+ * 1) We need the ability to persist an object and restore it. 2) The class for
+ * an object may be absent. If so we would like to skip the object and keep
+ * reading. 3) The class for an object may change. If so the new class should be
+ * able to read the old persistence info.
+ *
+ * We could ask the objects to serialize themselves into an ObjectOutputStream,
+ * DataOutputStream, or Hashtable. However all of these approaches fail to meet
+ * the second requirement.
+ *
* Memento supports binary persistance with a version ID.
*/
public final class XMLMemento implements IMemento {
private Document factory;
+
private Element element;
/**
- * Answer a memento for the document and element. For simplicity
- * you should use createReadRoot and createWriteRoot to create the initial
- * mementos on a document.
+ * Answer a memento for the document and element. For simplicity you should
+ * use createReadRoot and createWriteRoot to create the initial mementos on
+ * a document.
*/
public XMLMemento(Document doc, Element el) {
factory = doc;
@@ -93,13 +94,14 @@ public final class XMLMemento implements IMemento {
}
/**
- * Create a Document from a Reader and answer a root memento for reading
- * a document.
+ * Create a Document from a Reader and answer a root memento for reading a
+ * document.
*/
protected static XMLMemento createReadRoot(Reader reader) {
Document document = null;
try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilderFactory factory = DocumentBuilderFactory
+ .newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
document = parser.parse(new InputSource(reader));
Node node = document.getFirstChild();
@@ -111,7 +113,8 @@ public final class XMLMemento implements IMemento {
} finally {
try {
reader.close();
- } catch (Exception e) { }
+ } catch (Exception e) {
+ }
}
return null;
}
@@ -122,7 +125,8 @@ public final class XMLMemento implements IMemento {
public static XMLMemento createWriteRoot(String type) {
Document document;
try {
- document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+ document = DocumentBuilderFactory.newInstance()
+ .newDocumentBuilder().newDocument();
Element element = document.createElement(type);
document.appendChild(element);
return new XMLMemento(document, element);
@@ -142,10 +146,10 @@ public final class XMLMemento implements IMemento {
return null;
// Find the first node which is a child of this node.
- for (int nX = 0; nX < size; nX ++) {
+ for (int nX = 0; nX < size; nX++) {
Node node = nodes.item(nX);
if (node instanceof Element) {
- Element element2 = (Element)node;
+ Element element2 = (Element) node;
if (element2.getNodeName().equals(type))
return new XMLMemento(factory, element2);
}
@@ -158,7 +162,7 @@ public final class XMLMemento implements IMemento {
/**
* @see IMemento.
*/
- public IMemento [] getChildren(String type) {
+ public IMemento[] getChildren(String type) {
// Get the nodes.
NodeList nodes = element.getChildNodes();
int size = nodes.getLength();
@@ -167,10 +171,10 @@ public final class XMLMemento implements IMemento {
// Extract each node with given fType.
ArrayList list = new ArrayList(size);
- for (int nX = 0; nX < size; nX ++) {
+ for (int nX = 0; nX < size; nX++) {
Node node = nodes.item(nX);
if (node instanceof Element) {
- Element element2 = (Element)node;
+ Element element2 = (Element) node;
if (element2.getNodeName().equals(type))
list.add(element2);
}
@@ -178,16 +182,16 @@ public final class XMLMemento implements IMemento {
// Create a memento for each node.
size = list.size();
- IMemento [] results = new IMemento[size];
- for (int x = 0; x < size; x ++) {
- results[x] = new XMLMemento(factory, (Element)list.get(x));
+ IMemento[] results = new IMemento[size];
+ for (int x = 0; x < size; x++) {
+ results[x] = new XMLMemento(factory, (Element) list.get(x));
}
return results;
}
/**
* Return the contents of this memento as a byte array.
- *
+ *
* @return byte[]
*/
public byte[] getContents() throws IOException {
@@ -198,7 +202,7 @@ public final class XMLMemento implements IMemento {
/**
* Returns an input stream for writing to the disk with a local locale.
- *
+ *
* @return java.io.InputStream
*/
public InputStream getInputStream() throws IOException {
@@ -275,8 +279,9 @@ public final class XMLMemento implements IMemento {
/**
* Loads a memento from the given filename.
- *
- * @param in java.io.InputStream
+ *
+ * @param in
+ * java.io.InputStream
* @return org.eclipse.ui.IMemento
* @exception java.io.IOException
*/
@@ -286,15 +291,17 @@ public final class XMLMemento implements IMemento {
/**
* Loads a memento from the given filename.
- *
- * @param in java.io.InputStream
+ *
+ * @param in
+ * java.io.InputStream
* @return org.eclipse.ui.IMemento
* @exception java.io.IOException
*/
public static IMemento loadCorruptMemento(InputStream in) {
Document document = null;
try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilderFactory factory = DocumentBuilderFactory
+ .newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
document = parser.parse(in);
Node node = document.getFirstChild();
@@ -306,15 +313,17 @@ public final class XMLMemento implements IMemento {
} finally {
try {
in.close();
- } catch (Exception e) { }
+ } catch (Exception e) {
+ }
}
return null;
}
/**
* Loads a memento from the given filename.
- *
- * @param filename java.lang.String
+ *
+ * @param filename
+ * java.lang.String
* @return org.eclipse.ui.IMemento
* @exception java.io.IOException
*/
@@ -324,13 +333,15 @@ public final class XMLMemento implements IMemento {
/**
* Loads a memento from the given filename.
- *
- * @param url java.net.URL
+ *
+ * @param url
+ * java.net.URL
* @return org.eclipse.ui.IMemento
* @exception java.io.IOException
*/
public static IMemento loadMemento(URL url) throws IOException {
- return XMLMemento.createReadRoot(new InputStreamReader(url.openStream()));
+ return XMLMemento
+ .createReadRoot(new InputStreamReader(url.openStream()));
}
/**
@@ -339,18 +350,18 @@ public final class XMLMemento implements IMemento {
private void putElement(Element element2) {
NamedNodeMap nodeMap = element2.getAttributes();
int size = nodeMap.getLength();
- for (int i = 0; i < size; i++){
- Attr attr = (Attr)nodeMap.item(i);
- putString(attr.getName(),attr.getValue());
+ for (int i = 0; i < size; i++) {
+ Attr attr = (Attr) nodeMap.item(i);
+ putString(attr.getName(), attr.getValue());
}
NodeList nodes = element2.getChildNodes();
size = nodes.getLength();
- for (int i = 0; i < size; i ++) {
+ for (int i = 0; i < size; i++) {
Node node = nodes.item(i);
if (node instanceof Element) {
- XMLMemento child = (XMLMemento)createChild(node.getNodeName());
- child.putElement((Element)node);
+ XMLMemento child = (XMLMemento) createChild(node.getNodeName());
+ child.putElement((Element) node);
}
}
}
@@ -393,7 +404,8 @@ public final class XMLMemento implements IMemento {
Result result = new StreamResult(writer);
Source source = new DOMSource(factory);
try {
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ Transformer transformer = TransformerFactory.newInstance()
+ .newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
transformer.transform(source, result);
@@ -409,7 +421,8 @@ public final class XMLMemento implements IMemento {
Result result = new StreamResult(os);
Source source = new DOMSource(factory);
try {
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ Transformer transformer = TransformerFactory.newInstance()
+ .newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
transformer.transform(source, result);
@@ -420,8 +433,9 @@ public final class XMLMemento implements IMemento {
/**
* Saves the memento to the given file.
- *
- * @param filename java.lang.String
+ *
+ * @param filename
+ * java.lang.String
* @exception java.io.IOException
*/
public void saveToFile(String filename) throws IOException {
@@ -437,7 +451,8 @@ public final class XMLMemento implements IMemento {
if (w != null) {
try {
w.close();
- } catch (Exception e) { }
+ } catch (Exception e) {
+ }
}
}
}
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationComposite.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationComposite.java
index 47ba4b6..7eed4fe 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationComposite.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationComposite.java
@@ -4,7 +4,7 @@
* 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 - Initial API and implementation
**********************************************************************/
@@ -37,17 +37,21 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
+
/**
- *
+ *
*/
public class ConfigurationComposite extends Composite {
protected Table table;
+
protected TableViewer tableViewer;
protected Button edit;
+
protected Button remove;
-// protected Button start;
-// protected Button stop;
+
+ // protected Button start;
+ // protected Button stop;
protected List selection2;
@@ -71,15 +75,18 @@ public class ConfigurationComposite extends Composite {
Label label = new Label(this, SWT.WRAP);
label.setText(PHPHelpPlugin.getResource("%configurationsList"));
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_CENTER));
label = new Label(this, SWT.NONE);
- table = new Table(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
+ table = new Table(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL
+ | SWT.MULTI | SWT.FULL_SELECTION);
+ data = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL);
data.widthHint = 300;
data.heightHint = 300;
-// WorkbenchHelp.setHelp(table, ContextIds.PREF_MONITORS);
+ // WorkbenchHelp.setHelp(table, ContextIds.PREF_MONITORS);
table.setLayoutData(data);
table.setHeaderVisible(true);
@@ -97,10 +104,10 @@ public class ConfigurationComposite extends Composite {
colData = new ColumnWeightData(5, 30, true);
tableLayout.addColumnData(colData);
-// TableColumn urlColumn = new TableColumn(table, SWT.NONE);
-// urlColumn.setText(PHPHelpPlugin.getResource("%columnUser"));
-// colData = new ColumnWeightData(5, 30, true);
-// tableLayout.addColumnData(colData);
+ // TableColumn urlColumn = new TableColumn(table, SWT.NONE);
+ // urlColumn.setText(PHPHelpPlugin.getResource("%columnUser"));
+ // colData = new ColumnWeightData(5, 30, true);
+ // tableLayout.addColumnData(colData);
TableColumn localColumn = new TableColumn(table, SWT.NONE);
localColumn.setText(PHPHelpPlugin.getResource("%columnURL"));
@@ -113,11 +120,12 @@ public class ConfigurationComposite extends Composite {
tableViewer.setContentProvider(new ConfigurationContentProvider());
tableViewer.setLabelProvider(new ConfigurationTableLabelProvider());
tableViewer.setInput("root");
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- setSelection(event.getSelection());
- }
- });
+ tableViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ setSelection(event.getSelection());
+ }
+ });
Composite buttonComp = new Composite(this, SWT.NONE);
layout = new GridLayout();
@@ -127,10 +135,12 @@ public class ConfigurationComposite extends Composite {
layout.marginHeight = 0;
layout.numColumns = 1;
buttonComp.setLayout(layout);
- data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_END
+ | GridData.VERTICAL_ALIGN_FILL);
buttonComp.setLayoutData(data);
- Button add = SWTUtil.createButton(buttonComp, PHPHelpPlugin.getResource("%add"));
+ Button add = SWTUtil.createButton(buttonComp, PHPHelpPlugin
+ .getResource("%add"));
add.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ConfigurationDialog dialog = new ConfigurationDialog(getShell());
@@ -140,27 +150,32 @@ public class ConfigurationComposite extends Composite {
List list = PHPHelpPlugin.getConfigurations();
Object configuration = list.get(list.size() - 1);
- tableViewer.setSelection(new StructuredSelection(configuration));
+ tableViewer
+ .setSelection(new StructuredSelection(configuration));
}
});
- edit = SWTUtil.createButton(buttonComp, PHPHelpPlugin.getResource("%edit"));
+ edit = SWTUtil.createButton(buttonComp, PHPHelpPlugin
+ .getResource("%edit"));
edit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IConfiguration monitor = (IConfiguration) getSelection().get(0);
IConfigurationWorkingCopy wc = monitor.getWorkingCopy();
- ConfigurationDialog dialog = new ConfigurationDialog(getShell(), wc);
+ ConfigurationDialog dialog = new ConfigurationDialog(
+ getShell(), wc);
if (dialog.open() != Window.CANCEL) {
try {
tableViewer.refresh(wc.save());
- } catch (Exception ex) { }
+ } catch (Exception ex) {
+ }
}
}
});
edit.setEnabled(false);
- remove = SWTUtil.createButton(buttonComp, PHPHelpPlugin.getResource("%remove"));
+ remove = SWTUtil.createButton(buttonComp, PHPHelpPlugin
+ .getResource("%remove"));
remove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Iterator iterator = getSelection().iterator();
@@ -168,7 +183,8 @@ public class ConfigurationComposite extends Composite {
IConfiguration monitor = (IConfiguration) iterator.next();
try {
monitor.delete();
- } catch (Exception ex) { }
+ } catch (Exception ex) {
+ }
tableViewer.remove(monitor);
List list = PHPHelpPlugin.getConfigurations();
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationContentProvider.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationContentProvider.java
index 0fd236f..87d989b 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationContentProvider.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationContentProvider.java
@@ -4,7 +4,7 @@
* 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 - Initial API and implementation
**********************************************************************/
@@ -32,19 +32,19 @@ public class ConfigurationContentProvider implements IStructuredContentProvider
}
/**
- * Disposes of this content provider. This is called by the viewer when it is
- * disposed.
+ * Disposes of this content provider. This is called by the viewer when it
+ * is disposed.
*/
public void dispose() {
}
/**
- * Returns the elements to display in the viewer when its input is set to the
- * given element. These elements can be presented as rows in a table, items in
- * a list, etc. The result is not modified by the viewer.
- *
+ * Returns the elements to display in the viewer when its input is set to
+ * the given element. These elements can be presented as rows in a table,
+ * items in a list, etc. The result is not modified by the viewer.
+ *
* @param inputElement
- * the input element
+ * the input element
* @return the array of elements to display in the viewer
*/
public Object[] getElements(Object inputElement) {
@@ -66,15 +66,15 @@ public class ConfigurationContentProvider implements IStructuredContentProvider
* deregistering the viewer from the old input. In response to these change
* notifications, the content provider propagates the changes to the viewer.
*
- *
+ *
* @param viewer
- * the viewer
+ * the viewer
* @param oldInput
- * the old input element, or null
if the viewer did
- * not previously have an input
+ * the old input element, or null
if the viewer
+ * did not previously have an input
* @param newInput
- * the new input element, or null
if the viewer does
- * not have an input
+ * the new input element, or null
if the viewer
+ * does not have an input
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationDialog.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationDialog.java
index 634befb..70effbe 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationDialog.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationDialog.java
@@ -34,7 +34,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
/**
- *
+ *
*/
public class ConfigurationDialog extends Dialog {
protected IConfigurationWorkingCopy fConfiguration;
@@ -47,7 +47,7 @@ public class ConfigurationDialog extends Dialog {
private Text fUrl;
-// private Text fPassword;
+ // private Text fPassword;
interface StringModifyListener {
public void valueChanged(String s);
@@ -64,7 +64,8 @@ public class ConfigurationDialog extends Dialog {
/**
* @param parentShell
*/
- public ConfigurationDialog(Shell parentShell, IConfigurationWorkingCopy configuration) {
+ public ConfigurationDialog(Shell parentShell,
+ IConfigurationWorkingCopy configuration) {
super(parentShell);
this.fConfiguration = configuration;
isEdit = true;
@@ -87,15 +88,18 @@ public class ConfigurationDialog extends Dialog {
protected Label createLabel(Composite comp, String txt) {
Label label = new Label(comp, SWT.NONE);
label.setText(txt);
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
+ | GridData.VERTICAL_ALIGN_BEGINNING));
return label;
}
- protected Text createPassword(Composite comp, String txt, final StringModifyListener listener) {
+ protected Text createPassword(Composite comp, String txt,
+ final StringModifyListener listener) {
final Text text = new Text(comp, SWT.BORDER | SWT.PASSWORD);
if (txt != null)
text.setText(txt);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
data.widthHint = 150;
text.setLayoutData(data);
if (listener != null)
@@ -107,11 +111,13 @@ public class ConfigurationDialog extends Dialog {
return text;
}
- protected Text createText(Composite comp, String txt, final StringModifyListener listener) {
+ protected Text createText(Composite comp, String txt,
+ final StringModifyListener listener) {
final Text text = new Text(comp, SWT.BORDER);
if (txt != null)
text.setText(txt);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
data.widthHint = 150;
text.setLayoutData(data);
if (listener != null)
@@ -123,7 +129,8 @@ public class ConfigurationDialog extends Dialog {
return text;
}
- protected Combo createTypeCombo(Composite comp, final ArrayList types, String sel, final TypeModifyListener listener) {
+ protected Combo createTypeCombo(Composite comp, final ArrayList types,
+ String sel, final TypeModifyListener listener) {
final Combo combo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
int size = types.size();
String[] items = new String[size];
@@ -136,13 +143,15 @@ public class ConfigurationDialog extends Dialog {
combo.setItems(items);
if (index >= 0)
combo.select(index);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
data.widthHint = 150;
combo.setLayoutData(data);
if (listener != null)
combo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
- listener.valueChanged((String) types.get(combo.getSelectionIndex()));
+ listener.valueChanged((String) types.get(combo
+ .getSelectionIndex()));
}
public void widgetDefaultSelected(SelectionEvent e) {
@@ -159,12 +168,13 @@ public class ConfigurationDialog extends Dialog {
// WorkbenchHelp.setHelp(composite, ContextIds.PREF_DIALOG);
createLabel(composite, PHPHelpPlugin.getResource("%name"));
- fName = createText(composite, fConfiguration.getName() + "", new StringModifyListener() {
- public void valueChanged(String name) {
- fConfiguration.setName(name);
- validateFields();
- }
- });
+ fName = createText(composite, fConfiguration.getName() + "",
+ new StringModifyListener() {
+ public void valueChanged(String name) {
+ fConfiguration.setName(name);
+ validateFields();
+ }
+ });
Group group = new Group(composite, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
@@ -175,26 +185,28 @@ public class ConfigurationDialog extends Dialog {
group.setLayoutData(data);
group.setText(PHPHelpPlugin.getResource("%configGroup"));
-// createLabel(group, PHPHelpPlugin.getResource("%user"));
-// fUserName = createText(group, fConfiguration.getUser() + "", new StringModifyListener() {
-// public void valueChanged(String s) {
-// fConfiguration.setUser(s);
-// validateFields();
-// }
-// });
-
-// Composite warningComposite = new Composite(group, SWT.NONE);
-// layout = new GridLayout();
-// layout.numColumns = 2;
-// layout.marginHeight = 0;
-// layout.marginHeight = 0;
-// warningComposite.setLayout(layout);
-// data = new GridData(GridData.FILL_HORIZONTAL);
-// data.horizontalSpan = 3;
-// warningComposite.setLayoutData(data);
+ // createLabel(group, PHPHelpPlugin.getResource("%user"));
+ // fUserName = createText(group, fConfiguration.getUser() + "", new
+ // StringModifyListener() {
+ // public void valueChanged(String s) {
+ // fConfiguration.setUser(s);
+ // validateFields();
+ // }
+ // });
+
+ // Composite warningComposite = new Composite(group, SWT.NONE);
+ // layout = new GridLayout();
+ // layout.numColumns = 2;
+ // layout.marginHeight = 0;
+ // layout.marginHeight = 0;
+ // warningComposite.setLayout(layout);
+ // data = new GridData(GridData.FILL_HORIZONTAL);
+ // data.horizontalSpan = 3;
+ // warningComposite.setLayoutData(data);
// Label warningLabel = new Label(warningComposite, SWT.NONE);
// warningLabel.setImage(getImage(DLG_IMG_MESSAGE_WARNING));
- // warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING
+ // warningLabel.setLayoutData(new
+ // GridData(GridData.VERTICAL_ALIGN_BEGINNING
// | GridData.HORIZONTAL_ALIGN_BEGINNING));
// Label warningText = new Label(warningComposite, SWT.WRAP);
// warningText.setText(PHPHelpPlugin.getResource("%scrambledPassword"));
@@ -203,24 +215,27 @@ public class ConfigurationDialog extends Dialog {
// data.widthHint = 300;
// warningText.setLayoutData(data);
-// createLabel(group, PHPHelpPlugin.getResource("%password"));
-// fPassword = createPassword(group, fConfiguration.getPassword() + "", new StringModifyListener() {
-// public void valueChanged(String s) {
-// fConfiguration.setPassword(s);
-// validateFields();
-// }
-// });
+ // createLabel(group, PHPHelpPlugin.getResource("%password"));
+ // fPassword = createPassword(group, fConfiguration.getPassword() + "",
+ // new StringModifyListener() {
+ // public void valueChanged(String s) {
+ // fConfiguration.setPassword(s);
+ // validateFields();
+ // }
+ // });
createLabel(group, PHPHelpPlugin.getResource("%url"));
- fUrl = createText(group, fConfiguration.getURL(), new StringModifyListener() {
- public void valueChanged(String s) {
- fConfiguration.setURL(s);
- validateFields();
- }
- });
+ fUrl = createText(group, fConfiguration.getURL(),
+ new StringModifyListener() {
+ public void valueChanged(String s) {
+ fConfiguration.setURL(s);
+ validateFields();
+ }
+ });
createLabel(group, PHPHelpPlugin.getResource("%parseType"));
- createTypeCombo(group, PHPHelpPlugin.getTypes(), fConfiguration.getType(), new TypeModifyListener() {
+ createTypeCombo(group, PHPHelpPlugin.getTypes(), fConfiguration
+ .getType(), new TypeModifyListener() {
public void valueChanged(String fType) {
fConfiguration.setType(fType);
}
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationPreferencePage.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationPreferencePage.java
index ad23c6f..3602db5 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationPreferencePage.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationPreferencePage.java
@@ -4,13 +4,12 @@
* 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 - Initial API and implementation
**********************************************************************/
package net.sourceforge.phpdt.httpquery.preferences;
-
import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
import org.eclipse.jface.dialogs.Dialog;
@@ -23,10 +22,12 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+
/**
* The preference page that holds monitor properties.
*/
-public class ConfigurationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+public class ConfigurationPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
/**
* ConfigurationPreferencePage constructor comment.
@@ -38,8 +39,9 @@ public class ConfigurationPreferencePage extends PreferencePage implements IWork
/**
* Create the preference options.
- *
- * @param parent org.eclipse.swt.widgets.Composite
+ *
+ * @param parent
+ * org.eclipse.swt.widgets.Composite
* @return org.eclipse.swt.widgets.Control
*/
protected Control createContents(Composite parent) {
@@ -53,9 +55,10 @@ public class ConfigurationPreferencePage extends PreferencePage implements IWork
layout.marginWidth = 0;
layout.marginHeight = 0;
composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL);
composite.setLayoutData(data);
-// WorkbenchHelp.setHelp(composite, ContextIds.PREF);
+ // WorkbenchHelp.setHelp(composite, ContextIds.PREF);
Label label = new Label(composite, SWT.WRAP);
label.setText(PHPHelpPlugin.getResource("%preferenceDescription"));
@@ -65,7 +68,8 @@ public class ConfigurationPreferencePage extends PreferencePage implements IWork
label = new Label(composite, SWT.NONE);
label.setText("");
- ConfigurationComposite monitorComp = new ConfigurationComposite(composite, SWT.NONE);
+ ConfigurationComposite monitorComp = new ConfigurationComposite(
+ composite, SWT.NONE);
data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
monitorComp.setLayoutData(data);
@@ -76,31 +80,32 @@ public class ConfigurationPreferencePage extends PreferencePage implements IWork
/**
* Initializes this preference page using the passed desktop.
- *
- * @param desktop the current desktop
+ *
+ * @param desktop
+ * the current desktop
*/
public void init(IWorkbench workbench) {
}
/**
- * Performs special processing when this page's Defaults button has been pressed.
+ * Performs special processing when this page's Defaults button has been
+ * pressed.
*
* This is a framework hook method for sublcasses to do special things when
- * the Defaults button has been pressed.
- * Subclasses may override, but should call super.performDefaults
.
+ * the Defaults button has been pressed. Subclasses may override, but should
+ * call super.performDefaults
.
*
- * Label provider listeners are informed about state changes that affect the rendering of the viewer that uses this label - * provider. - *
- * - * @param listener - * a label provider listener - */ - public void addListener(ILabelProviderListener listener) { - } + /** + * Adds a listener to this label provider. Has no effect if an identical + * listener is already registered. + *+ * Label provider listeners are informed about state changes that affect the + * rendering of the viewer that uses this label provider. + *
+ * + * @param listener + * a label provider listener + */ + public void addListener(ILabelProviderListener listener) { + } - /** - * Disposes of this label provider. When a label provider is attached to a viewer, the viewer will automatically call this method - * when the viewer is being closed. When label providers are used outside of the context of a viewer, it is the client's - * responsibility to ensure that this method is called when the provider is no longer needed. - */ - public void dispose() { - } + /** + * Disposes of this label provider. When a label provider is attached to a + * viewer, the viewer will automatically call this method when the viewer is + * being closed. When label providers are used outside of the context of a + * viewer, it is the client's responsibility to ensure that this method is + * called when the provider is no longer needed. + */ + public void dispose() { + } - /** - * Returns the label image for the given column of the given element. - * - * @param element - * the object representing the entire row, ornull
indicating that no input object is set in the viewer
- * @param columnIndex
- * the zero-based index of the column in which the label appears
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
+ /**
+ * Returns the label image for the given column of the given element.
+ *
+ * @param element
+ * the object representing the entire row, or null
+ * indicating that no input object is set in the viewer
+ * @param columnIndex
+ * the zero-based index of the column in which the label appears
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
- /**
- * Returns the label text for the given column of the given element.
- *
- * @param element
- * the object representing the entire row, or null
indicating that no input object is set in the viewer
- * @param columnIndex
- * the zero-based index of the column in which the label appears
- */
- public String getColumnText(Object element, int columnIndex) {
- IConfiguration configuration = (IConfiguration) element;
- if (columnIndex == 0) {
- return configuration.getName();
- } else if (columnIndex == 1)
- return configuration.getType();
-// else if (columnIndex == 2)
-// return configuration.getUser();
- else if (columnIndex == 2)
- return configuration.getURL();
- else
- return "X";
- }
+ /**
+ * Returns the label text for the given column of the given element.
+ *
+ * @param element
+ * the object representing the entire row, or null
+ * indicating that no input object is set in the viewer
+ * @param columnIndex
+ * the zero-based index of the column in which the label appears
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ IConfiguration configuration = (IConfiguration) element;
+ if (columnIndex == 0) {
+ return configuration.getName();
+ } else if (columnIndex == 1)
+ return configuration.getType();
+ // else if (columnIndex == 2)
+ // return configuration.getUser();
+ else if (columnIndex == 2)
+ return configuration.getURL();
+ else
+ return "X";
+ }
- protected String notNull(String s) {
- if (s != null)
- return s;
- else
- return "";
- }
+ protected String notNull(String s) {
+ if (s != null)
+ return s;
+ else
+ return "";
+ }
- /**
- * Returns whether the label would be affected by a change to the given property of the given element. This can be used to
- * optimize a non-structural viewer update. If the property mentioned in the update does not affect the label, then the viewer
- * need not update the label.
- *
- * @param element
- * the element
- * @param property
- * the property
- * @return true
if the label would be affected, and false
if it would be unaffected
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
+ /**
+ * Returns whether the label would be affected by a change to the given
+ * property of the given element. This can be used to optimize a
+ * non-structural viewer update. If the property mentioned in the update
+ * does not affect the label, then the viewer need not update the label.
+ *
+ * @param element
+ * the element
+ * @param property
+ * the property
+ * @return true
if the label would be affected, and
+ * false
if it would be unaffected
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
- /**
- * Removes a listener to this label provider. Has no affect if an identical listener is not registered.
- *
- * @param listener
- * a label provider listener
- */
- public void removeListener(ILabelProviderListener listener) {
- }
+ /**
+ * Removes a listener to this label provider. Has no affect if an identical
+ * listener is not registered.
+ *
+ * @param listener
+ * a label provider listener
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/SWTUtil.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/SWTUtil.java
index 2701b21..10223cf 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/SWTUtil.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/SWTUtil.java
@@ -1,10 +1,10 @@
/**********************************************************************
* Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. Â This program and the accompanying materials
+ * 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 - Initial API and implementation
**********************************************************************/
@@ -22,6 +22,7 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
+
/**
* SWT Utility class.
*/
@@ -40,38 +41,45 @@ public class SWTUtil {
* Returns a width hint for a button control.
*/
protected static int getButtonWidthHint(Button button) {
- int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
- return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+ int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
+ IDialogConstants.BUTTON_WIDTH);
+ return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT,
+ true).x);
}
-
+
public static Button createButton(Composite comp, String label) {
Button b = new Button(comp, SWT.PUSH);
b.setText(label);
if (fontMetrics == null)
initializeDialogUnits(comp);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
data.widthHint = getButtonWidthHint(b);
- data.heightHint = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_HEIGHT);
+ data.heightHint = Dialog.convertVerticalDLUsToPixels(fontMetrics,
+ IDialogConstants.BUTTON_HEIGHT);
b.setLayoutData(data);
return b;
}
-
- public static Button createCheckbox(Composite comp, String txt, boolean isSelected){
+
+ public static Button createCheckbox(Composite comp, String txt,
+ boolean isSelected) {
Button button = new Button(comp, SWT.CHECK);
button.setText(txt);
GridLayout layout = new GridLayout();
comp.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
data.horizontalIndent = 10;
button.setLayoutData(data);
button.setSelection(isSelected);
return button;
}
-
+
public static Label createLabel(Composite comp, String txt) {
Label label = new Label(comp, SWT.NONE);
label.setText(txt);
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
+ | GridData.VERTICAL_ALIGN_BEGINNING));
return label;
}
}
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/PHPHelpPlugin.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/PHPHelpPlugin.java
index 0b1567a..e388fb1 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/PHPHelpPlugin.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/PHPHelpPlugin.java
@@ -66,6 +66,7 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
private static PHPHelpPlugin plugin;
private static ConfigurationManager manager;
+
/**
* The constructor.
*/
@@ -93,7 +94,8 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
}
private IWorkbenchPage internalGetActivePage() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
if (window != null)
return window.getActivePage();
return null;
@@ -112,12 +114,14 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
}
public static void log(int severity, String message) {
- Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null);
+ Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message,
+ null);
log(status);
}
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPeclipsePlugin.internalErrorOccurred", e)); //$NON-NLS-1$
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR,
+ "PHPeclipsePlugin.internalErrorOccurred", e)); //$NON-NLS-1$
}
public static boolean isDebug() {
@@ -132,8 +136,11 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
if (windowsSystem.equals(Platform.WS_WIN32)) {
store.setDefault(PHP_CHM_ENABLED, "false");
- store.setDefault(PHP_CHM_FILE, "c:\\wampp2\\php\\php_manual_en.chm");
- store.setDefault(PHP_CHM_COMMAND, "hh.exe \"mk:@MSITStore:{0}::/en/function.{1}.html\"");
+ store
+ .setDefault(PHP_CHM_FILE,
+ "c:\\wampp2\\php\\php_manual_en.chm");
+ store.setDefault(PHP_CHM_COMMAND,
+ "hh.exe \"mk:@MSITStore:{0}::/en/function.{1}.html\"");
} else {
store.setDefault(PHP_CHM_ENABLED, "false");
store.setDefault(PHP_CHM_FILE, "");
@@ -203,10 +210,10 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
/**
* Returns the translated String found with the given key.
- *
+ *
* @return java.lang.String
* @param key
- * java.lang.String
+ * java.lang.String
*/
public static String getResource(String key) {
try {
@@ -218,7 +225,7 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
/**
* Return a list of all the existing configurations.
- *
+ *
* @return java.util.List
*/
public static List getConfigurations() {
@@ -227,7 +234,7 @@ public class PHPHelpPlugin extends AbstractUIPlugin {
/**
* Create a new monitor.
- *
+ *
* @return working copy
*/
public static IConfigurationWorkingCopy createConfiguration() {
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPFunctionHelpResource.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPFunctionHelpResource.java
index d07bfc7..3aca93f 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPFunctionHelpResource.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/phphelp/actions/PHPFunctionHelpResource.java
@@ -14,7 +14,7 @@ package net.sourceforge.phpdt.phphelp.actions;
import org.eclipse.help.IHelpResource;
/**
- *
+ *
*/
public class PHPFunctionHelpResource implements IHelpResource {
@@ -26,7 +26,7 @@ public class PHPFunctionHelpResource implements IHelpResource {
/**
* Get standard PHPEclipse html help URL
- *
+ *
* @return String
*/
public String getHref() {
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitImages.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitImages.java
index f5126d3..89b5108 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitImages.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitImages.java
@@ -15,11 +15,10 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
-
public class PHPUnitImages {
- protected static final String NAME_PREFIX =
- "net.sourceforge.phpeclipse.phpunit";
+ protected static final String NAME_PREFIX = "net.sourceforge.phpeclipse.phpunit";
+
protected static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
protected static URL iconBaseURL;
@@ -27,12 +26,10 @@ public class PHPUnitImages {
static {
String pathSuffix = "icons/";
try {
- iconBaseURL =
- new URL(
- PHPUnitPlugin.getDefault().getDescriptor().getInstallURL(),
- pathSuffix);
+ iconBaseURL = new URL(PHPUnitPlugin.getDefault().getDescriptor()
+ .getInstallURL(), pathSuffix);
} catch (MalformedURLException e) {
- //PHPUnitPlugin.log(e);
+ // PHPUnitPlugin.log(e);
e.printStackTrace();
}
}
@@ -43,46 +40,55 @@ public class PHPUnitImages {
* Available cached Images in the Java plugin image registry.
*/
- public static final String IMG_SELECT_TEST_SUITE =
- NAME_PREFIX + "tsuite.gif";
+ public static final String IMG_SELECT_TEST_SUITE = NAME_PREFIX
+ + "tsuite.gif";
+
public static final String IMG_RUN_TEST_SUITE = NAME_PREFIX + "start.gif";
+
public static final String IMG_TEST_ERROR = NAME_PREFIX + "testerr.gif";
+
public static final String IMG_TEST_FAILURE = NAME_PREFIX + "testfail.gif";
+
public static final String IMG_TEST_PASS = NAME_PREFIX + "testok.gif";
- public static final String IMG_TEST_SUITE_ERROR =
- NAME_PREFIX + "tsuiteerror.gif";
- public static final String IMG_TEST_SUITE_PASS =
- NAME_PREFIX + "tsuiteok.gif";
- public static final String IMG_TEST_SUITE_FAILURE =
- NAME_PREFIX + "tsuitefail.gif";
+
+ public static final String IMG_TEST_SUITE_ERROR = NAME_PREFIX
+ + "tsuiteerror.gif";
+
+ public static final String IMG_TEST_SUITE_PASS = NAME_PREFIX
+ + "tsuiteok.gif";
+
+ public static final String IMG_TEST_SUITE_FAILURE = NAME_PREFIX
+ + "tsuitefail.gif";
public static final String IMG_ERROR = NAME_PREFIX + "error.gif";
+
public static final String IMG_FAILURE = NAME_PREFIX + "failure.gif";
- public static final ImageDescriptor DESC_SELECT_TEST_SUITE =
- createManaged(IMG_SELECT_TEST_SUITE);
- public static final ImageDescriptor DESC_RUN_TEST_SUITE =
- createManaged(IMG_RUN_TEST_SUITE);
- public static final ImageDescriptor DESC_TEST_ERROR =
- createManaged(IMG_TEST_ERROR);
- public static final ImageDescriptor DESC_TEST_FAILURE =
- createManaged(IMG_TEST_FAILURE);
- public static final ImageDescriptor DESC_TEST_PASS =
- createManaged(IMG_TEST_PASS);
- public static final ImageDescriptor DESC_TEST_SUITE_ERROR =
- createManaged(IMG_TEST_SUITE_ERROR);
- public static final ImageDescriptor DESC_TEST_SUITE_PASS =
- createManaged(IMG_TEST_SUITE_PASS);
- public static final ImageDescriptor DESC_TEST_SUITE_FAILURE =
- createManaged(IMG_TEST_SUITE_FAILURE);
+ public static final ImageDescriptor DESC_SELECT_TEST_SUITE = createManaged(IMG_SELECT_TEST_SUITE);
+
+ public static final ImageDescriptor DESC_RUN_TEST_SUITE = createManaged(IMG_RUN_TEST_SUITE);
+
+ public static final ImageDescriptor DESC_TEST_ERROR = createManaged(IMG_TEST_ERROR);
+
+ public static final ImageDescriptor DESC_TEST_FAILURE = createManaged(IMG_TEST_FAILURE);
+
+ public static final ImageDescriptor DESC_TEST_PASS = createManaged(IMG_TEST_PASS);
+
+ public static final ImageDescriptor DESC_TEST_SUITE_ERROR = createManaged(IMG_TEST_SUITE_ERROR);
+
+ public static final ImageDescriptor DESC_TEST_SUITE_PASS = createManaged(IMG_TEST_SUITE_PASS);
+
+ public static final ImageDescriptor DESC_TEST_SUITE_FAILURE = createManaged(IMG_TEST_SUITE_FAILURE);
public static final ImageDescriptor DESC_ERROR = createManaged(IMG_ERROR);
- public static final ImageDescriptor DESC_FAILURE =
- createManaged(IMG_FAILURE);
+
+ public static final ImageDescriptor DESC_FAILURE = createManaged(IMG_FAILURE);
+
/**
* Returns the image managed under the given key in this registry.
*
- * @param key the image's key
+ * @param key
+ * the image's key
* @return the image managed under the given key
*/
public static Image get(String key) {
@@ -93,12 +99,11 @@ public class PHPUnitImages {
return IMAGE_REGISTRY;
}
-
protected static ImageDescriptor createManaged(String name) {
try {
- ImageDescriptor result =
- ImageDescriptor.createFromURL(
- makeIconFileURL(name.substring(NAME_PREFIX_LENGTH)));
+ ImageDescriptor result = ImageDescriptor
+ .createFromURL(makeIconFileURL(name
+ .substring(NAME_PREFIX_LENGTH)));
IMAGE_REGISTRY.put(name, result);
return result;
} catch (MalformedURLException e) {
@@ -107,7 +112,7 @@ public class PHPUnitImages {
}
protected static URL makeIconFileURL(String name)
- throws MalformedURLException {
+ throws MalformedURLException {
if (iconBaseURL == null)
throw new MalformedURLException();
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitPlugin.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitPlugin.java
index e59bcab..006266b 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitPlugin.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitPlugin.java
@@ -16,31 +16,30 @@ import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.plugin.AbstractUIPlugin;
-
public class PHPUnitPlugin extends AbstractUIPlugin {
-
private static PHPUnitPlugin plugin;
- public static final String PLUGIN_ID= "net.sourceforge.phpeclipse.phpunit"; //$NON-NLS-1$
+
+ public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.phpunit"; //$NON-NLS-1$
/**
* @param descriptor
*/
public PHPUnitPlugin(IPluginDescriptor descriptor) {
-
+
super(descriptor);
-
- plugin= this;
-
- }
-
+ plugin = this;
+
+ }
public static PHPUnitPlugin getDefault() {
return plugin;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#createImageRegistry()
*/
protected ImageRegistry createImageRegistry() {
@@ -48,7 +47,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
return super.createImageRegistry();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#getDialogSettings()
*/
public IDialogSettings getDialogSettings() {
@@ -56,7 +57,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
return super.getDialogSettings();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#getImageRegistry()
*/
public ImageRegistry getImageRegistry() {
@@ -64,7 +67,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
return super.getImageRegistry();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore()
*/
public IPreferenceStore getPreferenceStore() {
@@ -72,7 +77,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
return super.getPreferenceStore();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#getWorkbench()
*/
public IWorkbench getWorkbench() {
@@ -80,7 +87,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
return super.getWorkbench();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.core.runtime.Plugin#initializeDefaultPluginPreferences()
*/
protected void initializeDefaultPluginPreferences() {
@@ -88,7 +97,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
super.initializeDefaultPluginPreferences();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeDefaultPreferences(org.eclipse.jface.preference.IPreferenceStore)
*/
protected void initializeDefaultPreferences(IPreferenceStore store) {
@@ -96,7 +107,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
super.initializeDefaultPreferences(store);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
*/
protected void initializeImageRegistry(ImageRegistry reg) {
@@ -104,7 +117,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
super.initializeImageRegistry(reg);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#loadDialogSettings()
*/
protected void loadDialogSettings() {
@@ -112,9 +127,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
super.loadDialogSettings();
}
-
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#refreshPluginActions()
*/
protected void refreshPluginActions() {
@@ -122,7 +137,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
super.refreshPluginActions();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#saveDialogSettings()
*/
protected void saveDialogSettings() {
@@ -130,9 +147,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
super.saveDialogSettings();
}
-
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.core.runtime.Plugin#shutdown()
*/
public void shutdown() throws CoreException {
@@ -140,7 +157,9 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
super.shutdown();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.core.runtime.Plugin#startup()
*/
public void startup() throws CoreException {
@@ -148,6 +167,4 @@ public class PHPUnitPlugin extends AbstractUIPlugin {
super.startup();
}
-
-
}
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitView.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitView.java
index 46a1f82..8d4c5c2 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitView.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitView.java
@@ -8,8 +8,6 @@
package net.sourceforge.phpeclipse.phpunit;
-
-
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
@@ -31,115 +29,106 @@ import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.part.ViewPart;
-
-
public class PHPUnitView extends ViewPart {
-
-
-
/*
- * like J Unit
- * a tree.
- * The first level nodes are the test suites.
- * children are nested test suites.
- * leafs: test functions.
- * hierarchy: package->testsuite1->testcase->test_function
+ * like J Unit a tree. The first level nodes are the test suites. children
+ * are nested test suites. leafs: test functions. hierarchy:
+ * package->testsuite1->testcase->test_function
*/
private static PHPUnitView view = null;
private XMLReportHandler handler;
-
+
private TestPool testPool;
- //private Button startButton;
+ // private Button startButton;
private ProgressInfoComposite progressInfoComposite;
+
private ResultsInfoComposite resultsInfoComposite;
- //private SettingsInfoComposite settingsInfoComposite; //TODO: move somewhere else, launcher, wizard or preferences.
+
+ // private SettingsInfoComposite settingsInfoComposite; //TODO: move
+ // somewhere else, launcher, wizard or preferences.
private FileDialog dialog;
+
private String testSuiteToRun;
+ private Action selectTestAction;
- private Action selectTestAction;
private Action startTestAction;
-
public PHPUnitView() {
-
- if(view == null)
+
+ if (view == null)
view = this;
-
-
}
-
+
public static PHPUnitView getDefault() {
-
-
- return view;
+
+ return view;
}
public void createPartControl(Composite parent) {
- //parent.setLayout(new FillLayout(SWT.VERTICAL));
+ // parent.setLayout(new FillLayout(SWT.VERTICAL));
dialog = new FileDialog(parent.getShell());
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
-
+
// set title and layout
- parent.setLayout(gridLayout);
-
+ parent.setLayout(gridLayout);
- //Launch ToolBar:
+ // Launch ToolBar:
setActions();
- //Build the progress info Composites
+ // Build the progress info Composites
progressInfoComposite = new ProgressInfoComposite(parent);
- progressInfoComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
-
-
-
- //Build the result info composite
+ progressInfoComposite.setLayoutData(new GridData(
+ GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ // Build the result info composite
resultsInfoComposite = new ResultsInfoComposite(parent);
- resultsInfoComposite.setLayoutData(new GridData(GridData.GRAB_VERTICAL | GridData.FILL_BOTH));
-
- //build the settings composite
- //buildSettingsComposite(parent);
-
- //settingsInfoComposite = new SettingsInfoComposite(parent, SWT.NONE);
-
-
-// startButton = new Button(parent, SWT.CENTER);
-// startButton.setText("Start Tests");
-// startButton.addMouseListener(new MouseListener() {
-//
-// public void mouseDoubleClick(MouseEvent arg0) {
-//
-// }
-//
-// public void mouseDown(MouseEvent arg0) {
-//
-// try {
-// String testFile = settingsInfoComposite.getTestSuite();
-// startTests(testFile);
-// } catch (IOException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-//
-//
-// }
-//
-// public void mouseUp(MouseEvent arg0) {
-//
-//
-// }
-//
-// }); // end add action listener.
+ resultsInfoComposite.setLayoutData(new GridData(GridData.GRAB_VERTICAL
+ | GridData.FILL_BOTH));
+
+ // build the settings composite
+ // buildSettingsComposite(parent);
+
+ // settingsInfoComposite = new SettingsInfoComposite(parent, SWT.NONE);
+
+ // startButton = new Button(parent, SWT.CENTER);
+ // startButton.setText("Start Tests");
+ // startButton.addMouseListener(new MouseListener() {
+ //
+ // public void mouseDoubleClick(MouseEvent arg0) {
+ //
+ // }
+ //
+ // public void mouseDown(MouseEvent arg0) {
+ //
+ // try {
+ // String testFile = settingsInfoComposite.getTestSuite();
+ // startTests(testFile);
+ // } catch (IOException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ //
+ //
+ // }
+ //
+ // public void mouseUp(MouseEvent arg0) {
+ //
+ //
+ // }
+ //
+ // }); // end add action listener.
}
@@ -147,85 +136,83 @@ public class PHPUnitView extends ViewPart {
* @param parent
*/
private void buildSettingsComposite(Composite parent) {
-
-
- //settingsInfoComposite = new Group(parent, SWT.NONE);
- //settingsInfoComposite.setText("Settings");
-// settingsInfoComposite.setLayout(new GridLayout(2,false));
-//
-//
-// //the test suite to launch
-// Label testSuiteLabel = new Label(settingsInfoComposite, SWT.NONE);
-// testSuiteLabel.setText("Test suite to run:");
-// //testSuiteLabel.setLayoutData(new GridData())
-// Text testSuiteText = new Text(settingsInfoComposite, SWT.NONE);
-//
-// //the path to php
-// Label phpPathLabel = new Label(settingsInfoComposite, SWT.NONE);
-// phpPathLabel.setText("php Path:");
-// //testSuiteLabel.setLayoutData(new GridData())
-// Text phpPathText = new Text(settingsInfoComposite, SWT.NONE);
+
+ // settingsInfoComposite = new Group(parent, SWT.NONE);
+ // settingsInfoComposite.setText("Settings");
+ // settingsInfoComposite.setLayout(new GridLayout(2,false));
+ //
+ //
+ // //the test suite to launch
+ // Label testSuiteLabel = new Label(settingsInfoComposite, SWT.NONE);
+ // testSuiteLabel.setText("Test suite to run:");
+ // //testSuiteLabel.setLayoutData(new GridData())
+ // Text testSuiteText = new Text(settingsInfoComposite, SWT.NONE);
+ //
+ // //the path to php
+ // Label phpPathLabel = new Label(settingsInfoComposite, SWT.NONE);
+ // phpPathLabel.setText("php Path:");
+ // //testSuiteLabel.setLayoutData(new GridData())
+ // Text phpPathText = new Text(settingsInfoComposite, SWT.NONE);
}
private void setActions() {
-
+
final IActionBars actionBars = getViewSite().getActionBars();
IToolBarManager toolBarManager = actionBars.getToolBarManager();
selectTestAction = new Action() {
-
+
public void run() {
-
+
testSuiteToRun = dialog.open();
- startTestAction.setEnabled(true);
+ startTestAction.setEnabled(true);
}
};
-
+
selectTestAction.setText("Select Test Suite");
- selectTestAction.setToolTipText("Select Test Suite");
- selectTestAction.setImageDescriptor(PHPUnitImages.DESC_SELECT_TEST_SUITE);
-
-
+ selectTestAction.setToolTipText("Select Test Suite");
+ selectTestAction
+ .setImageDescriptor(PHPUnitImages.DESC_SELECT_TEST_SUITE);
+
toolBarManager.add(selectTestAction);
-
-
+
startTestAction = new Action() {
-
+
public void run() {
-
-
+
try {
- if(testSuiteToRun == null || testSuiteToRun == "")
+ if (testSuiteToRun == null || testSuiteToRun == "")
return;
-
+
startTests(testSuiteToRun);
- //setEnabled(false);
-
+ // setEnabled(false);
+
} catch (IOException e) {
-
+
e.printStackTrace();
}
-
+
}
-
+
};
-
+
startTestAction.setText("Start Test");
- startTestAction.setToolTipText("Start Test Suite. Select a Test Suite first.");
+ startTestAction
+ .setToolTipText("Start Test Suite. Select a Test Suite first.");
startTestAction.setImageDescriptor(PHPUnitImages.DESC_RUN_TEST_SUITE);
- startTestAction.setEnabled(false);
-
+ startTestAction.setEnabled(false);
+
toolBarManager.add(startTestAction);
}
-
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ui.IWorkbenchPart#setFocus()
*/
public void setFocus() {
-
+
}
/**
@@ -239,107 +226,103 @@ public class PHPUnitView extends ViewPart {
// change icon color, increment pass counter, etc...
testPool.getTest(testID).setVerdict(TestCase.PASS);
-
}
-
private void markTestFail(String testID) {
-
+
testPool.getTest(testID).setVerdict(TestCase.FAIL);
-
+
}
+ public void startTests(String testSuite) throws IOException {
+ // testSuite: the name of the file containing the suite we want to run.
+ // we will put that test suite inside a contained that uses our
+ // SocketResult.
- public void startTests(String testSuite) throws IOException {
-
- //testSuite: the name of the file containing the suite we want to run.
- // we will put that test suite inside a contained that uses our SocketResult.
-
- //reset from previous run
+ // reset from previous run
reset();
-
-
+
testSuite = testSuite.replaceAll("\\\\", "/");
-
- System.out.println("new: " + testSuite);
-
- //where the plugin's temp files should go
- String tempFolder = "C:\\tmp";
+
+ System.out.println("new: " + testSuite);
+
+ // where the plugin's temp files should go
+ String tempFolder = "C:\\tmp";
String tempFileName = "temTest.php";
-
- //create the file.
+
+ // create the file.
File testFile = new File(tempFolder + "/" + tempFileName);
BufferedWriter out = new BufferedWriter(new FileWriter(testFile));
out.write("addTest(new TestSuite(\"" + testSuiteName + "\"));" + "\n");
-
-
+ out.write("$suite->addTest(new TestSuite(\"" + testSuiteName + "\"));"
+ + "\n");
+
out.write("$result = new SocketTestResult();" + "\n");
out.write("$suite->run($result);" + "\n");
out.write("$result->report(); " + "\n");
out.write("" + "\n");
out.write("" + "\n");
-
+
out.write("$output = ob_get_contents();" + "\n");
out.write("$fileHandle = fopen('c:/tmp/phpOut.txt');" + "\n");
out.write("fclose($fileHandle);" + "\n");
-
-
+
out.write("ob_end();" + "\n");
out.write("?>" + "\n");
-
+
out.flush();
out.close();
-
+
listenForReports();
-
+
try {
- Runtime.getRuntime().exec("php.exe " + tempFolder + "/" + tempFileName);
+ Runtime.getRuntime().exec(
+ "php.exe " + tempFolder + "/" + tempFileName);
} catch (Exception e) {
-
+
e.printStackTrace();
}
-
- //testFile.delete();
-
+
+ // testFile.delete();
+
}
/**
*
*/
private void reset() {
-
+
handler = new XMLReportHandler();
testPool = new TestPool("Ali Baba");
-
+
progressInfoComposite.resetInfo();
resultsInfoComposite.resetInfo();
-
+
}
/**
@@ -350,41 +333,40 @@ public class PHPUnitView extends ViewPart {
ConnectionListener conListener = new ConnectionListener();
conListener.start(this);
- } //end of method
+ } // end of method
/**
* handle this report: test passed, faile, end of all.
+ *
* @param report
*/
public void handleReport(String report) {
- //delegate to the XML report handler.
+ // delegate to the XML report handler.
handler.handle(report, this);
}
-
/**
* @param command
* @param testCount
* @param testID
*/
- public void handleCommand(
- String command, String[] args) {
-
+ public void handleCommand(String command, String[] args) {
if (command.equals("startAll")) {
-
- //markTestingStarted(new Integer(testCount).intValue());
-
-
+
+ // markTestingStarted(new Integer(testCount).intValue());
+
} else if (command.equals("testSuiteStarted")) {
String testID = args[0];
String testCount = args[1];
-
- //createNewTestSuite("TestSuiteName: " + testID, testID, new Integer(testCount).intValue());
- TestSuite suite = new TestSuite(null, "TestSuiteName: " + testID, testID, new Integer(testCount).intValue());
+
+ // createNewTestSuite("TestSuiteName: " + testID, testID, new
+ // Integer(testCount).intValue());
+ TestSuite suite = new TestSuite(null, "TestSuiteName: " + testID,
+ testID, new Integer(testCount).intValue());
testPool.addTestSuite(suite);
} else if (command.equals("testStarted")) {
@@ -393,36 +375,31 @@ public class PHPUnitView extends ViewPart {
String testCount = args[1];
String testName = args[2];
String parentTestSuiteName = args[3];
-
- testPool.addTest(new TestCase(testID, testName, parentTestSuiteName));
+
+ testPool
+ .addTest(new TestCase(testID, testName, parentTestSuiteName));
} else if (command.equals("testFINISHED")) {
-
-
} else if (command.equals("endAll")) {
-
}
-
update();
-
-
}
/**
*
*/
private void update() {
-
- //progressInfoComposite.updateInfo(numTests, testPool.getNumTestsRun(), numFailures, numErrors);
+
+ // progressInfoComposite.updateInfo(numTests, testPool.getNumTestsRun(),
+ // numFailures, numErrors);
progressInfoComposite.updateInfo(testPool);
resultsInfoComposite.updateInfo(testPool);
-
- }
+ }
/**
* @param currentTestID
@@ -443,12 +420,10 @@ public class PHPUnitView extends ViewPart {
*/
public void addTestException(String currentTestID, String exception) {
- //TODO: decide how to show exceptions. don't show them for now.
- //reportArea.append(" test " + currentTestID + " exception: " + exception + "\n");
+ // TODO: decide how to show exceptions. don't show them for now.
+ // reportArea.append(" test " + currentTestID + " exception: " +
+ // exception + "\n");
}
-
-
-
-} //end of class
+} // end of class
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ProgressInfoComposite.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ProgressInfoComposite.java
index 92e19dd..f1a80a3 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ProgressInfoComposite.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ProgressInfoComposite.java
@@ -6,7 +6,6 @@
*
*************************************************************************/
-
package net.sourceforge.phpeclipse.phpunit;
import net.sourceforge.phpeclipse.phpunit.testpool.TestPool;
@@ -19,15 +18,14 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar;
-
public class ProgressInfoComposite extends Composite {
-
private Label labelRuns, labelRunsVal; // Runs: 12
+
private Label labelErrors, labelErrorsImage, labelErrorsVal;
+
private Label labelFailures, labelFailuresImage, labelFailuresVal;
-
-
+
private ProgressBar progressBar;
/**
@@ -35,28 +33,25 @@ public class ProgressInfoComposite extends Composite {
* @param arg1
*/
public ProgressInfoComposite(Composite parent) {
-
+
super(parent, SWT.NONE);
-
+
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
-
+
// set title and layout
setLayout(gridLayout);
-
// set the progress bar
progressBar = new ProgressBar(this, SWT.HORIZONTAL);
- progressBar.setLayoutData(
- new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ progressBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.FILL_HORIZONTAL));
progressBar.setMinimum(0);
-
- Composite labelsComposite =
- new Composite(this, SWT.NONE);
-
- labelsComposite.setLayoutData(
- new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ Composite labelsComposite = new Composite(this, SWT.NONE);
+
+ labelsComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.FILL_HORIZONTAL));
labelsComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
@@ -72,43 +67,39 @@ public class ProgressInfoComposite extends Composite {
labelFailuresVal = new Label(labelsComposite, SWT.NONE);
labelFailuresVal.setText("0");
-
labelErrorsImage = new Label(labelsComposite, SWT.NONE);
labelErrorsImage.setImage(PHPUnitImages.DESC_ERROR.createImage());
labelErrors = new Label(labelsComposite, SWT.NONE);
labelErrors.setText("Errors: ");
labelErrorsVal = new Label(labelsComposite, SWT.NONE);
- labelErrorsVal.setText("0");
+ labelErrorsVal.setText("0");
}
public void resetInfo() {
-
+
labelErrorsVal.setText("0");
labelFailuresVal.setText("0");
labelRunsVal.setText("0 / 0");
- progressBar.setSelection(0);
-
+ progressBar.setSelection(0);
+
}
public void updateInfo(TestPool testPool) {
-
+
int numTestsOverall = testPool.getNumTestsOverall();
int numTestsRun = testPool.getNumTestsRun();
-
- //update progress bar
+
+ // update progress bar
progressBar.setMaximum(numTestsOverall);
progressBar.setSelection(numTestsRun);
-
-
- //update labels
+
+ // update labels
labelRunsVal.setText(numTestsRun + " / " + numTestsOverall);
labelFailuresVal.setText("" + testPool.getNumFailures());
labelErrorsVal.setText("" + testPool.getNumErrors());
-
- //TODO: change Failures label to red if some exist.
-
-
-
+
+ // TODO: change Failures label to red if some exist.
+
}
}
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ResultsInfoComposite.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ResultsInfoComposite.java
index efaa99b..ae43e74 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ResultsInfoComposite.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ResultsInfoComposite.java
@@ -6,7 +6,6 @@
*
*************************************************************************/
-
package net.sourceforge.phpeclipse.phpunit;
import net.sourceforge.phpeclipse.phpunit.testpool.TestPool;
@@ -17,13 +16,10 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-
public class ResultsInfoComposite extends Composite {
-
-
private TreeViewer treeViewer;
-
+
/**
* @param arg0
* @param arg1
@@ -34,34 +30,34 @@ public class ResultsInfoComposite extends Composite {
GridLayout layout = new GridLayout();
layout.numColumns = 1;
-
+
setLayout(layout);
-
+
treeViewer = new TreeViewer(this, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
- treeViewer.getControl().setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
-
-
+ treeViewer.getControl().setLayoutData(
+ new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_BOTH
+ | GridData.GRAB_VERTICAL));
+
TestPoolLabelProvider labelProvider = new TestPoolLabelProvider();
- TestPoolContentProvider contentProvider= new TestPoolContentProvider();
-
+ TestPoolContentProvider contentProvider = new TestPoolContentProvider();
+
treeViewer.setContentProvider(contentProvider);
treeViewer.setLabelProvider(labelProvider);
-
+
}
-
public void resetInfo() {
-
+
treeViewer.setInput(null);
}
-
+
public void updateInfo(TestPool testPool) {
-
+
// take care of the TreeView and its content and label providers.
-
+
treeViewer.setInput(testPool.getRoot());
-
+
}
}
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/SettingsInfoComposite.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/SettingsInfoComposite.java
index 53539a0..f815d87 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/SettingsInfoComposite.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/SettingsInfoComposite.java
@@ -6,7 +6,6 @@
*
*************************************************************************/
-
package net.sourceforge.phpeclipse.phpunit;
import org.eclipse.swt.SWT;
@@ -16,13 +15,12 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
-
-
public class SettingsInfoComposite extends Composite {
FileDialog dialog;
+
Button button;
-
+
String testSuitePath;
/**
@@ -30,14 +28,14 @@ public class SettingsInfoComposite extends Composite {
* @param arg1
*/
public SettingsInfoComposite(Composite parent, int style) {
-
+
super(parent, style);
-
+
dialog = new FileDialog(parent.getShell());
-
+
button = new Button(parent, SWT.NONE);
button.setText("Browser for test...");
-
+
button.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent arg0) {
// TODO Auto-generated method stub
@@ -45,7 +43,7 @@ public class SettingsInfoComposite extends Composite {
}
public void mouseDown(MouseEvent arg0) {
-
+
testSuitePath = dialog.open();
System.out.println("file: " + testSuitePath);
@@ -56,31 +54,22 @@ public class SettingsInfoComposite extends Composite {
}
});
-
-
-
-
-
+
}
-
-
+
public String getTestSuite() {
-
+
return testSuitePath;
}
-
/**
*
*/
protected void showFileDialog() {
-
+
testSuitePath = dialog.open();
System.out.println("file: " + testSuitePath);
-
-
+
}
-
-
}
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/TestPoolContentProvider.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/TestPoolContentProvider.java
index b099ef6..b93d3b2 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/TestPoolContentProvider.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/TestPoolContentProvider.java
@@ -6,7 +6,6 @@
*
*************************************************************************/
-
package net.sourceforge.phpeclipse.phpunit;
import java.util.Vector;
@@ -17,46 +16,47 @@ import net.sourceforge.phpeclipse.phpunit.testpool.TestSuite;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
-
-
public class TestPoolContentProvider implements ITreeContentProvider {
-
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
public Object[] getChildren(Object parentElement) {
- if(parentElement instanceof TestSuite) {
+ if (parentElement instanceof TestSuite) {
Vector allChildren = new Vector();
- allChildren.addAll(((TestSuite)parentElement).getTestCases());
- allChildren.addAll(((TestSuite)parentElement).getTestSuites());
-
+ allChildren.addAll(((TestSuite) parentElement).getTestCases());
+ allChildren.addAll(((TestSuite) parentElement).getTestSuites());
+
return allChildren.toArray();
-
+
} else {
return new Object[0];
}
-
-
+
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
*/
public Object getParent(Object element) {
-
- if(element instanceof TestSuite)
- return ((TestSuite)element).getParent();
- else if (element instanceof TestCase)
- return ((TestCase)element).getParentSuite();
+
+ if (element instanceof TestSuite)
+ return ((TestSuite) element).getParent();
+ else if (element instanceof TestCase)
+ return ((TestCase) element).getParentSuite();
else
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
*/
public boolean hasChildren(Object element) {
@@ -64,24 +64,31 @@ public class TestPoolContentProvider implements ITreeContentProvider {
return getChildren(element).length > 0;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
public Object[] getElements(Object inputElement) {
-
+
return getChildren(inputElement);
-
+
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
-
+
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
+ * java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// TODO Auto-generated method stub
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/TestPoolLabelProvider.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/TestPoolLabelProvider.java
index 1aec92c..40614c3 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/TestPoolLabelProvider.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/TestPoolLabelProvider.java
@@ -6,7 +6,6 @@
*
*************************************************************************/
-
package net.sourceforge.phpeclipse.phpunit;
import net.sourceforge.phpeclipse.phpunit.testpool.TestCase;
@@ -15,69 +14,64 @@ import net.sourceforge.phpeclipse.phpunit.testpool.TestSuite;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
-
-
+
public class TestPoolLabelProvider extends LabelProvider {
public String getText(Object element) {
-
+
String text = "";
-
- if(element instanceof TestSuite)
- return ((TestSuite)element).getName();
- else if(element instanceof TestCase) {
-
- text = ((TestCase)element).getTestName();
-
- //has the form: TESTSUITENAME_TESTNAME
-
- }
- else
+
+ if (element instanceof TestSuite)
+ return ((TestSuite) element).getName();
+ else if (element instanceof TestCase) {
+
+ text = ((TestCase) element).getTestName();
+
+ // has the form: TESTSUITENAME_TESTNAME
+
+ } else
text = "UNKNOWN ELEMENT TYPE";
-
+
return text;
-
+
}
public Image getImage(Object element) {
-
+
Image image = null;
ImageDescriptor descriptor = null;
-
- if(element instanceof TestSuite) {
-
- TestSuite suite = (TestSuite)element;
- descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS;
+ if (element instanceof TestSuite) {
+
+ TestSuite suite = (TestSuite) element;
+ descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS;
- if(suite.hasError())
+ if (suite.hasError())
descriptor = PHPUnitImages.DESC_TEST_SUITE_ERROR;
- else if(suite.hasFailure())
+ else if (suite.hasFailure())
descriptor = PHPUnitImages.DESC_TEST_SUITE_FAILURE;
- else if(suite.isAllPass())
+ else if (suite.isAllPass())
descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS;
-
-
- } else if(element instanceof TestCase) {
-
- TestCase test = (TestCase)element;
-
+
+ } else if (element instanceof TestCase) {
+
+ TestCase test = (TestCase) element;
+
descriptor = PHPUnitImages.DESC_TEST_PASS;
-
- if(test.isError())
+
+ if (test.isError())
descriptor = PHPUnitImages.DESC_TEST_ERROR;
- else if(test.isFailure())
+ else if (test.isFailure())
descriptor = PHPUnitImages.DESC_TEST_FAILURE;
- else if(test.isPass())
+ else if (test.isPass())
descriptor = PHPUnitImages.DESC_TEST_PASS;
-
+
}
-
+
image = descriptor.createImage();
-
-
+
return image;
-
+
}
}
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/preferences/PHPUnitPreferencePage.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/preferences/PHPUnitPreferencePage.java
index c00c15b..ffd19f1 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/preferences/PHPUnitPreferencePage.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/preferences/PHPUnitPreferencePage.java
@@ -6,7 +6,6 @@
*
*************************************************************************/
-
package net.sourceforge.phpeclipse.phpunit.preferences;
import net.sourceforge.phpeclipse.phpunit.PHPUnitPlugin;
@@ -18,26 +17,20 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
/**
- * This class represents a preference page that
- * is contributed to the Preferences dialog. By
- * subclassing FieldEditorPreferencePage, we
- * can use the field support built into JFace that allows
- * us to create a page that is small and knows how to
- * save, restore and apply itself.
+ * This class represents a preference page that is contributed to the
+ * Preferences dialog. By subclassing FieldEditorPreferencePage,
+ * we can use the field support built into JFace that allows us to create a page
+ * that is small and knows how to save, restore and apply itself.
*
- * This page is used to modify preferences only. They
- * are stored in the preference store that belongs to
- * the main plug-in class. That way, preferences can
- * be accessed directly via the preference store.
+ * This page is used to modify preferences only. They are stored in the
+ * preference store that belongs to the main plug-in class. That way,
+ * preferences can be accessed directly via the preference store.
*/
-public class PHPUnitPreferencePage
- extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage {
-
-
- public static final String PHPUNIT_PATH = "PHPUnitPathPreference";
+public class PHPUnitPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+ public static final String PHPUNIT_PATH = "PHPUnitPathPreference";
public PHPUnitPreferencePage() {
super(GRID);
@@ -45,31 +38,29 @@ public class PHPUnitPreferencePage
setDescription("Please browse for the folder containing the PHPUnit files (among them: \"phpunit.php\" and \"socketTestResult.php\"). If you don't have it, please download the latest version from http://sourceforge.net/projects/phpunit/ first. ");
initializeDefaults();
}
-/**
- * Sets the default values of the preferences.
- */
+
+ /**
+ * Sets the default values of the preferences.
+ */
private void initializeDefaults() {
IPreferenceStore store = getPreferenceStore();
}
-
-/**
- * Creates the field editors. Field editors are abstractions of
- * the common GUI blocks needed to manipulate various types
- * of preferences. Each field editor knows how to save and
- * restore itself.
- */
- public void createFieldEditors() {
+ /**
+ * Creates the field editors. Field editors are abstractions of the common
+ * GUI blocks needed to manipulate various types of preferences. Each field
+ * editor knows how to save and restore itself.
+ */
- addField(new DirectoryFieldEditor(PHPUNIT_PATH,
- "&PHPUnit Path:", getFieldEditorParent()));
-
+ public void createFieldEditors() {
+ addField(new DirectoryFieldEditor(PHPUNIT_PATH, "&PHPUnit Path:",
+ getFieldEditorParent()));
}
-
+
public void init(IWorkbench workbench) {
-
+
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/ConnectionListener.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/ConnectionListener.java
index 7e5b74f..012a65d 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/ConnectionListener.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/ConnectionListener.java
@@ -6,8 +6,6 @@
*
*************************************************************************/
-
-
package net.sourceforge.phpeclipse.phpunit.reporthandling;
import java.net.ServerSocket;
@@ -15,25 +13,25 @@ import java.net.Socket;
import net.sourceforge.phpeclipse.phpunit.PHPUnitView;
-
public class ConnectionListener extends Thread {
private ServerSocket sSocket = null;
+
private Socket serviceSocket = null;
+
private PHPUnitView view;
-
-
+
public void start(PHPUnitView view) {
-
+
this.view = view;
super.start();
}
-
+
public void run() {
try {
- //reportArea.append("listening at port 12345");
+ // reportArea.append("listening at port 12345");
sSocket = new ServerSocket(12345);
@@ -53,7 +51,7 @@ public class ConnectionListener extends Thread {
} // end of run()
public static void main(String[] args) {
-
+
(new ConnectionListener()).start(new PHPUnitView());
}
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/ReportListener.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/ReportListener.java
index 18238a5..f0fb4a7 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/ReportListener.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/ReportListener.java
@@ -6,8 +6,6 @@
*
*************************************************************************/
-
-
package net.sourceforge.phpeclipse.phpunit.reporthandling;
import java.io.BufferedReader;
@@ -20,8 +18,9 @@ import net.sourceforge.phpeclipse.phpunit.PHPUnitView;
public class ReportListener extends Thread {
Socket serviceSocket;
+
PHPUnitView view;
-
+
public ReportListener(Socket serviceSocket, PHPUnitView view) {
this.view = view;
this.serviceSocket = serviceSocket;
@@ -38,16 +37,16 @@ public class ReportListener extends Thread {
BufferedReader in = new BufferedReader(reader);
String report = null;
int i = 0;
- // keep listening until the
- while ( (report = in.readLine()) != null &&
- (report != "end_all_tests") ) {
+ // keep listening until the
+ while ((report = in.readLine()) != null
+ && (report != "end_all_tests")) {
- //System.out.println("received something...");
+ // System.out.println("received something...");
view.handleReport(report);
- //System.out.println(report);
+ // System.out.println(report);
}
- //reportArea.append("Finished!");
+ // reportArea.append("Finished!");
System.out.println("Finished");
serviceSocket.close();
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/XMLReportHandler.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/XMLReportHandler.java
index 27ddbc3..4638cfe 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/XMLReportHandler.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/reporthandling/XMLReportHandler.java
@@ -6,7 +6,6 @@
*
*************************************************************************/
-
package net.sourceforge.phpeclipse.phpunit.reporthandling;
import java.io.File;
@@ -27,36 +26,42 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class XMLReportHandler extends DefaultHandler {
-
+
private String currentVerdict;
- private PHPUnitView view;
+
+ private PHPUnitView view;
+
private String currentCommand;
+
private String currentTestCount;
+
private String currentTestID;
+
private String currentTestName;
+
private String currentTestParentTestSuiteName;
-
+
private void doAsyncRunnable(Runnable runnable) {
-
+
view.getSite().getShell().getDisplay().asyncExec(runnable);
}
-
+
public void handle(String report, PHPUnitView view) {
- //TODO : how to parse directly a string?
+ // TODO : how to parse directly a string?
// now doing it with a stream.
this.view = view;
SAXParser parser;
-
+
System.out.println("handling: " + report);
-
+
try {
-
+
File file = new File("tmp3.xml");
FileOutputStream out = null;
FileInputStream in = null;
out = new FileOutputStream(file);
- //OutputStreamWriter outS = new OutputStreamWriter(out, UTF8);
+ // OutputStreamWriter outS = new OutputStreamWriter(out, UTF8);
report += "\n \r";
out.write(report.getBytes("UTF8"));
out.close();
@@ -65,7 +70,7 @@ public class XMLReportHandler extends DefaultHandler {
parser.parse(in, this);
in.close();
file.delete();
-
+
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -75,7 +80,7 @@ public class XMLReportHandler extends DefaultHandler {
} catch (FactoryConfigurationError e) {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (FileNotFoundException e1) {
+ } catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e) {
@@ -83,102 +88,104 @@ public class XMLReportHandler extends DefaultHandler {
e.printStackTrace();
}
-
-
}
-
- /* (non-Javadoc)
- * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.ContentHandler#endElement(java.lang.String,
+ * java.lang.String, java.lang.String)
*/
public void endElement(String arg0, String arg1, String elementName)
- throws SAXException {
-
- // send this current command to view
+ throws SAXException {
+
+ // send this current command to view
}
- /* (non-Javadoc)
- * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.xml.sax.ContentHandler#startElement(java.lang.String,
+ * java.lang.String, java.lang.String, org.xml.sax.Attributes)
*/
- public void startElement(
- String arg0,
- String arg1,
- String elementName,
- Attributes attributes)
- throws SAXException {
-
- System.out.println(arg0 + " - " + arg1 + " - " + elementName);
-
-
- if(elementName.equals("report")) {
-
+ public void startElement(String arg0, String arg1, String elementName,
+ Attributes attributes) throws SAXException {
+
+ System.out.println(arg0 + " - " + arg1 + " - " + elementName);
+
+ if (elementName.equals("report")) {
+
currentCommand = attributes.getValue("command");
currentTestCount = attributes.getValue("testCount");
currentTestID = attributes.getValue("testID");
currentTestName = attributes.getValue("testName");
- currentTestParentTestSuiteName = attributes.getValue("parentTestSuiteName");
-
+ currentTestParentTestSuiteName = attributes
+ .getValue("parentTestSuiteName");
+
doAsyncRunnable(new Runnable() {
-
+
public void run() {
-
- //view.handleCommand(currentCommand, currentTestCount, currentTestID, );
- view.handleCommand(currentCommand, new String[] {currentTestID, currentTestCount, currentTestName, currentTestParentTestSuiteName});
-
- }
+
+ // view.handleCommand(currentCommand, currentTestCount,
+ // currentTestID, );
+ view.handleCommand(currentCommand, new String[] {
+ currentTestID, currentTestCount, currentTestName,
+ currentTestParentTestSuiteName });
+
+ }
});
} else if (elementName.equals("verdict")) {
-
- currentVerdict = attributes.getValue("desc");
- //view.setTestVerdict(currentTestID, currentVerdict);
-
+
+ currentVerdict = attributes.getValue("desc");
+ // view.setTestVerdict(currentTestID, currentVerdict);
+
doAsyncRunnable(new Runnable() {
-
+
public void run() {
-
- view.setTestVerdict(currentTestID, currentVerdict);
+
+ view.setTestVerdict(currentTestID, currentVerdict);
}
-
- });
+
+ });
} else if (elementName.equals("exceptions")) {
-
- //do nothing
-
+
+ // do nothing
+
} else if (elementName.equals("exception")) {
-
+
final String exception = attributes.getValue("desc");
-
+
doAsyncRunnable(new Runnable() {
-
+
public void run() {
-
- view.addTestException(currentTestID, exception);
+
+ view.addTestException(currentTestID, exception);
}
-
- });
-
+
+ });
+
}
-
-
+
}
public static void main(String[] args) {
-
+
XMLReportHandler handler = new XMLReportHandler();
String xml = "";
xml = "
- * input string = "abc\ndef\tghi", - * indent = 3 - * result = "\"\t\t\tabc\\n" + - * "\t\t\tdef\tghi\"" + * input string = "abc\ndef\tghi", + * indent = 3 + * result = "\"\t\t\tabc\\n" + + * "\t\t\tdef\tghi\"" ** *
- * input string = "abc\ndef\tghi\n", - * indent = 3 - * result = "\"\t\t\tabc\\n" + - * "\t\t\tdef\tghi\\n\"" + * input string = "abc\ndef\tghi\n", + * indent = 3 + * result = "\"\t\t\tabc\\n" + + * "\t\t\tdef\tghi\\n\"" ** *
- * input string = "abc\r\ndef\tghi\r\n", - * indent = 3 - * result = "\"\t\t\tabc\\r\\n" + - * "\t\t\tdef\tghi\\r\\n\"" + * input string = "abc\r\ndef\tghi\r\n", + * indent = 3 + * result = "\"\t\t\tabc\\r\\n" + + * "\t\t\tdef\tghi\\r\\n\"" ** *
\n" + "EOF;");
- checkPHP("interface Shape { \n" + " function draw(); \n" + "} \n" + "\n" + "class Rectangle implements Shape { \n"
- + " function draw() { \n" + " print \"Drawing a rectangle\"; \n" + " } \n" + "}");
- checkPHP("class MyClass { \n" + " private $priv; \n" + "\n" + " public function getVar() { \n"
+ checkPHP("$this->_reg_objects[$object] =\n"
+ + " array(&$object_impl, $allowed, $smarty_args);");
+ checkPHP("echo <<< EOF\n" + "
|