- * 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()}.
*
*
- * @return The source code, or 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.
*
- * 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.
*
*/
public class PHPDebugModel {
-
+
/**
* Not to be instantiated.
*/
private PHPDebugModel() {
super();
}
-
+
/**
* Returns the identifier for the PHP debug model plug-in
- *
+ *
* @return plugin identifier
*/
-// public static String getPluginIdentifier() {
-// return PHPDebugCorePlugin.getUniqueIdentifier();
-// }
-
+ // public static String getPluginIdentifier() {
+ // return PHPDebugCorePlugin.getUniqueIdentifier();
+ // }
/**
- * Creates and returns a line breakpoint in the type with
- * at the given line number. The marker associated with the
- * breakpoint will be created on the specified resource. If a character
- * range within the line is known, it may be specified by charStart/charEnd.
- * If hitCount is > 0, the breakpoint will suspend execution when it is
- * "hit" the specified number of times.
+ * Creates and returns a line breakpoint in the type with at the given line
+ * number. The marker associated with the breakpoint will be created on the
+ * specified resource. If a character range within the line is known, it may
+ * be specified by charStart/charEnd. If hitCount is > 0, the breakpoint
+ * will suspend execution when it is "hit" the specified number of times.
*
- * @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.
+ * @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:
- *
Failure creating underlying marker. The exception's status contains
- * the underlying exception responsible for the failure.
+ * @exception CoreException
+ * If this method fails. Reasons include:
+ *
+ *
Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for
+ * the failure.
+ *
* @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.
*
* A breakpoint is defined in two parts:
*
- *
By an extension of kind "org.eclipse.debug.core.breakpoints"
- *
By a marker definition that corresponds to the above breakpoint extension
+ *
By an extension of kind
+ * "org.eclipse.debug.core.breakpoints"
+ *
By a marker definition that corresponds to the above breakpoint
+ * extension
*
*
- * 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.
+ * 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.
+ *
*
- * 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.
+ * 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.
*
*
- * 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
+ * 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.
*
*
@@ -76,98 +80,109 @@ import org.eclipse.debug.core.model.IBreakpoint;
public abstract class PHPBreakpoint extends Breakpoint implements IBreakpoint {
/**
- * Breakpoint attribute storing a breakpoint's hit count value
- * (value "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("
"); //$NON-NLS-1$
}
private static String getTypeName(IVariable variable) throws DebugException {
- IValue value= variable.getValue();
- if (value instanceof PHPValue)
- return((PHPValue) value).getReferenceTypeName();
+ IValue value = variable.getValue();
+ if (value instanceof PHPValue)
+ return ((PHPValue) value).getReferenceTypeName();
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.text.ITextHoverExtension#getInformationControlCreator()
*/
public IInformationControlCreator getInformationControlCreator() {
-// if (Platform.getPlugin("org.eclipse.jdt.ui").getPluginPreferences().getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE)) { //$NON-NLS-1$
- return new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent, SWT.NONE,
- new HTMLTextPresenter(true),
- PHPDebugUiMessages.getString("JavaDebugHover.16")); //$NON-NLS-1$
- }
- };
-// }
-// return null;
+ // if
+ // (Platform.getPlugin("org.eclipse.jdt.ui").getPluginPreferences().getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE))
+ // { //$NON-NLS-1$
+ return new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ return new DefaultInformationControl(parent, SWT.NONE,
+ new HTMLTextPresenter(true), PHPDebugUiMessages
+ .getString("JavaDebugHover.16")); //$NON-NLS-1$
+ }
+ };
+ // }
+ // return null;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.text.ITextHoverExtension#getHoverControlCreator()
*/
public IInformationControlCreator getHoverControlCreator() {
- if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE)) { //$NON-NLS-1$
+ if (PreferenceConstants.getPreferenceStore().getBoolean(
+ PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE)) { //$NON-NLS-1$
return new IInformationControlCreator() {
public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent, SWT.NONE,
- new HTMLTextPresenter(true),
- PHPDebugUiMessages.getString("PHPDebugHover.16")); //$NON-NLS-1$
- }
- };
+ return new DefaultInformationControl(parent, SWT.NONE,
+ new HTMLTextPresenter(true), PHPDebugUiMessages
+ .getString("PHPDebugHover.16")); //$NON-NLS-1$
+ }
+ };
}
return null;
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugModelPresentation.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugModelPresentation.java
index 79821fa..866fab9 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugModelPresentation.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugModelPresentation.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;
import java.util.HashMap;
@@ -41,24 +41,29 @@ import org.eclipse.ui.part.FileEditorInput;
/**
* @see IDebugModelPresentation
*/
-public class PHPDebugModelPresentation extends LabelProvider implements IDebugModelPresentation {
+public class PHPDebugModelPresentation extends LabelProvider implements
+ IDebugModelPresentation {
- protected HashMap fAttributes= new HashMap(3);
+ protected HashMap fAttributes = new HashMap(3);
public PHPDebugModelPresentation() {
super();
}
+
/**
* @see IDebugModelPresentation#getEditorId(IEditorInput, Object)
*/
public String getEditorId(IEditorInput input, Object inputObject) {
- IEditorRegistry registry= PlatformUI.getWorkbench().getEditorRegistry();
- IEditorDescriptor descriptor= registry.getDefaultEditor(input.getName());
+ IEditorRegistry registry = PlatformUI.getWorkbench()
+ .getEditorRegistry();
+ IEditorDescriptor descriptor = registry.getDefaultEditor(input
+ .getName());
if (descriptor != null)
return descriptor.getId();
-
+
return null;
}
+
/**
* @see IDebugModelPresentation#setAttribute(String, Object)
*/
@@ -68,17 +73,18 @@ public class PHPDebugModelPresentation extends LabelProvider implements IDebugMo
}
fAttributes.put(id, value);
}
-
+
/**
* @see IDebugModelPresentation#getEditorInput(Object)
*/
public IEditorInput getEditorInput(Object item) {
if (item instanceof PHPLineBreakpoint) {
- IBreakpoint bp= (IBreakpoint)item;
- IMarker ma= bp.getMarker();
- IFile eclipseFile = PHPDebugUiPlugin.getWorkspace().getRoot().getFileForLocation(ma.getResource().getLocation());
- if (eclipseFile == null) {
+ IBreakpoint bp = (IBreakpoint) item;
+ IMarker ma = bp.getMarker();
+ IFile eclipseFile = PHPDebugUiPlugin.getWorkspace().getRoot()
+ .getFileForLocation(ma.getResource().getLocation());
+ if (eclipseFile == null) {
return null;
}
return new FileEditorInput(eclipseFile);
@@ -94,24 +100,25 @@ public class PHPDebugModelPresentation extends LabelProvider implements IDebugMo
return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
} else if (element instanceof IMarker) {
return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
- } else if (element instanceof PHPStackFrame || element instanceof PHPThread || element instanceof IPHPDebugTarget) {
+ } else if (element instanceof PHPStackFrame
+ || element instanceof PHPThread
+ || element instanceof IPHPDebugTarget) {
return getDebugElementImage(element);
} else if (element instanceof PHPVariable) {
- return getVariableImage((PHPVariable)element);
+ return getVariableImage((PHPVariable) element);
} else if (element instanceof PHPValue) {
- return getValueImage((PHPValue)element);
+ return getValueImage((PHPValue) element);
}
return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
}
private Image getVariableImage(PHPVariable phpVar) {
-/* if (phpVar != null) {
- if (phpVar.isLocal())
- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
- if (phpVar.isHashValue())
- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
- }
- */
+ /*
+ * if (phpVar != null) { if (phpVar.isLocal()) return
+ * DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); if
+ * (phpVar.isHashValue()) return
+ * DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); }
+ */
return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
}
@@ -128,17 +135,18 @@ public class PHPDebugModelPresentation extends LabelProvider implements IDebugMo
public String getText(Object element) {
try {
if (element instanceof PHPLineBreakpoint) {
- return getBreakpointText((IBreakpoint)element);
+ return getBreakpointText((IBreakpoint) element);
} else if (element instanceof PHPVariable) {
- PHPVariable phpVar= (PHPVariable) element;
+ PHPVariable phpVar = (PHPVariable) element;
return phpVar.toString();
}
} catch (CoreException e) {
- return PHPDebugUiMessages.getString("PHPDebugModelPresentation."); //$NON-NLS-1$
+ return PHPDebugUiMessages
+ .getString("PHPDebugModelPresentation."); //$NON-NLS-1$
}
return null;
}
-
+
/**
* @see IDebugModelPresentation#computeDetail(IValue, IValueDetailListener)
*/
@@ -147,62 +155,72 @@ public class PHPDebugModelPresentation extends LabelProvider implements IDebugMo
}
protected IBreakpoint getBreakpoint(IMarker marker) {
- return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
+ return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(
+ marker);
}
- protected String getBreakpointText(IBreakpoint breakpoint) throws CoreException {
+ protected String getBreakpointText(IBreakpoint breakpoint)
+ throws CoreException {
if (breakpoint instanceof PHPLineBreakpoint) {
return getLineBreakpointText((PHPLineBreakpoint) breakpoint);
}
return ""; //$NON-NLS-1$
}
-
- protected String getLineBreakpointText(PHPLineBreakpoint breakpoint) throws CoreException {
+
+ protected String getLineBreakpointText(PHPLineBreakpoint breakpoint)
+ throws CoreException {
StringBuffer label = new StringBuffer();
- label.append (breakpoint.getMarker().getResource().getFullPath());
- label.append (" ["); //$NON-NLS-1$
- label.append (PHPDebugUiMessages.getString("PHPDebugModelPresentation.line")); //$NON-NLS-1$
- label.append (' ');
- label.append (breakpoint.getLineNumber());
- label.append (']');
-
- if (breakpoint.getHitCount () > 0) {
- label.append (" [skip count ");
- label.append (breakpoint.getHitCount ());
- label.append (']');
+ label.append(breakpoint.getMarker().getResource().getFullPath());
+ label.append(" ["); //$NON-NLS-1$
+ label.append(PHPDebugUiMessages
+ .getString("PHPDebugModelPresentation.line")); //$NON-NLS-1$
+ label.append(' ');
+ label.append(breakpoint.getLineNumber());
+ label.append(']');
+
+ if (breakpoint.getHitCount() > 0) {
+ label.append(" [skip count ");
+ label.append(breakpoint.getHitCount());
+ label.append(']');
}
-
- if (breakpoint.isConditionEnabled ()){
- label.append (" [conditional]");
+
+ if (breakpoint.isConditionEnabled()) {
+ label.append(" [conditional]");
}
-
+
return label.toString();
}
-
+
/**
* Returns the image associated with the given element or 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 = ""; //$NON-NLS-1$
-// }
-// IType type= method.getDeclaringType();
-// String methodSignature= method.getSignature();
-// if (!type.isBinary()) {
-// //resolve the type names
-// methodSignature= resolveMethodSignature(type, methodSignature);
-// if (methodSignature == null) {
-// IStatus status = new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, "Source method signature could not be resolved", null); //$NON-NLS-1$
-// throw new CoreException(status);
-// }
-// }
-// JDIDebugModel.createMethodBreakpoint(BreakpointUtils.getBreakpointResource(method), type.getFullyQualifiedName(), methodName, methodSignature, true, false, false, -1, start, end, 0, true, attributes);
-// } else {
-// // remove breakpoint
-// breakpointManager.removeBreakpoint(breakpoint, true);
-// }
-// }
-// }
+ 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 = ""; //$NON-NLS-1$
+ // }
+ // IType type= method.getDeclaringType();
+ // String methodSignature= method.getSignature();
+ // if (!type.isBinary()) {
+ // //resolve the type names
+ // methodSignature= resolveMethodSignature(type, methodSignature);
+ // if (methodSignature == null) {
+ // IStatus status = new Status(IStatus.ERROR,
+ // JDIDebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, "Source method
+ // signature could not be resolved", null); //$NON-NLS-1$
+ // throw new CoreException(status);
+ // }
+ // }
+ // JDIDebugModel.createMethodBreakpoint(BreakpointUtils.getBreakpointResource(method),
+ // type.getFullyQualifiedName(), methodName, methodSignature, true,
+ // false, false, -1, start, end, 0, true, attributes);
+ // } else {
+ // // remove breakpoint
+ // breakpointManager.removeBreakpoint(breakpoint, true);
+ // }
+ // }
+ // }
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
*/
- public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) {
-// if (selection instanceof IStructuredSelection) {
-// IStructuredSelection ss = (IStructuredSelection) selection;
-// return getMethods(ss).length > 0;
-// } else {
-// return selection instanceof ITextSelection;
-// }
+ public boolean canToggleMethodBreakpoints(IWorkbenchPart part,
+ ISelection selection) {
+ // if (selection instanceof IStructuredSelection) {
+ // IStructuredSelection ss = (IStructuredSelection) selection;
+ // return getMethods(ss).length > 0;
+ // } else {
+ // return selection instanceof ITextSelection;
+ // }
return false;
}
@@ -266,7 +321,8 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
while (iterator.hasNext()) {
Object thing = iterator.next();
try {
- if (thing instanceof IMethod && !Flags.isAbstract(((IMethod)thing).getFlags())) {
+ if (thing instanceof IMethod
+ && !Flags.isAbstract(((IMethod) thing).getFlags())) {
methods.add(thing);
}
} catch (JavaModelException e) {
@@ -276,128 +332,153 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
}
}
-// protected IField[] getFields(IStructuredSelection selection) {
-// if (selection.isEmpty()) {
-// return new IField[0];
-// } else {
-// List fields = new ArrayList(selection.size());
-// Iterator iterator = selection.iterator();
-// while (iterator.hasNext()) {
-// Object thing = iterator.next();
-// if (thing instanceof IField) {
-// fields.add(thing);
-// } else if (thing instanceof IJavaFieldVariable) {
-// IField field= getField((IJavaFieldVariable) thing);
-// if (field != null) {
-// fields.add(field);
-// }
-// }
-// }
-// return (IField[]) fields.toArray(new IField[fields.size()]);
-// }
-// }
+ // protected IField[] getFields(IStructuredSelection selection) {
+ // if (selection.isEmpty()) {
+ // return new IField[0];
+ // } else {
+ // List fields = new ArrayList(selection.size());
+ // Iterator iterator = selection.iterator();
+ // while (iterator.hasNext()) {
+ // Object thing = iterator.next();
+ // if (thing instanceof IField) {
+ // fields.add(thing);
+ // } else if (thing instanceof IJavaFieldVariable) {
+ // IField field= getField((IJavaFieldVariable) thing);
+ // if (field != null) {
+ // fields.add(field);
+ // }
+ // }
+ // }
+ // return (IField[]) fields.toArray(new IField[fields.size()]);
+ // }
+ // }
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
*/
- public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
-// report(null, part);
-// selection = translateToMembers(part, selection);
-// if (selection instanceof ITextSelection) {
-// ITextSelection textSelection= (ITextSelection) selection;
-// CompilationUnit compilationUnit= parseCompilationUnit((ITextEditor)part);
-// if (compilationUnit != null) {
-// BreakpointFieldLocator locator= new BreakpointFieldLocator(textSelection.getOffset());
-// compilationUnit.accept(locator);
-// String fieldName= locator.getFieldName();
-// if (fieldName == null) {
-// report(ActionMessages.getString("ManageWatchpointActionDelegate.CantAdd"), part); //$NON-NLS-1$
-// return;
-// }
-// String typeName= locator.getTypeName();
-// // check if the watchpoint already exists. 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 IJavaWatchpoint) {
-// IJavaWatchpoint watchpoint= (IJavaWatchpoint)breakpoint;
-// if (typeName.equals(watchpoint.getTypeName()) && fieldName.equals(watchpoint.getFieldName())) {
-// breakpointManager.removeBreakpoint(watchpoint, true);
-// return;
-// }
-// }
-// }
-// // add the watchpoint
-// JDIDebugModel.createWatchpoint(getResource((IEditorPart)part), typeName, fieldName, -1, -1, -1, 0, true, new HashMap(10));
-// }
-// } else if (selection instanceof IStructuredSelection) {
-// IField[] members = getFields((IStructuredSelection)selection);
-// if (members.length == 0) {
-// report(ActionMessages.getString("ToggleBreakpointAdapter.10"), part); //$NON-NLS-1$
-// return;
-// }
-// // add or remove watchpoint
-// IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
-// for (int i= 0, length= members.length; i < length; i++) {
-// IField element= members[i];
-// IJavaBreakpoint breakpoint= getBreakpoint(element);
-// if (breakpoint == null) {
-// IType type = element.getDeclaringType();
-// int start = -1;
-// int end = -1;
-// ISourceRange range = element.getNameRange();
-// if (range != null) {
-// start = range.getOffset();
-// end = start + range.getLength();
-// }
-// Map attributes = new HashMap(10);
-// BreakpointUtils.addJavaBreakpointAttributes(attributes, element);
-// JDIDebugModel.createWatchpoint(BreakpointUtils.getBreakpointResource(type), type.getFullyQualifiedName(), element.getElementName(), -1, start, end, 0, true, attributes);
-// } else {
-// // remove breakpoint
-// breakpointManager.removeBreakpoint(breakpoint, true);
-// }
-// }
-// }
+ public void toggleWatchpoints(IWorkbenchPart part, ISelection selection)
+ throws CoreException {
+ // report(null, part);
+ // selection = translateToMembers(part, selection);
+ // if (selection instanceof ITextSelection) {
+ // ITextSelection textSelection= (ITextSelection) selection;
+ // CompilationUnit compilationUnit=
+ // parseCompilationUnit((ITextEditor)part);
+ // if (compilationUnit != null) {
+ // BreakpointFieldLocator locator= new
+ // BreakpointFieldLocator(textSelection.getOffset());
+ // compilationUnit.accept(locator);
+ // String fieldName= locator.getFieldName();
+ // if (fieldName == null) {
+ // report(ActionMessages.getString("ManageWatchpointActionDelegate.CantAdd"),
+ // part); //$NON-NLS-1$
+ // return;
+ // }
+ // String typeName= locator.getTypeName();
+ // // check if the watchpoint already exists. 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 IJavaWatchpoint) {
+ // IJavaWatchpoint watchpoint= (IJavaWatchpoint)breakpoint;
+ // if (typeName.equals(watchpoint.getTypeName()) &&
+ // fieldName.equals(watchpoint.getFieldName())) {
+ // breakpointManager.removeBreakpoint(watchpoint, true);
+ // return;
+ // }
+ // }
+ // }
+ // // add the watchpoint
+ // JDIDebugModel.createWatchpoint(getResource((IEditorPart)part),
+ // typeName, fieldName, -1, -1, -1, 0, true, new HashMap(10));
+ // }
+ // } else if (selection instanceof IStructuredSelection) {
+ // IField[] members = getFields((IStructuredSelection)selection);
+ // if (members.length == 0) {
+ // report(ActionMessages.getString("ToggleBreakpointAdapter.10"), part);
+ // //$NON-NLS-1$
+ // return;
+ // }
+ // // add or remove watchpoint
+ // IBreakpointManager breakpointManager=
+ // DebugPlugin.getDefault().getBreakpointManager();
+ // for (int i= 0, length= members.length; i < length; i++) {
+ // IField element= members[i];
+ // IJavaBreakpoint breakpoint= getBreakpoint(element);
+ // if (breakpoint == null) {
+ // IType type = element.getDeclaringType();
+ // int start = -1;
+ // int end = -1;
+ // ISourceRange range = element.getNameRange();
+ // if (range != null) {
+ // start = range.getOffset();
+ // end = start + range.getLength();
+ // }
+ // Map attributes = new HashMap(10);
+ // BreakpointUtils.addJavaBreakpointAttributes(attributes, element);
+ // JDIDebugModel.createWatchpoint(BreakpointUtils.getBreakpointResource(type),
+ // type.getFullyQualifiedName(), element.getElementName(), -1, start,
+ // end, 0, true, attributes);
+ // } else {
+ // // remove breakpoint
+ // breakpointManager.removeBreakpoint(breakpoint, true);
+ // }
+ // }
+ // }
}
- public static String resolveMethodSignature(IType type, String methodSignature) throws JavaModelException {
- String[] parameterTypes= Signature.getParameterTypes(methodSignature);
- int length= length= parameterTypes.length;
- String[] resolvedParameterTypes= new String[length];
+ public static String resolveMethodSignature(IType type,
+ String methodSignature) throws JavaModelException {
+ String[] parameterTypes = Signature.getParameterTypes(methodSignature);
+ int length = length = parameterTypes.length;
+ String[] resolvedParameterTypes = new String[length];
for (int i = 0; i < length; i++) {
- resolvedParameterTypes[i]= resolveType(type, parameterTypes[i]);
+ resolvedParameterTypes[i] = resolveType(type, parameterTypes[i]);
if (resolvedParameterTypes[i] == null) {
return null;
}
}
- String resolvedReturnType= resolveType(type, Signature.getReturnType(methodSignature));
+ String resolvedReturnType = resolveType(type, Signature
+ .getReturnType(methodSignature));
if (resolvedReturnType == null) {
return null;
}
- return Signature.createMethodSignature(resolvedParameterTypes, resolvedReturnType);
+ return Signature.createMethodSignature(resolvedParameterTypes,
+ resolvedReturnType);
}
- private static String resolveType(IType type, String typeSignature) throws JavaModelException {
-// int count= Signature.getArrayCount(typeSignature);
-// String elementTypeSignature= Signature.getElementType(typeSignature);
-// if (elementTypeSignature.length() == 1) {
-// // no need to resolve primitive types
-// return typeSignature;
-// }
-// String elementTypeName= Signature.toString(elementTypeSignature);
-// String[][] resolvedElementTypeNames= type.resolveType(elementTypeName);
-// if (resolvedElementTypeNames == null || resolvedElementTypeNames.length != 1) {
-// // the type name cannot be resolved
-// return null;
-// }
-// String resolvedElementTypeName= Signature.toQualifiedName(resolvedElementTypeNames[0]);
-// String resolvedElementTypeSignature= Signature.createTypeSignature(resolvedElementTypeName, true).replace('.', '/');
-// return Signature.createArraySignature(resolvedElementTypeSignature, count);
+ private static String resolveType(IType type, String typeSignature)
+ throws JavaModelException {
+ // int count= Signature.getArrayCount(typeSignature);
+ // String elementTypeSignature= Signature.getElementType(typeSignature);
+ // if (elementTypeSignature.length() == 1) {
+ // // no need to resolve primitive types
+ // return typeSignature;
+ // }
+ // String elementTypeName= Signature.toString(elementTypeSignature);
+ // String[][] resolvedElementTypeNames=
+ // type.resolveType(elementTypeName);
+ // if (resolvedElementTypeNames == null ||
+ // resolvedElementTypeNames.length != 1) {
+ // // the type name cannot be resolved
+ // return null;
+ // }
+ // String resolvedElementTypeName=
+ // Signature.toQualifiedName(resolvedElementTypeNames[0]);
+ // String resolvedElementTypeSignature=
+ // Signature.createTypeSignature(resolvedElementTypeName,
+ // true).replace('.', '/');
+ // return Signature.createArraySignature(resolvedElementTypeSignature,
+ // count);
return "";
}
@@ -405,27 +486,30 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
IResource resource;
IEditorInput editorInput = editor.getEditorInput();
if (editorInput instanceof IFileEditorInput) {
- resource= ((IFileEditorInput)editorInput).getFile();
+ resource = ((IFileEditorInput) editorInput).getFile();
} else {
- resource= ResourcesPlugin.getWorkspace().getRoot();
+ resource = ResourcesPlugin.getWorkspace().getRoot();
}
return resource;
}
/**
* Returns a handle to the specified method or 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 = "****";
-
+
protected String interpreterArguments, phpFileArguments;
public static ExecutionArguments getExecutionArguments(IFile phpScriptFile) {
try {
- String executionArgumentsPersistableFormat = phpScriptFile.getPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY);
+ String executionArgumentsPersistableFormat = phpScriptFile
+ .getPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY);
ExecutionArguments executionArguments = new ExecutionArguments();
-
- if (executionArgumentsPersistableFormat != null) {
- int argBreakIndex = executionArgumentsPersistableFormat.indexOf(ARGUMENT_SEPARATOR);
- executionArguments.setInterpreterArguments(executionArgumentsPersistableFormat.substring(0, argBreakIndex));
- executionArguments.setPHPFileArguments(executionArgumentsPersistableFormat.substring(argBreakIndex + ARGUMENT_SEPARATOR.length()));
+
+ if (executionArgumentsPersistableFormat != null) {
+ int argBreakIndex = executionArgumentsPersistableFormat
+ .indexOf(ARGUMENT_SEPARATOR);
+ executionArguments
+ .setInterpreterArguments(executionArgumentsPersistableFormat
+ .substring(0, argBreakIndex));
+ executionArguments
+ .setPHPFileArguments(executionArgumentsPersistableFormat
+ .substring(argBreakIndex
+ + ARGUMENT_SEPARATOR.length()));
}
-
+
return executionArguments;
- } catch (CoreException e) {}
-
+ } catch (CoreException e) {
+ }
+
return null;
}
- public static void setExecutionArguments(IFile phpScriptFile, ExecutionArguments arguments) {
+ public static void setExecutionArguments(IFile phpScriptFile,
+ ExecutionArguments arguments) {
try {
- phpScriptFile.setPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY, arguments.toPersistableFormat());
- } catch (CoreException e) {}
+ phpScriptFile.setPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY,
+ arguments.toPersistableFormat());
+ } catch (CoreException e) {
+ }
}
public void setInterpreterArguments(String theArguments) {
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java
index 6784d49..7831922 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java
@@ -10,7 +10,7 @@ import org.eclipse.swt.graphics.Image;
/**
* @author xp4
- *
+ *
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
*/
@@ -28,9 +28,11 @@ public class LoadPathEntryLabelProvider implements ILabelProvider {
*/
public String getText(Object element) {
if (element != null && element.getClass() == LoadPathEntry.class)
- return ((LoadPathEntry) element).getProject().getLocation().toOSString();
-
- PHPDebugUiPlugin.log(new RuntimeException("Unable to render load path."));
+ return ((LoadPathEntry) element).getProject().getLocation()
+ .toOSString();
+
+ PHPDebugUiPlugin
+ .log(new RuntimeException("Unable to render load path."));
return null;
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPApplicationTabGroup.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPApplicationTabGroup.java
index f4e47f6..6b0ea92 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPApplicationTabGroup.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPApplicationTabGroup.java
@@ -6,24 +6,21 @@ import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
-public class PHPApplicationTabGroup
- extends AbstractLaunchConfigurationTabGroup {
+public class PHPApplicationTabGroup extends AbstractLaunchConfigurationTabGroup {
public PHPApplicationTabGroup() {
super();
}
/**
- * @see ILaunchConfigurationTabGroup#createTabs(ILaunchConfigurationDialog, String)
+ * @see ILaunchConfigurationTabGroup#createTabs(ILaunchConfigurationDialog,
+ * String)
*/
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
- new PHPEntryPointTab(),
- new PHPArgumentsTab(),
- new PHPEnvironmentTab(),
- new PHPEnvironmentTab2(),
- new CommonTab()
- };
+ new PHPEntryPointTab(), new PHPArgumentsTab(),
+ new PHPEnvironmentTab(), new PHPEnvironmentTab2(),
+ new CommonTab() };
setTabs(tabs);
}
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPArgumentsTab.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPArgumentsTab.java
index 26ff6c7..2368be5 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPArgumentsTab.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPArgumentsTab.java
@@ -26,7 +26,9 @@ import org.eclipse.swt.widgets.Text;
public class PHPArgumentsTab extends AbstractLaunchConfigurationTab {
protected Text interpreterArgsText, programArgsText;
+
protected DirectorySelector workingDirectorySelector;
+
protected Button useDefaultWorkingDirectoryButton;
public PHPArgumentsTab() {
@@ -36,35 +38,51 @@ public class PHPArgumentsTab extends AbstractLaunchConfigurationTab {
public void createControl(Composite parent) {
Composite composite = createPageRoot(parent);
- new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.working_dir"));
+ new Label(composite, SWT.NONE).setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPArguments.working_dir"));
workingDirectorySelector = new DirectorySelector(composite);
- workingDirectorySelector.setBrowseDialogMessage(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.working_dir_browser_message"));
- workingDirectorySelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ workingDirectorySelector
+ .setBrowseDialogMessage(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPArguments.working_dir_browser_message"));
+ workingDirectorySelector.setLayoutData(new GridData(
+ GridData.FILL_HORIZONTAL));
workingDirectorySelector.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
- Composite defaultWorkingDirectoryComposite = new Composite(composite, SWT.NONE);
+ Composite defaultWorkingDirectoryComposite = new Composite(composite,
+ SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
defaultWorkingDirectoryComposite.setLayout(layout);
- useDefaultWorkingDirectoryButton = new Button(defaultWorkingDirectoryComposite, SWT.CHECK);
- useDefaultWorkingDirectoryButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setUseDefaultWorkingDirectory(((Button) e.getSource()).getSelection());
- }
- });
- new Label(defaultWorkingDirectoryComposite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.working_dir_use_default_message"));
+ useDefaultWorkingDirectoryButton = new Button(
+ defaultWorkingDirectoryComposite, SWT.CHECK);
+ useDefaultWorkingDirectoryButton
+ .addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ setUseDefaultWorkingDirectory(((Button) e.getSource())
+ .getSelection());
+ }
+ });
+ new Label(defaultWorkingDirectoryComposite, SWT.NONE)
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPArguments.working_dir_use_default_message"));
defaultWorkingDirectoryComposite.pack();
- new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.interpreter_args_box_title"));
- interpreterArgsText = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
+ new Label(composite, SWT.NONE)
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPArguments.interpreter_args_box_title"));
+ interpreterArgsText = new Text(composite, SWT.MULTI | SWT.V_SCROLL
+ | SWT.BORDER);
interpreterArgsText.setLayoutData(new GridData(GridData.FILL_BOTH));
- new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.program_args_box_title"));
- programArgsText = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
+ new Label(composite, SWT.NONE)
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPArguments.program_args_box_title"));
+ programArgsText = new Text(composite, SWT.MULTI | SWT.V_SCROLL
+ | SWT.BORDER);
programArgsText.setLayoutData(new GridData(GridData.FILL_BOTH));
}
@@ -72,24 +90,34 @@ public class PHPArgumentsTab extends AbstractLaunchConfigurationTab {
if (!useDefaultWorkingDirectoryButton.getSelection() == useDefault)
useDefaultWorkingDirectoryButton.setSelection(useDefault);
if (useDefault)
- workingDirectorySelector.setSelectionText(PHPDebugUiConstants.DEFAULT_WORKING_DIRECTORY);
+ workingDirectorySelector
+ .setSelectionText(PHPDebugUiConstants.DEFAULT_WORKING_DIRECTORY);
workingDirectorySelector.setEnabled(!useDefault);
}
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, PHPDebugUiConstants.DEFAULT_WORKING_DIRECTORY);
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.WORKING_DIRECTORY,
+ PHPDebugUiConstants.DEFAULT_WORKING_DIRECTORY);
// set hidden attribute
- configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "net.sourceforge.phpdt.debug.ui.PHPSourceLocator") ;
+ configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID,
+ "net.sourceforge.phpdt.debug.ui.PHPSourceLocator");
}
public void initializeFrom(ILaunchConfiguration configuration) {
String workingDirectory = "", interpreterArgs = "", programArgs = "";
boolean useDefaultWorkDir = true;
try {
- workingDirectory = configuration.getAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
- interpreterArgs = configuration.getAttribute(PHPLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS, "");
- programArgs = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROGRAM_ARGUMENTS, "");
- useDefaultWorkDir = configuration.getAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_WORKING_DIRECTORY, true);
+ workingDirectory = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
+ interpreterArgs = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS, "");
+ programArgs = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.PROGRAM_ARGUMENTS, "");
+ useDefaultWorkDir = configuration
+ .getAttribute(
+ PHPLaunchConfigurationAttribute.USE_DEFAULT_WORKING_DIRECTORY,
+ true);
} catch (CoreException e) {
log(e);
}
@@ -101,10 +129,18 @@ public class PHPArgumentsTab extends AbstractLaunchConfigurationTab {
}
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, workingDirectorySelector.getValidatedSelectionText());
- configuration.setAttribute(PHPLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS, interpreterArgsText.getText());
- configuration.setAttribute(PHPLaunchConfigurationAttribute.PROGRAM_ARGUMENTS, programArgsText.getText());
- configuration.setAttribute(PHPLaunchConfigurationAttribute.USE_DEFAULT_WORKING_DIRECTORY, useDefaultWorkingDirectoryButton.getSelection());
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.WORKING_DIRECTORY,
+ workingDirectorySelector.getValidatedSelectionText());
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS,
+ interpreterArgsText.getText());
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.PROGRAM_ARGUMENTS,
+ programArgsText.getText());
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.USE_DEFAULT_WORKING_DIRECTORY,
+ useDefaultWorkingDirectoryButton.getSelection());
}
protected Composite createPageRoot(Composite parent) {
@@ -119,14 +155,17 @@ public class PHPArgumentsTab extends AbstractLaunchConfigurationTab {
}
public String getName() {
- return PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.name");
+ return PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPArguments.name");
}
public boolean isValid(ILaunchConfiguration launchConfig) {
try {
- String workingDirectory = launchConfig.getAttribute(PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
+ String workingDirectory = launchConfig.getAttribute(
+ PHPLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
if (workingDirectory.length() == 0) {
- setErrorMessage(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPArguments.working_dir_error_message"));
+ setErrorMessage(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPArguments.working_dir_error_message"));
return false;
}
} catch (CoreException e) {
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEntryPointTab.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEntryPointTab.java
index 37007fb..57c3e81 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEntryPointTab.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEntryPointTab.java
@@ -42,10 +42,13 @@ public class PHPEntryPointTab extends AbstractLaunchConfigurationTab {
public void createControl(Composite parent) {
Composite composite = createPageRoot(parent);
- new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEntryPoint.projectLabel"));
+ new Label(composite, SWT.NONE)
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEntryPoint.projectLabel"));
projectSelector = new PHPProjectSelector(composite);
- projectSelector.setBrowseDialogMessage(PHPDebugUiMessages
- .getString("LaunchConfigurationTab.PHPEntryPoint.projectSelectorMessage"));
+ projectSelector
+ .setBrowseDialogMessage(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEntryPoint.projectSelectorMessage"));
projectSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
projectSelector.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
@@ -53,9 +56,12 @@ public class PHPEntryPointTab extends AbstractLaunchConfigurationTab {
}
});
- new Label(composite, SWT.NONE).setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEntryPoint.fileLabel"));
+ new Label(composite, SWT.NONE).setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEntryPoint.fileLabel"));
fileSelector = new PHPFileSelector(composite, projectSelector);
- fileSelector.setBrowseDialogMessage(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEntryPoint.fileSelectorMessage"));
+ fileSelector
+ .setBrowseDialogMessage(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEntryPoint.fileSelectorMessage"));
fileSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fileSelector.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
@@ -91,29 +97,38 @@ public class PHPEntryPointTab extends AbstractLaunchConfigurationTab {
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
IResource file = getContext();
if (file != null) {
- configuration.setAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, file.getProject().getName());
- configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_NAME,file.getProjectRelativePath().toOSString());
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.PROJECT_NAME, file
+ .getProject().getName());
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.FILE_NAME, file
+ .getProjectRelativePath().toOSString());
}
}
public void initializeFrom(ILaunchConfiguration configuration) {
try {
- originalProjectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
- originalFileName = configuration.getAttribute(PHPLaunchConfigurationAttribute.FILE_NAME, "");
+ originalProjectName = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
+ originalFileName = configuration.getAttribute(
+ PHPLaunchConfigurationAttribute.FILE_NAME, "");
} catch (CoreException e) {
log(e);
}
projectSelector.setSelectionText(originalProjectName);
if (!"".equals(originalFileName))
- fileSelector.setSelectionText(new Path(originalFileName).toOSString());
+ fileSelector.setSelectionText(new Path(originalFileName)
+ .toOSString());
}
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, projectSelector.getSelectionText());
+ configuration.setAttribute(
+ PHPLaunchConfigurationAttribute.PROJECT_NAME, projectSelector
+ .getSelectionText());
IFile file = fileSelector.getSelection();
- configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_NAME, file == null ? "" : file.getProjectRelativePath()
- .toString());
+ configuration.setAttribute(PHPLaunchConfigurationAttribute.FILE_NAME,
+ file == null ? "" : file.getProjectRelativePath().toString());
}
protected Composite createPageRoot(Composite parent) {
@@ -127,21 +142,26 @@ public class PHPEntryPointTab extends AbstractLaunchConfigurationTab {
}
public String getName() {
- return PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEntryPoint.name");
+ return PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEntryPoint.name");
}
public boolean isValid(ILaunchConfiguration launchConfig) {
try {
- String projectName = launchConfig.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
+ String projectName = launchConfig.getAttribute(
+ PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
if (projectName.length() == 0) {
- setErrorMessage(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEntryPoint.invalidProjectSelectionMessage"));
+ setErrorMessage(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEntryPoint.invalidProjectSelectionMessage"));
return false;
}
- String fileName = launchConfig.getAttribute(PHPLaunchConfigurationAttribute.FILE_NAME, "");
+ String fileName = launchConfig.getAttribute(
+ PHPLaunchConfigurationAttribute.FILE_NAME, "");
if (fileName.length() == 0) {
- setErrorMessage(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEntryPoint.invalidFileSelectionMessage"));
+ setErrorMessage(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEntryPoint.invalidFileSelectionMessage"));
return false;
}
} catch (CoreException e) {
diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java
index 7146d15..0257ce1 100644
--- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java
+++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java
@@ -49,406 +49,461 @@ import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
- protected ListViewer loadPathListViewer;
+ protected ListViewer loadPathListViewer;
- protected java.util.List installedInterpretersWorkingCopy;
+ protected java.util.List installedInterpretersWorkingCopy;
- protected Combo interpreterCombo;
+ protected Combo interpreterCombo;
- // protected Button loadPathDefaultButton;
- protected Button fRemoteDebugCheckBox;
- protected Button fRemoteDebugTranslate;
+ // protected Button loadPathDefaultButton;
+ protected Button fRemoteDebugCheckBox;
- protected Button fOpenDBGSessionInBrowserCheckBox;
+ protected Button fRemoteDebugTranslate;
- protected Button fPathMapRemoveButton;
+ protected Button fOpenDBGSessionInBrowserCheckBox;
- protected Button fPathMapAddButton;
+ protected Button fPathMapRemoveButton;
- protected Button fPathMapEditButton;
+ protected Button fPathMapAddButton;
- protected Text fRemoteSourcePath;
+ protected Button fPathMapEditButton;
- protected Table fRemoteDebugPathMapTable;
+ protected Text fRemoteSourcePath;
- protected TabFolder tabFolder;
+ protected Table fRemoteDebugPathMapTable;
- private class RemoteDebugTabListener extends SelectionAdapter implements ModifyListener {
+ protected TabFolder tabFolder;
+
+ private class RemoteDebugTabListener extends SelectionAdapter implements
+ ModifyListener {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void modifyText(ModifyEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent e) {
+ Object source = e.getSource();
+ if (source == fRemoteDebugPathMapTable) {
+ setPathMapButtonsEnableState();
+ } else if (source == fPathMapAddButton) {
+ handlePathMapAddButtonSelected();
+ } else if (source == fPathMapEditButton) {
+ handlePathMapEditButtonSelected();
+ } else if (source == fPathMapRemoveButton) {
+ handlePathMapRemoveButtonSelected();
+ } else if (source == fRemoteDebugCheckBox) {
+ setRemoteTabEnableState();
+ } else if (source == fRemoteDebugTranslate) {
+ setRemoteTabEnableState();
+ } else {
+ updateLaunchConfigurationDialog();
+ ;
+ }
+
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- updateLaunchConfigurationDialog();
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
- Object source = e.getSource();
- if (source == fRemoteDebugPathMapTable) {
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ private RemoteDebugTabListener fListener = new RemoteDebugTabListener();
+
+ private static final boolean DEFAULT_REMOTE_DEBUG = false;
+
+ private static final boolean DEFAULT_REMOTE_DEBUG_TRANSLATE = false;
+
+ private static final boolean DEFAULT_OPEN_DBGSESSION_IN_BROWSER = true;
+
+ static String[] columnTitles = {
+ PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.local"),
+ PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.remote") };
+
+ public PHPEnvironmentTab() {
+ super();
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = createPageRoot(parent);
+
+ tabFolder = new TabFolder(composite, SWT.NONE);
+ GridData gridData = new GridData(GridData.FILL_BOTH);
+ tabFolder.setLayoutData(gridData);
+
+ // addLoadPathTab(tabFolder);
+ addInterpreterTab(tabFolder);
+ addRemoteDebugTab(tabFolder);
+ }
+
+ protected void addRemoteDebugTab(TabFolder tabFolder) {
+ Label label;
+
+ TabItem remoteDebugTab = new TabItem(tabFolder, SWT.NONE, 0);
+ remoteDebugTab
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.label"));
+
+ Composite comp = new Composite(tabFolder, SWT.NONE);
+ comp.setLayout(new GridLayout());
+ remoteDebugTab.setControl(comp);
+ GridData gd;
+
+ fRemoteDebugCheckBox = new Button(comp, SWT.CHECK);
+ fRemoteDebugCheckBox
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteCheckBox.label"));
+ fRemoteDebugCheckBox.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING));
+ fRemoteDebugCheckBox.addSelectionListener(fListener);
+
+ fRemoteDebugTranslate = new Button(comp, SWT.CHECK);
+ fRemoteDebugTranslate
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteTranslate.label"));
+ fRemoteDebugTranslate.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING));
+ fRemoteDebugTranslate.addSelectionListener(fListener);
+
+ fOpenDBGSessionInBrowserCheckBox = new Button(comp, SWT.CHECK);
+ fOpenDBGSessionInBrowserCheckBox
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.OpenDBGSessionInBrowserCheckBox.label"));
+ fOpenDBGSessionInBrowserCheckBox.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING));
+ fOpenDBGSessionInBrowserCheckBox.addSelectionListener(fListener);
+
+ label = new Label(comp, SWT.NONE);
+ label
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteSourcePath.label"));
+ fRemoteSourcePath = new Text(comp, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fRemoteSourcePath.setLayoutData(gd);
+ fRemoteSourcePath.addModifyListener(fListener);
+
+ createVerticalSpacer(comp, 1);
+
+ Composite pathMapComp = new Composite(comp, SWT.NONE);
+ gd = new GridData(GridData.FILL_BOTH);
+ pathMapComp.setLayoutData(gd);
+ GridLayout parametersLayout = new GridLayout();
+ parametersLayout.numColumns = 2;
+ parametersLayout.marginHeight = 0;
+ parametersLayout.marginWidth = 0;
+ pathMapComp.setLayout(parametersLayout);
+
+ Label pathMapLabel = new Label(pathMapComp, SWT.NONE);
+ pathMapLabel
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.label"));
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ pathMapLabel.setLayoutData(gd);
+
+ fRemoteDebugPathMapTable = new Table(pathMapComp, SWT.BORDER
+ | SWT.MULTI);
+ TableLayout tableLayout = new TableLayout();
+ fRemoteDebugPathMapTable.setLayout(tableLayout);
+
+ gd = new GridData(GridData.FILL_BOTH);
+ fRemoteDebugPathMapTable.setLayoutData(gd);
+ TableColumn column1 = new TableColumn(this.fRemoteDebugPathMapTable,
+ SWT.NONE);
+ column1
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.local")); //$NON-NLS-1$
+ TableColumn column2 = new TableColumn(this.fRemoteDebugPathMapTable,
+ SWT.NONE);
+ column2
+ .setText(PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.remote")); //$NON-NLS-1$
+ tableLayout.addColumnData(new ColumnWeightData(100));
+ tableLayout.addColumnData(new ColumnWeightData(100));
+ fRemoteDebugPathMapTable.setHeaderVisible(true);
+ fRemoteDebugPathMapTable.setLinesVisible(true);
+ fRemoteDebugPathMapTable.addSelectionListener(fListener);
+ fRemoteDebugPathMapTable.addMouseListener(new MouseAdapter() {
+ public void mouseDoubleClick(MouseEvent e) {
+ setPathMapButtonsEnableState();
+ if (fPathMapEditButton.isEnabled()) {
+ handlePathMapEditButtonSelected();
+ }
+ }
+ });
+ // fRemoteDebugPathMapTable.setEnabled(false);
+
+ Composite envButtonComp = new Composite(pathMapComp, SWT.NONE);
+ GridLayout envButtonLayout = new GridLayout();
+ envButtonLayout.marginHeight = 0;
+ envButtonLayout.marginWidth = 0;
+ envButtonComp.setLayout(envButtonLayout);
+ gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING
+ | GridData.HORIZONTAL_ALIGN_FILL);
+ envButtonComp.setLayoutData(gd);
+
+ fPathMapAddButton = createPushButton(
+ envButtonComp,
+ PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Add.label"), null); //$NON-NLS-1$
+ fPathMapAddButton.addSelectionListener(fListener);
+ // fPathMapAddButton.setEnabled(false);
+
+ fPathMapEditButton = createPushButton(
+ envButtonComp,
+ PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Edit.label"), null); //$NON-NLS-1$
+ fPathMapEditButton.addSelectionListener(fListener);
+ // fPathMapEditButton.setEnabled(false);
+
+ fPathMapRemoveButton = createPushButton(
+ envButtonComp,
+ PHPDebugUiMessages
+ .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Remove.label"), null); //$NON-NLS-1$
+ fPathMapRemoveButton.addSelectionListener(fListener);
+ // fPathMapRemoveButton.setEnabled(false);
+
+ }
+
+ void handlePathMapAddButtonSelected() {
+ EditPathMapDialog dialog = new EditPathMapDialog(getShell(),
+ "Edit File Map", new String[] { EMPTY_STRING, EMPTY_STRING });
+ openNewPathMapDialog(dialog, null);
+ // dialog.create();
+ // if (dialog.open()==EditPathMapDialog.OK)
+ // {
+ // TableItem item = new TableItem (fRemoteDebugPathMapTable, SWT.NONE);
+ // item.setText(0,dialog.getLocalPath());
+ // item.setText(1,dialog.getRemotePath());
+ // updateLaunchConfigurationDialog();
+ // }
+ // updateLaunchConfigurationDialog();
+ setPathMapButtonsEnableState();
+ }
+
+ void handlePathMapRemoveButtonSelected() {
+ int[] selectedIndices = this.fRemoteDebugPathMapTable
+ .getSelectionIndices();
+ this.fRemoteDebugPathMapTable.remove(selectedIndices);
setPathMapButtonsEnableState();
- } else if (source == fPathMapAddButton) {
- handlePathMapAddButtonSelected();
- } else if (source == fPathMapEditButton) {
- handlePathMapEditButtonSelected();
- } else if (source == fPathMapRemoveButton) {
- handlePathMapRemoveButtonSelected();
- } else if (source == fRemoteDebugCheckBox) {
- setRemoteTabEnableState();
- } else if (source == fRemoteDebugTranslate) {
- setRemoteTabEnableState();
- } else {
updateLaunchConfigurationDialog();
- ;
- }
+ }
+ void handlePathMapEditButtonSelected() {
+ TableItem selectedItem = this.fRemoteDebugPathMapTable.getSelection()[0];
+ String local = selectedItem.getText(0);
+ String remote = selectedItem.getText(1);
+ EditPathMapDialog dialog = new EditPathMapDialog(getShell(),
+ "Edit File Map", new String[] { local, remote });
+ openNewPathMapDialog(dialog, selectedItem);
}
- }
-
- private static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
- private RemoteDebugTabListener fListener = new RemoteDebugTabListener();
-
- private static final boolean DEFAULT_REMOTE_DEBUG = false;
-
- private static final boolean DEFAULT_REMOTE_DEBUG_TRANSLATE = false;
-
- private static final boolean DEFAULT_OPEN_DBGSESSION_IN_BROWSER = true;
-
- static String[] columnTitles = {
- PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.local"),
- PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMapTableTitle.remote") };
-
- public PHPEnvironmentTab() {
- super();
- }
-
- public void createControl(Composite parent) {
- Composite composite = createPageRoot(parent);
-
- tabFolder = new TabFolder(composite, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_BOTH);
- tabFolder.setLayoutData(gridData);
-
- // addLoadPathTab(tabFolder);
- addInterpreterTab(tabFolder);
- addRemoteDebugTab(tabFolder);
- }
-
- protected void addRemoteDebugTab(TabFolder tabFolder) {
- Label label;
-
- TabItem remoteDebugTab = new TabItem(tabFolder, SWT.NONE, 0);
- remoteDebugTab.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.label"));
-
- Composite comp = new Composite(tabFolder, SWT.NONE);
- comp.setLayout(new GridLayout());
- remoteDebugTab.setControl(comp);
- GridData gd;
-
- fRemoteDebugCheckBox = new Button(comp, SWT.CHECK);
- fRemoteDebugCheckBox.setText(PHPDebugUiMessages
- .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteCheckBox.label"));
- fRemoteDebugCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- fRemoteDebugCheckBox.addSelectionListener(fListener);
-
- fRemoteDebugTranslate = new Button(comp, SWT.CHECK);
- fRemoteDebugTranslate.setText(PHPDebugUiMessages
- .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteTranslate.label"));
- fRemoteDebugTranslate.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- fRemoteDebugTranslate.addSelectionListener(fListener);
-
- fOpenDBGSessionInBrowserCheckBox = new Button(comp, SWT.CHECK);
- fOpenDBGSessionInBrowserCheckBox.setText(PHPDebugUiMessages
- .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.OpenDBGSessionInBrowserCheckBox.label"));
- fOpenDBGSessionInBrowserCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- fOpenDBGSessionInBrowserCheckBox.addSelectionListener(fListener);
-
- label = new Label(comp, SWT.NONE);
- label.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.RemoteSourcePath.label"));
- fRemoteSourcePath = new Text(comp, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fRemoteSourcePath.setLayoutData(gd);
- fRemoteSourcePath.addModifyListener(fListener);
-
- createVerticalSpacer(comp, 1);
-
- Composite pathMapComp = new Composite(comp, SWT.NONE);
- gd = new GridData(GridData.FILL_BOTH);
- pathMapComp.setLayoutData(gd);
- GridLayout parametersLayout = new GridLayout();
- parametersLayout.numColumns = 2;
- parametersLayout.marginHeight = 0;
- parametersLayout.marginWidth = 0;
- pathMapComp.setLayout(parametersLayout);
-
- Label pathMapLabel = new Label(pathMapComp, SWT.NONE);
- pathMapLabel.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.label"));
- gd = new GridData();
- gd.horizontalSpan = 2;
- pathMapLabel.setLayoutData(gd);
-
- fRemoteDebugPathMapTable = new Table(pathMapComp, SWT.BORDER | SWT.MULTI);
- TableLayout tableLayout = new TableLayout();
- fRemoteDebugPathMapTable.setLayout(tableLayout);
-
- gd = new GridData(GridData.FILL_BOTH);
- fRemoteDebugPathMapTable.setLayoutData(gd);
- TableColumn column1 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE);
- column1.setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.local")); //$NON-NLS-1$
- TableColumn column2 = new TableColumn(this.fRemoteDebugPathMapTable, SWT.NONE);
- column2
- .setText(PHPDebugUiMessages.getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Table.Title.remote")); //$NON-NLS-1$
- tableLayout.addColumnData(new ColumnWeightData(100));
- tableLayout.addColumnData(new ColumnWeightData(100));
- fRemoteDebugPathMapTable.setHeaderVisible(true);
- fRemoteDebugPathMapTable.setLinesVisible(true);
- fRemoteDebugPathMapTable.addSelectionListener(fListener);
- fRemoteDebugPathMapTable.addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- setPathMapButtonsEnableState();
- if (fPathMapEditButton.isEnabled()) {
- handlePathMapEditButtonSelected();
+ /**
+ * Set the enabled state of whole tab.
+ */
+ private void setRemoteTabEnableState() {
+ boolean state = fRemoteDebugCheckBox.getSelection();
+ fRemoteSourcePath.setEnabled(state);
+ fRemoteDebugTranslate.setEnabled(state);
+
+ fRemoteDebugPathMapTable.setEnabled(state);
+ if (!state) {
+ fPathMapEditButton.setEnabled(false);
+ fPathMapRemoveButton.setEnabled(false);
+ fPathMapAddButton.setEnabled(false);
+ fOpenDBGSessionInBrowserCheckBox.setEnabled(false);
+ } else {
+ setPathMapButtonsEnableState();
}
- }
- });
- // fRemoteDebugPathMapTable.setEnabled(false);
-
- Composite envButtonComp = new Composite(pathMapComp, SWT.NONE);
- GridLayout envButtonLayout = new GridLayout();
- envButtonLayout.marginHeight = 0;
- envButtonLayout.marginWidth = 0;
- envButtonComp.setLayout(envButtonLayout);
- gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
- envButtonComp.setLayoutData(gd);
-
- fPathMapAddButton = createPushButton(envButtonComp, PHPDebugUiMessages
- .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Add.label"), null); //$NON-NLS-1$
- fPathMapAddButton.addSelectionListener(fListener);
- // fPathMapAddButton.setEnabled(false);
-
- fPathMapEditButton = createPushButton(envButtonComp, PHPDebugUiMessages
- .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Edit.label"), null); //$NON-NLS-1$
- fPathMapEditButton.addSelectionListener(fListener);
- // fPathMapEditButton.setEnabled(false);
-
- fPathMapRemoveButton = createPushButton(envButtonComp, PHPDebugUiMessages
- .getString("LaunchConfigurationTab.PHPEnvironment.remoteDebugTab.PathMap.Button.Remove.label"), null); //$NON-NLS-1$
- fPathMapRemoveButton.addSelectionListener(fListener);
- // fPathMapRemoveButton.setEnabled(false);
-
- }
-
- void handlePathMapAddButtonSelected() {
- EditPathMapDialog dialog = new EditPathMapDialog(getShell(), "Edit File Map", new String[] { EMPTY_STRING, EMPTY_STRING });
- openNewPathMapDialog(dialog, null);
- // dialog.create();
- // if (dialog.open()==EditPathMapDialog.OK)
- // {
- // TableItem item = new TableItem (fRemoteDebugPathMapTable, SWT.NONE);
- // item.setText(0,dialog.getLocalPath());
- // item.setText(1,dialog.getRemotePath());
- // updateLaunchConfigurationDialog();
- // }
- // updateLaunchConfigurationDialog();
- setPathMapButtonsEnableState();
- }
-
- void handlePathMapRemoveButtonSelected() {
- int[] selectedIndices = this.fRemoteDebugPathMapTable.getSelectionIndices();
- this.fRemoteDebugPathMapTable.remove(selectedIndices);
- setPathMapButtonsEnableState();
- updateLaunchConfigurationDialog();
- }
-
- void handlePathMapEditButtonSelected() {
- TableItem selectedItem = this.fRemoteDebugPathMapTable.getSelection()[0];
- String local = selectedItem.getText(0);
- String remote = selectedItem.getText(1);
- EditPathMapDialog dialog = new EditPathMapDialog(getShell(), "Edit File Map", new String[] { local, remote });
- openNewPathMapDialog(dialog, selectedItem);
- }
-
- /**
- * Set the enabled state of whole tab.
- */
- private void setRemoteTabEnableState() {
- boolean state = fRemoteDebugCheckBox.getSelection();
- fRemoteSourcePath.setEnabled(state);
- fRemoteDebugTranslate.setEnabled(state);
-
- fRemoteDebugPathMapTable.setEnabled(state);
- if (!state) {
- fPathMapEditButton.setEnabled(false);
- fPathMapRemoveButton.setEnabled(false);
- fPathMapAddButton.setEnabled(false);
- fOpenDBGSessionInBrowserCheckBox.setEnabled(false);
- } else {
- setPathMapButtonsEnableState();
+
+ updateLaunchConfigurationDialog();
}
- updateLaunchConfigurationDialog();
- }
+ /**
+ * Set the enabled state of the three environment variable-related buttons
+ * based on the selection in the PathMapTable widget.
+ */
+ private void setPathMapButtonsEnableState() {
+ // just do nothing for now
+ //
+ if (fRemoteDebugCheckBox.getSelection()) {
+ fOpenDBGSessionInBrowserCheckBox.setEnabled(true);
+ fRemoteDebugTranslate.setEnabled(true);
+ int selectCount = this.fRemoteDebugPathMapTable
+ .getSelectionIndices().length;
+ if (selectCount < 1) {
+ fPathMapEditButton.setEnabled(false);
+ fPathMapRemoveButton.setEnabled(false);
+ } else {
+ fPathMapRemoveButton.setEnabled(true);
+ if (selectCount == 1) {
+ fPathMapEditButton.setEnabled(true);
+ } else {
+ fPathMapEditButton.setEnabled(false);
+ }
+ }
+ fPathMapAddButton.setEnabled(true);
+ }
+ }
- /**
- * Set the enabled state of the three environment variable-related buttons based on the selection in the PathMapTable widget.
- */
- private void setPathMapButtonsEnableState() {
- // just do nothing for now
- //
- if (fRemoteDebugCheckBox.getSelection()) {
- fOpenDBGSessionInBrowserCheckBox.setEnabled(true);
- fRemoteDebugTranslate.setEnabled(true);
- int selectCount = this.fRemoteDebugPathMapTable.getSelectionIndices().length;
- if (selectCount < 1) {
- fPathMapEditButton.setEnabled(false);
- fPathMapRemoveButton.setEnabled(false);
- } else {
- fPathMapRemoveButton.setEnabled(true);
- if (selectCount == 1) {
- fPathMapEditButton.setEnabled(true);
- } else {
- fPathMapEditButton.setEnabled(false);
+ /**
+ * 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;
+ }
+ 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(" ", indx)) != -1) {
- // newer php error output (tested with 4.2.3)
- scanLine(output, file, indx, brIndx);
- indx = brIndx + 6;
- flag = false;
- }
- if (flag) {
- while ((brIndx = output.indexOf(" ", indx)) != -1) {
- // older php error output (tested with 4.2.3)
- scanLine(output, file, indx, brIndx);
- indx = brIndx + 4;
- }
- }
- }
-
- private void scanLine(final String output, final IFile file, final int indx, final int brIndx) throws CoreException {
- String current;
- // String outLineNumberString; never used
- final StringBuffer lineNumberBuffer = new StringBuffer(10);
- char ch;
- current = output.substring(indx, brIndx);
-
- if (current.indexOf(PARSE_WARNING_STRING) != -1 || current.indexOf(PARSE_ERROR_STRING) != -1) {
- final int onLine = current.indexOf("on line ");
- if (onLine != -1) {
- lineNumberBuffer.delete(0, lineNumberBuffer.length());
- for (int i = onLine; i < current.length(); i++) {
- ch = current.charAt(i);
- if ('0' <= ch && '9' >= ch) {
- lineNumberBuffer.append(ch);
- }
- }
-
- final int lineNumber = Integer.parseInt(lineNumberBuffer.toString());
-
- final Hashtable attributes = new Hashtable();
-
- current = StringUtil.replaceAll(current, "\n", "");
- current = StringUtil.replaceAll(current, "", "");
- current = StringUtil.replaceAll(current, "", "");
- MarkerUtilities.setMessage(attributes, current);
-
- if (current.indexOf(PARSE_ERROR_STRING) != -1)
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- else if (current.indexOf(PARSE_WARNING_STRING) != -1)
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- else
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- MarkerUtilities.setLineNumber(attributes, lineNumber);
- MarkerUtilities.createMarker(file, attributes, PROBLEM_ID);
- }
- }
- }
-
- /**
- * This will set a marker.
- *
- * @param file
- * the file that generated the marker
- * @param message
- * the message
- * @param charStart
- * the starting character
- * @param charEnd
- * the end character
- * @param errorLevel
- * the error level ({@link ExternalPHPParser#ERROR},{@link ExternalPHPParser#INFO},{@link ExternalPHPParser#WARNING}),
- * {@link ExternalPHPParser#TASK})
- * @throws CoreException
- * an exception throwed by the MarkerUtilities
- */
- private void setMarker(final IFile file, final String message, final int charStart, final int charEnd, final int errorLevel)
- throws CoreException {
- if (file != null) {
- final Hashtable attributes = new Hashtable();
- MarkerUtilities.setMessage(attributes, message);
- switch (errorLevel) {
- case ERROR:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- break;
- case WARNING:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- break;
- case INFO:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- break;
- case TASK:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.TASK));
- break;
- }
- MarkerUtilities.setCharStart(attributes, charStart);
- MarkerUtilities.setCharEnd(attributes, charEnd);
- MarkerUtilities.createMarker(file, attributes, PROBLEM_ID);
- }
- }
-
- /**
- * This will set a marker.
- *
- * @param file
- * the file that generated the marker
- * @param message
- * the message
- * @param line
- * the line number
- * @param errorLevel
- * the error level ({@link ExternalPHPParser#ERROR},{@link ExternalPHPParser#INFO},{@link ExternalPHPParser#WARNING})
- * @throws CoreException
- * an exception throwed by the MarkerUtilities
- */
- private void setMarker(final IFile file, final String message, final int line, final int errorLevel, final String location)
- throws CoreException {
- if (file != null) {
- String markerKind = PROBLEM_ID;
- final Hashtable attributes = new Hashtable();
- MarkerUtilities.setMessage(attributes, message);
- switch (errorLevel) {
- case ERROR:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- break;
- case WARNING:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- break;
- case INFO:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- break;
- case TASK:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- markerKind = IMarker.TASK;
- break;
- }
- attributes.put(IMarker.LOCATION, location);
- MarkerUtilities.setLineNumber(attributes, line);
- MarkerUtilities.createMarker(file, attributes, markerKind);
- }
- }
-
- /**
- * This will set a marker.
- *
- * @param message
- * the message
- * @param charStart
- * the starting character
- * @param charEnd
- * the end character
- * @param errorLevel
- * the error level ({@link ExternalPHPParser#ERROR},{@link ExternalPHPParser#INFO},{@link ExternalPHPParser#WARNING})
- * @throws CoreException
- * an exception throwed by the MarkerUtilities
- */
- private void setMarker(final String message, final int charStart, final int charEnd, final int errorLevel, final String location)
- throws CoreException {
- if (fFileToParse != null) {
- setMarker(fFileToParse, message, charStart, charEnd, errorLevel, location);
- }
- }
-
- /**
- * This will set a marker.
- *
- * @param file
- * the file that generated the marker
- * @param message
- * the message
- * @param charStart
- * the starting character
- * @param charEnd
- * the end character
- * @param errorLevel
- * the error level ({@link ExternalPHPParser#ERROR},{@link ExternalPHPParser#INFO},{@link ExternalPHPParser#WARNING})
- * @param location
- * the location of the error
- * @throws CoreException
- * an exception throwed by the MarkerUtilities
- */
- private void setMarker(final IFile file, final String message, final int charStart, final int charEnd, final int errorLevel,
- final String location) throws CoreException {
- if (file != null) {
- final Hashtable attributes = new Hashtable();
- MarkerUtilities.setMessage(attributes, message);
- switch (errorLevel) {
- case ERROR:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- break;
- case WARNING:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- break;
- case INFO:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- break;
- case TASK:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.TASK));
- break;
- }
- attributes.put(IMarker.LOCATION, location);
- MarkerUtilities.setCharStart(attributes, charStart);
- MarkerUtilities.setCharEnd(attributes, charEnd);
- MarkerUtilities.createMarker(file, attributes, PROBLEM_ID); //IMarker.PROBLEM);
- }
- }
-
- private String getParserOutput(String command, String consoleMessage) {
- try {
- PHPConsole console = new PHPConsole();
- try {
- console.println(consoleMessage + command);
- } catch (Throwable th) {
-
- }
-
- Runtime runtime = Runtime.getRuntime();
-
- // runs the command
- Process p = runtime.exec(command);
-
- // gets the input stream to have the post-compile-time information
- InputStream stream = p.getInputStream();
-
- // get the string from Stream
- String consoleOutput = PHPConsole.getStringFromStream(stream);
-
- // prints out the information
- if (console != null) {
- console.print(consoleOutput);
- }
- return consoleOutput;
-
- } catch (IOException e) {
- MessageDialog.openInformation(null, "IOException: ", e.getMessage());
- }
- return "";
- }
+ 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(" ", indx)) != -1) {
+ // newer php error output (tested with 4.2.3)
+ scanLine(output, file, indx, brIndx);
+ indx = brIndx + 6;
+ flag = false;
+ }
+ if (flag) {
+ while ((brIndx = output.indexOf(" ", indx)) != -1) {
+ // older php error output (tested with 4.2.3)
+ scanLine(output, file, indx, brIndx);
+ indx = brIndx + 4;
+ }
+ }
+ }
+
+ private void scanLine(final String output, final IFile file,
+ final int indx, final int brIndx) throws CoreException {
+ String current;
+ // String outLineNumberString; never used
+ final StringBuffer lineNumberBuffer = new StringBuffer(10);
+ char ch;
+ current = output.substring(indx, brIndx);
+
+ if (current.indexOf(PARSE_WARNING_STRING) != -1
+ || current.indexOf(PARSE_ERROR_STRING) != -1) {
+ final int onLine = current.indexOf("on line ");
+ if (onLine != -1) {
+ lineNumberBuffer.delete(0, lineNumberBuffer.length());
+ for (int i = onLine; i < current.length(); i++) {
+ ch = current.charAt(i);
+ if ('0' <= ch && '9' >= ch) {
+ lineNumberBuffer.append(ch);
+ }
+ }
+
+ final int lineNumber = Integer.parseInt(lineNumberBuffer
+ .toString());
+
+ final Hashtable attributes = new Hashtable();
+
+ current = StringUtil.replaceAll(current, "\n", "");
+ current = StringUtil.replaceAll(current, "", "");
+ current = StringUtil.replaceAll(current, "", "");
+ MarkerUtilities.setMessage(attributes, current);
+
+ if (current.indexOf(PARSE_ERROR_STRING) != -1)
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_ERROR));
+ else if (current.indexOf(PARSE_WARNING_STRING) != -1)
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_WARNING));
+ else
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_INFO));
+ MarkerUtilities.setLineNumber(attributes, lineNumber);
+ MarkerUtilities.createMarker(file, attributes, PROBLEM_ID);
+ }
+ }
+ }
+
+ /**
+ * This will set a marker.
+ *
+ * @param file
+ * the file that generated the marker
+ * @param message
+ * the message
+ * @param charStart
+ * the starting character
+ * @param charEnd
+ * the end character
+ * @param errorLevel
+ * the error level ({@link ExternalPHPParser#ERROR},{@link ExternalPHPParser#INFO},{@link ExternalPHPParser#WARNING}),
+ * {@link ExternalPHPParser#TASK})
+ * @throws CoreException
+ * an exception throwed by the MarkerUtilities
+ */
+ private void setMarker(final IFile file, final String message,
+ final int charStart, final int charEnd, final int errorLevel)
+ throws CoreException {
+ if (file != null) {
+ final Hashtable attributes = new Hashtable();
+ MarkerUtilities.setMessage(attributes, message);
+ switch (errorLevel) {
+ case ERROR:
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_ERROR));
+ break;
+ case WARNING:
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_WARNING));
+ break;
+ case INFO:
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_INFO));
+ break;
+ case TASK:
+ attributes.put(IMarker.SEVERITY, new Integer(IMarker.TASK));
+ break;
+ }
+ MarkerUtilities.setCharStart(attributes, charStart);
+ MarkerUtilities.setCharEnd(attributes, charEnd);
+ MarkerUtilities.createMarker(file, attributes, PROBLEM_ID);
+ }
+ }
+
+ /**
+ * This will set a marker.
+ *
+ * @param file
+ * the file that generated the marker
+ * @param message
+ * the message
+ * @param line
+ * the line number
+ * @param errorLevel
+ * the error level ({@link ExternalPHPParser#ERROR},{@link ExternalPHPParser#INFO},{@link ExternalPHPParser#WARNING})
+ * @throws CoreException
+ * an exception throwed by the MarkerUtilities
+ */
+ private void setMarker(final IFile file, final String message,
+ final int line, final int errorLevel, final String location)
+ throws CoreException {
+ if (file != null) {
+ String markerKind = PROBLEM_ID;
+ final Hashtable attributes = new Hashtable();
+ MarkerUtilities.setMessage(attributes, message);
+ switch (errorLevel) {
+ case ERROR:
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_ERROR));
+ break;
+ case WARNING:
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_WARNING));
+ break;
+ case INFO:
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_INFO));
+ break;
+ case TASK:
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_INFO));
+ markerKind = IMarker.TASK;
+ break;
+ }
+ attributes.put(IMarker.LOCATION, location);
+ MarkerUtilities.setLineNumber(attributes, line);
+ MarkerUtilities.createMarker(file, attributes, markerKind);
+ }
+ }
+
+ /**
+ * This will set a marker.
+ *
+ * @param message
+ * the message
+ * @param charStart
+ * the starting character
+ * @param charEnd
+ * the end character
+ * @param errorLevel
+ * the error level ({@link ExternalPHPParser#ERROR},{@link ExternalPHPParser#INFO},{@link ExternalPHPParser#WARNING})
+ * @throws CoreException
+ * an exception throwed by the MarkerUtilities
+ */
+ private void setMarker(final String message, final int charStart,
+ final int charEnd, final int errorLevel, final String location)
+ throws CoreException {
+ if (fFileToParse != null) {
+ setMarker(fFileToParse, message, charStart, charEnd, errorLevel,
+ location);
+ }
+ }
+
+ /**
+ * This will set a marker.
+ *
+ * @param file
+ * the file that generated the marker
+ * @param message
+ * the message
+ * @param charStart
+ * the starting character
+ * @param charEnd
+ * the end character
+ * @param errorLevel
+ * the error level ({@link ExternalPHPParser#ERROR},{@link ExternalPHPParser#INFO},{@link ExternalPHPParser#WARNING})
+ * @param location
+ * the location of the error
+ * @throws CoreException
+ * an exception throwed by the MarkerUtilities
+ */
+ private void setMarker(final IFile file, final String message,
+ final int charStart, final int charEnd, final int errorLevel,
+ final String location) throws CoreException {
+ if (file != null) {
+ final Hashtable attributes = new Hashtable();
+ MarkerUtilities.setMessage(attributes, message);
+ switch (errorLevel) {
+ case ERROR:
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_ERROR));
+ break;
+ case WARNING:
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_WARNING));
+ break;
+ case INFO:
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_INFO));
+ break;
+ case TASK:
+ attributes.put(IMarker.SEVERITY, new Integer(IMarker.TASK));
+ break;
+ }
+ attributes.put(IMarker.LOCATION, location);
+ MarkerUtilities.setCharStart(attributes, charStart);
+ MarkerUtilities.setCharEnd(attributes, charEnd);
+ MarkerUtilities.createMarker(file, attributes, PROBLEM_ID); // IMarker.PROBLEM);
+ }
+ }
+
+ private String getParserOutput(String command, String consoleMessage) {
+ try {
+ PHPConsole console = new PHPConsole();
+ try {
+ console.println(consoleMessage + command);
+ } catch (Throwable th) {
+
+ }
+
+ Runtime runtime = Runtime.getRuntime();
+
+ // runs the command
+ Process p = runtime.exec(command);
+
+ // gets the input stream to have the post-compile-time information
+ InputStream stream = p.getInputStream();
+
+ // get the string from Stream
+ String consoleOutput = PHPConsole.getStringFromStream(stream);
+
+ // prints out the information
+ if (console != null) {
+ console.print(consoleOutput);
+ }
+ return consoleOutput;
+
+ } catch (IOException e) {
+ MessageDialog
+ .openInformation(null, "IOException: ", e.getMessage());
+ }
+ return "";
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPExternalParserAction.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPExternalParserAction.java
index 58a5a2e..f255449 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPExternalParserAction.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPExternalParserAction.java
@@ -1,14 +1,14 @@
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
+
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
package net.sourceforge.phpdt.externaltools.actions;
import java.util.Iterator;
@@ -23,67 +23,71 @@ import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
-
public class PHPExternalParserAction implements IObjectActionDelegate {
- private IWorkbenchPart workbenchPart;
- /**
- * Constructor for Action1.
- */
- public PHPExternalParserAction() {
- super();
- }
-
- /**
- * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- workbenchPart = targetPart;
- }
-
- // public static void open(final URL url, final Shell shell, final String dialogTitle) {
- // IHelp help= WorkbenchHelp.getHelpSupport();
- // if (help != null) {
- // WorkbenchHelp.getHelpSupport().displayHelpResource(url.toExternalForm());
- // } else {
- // showMessage(shell, dialogTitle, ActionMessages.getString("OpenBrowserUtil.help_not_available"), false); //$NON-NLS-1$
- // }
- // }
-
- public void run(IAction action) {
- ISelectionProvider selectionProvider = null;
- selectionProvider = workbenchPart.getSite().getSelectionProvider();
-
- StructuredSelection selection = null;
- selection = (StructuredSelection) selectionProvider.getSelection();
-
- //Shell shell = null;
- Iterator iterator = null;
- iterator = selection.iterator();
- while (iterator.hasNext()) {
- // obj => selected object in the view
- Object obj = iterator.next();
-
- // is it a resource
- if (obj instanceof IResource) {
- IResource resource = (IResource) obj;
-
- // check if it's a file resource
- switch (resource.getType()) {
-
- case IResource.FILE :
- // single file:
- ExternalPHPParser parser = new ExternalPHPParser((IFile)resource);
- parser.phpExternalParse();
- }
- }
- }
- }
-
- /**
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
+ private IWorkbenchPart workbenchPart;
+
+ /**
+ * Constructor for Action1.
+ */
+ public PHPExternalParserAction() {
+ super();
+ }
+
+ /**
+ * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ workbenchPart = targetPart;
+ }
+
+ // public static void open(final URL url, final Shell shell, final String
+ // dialogTitle) {
+ // IHelp help= WorkbenchHelp.getHelpSupport();
+ // if (help != null) {
+ // WorkbenchHelp.getHelpSupport().displayHelpResource(url.toExternalForm());
+ // } else {
+ // showMessage(shell, dialogTitle,
+ // ActionMessages.getString("OpenBrowserUtil.help_not_available"), false);
+ // //$NON-NLS-1$
+ // }
+ // }
+
+ public void run(IAction action) {
+ ISelectionProvider selectionProvider = null;
+ selectionProvider = workbenchPart.getSite().getSelectionProvider();
+
+ StructuredSelection selection = null;
+ selection = (StructuredSelection) selectionProvider.getSelection();
+
+ // Shell shell = null;
+ Iterator iterator = null;
+ iterator = selection.iterator();
+ while (iterator.hasNext()) {
+ // obj => selected object in the view
+ Object obj = iterator.next();
+
+ // is it a resource
+ if (obj instanceof IResource) {
+ IResource resource = (IResource) obj;
+
+ // check if it's a file resource
+ switch (resource.getType()) {
+
+ case IResource.FILE:
+ // single file:
+ ExternalPHPParser parser = new ExternalPHPParser(
+ (IFile) resource);
+ parser.phpExternalParse();
+ }
+ }
+ }
+ }
+
+ /**
+ * @see IActionDelegate#selectionChanged(IAction, ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPRestartApacheAction.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPRestartApacheAction.java
index 0a13cfa..5eb021d 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPRestartApacheAction.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPRestartApacheAction.java
@@ -1,30 +1,30 @@
/**********************************************************************
-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
- www.phpeclipse.de
-**********************************************************************/
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
package net.sourceforge.phpdt.externaltools.actions;
-
import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.preference.IPreferenceStore;
public class PHPRestartApacheAction extends PHPStartApacheAction {
- public void run(IAction action) {
- final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
- // execute(store.getString(PHPeclipsePlugin.APACHE_RESTART_PREF), "Restart Apache: ");
- execute(
- "apache_restart",
- store.getString(ExternalToolsPlugin.APACHE_RUN_PREF),
- store.getString(ExternalToolsPlugin.APACHE_RESTART_PREF),
- store.getBoolean(ExternalToolsPlugin.APACHE_RESTART_BACKGROUND));
- }
+ public void run(IAction action) {
+ final IPreferenceStore store = ExternalToolsPlugin.getDefault()
+ .getPreferenceStore();
+ // execute(store.getString(PHPeclipsePlugin.APACHE_RESTART_PREF),
+ // "Restart Apache: ");
+ execute("apache_restart", store
+ .getString(ExternalToolsPlugin.APACHE_RUN_PREF), store
+ .getString(ExternalToolsPlugin.APACHE_RESTART_PREF), store
+ .getBoolean(ExternalToolsPlugin.APACHE_RESTART_BACKGROUND));
+ }
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartApacheAction.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartApacheAction.java
index ebe3de7..28e2ed8 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartApacheAction.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartApacheAction.java
@@ -20,57 +20,66 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate {
- protected IWorkbenchWindow activeWindow = null;
+ protected IWorkbenchWindow activeWindow = null;
- public void run(IAction action) {
- final IPreferenceStore webUIStore = WebUI.getDefault().getPreferenceStore();
+ public void run(IAction action) {
+ final IPreferenceStore webUIStore = WebUI.getDefault()
+ .getPreferenceStore();
- String documentRoot = webUIStore.getString(WebUI.PHP_DOCUMENTROOT_PREF);
- final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
+ String documentRoot = webUIStore.getString(WebUI.PHP_DOCUMENTROOT_PREF);
+ final IPreferenceStore store = ExternalToolsPlugin.getDefault()
+ .getPreferenceStore();
- // replace backslash with slash in the DocumentRoot under Windows
- documentRoot = documentRoot.replace('\\', '/');
- String[] arguments = { documentRoot };
- MessageFormat form = new MessageFormat(store.getString(ExternalToolsPlugin.APACHE_START_PREF));
- execute("apache_start", store.getString(ExternalToolsPlugin.APACHE_RUN_PREF), form.format(arguments), store
- .getBoolean(ExternalToolsPlugin.APACHE_START_BACKGROUND));
- }
+ // replace backslash with slash in the DocumentRoot under Windows
+ documentRoot = documentRoot.replace('\\', '/');
+ String[] arguments = { documentRoot };
+ MessageFormat form = new MessageFormat(store
+ .getString(ExternalToolsPlugin.APACHE_START_PREF));
+ execute("apache_start", store
+ .getString(ExternalToolsPlugin.APACHE_RUN_PREF), form
+ .format(arguments), store
+ .getBoolean(ExternalToolsPlugin.APACHE_START_BACKGROUND));
+ }
- /**
- * Executes an external progam and saves the LaunchConfiguration under external tools
- *
- * @param command
- * external tools command name
- * @param executable
- * executable path i.e.c:\apache\apache.exe
- * @param arguments
- * arguments for this configuration
- * @param background
- * run this configuration in background mode
- */
- public static void execute(String command, String executable, String arguments, boolean background) {
-// PHPConsole console = new PHPConsole();
-// String consoleMessage;
-// if (background) {
-// consoleMessage = "run in background mode-" + command + ": " + executable + " " + arguments;
-// } else {
-// consoleMessage = "run in foreground mode-" + command + ": " + executable + " " + arguments;
-// }
-// console.println(consoleMessage);
+ /**
+ * Executes an external progam and saves the LaunchConfiguration under
+ * external tools
+ *
+ * @param command
+ * external tools command name
+ * @param executable
+ * executable path i.e.c:\apache\apache.exe
+ * @param arguments
+ * arguments for this configuration
+ * @param background
+ * run this configuration in background mode
+ */
+ public static void execute(String command, String executable,
+ String arguments, boolean background) {
+ // PHPConsole console = new PHPConsole();
+ // String consoleMessage;
+ // if (background) {
+ // consoleMessage = "run in background mode-" + command + ": " +
+ // executable + " " + arguments;
+ // } else {
+ // consoleMessage = "run in foreground mode-" + command + ": " +
+ // executable + " " + arguments;
+ // }
+ // console.println(consoleMessage);
- ExternalToolsUtil.execute(command, executable, arguments, background);
- }
+ ExternalToolsUtil.execute(command, executable, arguments, background);
+ }
- public void selectionChanged(IAction action, ISelection selection) {
+ public void selectionChanged(IAction action, ISelection selection) {
- }
+ }
- public void init(IWorkbenchWindow window) {
- this.activeWindow = window;
- }
+ public void init(IWorkbenchWindow window) {
+ this.activeWindow = window;
+ }
- public void dispose() {
+ public void dispose() {
- }
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartMySQLAction.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartMySQLAction.java
index 860302a..b26aa69 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartMySQLAction.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartMySQLAction.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
- www.phpeclipse.de
-**********************************************************************/
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
package net.sourceforge.phpdt.externaltools.actions;
import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
@@ -17,13 +17,14 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.preference.IPreferenceStore;
public class PHPStartMySQLAction extends PHPStartApacheAction {
- public void run(IAction action) {
- final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
- // execute(store.getString(PHPeclipsePlugin.MYSQL_PREF), "Start MySQL: ");
- execute(
- "mysql_start",
- store.getString(ExternalToolsPlugin.MYSQL_RUN_PREF),
- store.getString(ExternalToolsPlugin.MYSQL_PREF),
- store.getBoolean(ExternalToolsPlugin.MYSQL_START_BACKGROUND));
- }
+ public void run(IAction action) {
+ final IPreferenceStore store = ExternalToolsPlugin.getDefault()
+ .getPreferenceStore();
+ // execute(store.getString(PHPeclipsePlugin.MYSQL_PREF), "Start MySQL:
+ // ");
+ execute("mysql_start", store
+ .getString(ExternalToolsPlugin.MYSQL_RUN_PREF), store
+ .getString(ExternalToolsPlugin.MYSQL_PREF), store
+ .getBoolean(ExternalToolsPlugin.MYSQL_START_BACKGROUND));
+ }
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartXAMPPAction.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartXAMPPAction.java
index 9956b60..49d5a50 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartXAMPPAction.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStartXAMPPAction.java
@@ -19,54 +19,61 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class PHPStartXAMPPAction implements IWorkbenchWindowActionDelegate {
- protected IWorkbenchWindow activeWindow = null;
+ protected IWorkbenchWindow activeWindow = null;
- public void run(IAction action) {
- final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
- String executable = store.getString(ExternalToolsPlugin.XAMPP_START_PREF);
- String workingDirectory = null;
- if (executable != null && executable.length() > 0) {
- int index = executable.lastIndexOf(File.separatorChar);
- if (index > 0) {
- workingDirectory = executable.substring(0, index);
- }
- }
- execute("xampp_start", executable, workingDirectory, true);
- }
+ public void run(IAction action) {
+ final IPreferenceStore store = ExternalToolsPlugin.getDefault()
+ .getPreferenceStore();
+ String executable = store
+ .getString(ExternalToolsPlugin.XAMPP_START_PREF);
+ String workingDirectory = null;
+ if (executable != null && executable.length() > 0) {
+ int index = executable.lastIndexOf(File.separatorChar);
+ if (index > 0) {
+ workingDirectory = executable.substring(0, index);
+ }
+ }
+ execute("xampp_start", executable, workingDirectory, true);
+ }
- /**
- * Executes an external progam and saves the LaunchConfiguration under external tools
- *
- * @param command
- * external tools command name
- * @param executable
- * executable path i.e.c:\apache\apache.exe
- * @param background
- * run this configuration in background mode
- */
- public static void execute(String command, String executable, String workingDirectory, boolean background) {
-// PHPConsole console = new PHPConsole();
-// String consoleMessage;
-// if (background) {
-// consoleMessage = "run in background mode-" + command + ": " + executable;
-// } else {
-// consoleMessage = "run in foreground mode-" + command + ": " + executable;
-// }
-// console.println(consoleMessage);
+ /**
+ * Executes an external progam and saves the LaunchConfiguration under
+ * external tools
+ *
+ * @param command
+ * external tools command name
+ * @param executable
+ * executable path i.e.c:\apache\apache.exe
+ * @param background
+ * run this configuration in background mode
+ */
+ public static void execute(String command, String executable,
+ String workingDirectory, boolean background) {
+ // PHPConsole console = new PHPConsole();
+ // String consoleMessage;
+ // if (background) {
+ // consoleMessage = "run in background mode-" + command + ": " +
+ // executable;
+ // } else {
+ // consoleMessage = "run in foreground mode-" + command + ": " +
+ // executable;
+ // }
+ // console.println(consoleMessage);
- ExternalToolsUtil.execute(command, executable, workingDirectory, null, background);
- }
+ ExternalToolsUtil.execute(command, executable, workingDirectory, null,
+ background);
+ }
- public void selectionChanged(IAction action, ISelection selection) {
+ public void selectionChanged(IAction action, ISelection selection) {
- }
+ }
- public void init(IWorkbenchWindow window) {
- this.activeWindow = window;
- }
+ public void init(IWorkbenchWindow window) {
+ this.activeWindow = window;
+ }
- public void dispose() {
+ public void dispose() {
- }
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStopApacheAction.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStopApacheAction.java
index 1bdf89b..05880d2 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStopApacheAction.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStopApacheAction.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
- www.phpeclipse.de
-**********************************************************************/
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
package net.sourceforge.phpdt.externaltools.actions;
import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
@@ -17,13 +17,14 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.preference.IPreferenceStore;
public class PHPStopApacheAction extends PHPStartApacheAction {
- public void run(IAction action) {
- final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
- // execute(store.getString(PHPeclipsePlugin.APACHE_STOP_PREF), "Stop Apache: ");
- execute(
- "apache_stop",
- store.getString(ExternalToolsPlugin.APACHE_RUN_PREF),
- store.getString(ExternalToolsPlugin.APACHE_STOP_PREF),
- store.getBoolean(ExternalToolsPlugin.APACHE_STOP_BACKGROUND));
- }
+ public void run(IAction action) {
+ final IPreferenceStore store = ExternalToolsPlugin.getDefault()
+ .getPreferenceStore();
+ // execute(store.getString(PHPeclipsePlugin.APACHE_STOP_PREF), "Stop
+ // Apache: ");
+ execute("apache_stop", store
+ .getString(ExternalToolsPlugin.APACHE_RUN_PREF), store
+ .getString(ExternalToolsPlugin.APACHE_STOP_PREF), store
+ .getBoolean(ExternalToolsPlugin.APACHE_STOP_BACKGROUND));
+ }
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStopXAMPPAction.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStopXAMPPAction.java
index de26291..cd816ee 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStopXAMPPAction.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/actions/PHPStopXAMPPAction.java
@@ -19,54 +19,61 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class PHPStopXAMPPAction implements IWorkbenchWindowActionDelegate {
- protected IWorkbenchWindow activeWindow = null;
+ protected IWorkbenchWindow activeWindow = null;
- public void run(IAction action) {
- final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
- String executable = store.getString(ExternalToolsPlugin.XAMPP_STOP_PREF);
- String workingDirectory = null;
- if (executable != null && executable.length() > 0) {
- int index = executable.lastIndexOf(File.separatorChar);
- if (index > 0) {
- workingDirectory = executable.substring(0, index);
- }
- }
- execute("xampp_stop", executable, workingDirectory, true);
- }
+ public void run(IAction action) {
+ final IPreferenceStore store = ExternalToolsPlugin.getDefault()
+ .getPreferenceStore();
+ String executable = store
+ .getString(ExternalToolsPlugin.XAMPP_STOP_PREF);
+ String workingDirectory = null;
+ if (executable != null && executable.length() > 0) {
+ int index = executable.lastIndexOf(File.separatorChar);
+ if (index > 0) {
+ workingDirectory = executable.substring(0, index);
+ }
+ }
+ execute("xampp_stop", executable, workingDirectory, true);
+ }
- /**
- * Executes an external progam and saves the LaunchConfiguration under external tools
- *
- * @param command
- * external tools command name
- * @param executable
- * executable path i.e.c:\apache\apache.exe
- * @param background
- * run this configuration in background mode
- */
- public static void execute(String command, String executable, String workingDirectory, boolean background) {
-// PHPConsole console = new PHPConsole();
-// String consoleMessage;
-// if (background) {
-// consoleMessage = "run in background mode-" + command + ": " + executable;
-// } else {
-// consoleMessage = "run in foreground mode-" + command + ": " + executable;
-// }
-// console.println(consoleMessage);
+ /**
+ * Executes an external progam and saves the LaunchConfiguration under
+ * external tools
+ *
+ * @param command
+ * external tools command name
+ * @param executable
+ * executable path i.e.c:\apache\apache.exe
+ * @param background
+ * run this configuration in background mode
+ */
+ public static void execute(String command, String executable,
+ String workingDirectory, boolean background) {
+ // PHPConsole console = new PHPConsole();
+ // String consoleMessage;
+ // if (background) {
+ // consoleMessage = "run in background mode-" + command + ": " +
+ // executable;
+ // } else {
+ // consoleMessage = "run in foreground mode-" + command + ": " +
+ // executable;
+ // }
+ // console.println(consoleMessage);
- ExternalToolsUtil.execute(command, executable, workingDirectory, null, background);
- }
+ ExternalToolsUtil.execute(command, executable, workingDirectory, null,
+ background);
+ }
- public void selectionChanged(IAction action, ISelection selection) {
+ public void selectionChanged(IAction action, ISelection selection) {
- }
+ }
- public void init(IWorkbenchWindow window) {
- this.activeWindow = window;
- }
+ public void init(IWorkbenchWindow window) {
+ this.activeWindow = window;
+ }
- public void dispose() {
+ public void dispose() {
- }
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/group/IGroupDialogPage.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/group/IGroupDialogPage.java
index d441165..1eaed85 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/group/IGroupDialogPage.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/group/IGroupDialogPage.java
@@ -1,61 +1,64 @@
package net.sourceforge.phpdt.externaltools.group;
/**********************************************************************
-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.jface.dialogs.IMessageProvider;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
/**
- * Represents the API for a group of visual components
- * to access the dialog page that contains it.
+ * Represents the API for a group of visual components to access the dialog page
+ * that contains it.
*
- * 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 the GridData 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.
*
- *
- * @param newMessage the message, or 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 Images.
*/
private static ImageRegistry imageRegistry;
-
+
/**
* A table of all the ImageDescriptors.
*/
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 IResources 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 IResources 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 startstartend(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 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) {
- return path.toString();
- }
- return "";
- }
+ /**
+ * 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);
+ if (path != null) {
+ return path.toString();
+ }
+ return "";
+ }
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableComponent.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableComponent.java
index 722ffb2..eafb791 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableComponent.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/IVariableComponent.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;
@@ -15,63 +15,65 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
/**
- * Represents the API for a client extending one of the
- * variable extension points to provide visual editing
- * of the variable.
+ * Represents the API for a client extending one of the variable extension
+ * points to provide visual editing of the variable.
*
- * 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, otherwise null 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 the IPath 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 the IResource 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
- * 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 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 isValid true 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 be null 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 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();
+ /**
+ * 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 "";
- }
+ if (lowerCaseFileName.startsWith(documentRoot)) {
+ localhostURL = localhostURL.substring(documentRoot.length());
+ localhostURL = store.getString(WebUI.PHP_LOCALHOST_PREF)
+ + localhostURL;
+ }
+ return localhostURL;
+ }
+ return "";
+ }
}
diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/WorkingSetExpander.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/WorkingSetExpander.java
index 73474d0..0727bb9 100644
--- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/WorkingSetExpander.java
+++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/variable/WorkingSetExpander.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 org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
@@ -15,8 +15,7 @@ import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PlatformUI;
/**
- * Expands a working set type variable into the desired
- * result format.
+ * Expands a working set type variable into the desired result format.
*
* 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 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;
- }
-
- /**
- * 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; i 0)
- setSelectedInterpreter((PHPInterpreter)installedInterpreters.get(0));
+ setSelectedInterpreter((PHPInterpreter) installedInterpreters
+ .get(0));
else
setSelectedInterpreter(null);
}
@@ -92,9 +96,11 @@ public class PHPRuntime {
protected Writer getRuntimeConfigurationWriter() {
try {
- OutputStream stream = new BufferedOutputStream(new FileOutputStream(getRuntimeConfigurationFile()));
+ OutputStream stream = new BufferedOutputStream(
+ new FileOutputStream(getRuntimeConfigurationFile()));
return new OutputStreamWriter(stream);
- } catch (FileNotFoundException e) {}
+ } catch (FileNotFoundException e) {
+ }
return null;
}
@@ -104,11 +110,14 @@ public class PHPRuntime {
try {
File file = getRuntimeConfigurationFile();
if (file.exists()) {
- XMLReader reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
- reader.setContentHandler(getRuntimeConfigurationContentHandler());
- reader.parse(new InputSource(getRuntimeConfigurationReader(file)));
+ XMLReader reader = SAXParserFactory.newInstance()
+ .newSAXParser().getXMLReader();
+ reader
+ .setContentHandler(getRuntimeConfigurationContentHandler());
+ reader.parse(new InputSource(
+ getRuntimeConfigurationReader(file)));
}
- } catch(Exception e) {
+ } catch (Exception e) {
PHPLaunchingPlugin.log(e);
}
}
@@ -116,19 +125,22 @@ public class PHPRuntime {
protected Reader getRuntimeConfigurationReader(File file) {
try {
return new FileReader(file);
- } catch(FileNotFoundException e) {}
+ } catch (FileNotFoundException e) {
+ }
return new StringReader("");
}
protected void writeXML(Writer writer) {
try {
- writer.write("");
+ writer
+ .write("");
Iterator interpretersIterator = installedInterpreters.iterator();
while (interpretersIterator.hasNext()) {
writer.write("");
writer.flush();
- } catch(IOException e) {
+ } catch (IOException e) {
PHPLaunchingPlugin.log(e);
}
}
protected ContentHandler getRuntimeConfigurationContentHandler() {
return new ContentHandler() {
- public void setDocumentLocator(Locator locator) {}
- public void startDocument() throws SAXException {}
- public void endDocument() throws SAXException {}
- public void startPrefixMapping(String prefix, String uri) throws SAXException {}
- public void endPrefixMapping(String prefix) throws SAXException {}
- public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
+ public void setDocumentLocator(Locator locator) {
+ }
+
+ public void startDocument() throws SAXException {
+ }
+
+ public void endDocument() throws SAXException {
+ }
+
+ public void startPrefixMapping(String prefix, String uri)
+ throws SAXException {
+ }
+
+ public void endPrefixMapping(String prefix) throws SAXException {
+ }
+
+ public void startElement(String namespaceURI, String localName,
+ String qName, Attributes atts) throws SAXException {
if ("interpreter".equals(qName)) {
- String interpreterName = atts.getValue("name");
- java.io.File installLocation;
- if (interpreterName!=null) {
- installLocation = new File(atts.getValue("path")+File.separatorChar+interpreterName);
- } else {
- installLocation = new File(atts.getValue("path"));
- }
- PHPInterpreter interpreter = new PHPInterpreter(installLocation);
+ String interpreterName = atts.getValue("name");
+ java.io.File installLocation;
+ if (interpreterName != null) {
+ installLocation = new File(atts.getValue("path")
+ + File.separatorChar + interpreterName);
+ } else {
+ installLocation = new File(atts.getValue("path"));
+ }
+ PHPInterpreter interpreter = new PHPInterpreter(
+ installLocation);
installedInterpreters.add(interpreter);
if (atts.getValue("selected") != null)
selectedInterpreter = interpreter;
}
}
- public void endElement(String namespaceURI, String localName, String qName) throws SAXException {}
- public void characters(char[] ch, int start, int length) throws SAXException {}
- public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {}
- public void processingInstruction(String target, String data) throws SAXException {}
- public void skippedEntity(String name) throws SAXException {}
+
+ public void endElement(String namespaceURI, String localName,
+ String qName) throws SAXException {
+ }
+
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ }
+
+ public void ignorableWhitespace(char[] ch, int start, int length)
+ throws SAXException {
+ }
+
+ public void processingInstruction(String target, String data)
+ throws SAXException {
+ }
+
+ public void skippedEntity(String name) throws SAXException {
+ }
};
}
protected File getRuntimeConfigurationFile() {
- IPath stateLocation = PHPLaunchingPlugin.getDefault().getStateLocation();
+ IPath stateLocation = PHPLaunchingPlugin.getDefault()
+ .getStateLocation();
IPath fileLocation = stateLocation.append("runtimeConfiguration.xml");
return new File(fileLocation.toOSString());
}
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/AbstractHTTPQueryAction.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/AbstractHTTPQueryAction.java
index 1592734..2191117 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/AbstractHTTPQueryAction.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/AbstractHTTPQueryAction.java
@@ -27,16 +27,19 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate {
abstract protected Configuration getConfiguration(String name);
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- if (targetEditor != null && (targetEditor instanceof AbstractTextEditor)) {
+ if (targetEditor != null
+ && (targetEditor instanceof AbstractTextEditor)) {
editor = (AbstractTextEditor) targetEditor;
}
}
public void run(IAction action) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
if (editor == null) {
IEditorPart targetEditor = window.getActivePage().getActiveEditor();
- if (targetEditor != null && (targetEditor instanceof AbstractTextEditor)) {
+ if (targetEditor != null
+ && (targetEditor instanceof AbstractTextEditor)) {
editor = (AbstractTextEditor) targetEditor;
}
}
@@ -66,11 +69,13 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate {
}
public IDocument getDocument() {
- IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+ IDocument doc = editor.getDocumentProvider().getDocument(
+ editor.getEditorInput());
return doc;
}
- public static String getSelectedText(AbstractTextEditor editor, IDocument document, int initialPos) {
+ public static String getSelectedText(AbstractTextEditor editor,
+ IDocument document, int initialPos) {
try {
int pos = initialPos;
int line = document.getLineOfOffset(pos);
@@ -78,9 +83,9 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate {
int end = start + document.getLineInformation(line).getLength();
/*
- * The line does not include \n or \r so pos can be > end. Making pos =
- * end in this case is safe for the purposes of determining the TextRegion
- * at the cursor position
+ * The line does not include \n or \r so pos can be > end. Making
+ * pos = end in this case is safe for the purposes of determining
+ * the TextRegion at the cursor position
*/
if (pos > end) {
pos = end;
@@ -105,7 +110,8 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate {
}
}
if (textStart != (-1) && textEnd != (-1) && textStart < textEnd) {
- return new String(word.toCharArray(), textStart, textEnd - textStart);
+ return new String(word.toCharArray(), textStart, textEnd
+ - textStart);
}
} catch (Exception e) {
@@ -115,7 +121,8 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate {
public String generateUrl(Configuration config, String template) {
IDocument doc = getDocument();
- ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
+ ITextSelection selection = (ITextSelection) editor
+ .getSelectionProvider().getSelection();
int pos = selection.getOffset();
int len = selection.getLength();
String wikiTitle;
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/HTTPQueryAction.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/HTTPQueryAction.java
index fe5a211..7b0381c 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/HTTPQueryAction.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/HTTPQueryAction.java
@@ -21,7 +21,8 @@ public class HTTPQueryAction extends AbstractHTTPQueryAction {
}
protected Configuration getConfiguration(String name) {
- List allConfigsList = ConfigurationManager.getInstance().getConfigurations();
+ List allConfigsList = ConfigurationManager.getInstance()
+ .getConfigurations();
ArrayList configsList = new ArrayList();
for (int i = 0; i < allConfigsList.size(); i++) {
IConfiguration temp = (IConfiguration) allConfigsList.get(i);
@@ -37,8 +38,10 @@ public class HTTPQueryAction extends AbstractHTTPQueryAction {
}
Collections.sort(configsList);
- ListSelectionDialog listSelectionDialog = new ListSelectionDialog(PHPHelpPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getShell(), configsList, new ListContentProvider(), new LabelProvider(), "Select URL");
+ ListSelectionDialog listSelectionDialog = new ListSelectionDialog(
+ PHPHelpPlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow().getShell(), configsList,
+ new ListContentProvider(), new LabelProvider(), "Select URL");
listSelectionDialog.setTitle("Multiple configuration found");
if (listSelectionDialog.open() == Window.OK) {
Object[] configurations = listSelectionDialog.getResult();
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/KodersAction.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/KodersAction.java
index d9834ef..f6794c1 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/KodersAction.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/KodersAction.java
@@ -4,22 +4,21 @@ import net.sourceforge.phpdt.httpquery.config.Configuration;
import net.sourceforge.phpdt.httpquery.config.ConfigurationWorkingCopy;
import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
-
public class KodersAction extends HTTPQueryAction {
- public KodersAction() {
- super();
- }
+ public KodersAction() {
+ super();
+ }
- protected Configuration getConfiguration(String name) {
- Configuration conf = super.getConfiguration("Koders.com");
+ protected Configuration getConfiguration(String name) {
+ Configuration conf = super.getConfiguration("Koders.com");
if (conf != null) {
return conf;
}
- ConfigurationWorkingCopy config = new ConfigurationWorkingCopy();
- config.setName("Koders.com");
- config.setURL("http://koders.com/?s=$text.selection");
- config.setType(PHPHelpPlugin.HTTP_QUERY);
- return config;
- }
+ ConfigurationWorkingCopy config = new ConfigurationWorkingCopy();
+ config.setName("Koders.com");
+ config.setURL("http://koders.com/?s=$text.selection");
+ config.setType(PHPHelpPlugin.HTTP_QUERY);
+ return config;
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/PHPHelpAction.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/PHPHelpAction.java
index d5e5423..e0c5b2b 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/PHPHelpAction.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/PHPHelpAction.java
@@ -4,22 +4,22 @@ import net.sourceforge.phpdt.httpquery.config.Configuration;
import net.sourceforge.phpdt.httpquery.config.ConfigurationWorkingCopy;
import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
-
public class PHPHelpAction extends HTTPQueryAction {
- public PHPHelpAction() {
- super();
- }
+ public PHPHelpAction() {
+ super();
+ }
- protected Configuration getConfiguration(String name) {
- Configuration conf = super.getConfiguration("PHP Manual");
+ protected Configuration getConfiguration(String name) {
+ Configuration conf = super.getConfiguration("PHP Manual");
if (conf != null) {
return conf;
}
- ConfigurationWorkingCopy config = new ConfigurationWorkingCopy();
- config.setName("PHP Manual");
- config.setURL("http://www.php.net/manual/en/function.$php.selection.php");
- config.setType(PHPHelpPlugin.HTTP_QUERY);
- return config;
- }
+ ConfigurationWorkingCopy config = new ConfigurationWorkingCopy();
+ config.setName("PHP Manual");
+ config
+ .setURL("http://www.php.net/manual/en/function.$php.selection.php");
+ config.setType(PHPHelpPlugin.HTTP_QUERY);
+ return config;
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/Configuration.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/Configuration.java
index 98eb4d6..dcc6d84 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/Configuration.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/config/Configuration.java
@@ -13,472 +13,237 @@ package net.sourceforge.phpdt.httpquery.config;
import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
/**
- *
+ *
*/
public class Configuration implements IConfiguration, Comparable {
- 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;
- }
+ 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:
*
- *
Certain objects need to be saved and restored across platform sessions.
- *
- *
When an object is restored, an appropriate class for an object might not
- * be available. It must be possible to skip an object in this case.
- *
When an object is restored, the appropriate class for the object may be
- * different from the one when the object was originally saved. If so, the
- * new class should still be able to read the old form of the data.
+ *
Certain objects need to be saved and restored across platform sessions.
+ *
+ *
When an object is restored, an appropriate class for an object might not
+ * be available. It must be possible to skip an object in this case.
+ *
When an object is restored, the appropriate class for the object may be
+ * different from the one when the object was originally saved. If so, the new
+ * class should still be able to read the old form of the data.
*
*
*
- * 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.
*
- *
- * @param fType the fType
+ *
+ * @param fType
+ * the fType
* @return a new child memento
* @see #getChild
* @see #getChildren
@@ -68,16 +72,18 @@ public interface IMemento {
public IMemento createChild(String type);
/**
- * 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.
+ * 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.
*
- *
- * @param fType the fType
- * @param id the child id
+ *
+ * @param fType
+ * the fType
+ * @param id
+ * the child id
* @return a new child memento with the given fType and id
* @see #getId
*/
@@ -85,32 +91,35 @@ public interface IMemento {
/**
* Returns the first child with the given fType id.
- *
- * @param fType the fType id
+ *
+ * @param fType
+ * the fType id
* @return the first child with the given fType
*/
public IMemento getChild(String type);
/**
* Returns all children with the given fType id.
- *
- * @param fType the fType id
+ *
+ * @param fType
+ * the fType id
* @return the list of children with the given fType
*/
public IMemento[] getChildren(String type);
/**
* Returns the floating point 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 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.
*
*/
protected void performDefaults() {
-// displayButton.setSelection(WikiEditorPlugin.getDefaultShowOnActivityPreference());
+ // displayButton.setSelection(WikiEditorPlugin.getDefaultShowOnActivityPreference());
super.performDefaults();
}
/**
- * Method declared on IPreferencePage.
- * Subclasses should override
+ * Method declared on IPreferencePage. Subclasses should override
*/
public boolean performOk() {
-// WikiEditorPlugin.setShowOnActivityPreference(displayButton.getSelection());
+ // WikiEditorPlugin.setShowOnActivityPreference(displayButton.getSelection());
PHPHelpPlugin.getDefault().savePluginPreferences();
return true;
}
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationPreferencesDialog.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationPreferencesDialog.java
index 98682f7..aeb8d8e 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationPreferencesDialog.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationPreferencesDialog.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
**********************************************************************/
@@ -23,53 +23,55 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
public class ConfigurationPreferencesDialog extends Dialog {
- protected IConfigurationWorkingCopy monitor;
+ protected IConfigurationWorkingCopy monitor;
- protected boolean isEdit;
+ protected boolean isEdit;
- /**
- * @param parentShell
- */
- public ConfigurationPreferencesDialog(Shell parentShell, IConfigurationWorkingCopy monitor) {
- super(parentShell);
- this.monitor = monitor;
- isEdit = true;
- }
+ /**
+ * @param parentShell
+ */
+ public ConfigurationPreferencesDialog(Shell parentShell,
+ IConfigurationWorkingCopy monitor) {
+ super(parentShell);
+ this.monitor = monitor;
+ isEdit = true;
+ }
- public ConfigurationPreferencesDialog(Shell composite) {
- super(composite);
- isEdit = false;
- }
+ public ConfigurationPreferencesDialog(Shell composite) {
+ super(composite);
+ isEdit = false;
+ }
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(PHPHelpPlugin.getResource("%preferenceTitle"));
- }
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(PHPHelpPlugin.getResource("%preferenceTitle"));
+ }
- protected Control createDialogArea(Composite parent) {
- Composite compositeParent = (Composite) super.createDialogArea(parent);
+ protected Control createDialogArea(Composite parent) {
+ Composite compositeParent = (Composite) super.createDialogArea(parent);
- Composite composite = new Composite(compositeParent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- composite.setLayoutData(data);
- // WorkbenchHelp.setHelp(composite, ContextIds.PREF);
+ Composite composite = new Composite(compositeParent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(data);
+ // WorkbenchHelp.setHelp(composite, ContextIds.PREF);
- ConfigurationComposite monitorComp = new ConfigurationComposite(composite, SWT.NONE);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- monitorComp.setLayoutData(data);
+ ConfigurationComposite monitorComp = new ConfigurationComposite(
+ composite, SWT.NONE);
+ data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
+ monitorComp.setLayoutData(data);
- Dialog.applyDialogFont(composite);
+ Dialog.applyDialogFont(composite);
- return composite;
- }
+ return composite;
+ }
- protected void okPressed() {
- PHPHelpPlugin.getDefault().savePluginPreferences();
- super.okPressed();
- }
+ protected void okPressed() {
+ PHPHelpPlugin.getDefault().savePluginPreferences();
+ super.okPressed();
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationTableLabelProvider.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationTableLabelProvider.java
index 8d7229e..1f25835 100644
--- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationTableLabelProvider.java
+++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/preferences/ConfigurationTableLabelProvider.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,96 +20,104 @@ import org.eclipse.swt.graphics.Image;
* Configuration table label provider.
*/
public class ConfigurationTableLabelProvider implements ITableLabelProvider {
- /**
- * ConfigurationTableLabelProvider constructor comment.
- */
- public ConfigurationTableLabelProvider() {
- super();
- }
+ /**
+ * ConfigurationTableLabelProvider constructor comment.
+ */
+ public ConfigurationTableLabelProvider() {
+ super();
+ }
- /**
- * 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) {
- }
+ /**
+ * 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, 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 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 = " ";
- handler.handle(xml, null);
-
+ handler.handle(xml, null);
+
xml = " ";
handler.handle(xml, null);
-
+
xml = " ";
handler.handle(xml, null);
-
+
xml = "";
- handler.handle(xml, null);
+ handler.handle(xml, null);
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestCase.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestCase.java
index 5f3a8ed..3456c37 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestCase.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestCase.java
@@ -6,40 +6,37 @@
*
*************************************************************************/
-
package net.sourceforge.phpeclipse.phpunit.testpool;
-
-
public class TestCase {
public static final String PASS = "PASS";
+
public static final String FAIL = "FAIL";
- public static final String ERROR = "ERROR";
+ public static final String ERROR = "ERROR";
private TestSuite parentSuite;
+
private String testName;
+
private String testID;
+
private String verdict;
+
private String parentTestSuiteName;
-
-
-
/**
* @param testName
* @param testID
*/
public TestCase(String testID, String testName, String parentTestSuiteName) {
-
+
this.testName = testName;
this.testID = testID;
this.parentTestSuiteName = parentTestSuiteName;
}
-
-
/**
* @return
*/
@@ -66,10 +63,8 @@ public class TestCase {
*/
public void setTestID(String string) {
testID = string;
-
- }
-
+ }
/**
* @param string
@@ -83,12 +78,12 @@ public class TestCase {
*/
public void setVerdict(String string) {
verdict = string;
-
- if(isFailure())
+
+ if (isFailure())
parentSuite.setHasFailure();
- if(isError())
+ if (isError())
parentSuite.setHasError();
-
+
}
/**
@@ -97,14 +92,14 @@ public class TestCase {
public void setParentSuite(TestSuite suite) {
this.parentSuite = suite;
suite.setName(parentTestSuiteName);
-
+
}
/**
* @return
*/
public Object getParentSuite() {
-
+
return parentSuite;
}
@@ -112,7 +107,7 @@ public class TestCase {
* @return
*/
public boolean isError() {
-
+
return getVerdict().equals(TestCase.ERROR);
}
@@ -120,16 +115,16 @@ public class TestCase {
* @return
*/
public boolean isFailure() {
-
+
return getVerdict().equals(TestCase.FAIL);
-
+
}
/**
* @return
*/
public boolean isPass() {
-
+
return getVerdict().equals(TestCase.PASS);
}
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestPool.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestPool.java
index 8e6a7fb..ddd0422 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestPool.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestPool.java
@@ -6,79 +6,75 @@
*
*************************************************************************/
-
package net.sourceforge.phpeclipse.phpunit.testpool;
import java.util.HashMap;
-
public class TestPool {
- //private TestSuite currentParentTestSuite;
+ // private TestSuite currentParentTestSuite;
private HashMap tests;
+
private TestSuite root;
+
private TestSuite currentTestSuite;
-
-
+
/**
*
*/
public TestPool(String rootTitle) {
-
+
tests = new HashMap();
- root = null;
+ root = null;
currentTestSuite = root;
-
+
}
/**
* @param test
*/
public void addTest(TestCase test) {
-
+
tests.put(test.getTestID(), test);
-
+
currentTestSuite.addTestCase(test);
-
-
- //if we run all tests. then this is the end of this test suite.
- if( currentTestSuite != root && currentTestSuite.isFinished()) {
-
+
+ // if we run all tests. then this is the end of this test suite.
+ if (currentTestSuite != root && currentTestSuite.isFinished()) {
+
currentTestSuite = currentTestSuite.getParent();
- }
-
- }
+ }
+
+ }
/**
* @param suite
* @param numTestsRunSinceStartOfTestSuite
*/
public void addTestSuite(TestSuite suite) {
-
-
- if(root == null) {
- root = suite;
- }
- else {
-
- //add as sibling
+
+ if (root == null) {
+ root = suite;
+ } else {
+
+ // add as sibling
currentTestSuite.addTestSuite(suite);
suite.setParent(currentTestSuite);
- }
-
- currentTestSuite = suite;
+ }
+
+ currentTestSuite = suite;
}
/**
* @return
*/
public TestSuite getRoot() {
-
+
return root;
}
-
+
/**
* @param r
*/
@@ -86,87 +82,81 @@ public class TestPool {
this.root = r;
}
-
-
/**
* @param testID
* @return
*/
public TestCase getTest(String testID) {
-
+
return (TestCase) tests.get(testID);
}
public String toString() {
-
+
String string = "";
-
+
TestSuite node = root;
-
+
string = root.toString();
- return string;
-
- }
+ return string;
+ }
public int getNumTestsOverall() {
-
+
int total = root.getNumTestCasesExpected();
System.out.println("total: " + total);
return total;
-
+
}
-
+
public int getNumTestsRun() {
-
+
return tests.size();
-
-
+
}
-
+
public int getNumFailures() {
-
+
int total = 0;
-
-// Iterator i = tests.keySet().iterator();
-// String key = "";
-// while (i.hasNext()) {
-//
-//
-// key = (String) i.next();
-// TestCase element = (TestCase) tests.get(key);
-//
-//
-// if(element.isFailure())
-// total++;
-//
-// }
-
+
+ // Iterator i = tests.keySet().iterator();
+ // String key = "";
+ // while (i.hasNext()) {
+ //
+ //
+ // key = (String) i.next();
+ // TestCase element = (TestCase) tests.get(key);
+ //
+ //
+ // if(element.isFailure())
+ // total++;
+ //
+ // }
+
return total;
}
-
+
public int getNumErrors() {
int total = 0;
-
-// Iterator i = tests.keySet().iterator();
-// String key = "";
-// while (i.hasNext()) {
-//
-//
-// key = (String) i.next();
-// TestCase element = (TestCase) tests.get(key);
-//
-// if(element.isError())
-// total++;
-//
-// }
-
+
+ // Iterator i = tests.keySet().iterator();
+ // String key = "";
+ // while (i.hasNext()) {
+ //
+ //
+ // key = (String) i.next();
+ // TestCase element = (TestCase) tests.get(key);
+ //
+ // if(element.isError())
+ // total++;
+ //
+ // }
+
return total;
-
+
}
-
-
}
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestSuite.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestSuite.java
index 90cea9e..301b9fd 100644
--- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestSuite.java
+++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/testpool/TestSuite.java
@@ -6,28 +6,31 @@
*
*************************************************************************/
-
package net.sourceforge.phpeclipse.phpunit.testpool;
import java.util.Vector;
-
public class TestSuite {
-
-
private boolean hasFailure;
+
private boolean isAllPass;
+
private boolean hasError;
+
private Vector testCases; // current or actual.
+
private Vector testSuites; // current or actual.
+
private String name;
+
private String id;
- private int numTestCasesExpected; //expected
- private int numTestCasesRunSoFar;
- TestSuite parent;
+ private int numTestCasesExpected; // expected
+ private int numTestCasesRunSoFar;
+
+ TestSuite parent;
/**
* @param name
@@ -35,52 +38,52 @@ public class TestSuite {
* @param testCount
*/
public TestSuite(TestSuite parent, String name, String testID, int testCount) {
-
+
this.parent = parent;
this.id = testID;
this.name = name;
this.numTestCasesExpected = testCount;
-
+
testCases = new Vector();
testSuites = new Vector();
-
+
hasError = false;
isAllPass = true;
hasFailure = false;
}
-
+
public void addTestCase(TestCase test) {
testCases.addElement(test);
test.setParentSuite(this);
numTestCasesRunSoFar++;
}
-
- public void removeTestCase(TestCase test) {}
-
+
+ public void removeTestCase(TestCase test) {
+ }
+
public boolean contains(TestCase test) {
-
+
return false;
-
+
}
-
+
public String toString() {
-
+
String string = "";
-
- //print test cases.
+
+ // print test cases.
TestCase tc = null;
- for(int i = 0; i < testCases.size(); i++) {
-
+ for (int i = 0; i < testCases.size(); i++) {
+
tc = (TestCase) testCases.elementAt(i);
string += " - " + tc.getTestID() + ", " + tc.getTestName() + "\n";
-
-
+
}
-
- for(int i = 0; i < testSuites.size(); i++)
+
+ for (int i = 0; i < testSuites.size(); i++)
string += ((TestSuite) testSuites.elementAt(i)).toString();
-
- //print its own test suites.
+
+ // print its own test suites.
return string;
}
@@ -131,16 +134,16 @@ public class TestSuite {
*/
public void addTestSuite(TestSuite suite) {
testSuites.addElement(suite);
-
+
}
/**
* @return
*/
public boolean isFinished() {
-
+
return numTestCasesRunSoFar >= numTestCasesExpected;
-
+
}
/**
@@ -161,7 +164,7 @@ public class TestSuite {
* @return
*/
public int getNumTestCases() {
-
+
return testCases.size();
}
@@ -198,46 +201,44 @@ public class TestSuite {
*/
public boolean hasError() {
- return hasError;
+ return hasError;
}
-
+
public void setHasError() {
-
- if(hasError)
+
+ if (hasError)
return;
-
+
hasError = true;
-
- if(parent != null)
+
+ if (parent != null)
parent.setHasError();
}
-
/**
* @return
*/
public boolean hasFailure() {
- return hasFailure;
+ return hasFailure;
}
-
+
public void setHasFailure() {
-
- if(hasFailure)
+
+ if (hasFailure)
return;
-
+
hasFailure = true;
-
- if(parent != null)
+
+ if (parent != null)
parent.setHasFailure();
}
-
public boolean isAllPass() {
-
+
return !hasError() && !hasFailure();
-
- }
+
+ }
}
diff --git a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/SmartyUIMessages.java b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/SmartyUIMessages.java
index 3549dab..371817b 100644
--- a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/SmartyUIMessages.java
+++ b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/SmartyUIMessages.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: SmartyUIMessages.java,v 1.1 2004-09-03 17:31:19 jsurfer Exp $
+ * $Id: SmartyUIMessages.java,v 1.2 2006-10-21 23:19:32 pombredanne Exp $
*/
package net.sourceforge.phpdt.smarty.ui.internal;
@@ -27,16 +27,15 @@ public final class SmartyUIMessages {
/**
* Qualified name of the resource bundle containing the localized messages.
*/
- private static final String RESOURCE_BUNDLE =
- "net.sourceforge.phpdt.smarty.ui.internal.SmartyUIMessages"; //$NON-NLS-1$
+ private static final String RESOURCE_BUNDLE = "net.sourceforge.phpdt.smarty.ui.internal.SmartyUIMessages"; //$NON-NLS-1$
// Class Variables ---------------------------------------------------------
/**
* The resource bundle.
*/
- private static ResourceBundle resourceBundle =
- ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ private static ResourceBundle resourceBundle = ResourceBundle
+ .getBundle(RESOURCE_BUNDLE);
// Constructors ------------------------------------------------------------
@@ -61,7 +60,8 @@ public final class SmartyUIMessages {
/**
* Returns the message identified by the specified key.
*
- * @param key the message key
+ * @param key
+ * the message key
* @return the localized message, or the key enclosed by exclamation marks
* if no message was found for the key
*/
@@ -77,10 +77,12 @@ public final class SmartyUIMessages {
* Returns the message identified by the specified key, replacing a single
* parameter with the provided value.
*
- * @param key the message key
- * @param arg the parameter value
- * @return the formatted string, or the key enclosed by exclamation marks
- * if no message was found for the key
+ * @param key
+ * the message key
+ * @param arg
+ * the parameter value
+ * @return the formatted string, or the key enclosed by exclamation marks if
+ * no message was found for the key
*/
public static String getString(String key, String arg) {
return getString(key, new String[] { arg });
@@ -90,13 +92,15 @@ public final class SmartyUIMessages {
* Returns the message identified by the specified key, replacing all
* parameters with the provided values.
*
- * @param key the message key
- * @param args the parameter values
- * @return the formatted string, or the key enclosed by exclamation marks
- * if no message was found for the key
+ * @param key
+ * the message key
+ * @param args
+ * the parameter values
+ * @return the formatted string, or the key enclosed by exclamation marks if
+ * no message was found for the key
*/
public static String getString(String key, String[] args) {
- return MessageFormat.format(getString(key), args);
+ return MessageFormat.format(getString(key), args);
}
}
diff --git a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyDocumentProvider.java b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyDocumentProvider.java
index c6a5b6e..be57b5b 100644
--- a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyDocumentProvider.java
+++ b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyDocumentProvider.java
@@ -8,14 +8,13 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: SmartyDocumentProvider.java,v 1.1 2004-09-03 17:31:18 jsurfer Exp $
+ * $Id: SmartyDocumentProvider.java,v 1.2 2006-10-21 23:19:32 pombredanne Exp $
*/
package net.sourceforge.phpdt.smarty.ui.internal.editor;
import net.sourceforge.phpeclipse.xml.ui.internal.editor.XMLDocumentProvider;
-
/**
* Document provider for HTML files.
*/
diff --git a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyDocumentSetupParticipant.java b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyDocumentSetupParticipant.java
index b8fac8b..a92b365 100644
--- a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyDocumentSetupParticipant.java
+++ b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyDocumentSetupParticipant.java
@@ -8,14 +8,13 @@
* Contributors:
* Christopher Lenz - initial implementation
*
- * $Id: SmartyDocumentSetupParticipant.java,v 1.1 2004-09-03 17:31:18 jsurfer Exp $
+ * $Id: SmartyDocumentSetupParticipant.java,v 1.2 2006-10-21 23:19:32 pombredanne Exp $
*/
package net.sourceforge.phpdt.smarty.ui.internal.editor;
import net.sourceforge.phpeclipse.xml.ui.internal.editor.XMLDocumentSetupParticipant;
-
/**
* Document setup participant that sets up the HTML specific partitioning.
*/
diff --git a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditor.java b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditor.java
index 77aa1b4..93639a6 100644
--- a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditor.java
+++ b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditor.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial implementation
*
- * $Id: SmartyEditor.java,v 1.1 2004-09-03 17:31:18 jsurfer Exp $
+ * $Id: SmartyEditor.java,v 1.2 2006-10-21 23:19:32 pombredanne Exp $
*/
package net.sourceforge.phpdt.smarty.ui.internal.editor;
@@ -24,33 +24,31 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.ui.texteditor.ContentAssistAction;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-
/**
* HTML editor implementation.
*/
public class SmartyEditor extends XMLEditor {
- public SmartyEditor() {
- super(ShowExternalPreviewAction.SMARTY_TYPE);
- }
+ public SmartyEditor() {
+ super(ShowExternalPreviewAction.SMARTY_TYPE);
+ }
+
// Instance Variables ------------------------------------------------------
-
- /** The associated preview page. */
-// private HTMLPreviewPage previewPage;
+ /** The associated preview page. */
+ // private HTMLPreviewPage previewPage;
// XMLEditor Implementation ------------------------------------------------
-
- /*
+ /*
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
*/
public Object getAdapter(Class adapter) {
-// if (adapter == IBrowserPreviewPage.class) {
-// if (previewPage == null) {
-// previewPage = createPreviewPage();
-// }
-// return previewPage;
-// }
+ // if (adapter == IBrowserPreviewPage.class) {
+ // if (previewPage == null) {
+ // previewPage = createPreviewPage();
+ // }
+ // return previewPage;
+ // }
return super.getAdapter(adapter);
}
@@ -59,36 +57,37 @@ public class SmartyEditor extends XMLEditor {
/**
* Creates the HTML preview page.
*/
-// private HTMLPreviewPage createPreviewPage() {
-// IEditorInput input = getEditorInput();
-// if (input instanceof IFileEditorInput) {
-// IFile file = ((IFileEditorInput) input).getFile();
-// try {
-// URL location = file.getLocation().toFile().toURL();
-// return new HTMLPreviewPage(location);
-// } catch (MalformedURLException e) { }
-// }
-// return null;
-// }
+ // private HTMLPreviewPage createPreviewPage() {
+ // IEditorInput input = getEditorInput();
+ // if (input instanceof IFileEditorInput) {
+ // IFile file = ((IFileEditorInput) input).getFile();
+ // try {
+ // URL location = file.getLocation().toFile().toURL();
+ // return new HTMLPreviewPage(location);
+ // } catch (MalformedURLException e) { }
+ // }
+ // return null;
+ // }
protected void createActions() {
super.createActions();
- IAction action = new ContentAssistAction(SmartyEditorMessages.getResourceBundle(),
- "ContentAssistProposal.", this); //$NON-NLS-1$
- action
- .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- setAction("ContentAssistProposal", action); //$NON-NLS-1$
- markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
-
-// IAction action= new TextOperationAction(
-// TemplateMessages.getResourceBundle(),
-// "Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$
-// this,
-// ISourceViewer.CONTENTASSIST_PROPOSALS);
-// action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
-// setAction(TEMPLATE_PROPOSALS, action);
-// markAsStateDependentAction(TEMPLATE_PROPOSALS, true);
+ IAction action = new ContentAssistAction(SmartyEditorMessages
+ .getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
+ action
+ .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ setAction("ContentAssistProposal", action); //$NON-NLS-1$
+ markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
+
+ // IAction action= new TextOperationAction(
+ // TemplateMessages.getResourceBundle(),
+ // "Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$
+ // this,
+ // ISourceViewer.CONTENTASSIST_PROPOSALS);
+ // action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ // setAction(TEMPLATE_PROPOSALS, action);
+ // markAsStateDependentAction(TEMPLATE_PROPOSALS, true);
}
+
/*
* @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
*/
diff --git a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditorActionContributor.java b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditorActionContributor.java
index 4196b46..9dd8c26 100644
--- a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditorActionContributor.java
+++ b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditorActionContributor.java
@@ -22,7 +22,8 @@ import org.eclipse.ui.texteditor.ITextEditor;
/**
* Common base class for action contributors for Java editors.
*/
-public class SmartyEditorActionContributor extends BasicTextEditorActionContributor {
+public class SmartyEditorActionContributor extends
+ BasicTextEditorActionContributor {
/*
* (non-Javadoc)
@@ -43,11 +44,13 @@ public class SmartyEditorActionContributor extends BasicTextEditorActionContribu
file = ((IFileEditorInput) editorInput).getFile();
}
- ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction.getInstance();
+ ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction
+ .getInstance();
fShowExternalPreviewAction.setEditor(textEditor);
fShowExternalPreviewAction.update();
if (fShowExternalPreviewAction != null)
- fShowExternalPreviewAction.doRun(ShowExternalPreviewAction.SMARTY_TYPE);
+ fShowExternalPreviewAction
+ .doRun(ShowExternalPreviewAction.SMARTY_TYPE);
}
}
}
diff --git a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditorMessages.java b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditorMessages.java
index 395dbfa..405d06d 100644
--- a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditorMessages.java
+++ b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/editor/SmartyEditorMessages.java
@@ -1,14 +1,14 @@
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
+
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
package net.sourceforge.phpdt.smarty.ui.internal.editor;
import java.text.MessageFormat;
@@ -17,9 +17,10 @@ import java.util.ResourceBundle;
public class SmartyEditorMessages {
- private static final String RESOURCE_BUNDLE= "net.sourceforge.phpdt.smarty.ui.internal.editor.SmartyEditorMessages";//$NON-NLS-1$
+ private static final String RESOURCE_BUNDLE = "net.sourceforge.phpdt.smarty.ui.internal.editor.SmartyEditorMessages";//$NON-NLS-1$
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ private static ResourceBundle fgResourceBundle = ResourceBundle
+ .getBundle(RESOURCE_BUNDLE);
private SmartyEditorMessages() {
}
@@ -31,14 +32,14 @@ public class SmartyEditorMessages {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
}
-
+
/**
* 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);
}
-
+
public static ResourceBundle getResourceBundle() {
return fgResourceBundle;
}
diff --git a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyCompletionProcessor.java b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyCompletionProcessor.java
index d20fead..1aef925 100644
--- a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyCompletionProcessor.java
+++ b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyCompletionProcessor.java
@@ -18,18 +18,18 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.templates.TemplateContextType;
-
/**
* A completion processor for XML templates.
*/
public class SmartyCompletionProcessor extends BasicCompletionProcessor {
-
+
/**
- * Return the XML context type that is supported by this plugin.
+ * Return the XML context type that is supported by this plugin.
*/
- protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) {
- return WebUI.getDefault().getContextTypeRegistry().getContextType(HTMLContextType.HTML_CONTEXT_TYPE);
+ protected TemplateContextType getContextType(ITextViewer viewer,
+ IRegion region) {
+ return WebUI.getDefault().getContextTypeRegistry().getContextType(
+ HTMLContextType.HTML_CONTEXT_TYPE);
}
-
}
diff --git a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyConfiguration.java b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyConfiguration.java
index cc272c1..f64ad38 100644
--- a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyConfiguration.java
+++ b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyConfiguration.java
@@ -23,96 +23,111 @@ import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.texteditor.ITextEditor;
public class SmartyConfiguration extends XMLConfiguration {
- private SmartyTagScanner smartyTagScanner;
- public SmartyConfiguration(XMLTextTools tools) {
- this(tools, null);
- }
-
- public SmartyConfiguration(XMLTextTools tools, ITextEditor editor) {
- super(tools, editor);
- Map tokens = tools.getTokens();
- smartyTagScanner = new SmartyTagScanner(tokens);
- }
-
- public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- ContentAssistant assistant = new ContentAssistant();
- assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
-
- IContentAssistProcessor processor = new SmartyCompletionProcessor();
- assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_TAG);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_PI);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_COMMENT);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_DECL);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_TAG);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_ATTRIBUTE);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_CDATA);
-
- assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
- assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
-
- return assistant;
- }
+ private SmartyTagScanner smartyTagScanner;
+
+ public SmartyConfiguration(XMLTextTools tools) {
+ this(tools, null);
+ }
+
+ public SmartyConfiguration(XMLTextTools tools, ITextEditor editor) {
+ super(tools, editor);
+ Map tokens = tools.getTokens();
+ smartyTagScanner = new SmartyTagScanner(tokens);
+ }
+
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ ContentAssistant assistant = new ContentAssistant();
+ assistant
+ .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+
+ IContentAssistProcessor processor = new SmartyCompletionProcessor();
+ assistant.setContentAssistProcessor(processor,
+ IDocument.DEFAULT_CONTENT_TYPE);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_TAG);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_PI);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_COMMENT);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_DECL);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_TAG);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_ATTRIBUTE);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_CDATA);
+
+ assistant
+ .setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
+ assistant
+ .setInformationControlCreator(getInformationControlCreator(sourceViewer));
+
+ return assistant;
+ }
+
/**
* Returns a scanner which is configured to scan XML text.
*
- * @return an XML text scanner
+ * @return an XML text scanner
*/
public SmartyTagScanner getSmartyScanner() {
return smartyTagScanner;
}
- /*
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(ISourceViewer)
- */
- public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- PresentationReconciler reconciler = new PresentationReconciler();
- DefaultDamagerRepairer dr;
+ /*
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(ISourceViewer)
+ */
+ public IPresentationReconciler getPresentationReconciler(
+ ISourceViewer sourceViewer) {
+ PresentationReconciler reconciler = new PresentationReconciler();
- dr = new DefaultDamagerRepairer(getSmartyScanner());
- reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
- reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ DefaultDamagerRepairer dr;
- dr = new DefaultDamagerRepairer(xmlTextTools.getDTDTextScanner());
- reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL);
- reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL);
+ dr = new DefaultDamagerRepairer(getSmartyScanner());
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLPIScanner());
+ dr = new DefaultDamagerRepairer(xmlTextTools.getDTDTextScanner());
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL);
- reconciler.setDamager(dr, XMLPartitionScanner.XML_PI);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_PI);
- reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_PI);
- reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_PI);
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLPIScanner());
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLCommentScanner());
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_PI);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_PI);
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_PI);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_PI);
- reconciler.setDamager(dr, XMLPartitionScanner.XML_COMMENT);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_COMMENT);
- reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
- reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLCommentScanner());
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLDeclScanner());
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_COMMENT);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_COMMENT);
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
- reconciler.setDamager(dr, XMLPartitionScanner.XML_DECL);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_DECL);
- reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_DECL);
- reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_DECL);
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLDeclScanner());
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLTagScanner());
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_DECL);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_DECL);
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_DECL);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_DECL);
- reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLTagScanner());
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLAttributeScanner());
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
- reconciler.setDamager(dr, XMLPartitionScanner.XML_ATTRIBUTE);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_ATTRIBUTE);
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLAttributeScanner());
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLCDATAScanner());
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_ATTRIBUTE);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_ATTRIBUTE);
- reconciler.setDamager(dr, XMLPartitionScanner.XML_CDATA);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_CDATA);
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLCDATAScanner());
- return reconciler;
- }
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_CDATA);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_CDATA);
+
+ return reconciler;
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyTagRule.java b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyTagRule.java
index 1e22864..0312be1 100644
--- a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyTagRule.java
+++ b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyTagRule.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: SmartyTagRule.java,v 1.2 2004-12-29 21:30:33 axelcl Exp $
+ * $Id: SmartyTagRule.java,v 1.3 2006-10-21 23:19:32 pombredanne Exp $
*/
package net.sourceforge.phpdt.smarty.ui.internal.text;
@@ -23,50 +23,50 @@ import org.eclipse.jface.text.rules.Token;
*/
public class SmartyTagRule implements IRule {
- private IToken token;
+ private IToken token;
- public SmartyTagRule(IToken token) {
- this.token = token;
- }
+ public SmartyTagRule(IToken token) {
+ this.token = token;
+ }
- public IToken evaluate(ICharacterScanner scanner) {
- int ch = scanner.read();
- if (ch == '}') {
- return token;
- }
- if (ch == '/') {
- ch = scanner.read();
- if (ch == '}') {
- return token;
- }
+ public IToken evaluate(ICharacterScanner scanner) {
+ int ch = scanner.read();
+ if (ch == '}') {
+ return token;
+ }
+ if (ch == '/') {
+ ch = scanner.read();
+ if (ch == '}') {
+ return token;
+ }
- scanner.unread();
- scanner.unread();
- return Token.UNDEFINED;
- }
- if (ch == '{') {
- ch = scanner.read();
- if (ch == '/') {
- ch = scanner.read();
- }
- loop: while (true) {
- switch (ch) {
- case ICharacterScanner.EOF:
- case 0x09:
- case 0x0A:
- case 0x0D:
- case 0x20:
- scanner.unread();
- break loop;
- case '}':
- break loop;
- }
+ scanner.unread();
+ scanner.unread();
+ return Token.UNDEFINED;
+ }
+ if (ch == '{') {
+ ch = scanner.read();
+ if (ch == '/') {
+ ch = scanner.read();
+ }
+ loop: while (true) {
+ switch (ch) {
+ case ICharacterScanner.EOF:
+ case 0x09:
+ case 0x0A:
+ case 0x0D:
+ case 0x20:
+ scanner.unread();
+ break loop;
+ case '}':
+ break loop;
+ }
- ch = scanner.read();
- }
- return token;
- }
- scanner.unread();
- return Token.UNDEFINED;
- }
+ ch = scanner.read();
+ }
+ return token;
+ }
+ scanner.unread();
+ return Token.UNDEFINED;
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyTagScanner.java b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyTagScanner.java
index 22be5dc..b4571bb 100644
--- a/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyTagScanner.java
+++ b/net.sourceforge.phpeclipse.smarty.ui/src/net/sourceforge/phpdt/smarty/ui/internal/text/SmartyTagScanner.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: SmartyTagScanner.java,v 1.1 2004-09-02 18:25:04 jsurfer Exp $
+ * $Id: SmartyTagScanner.java,v 1.2 2006-10-21 23:19:32 pombredanne Exp $
*/
package net.sourceforge.phpdt.smarty.ui.internal.text;
@@ -29,22 +29,20 @@ import org.eclipse.jface.text.rules.WordRule;
* @author Igor Malinin
*/
public class SmartyTagScanner extends BufferedRuleBasedScanner {
-
+
/**
* Creates a color token scanner.
*/
public SmartyTagScanner(Map tokens) {
- setDefaultReturnToken((Token) tokens.get(
- IXMLSyntaxConstants.XML_DEFAULT));
+ setDefaultReturnToken((Token) tokens
+ .get(IXMLSyntaxConstants.XML_DEFAULT));
IToken tag = (Token) tokens.get(IXMLSyntaxConstants.XML_TAG);
IToken smartyTag = (Token) tokens.get(IXMLSyntaxConstants.XML_SMARTY);
IToken attribute = (Token) tokens.get(IXMLSyntaxConstants.XML_ATT_NAME);
- IRule[] rules = {
- new XMLTagRule(tag),
- new SmartyTagRule(smartyTag),
- new WordRule(new NameDetector(), attribute),};
+ IRule[] rules = { new XMLTagRule(tag), new SmartyTagRule(smartyTag),
+ new WordRule(new NameDetector(), attribute), };
setRules(rules);
}
diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/AbstractCompilerTest.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/AbstractCompilerTest.java
index c334f5f..19da326 100644
--- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/AbstractCompilerTest.java
+++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/AbstractCompilerTest.java
@@ -34,35 +34,35 @@ import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblem;
import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
-//import net.sourceforge.phpdt.core.tests.junit.extension.TestCase;
-//import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
+// import net.sourceforge.phpdt.core.tests.junit.extension.TestCase;
+// import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
public class AbstractCompilerTest extends TestCase {
private static int possibleComplianceLevels = -1;
protected String complianceLevel;
- public void checkParsePHP(
- char[] source,
- String expectedSyntaxErrorDiagnosis) {
-// String testName) {
- UnitParser parser =
- new UnitParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- new CompilerOptions(getCompilerOptions()),
- new DefaultProblemFactory(Locale.getDefault())));
+ public void checkParsePHP(char[] source, String expectedSyntaxErrorDiagnosis) {
+ // String testName) {
+
+ UnitParser parser = new UnitParser(new ProblemReporter(
+ DefaultErrorHandlingPolicies.proceedWithAllProblems(),
+ new CompilerOptions(getCompilerOptions()),
+ new DefaultProblemFactory(Locale.getDefault())));
ICompilationUnit sourceUnit = new CompilationUnit(source, "", null);
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
+ CompilationResult compilationResult = new CompilationResult(sourceUnit,
+ 0, 0, 0);
- CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult, true);
-// if (computedUnit.types != null) {
-// for (int i = computedUnit.types.size(); --i >= 0;){
-// ((TypeDeclaration)computedUnit.types.get(i)).parseMethod(parser, computedUnit);
-// }
-// }
+ CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit,
+ compilationResult, true);
+ // if (computedUnit.types != null) {
+ // for (int i = computedUnit.types.size(); --i >= 0;){
+ // ((TypeDeclaration)computedUnit.types.get(i)).parseMethod(parser,
+ // computedUnit);
+ // }
+ // }
StringBuffer buffer = new StringBuffer(100);
if (compilationResult.hasProblems() || compilationResult.hasTasks()) {
@@ -75,10 +75,16 @@ public class AbstractCompilerTest extends TestCase {
if (problemCount == 0)
buffer.append("----------\n");
problemCount++;
- buffer.append(problemCount + (problems[i].isError() ? ". ERROR" : ". WARNING"));
- buffer.append(" in " + new String(problems[i].getOriginatingFileName()).replace('/', '\\'));
+ buffer
+ .append(problemCount
+ + (problems[i].isError() ? ". ERROR"
+ : ". WARNING"));
+ buffer.append(" in "
+ + new String(problems[i].getOriginatingFileName())
+ .replace('/', '\\'));
try {
- buffer.append(((DefaultProblem)problems[i]).errorReportSource(unitSource));
+ buffer.append(((DefaultProblem) problems[i])
+ .errorReportSource(unitSource));
buffer.append("\n");
buffer.append(problems[i].getMessage());
buffer.append("\n");
@@ -92,35 +98,35 @@ public class AbstractCompilerTest extends TestCase {
}
}
String computedSyntaxErrorDiagnosis = buffer.toString();
- if(!expectedSyntaxErrorDiagnosis.equals(computedSyntaxErrorDiagnosis)) {
- System.out.println(Util.displayString(computedSyntaxErrorDiagnosis));
+ if (!expectedSyntaxErrorDiagnosis.equals(computedSyntaxErrorDiagnosis)) {
+ System.out
+ .println(Util.displayString(computedSyntaxErrorDiagnosis));
}
- assertEquals(
- "Invalid syntax error diagnosis",
- expectedSyntaxErrorDiagnosis,
- computedSyntaxErrorDiagnosis);
+ assertEquals("Invalid syntax error diagnosis",
+ expectedSyntaxErrorDiagnosis, computedSyntaxErrorDiagnosis);
}
- public void checkParseHTML(
- char[] source,
- String expectedSyntaxErrorDiagnosis) {
-// String testName) {
- UnitParser parser =
- new UnitParser(
- new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- new CompilerOptions(getCompilerOptions()),
- new DefaultProblemFactory(Locale.getDefault())));
+ public void checkParseHTML(char[] source,
+ String expectedSyntaxErrorDiagnosis) {
+ // String testName) {
+
+ UnitParser parser = new UnitParser(new ProblemReporter(
+ DefaultErrorHandlingPolicies.proceedWithAllProblems(),
+ new CompilerOptions(getCompilerOptions()),
+ new DefaultProblemFactory(Locale.getDefault())));
ICompilationUnit sourceUnit = new CompilationUnit(source, "", null);
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
+ CompilationResult compilationResult = new CompilationResult(sourceUnit,
+ 0, 0, 0);
- CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult, false);
-// if (computedUnit.types != null) {
-// for (int i = computedUnit.types.size(); --i >= 0;){
-// ((TypeDeclaration)computedUnit.types.get(i)).parseMethod(parser, computedUnit);
-// }
-// }
+ CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit,
+ compilationResult, false);
+ // if (computedUnit.types != null) {
+ // for (int i = computedUnit.types.size(); --i >= 0;){
+ // ((TypeDeclaration)computedUnit.types.get(i)).parseMethod(parser,
+ // computedUnit);
+ // }
+ // }
StringBuffer buffer = new StringBuffer(100);
if (compilationResult.hasProblems() || compilationResult.hasTasks()) {
@@ -133,10 +139,16 @@ public class AbstractCompilerTest extends TestCase {
if (problemCount == 0)
buffer.append("----------\n");
problemCount++;
- buffer.append(problemCount + (problems[i].isError() ? ". ERROR" : ". WARNING"));
- buffer.append(" in " + new String(problems[i].getOriginatingFileName()).replace('/', '\\'));
+ buffer
+ .append(problemCount
+ + (problems[i].isError() ? ". ERROR"
+ : ". WARNING"));
+ buffer.append(" in "
+ + new String(problems[i].getOriginatingFileName())
+ .replace('/', '\\'));
try {
- buffer.append(((DefaultProblem)problems[i]).errorReportSource(unitSource));
+ buffer.append(((DefaultProblem) problems[i])
+ .errorReportSource(unitSource));
buffer.append("\n");
buffer.append(problems[i].getMessage());
buffer.append("\n");
@@ -150,61 +162,65 @@ public class AbstractCompilerTest extends TestCase {
}
}
String computedSyntaxErrorDiagnosis = buffer.toString();
- if(!expectedSyntaxErrorDiagnosis.equals(computedSyntaxErrorDiagnosis)) {
- System.out.println(Util.displayString(computedSyntaxErrorDiagnosis));
+ if (!expectedSyntaxErrorDiagnosis.equals(computedSyntaxErrorDiagnosis)) {
+ System.out
+ .println(Util.displayString(computedSyntaxErrorDiagnosis));
}
- assertEquals(
- "Invalid syntax error diagnosis",
- expectedSyntaxErrorDiagnosis,
- computedSyntaxErrorDiagnosis);
+ assertEquals("Invalid syntax error diagnosis",
+ expectedSyntaxErrorDiagnosis, computedSyntaxErrorDiagnosis);
}
+
/*
* Returns the possible compliance levels this VM instance can run.
*/
-// public static int getPossibleComplianceLevels() {
-// if (possibleComplianceLevels == -1) {
-// String compliance = System.getProperty("compliance");
-// if (compliance != null) {
-// if (COMPLIANCE_1_3.equals(compliance)) {
-// possibleComplianceLevels = F_1_3;
-// } else if (COMPLIANCE_1_4.equals(compliance)) {
-// possibleComplianceLevels = F_1_4;
-// } else if (COMPLIANCE_1_5.equals(compliance)) {
-// possibleComplianceLevels = F_1_5;
-// } else {
-// System.out.println("Invalid compliance specified (" + compliance + ")");
-// System.out.println("Use one of " + COMPLIANCE_1_3 + ", " + COMPLIANCE_1_4 + ", " + COMPLIANCE_1_5);
-// System.out.println("Defaulting to all possible compliances");
-// }
-// }
-// if (possibleComplianceLevels == -1) {
-// possibleComplianceLevels = F_1_3;
-// String specVersion = System.getProperty("java.specification.version");
-// boolean canRun1_4 = !"1.0".equals(specVersion) && !"1.1".equals(specVersion) && !"1.2".equals(specVersion) && !"1.3".equals(specVersion);
-// if (canRun1_4) {
-// possibleComplianceLevels |= F_1_4;
-// }
-// boolean canRun1_5 = canRun1_4 && !"1.4".equals(specVersion);
-// if (canRun1_5) {
-// possibleComplianceLevels |= F_1_5;
-// }
-// }
-// }
-// return possibleComplianceLevels;
-// }
-
+ // public static int getPossibleComplianceLevels() {
+ // if (possibleComplianceLevels == -1) {
+ // String compliance = System.getProperty("compliance");
+ // if (compliance != null) {
+ // if (COMPLIANCE_1_3.equals(compliance)) {
+ // possibleComplianceLevels = F_1_3;
+ // } else if (COMPLIANCE_1_4.equals(compliance)) {
+ // possibleComplianceLevels = F_1_4;
+ // } else if (COMPLIANCE_1_5.equals(compliance)) {
+ // possibleComplianceLevels = F_1_5;
+ // } else {
+ // System.out.println("Invalid compliance specified (" + compliance + ")");
+ // System.out.println("Use one of " + COMPLIANCE_1_3 + ", " + COMPLIANCE_1_4
+ // + ", " + COMPLIANCE_1_5);
+ // System.out.println("Defaulting to all possible compliances");
+ // }
+ // }
+ // if (possibleComplianceLevels == -1) {
+ // possibleComplianceLevels = F_1_3;
+ // String specVersion = System.getProperty("java.specification.version");
+ // boolean canRun1_4 = !"1.0".equals(specVersion) &&
+ // !"1.1".equals(specVersion) && !"1.2".equals(specVersion) &&
+ // !"1.3".equals(specVersion);
+ // if (canRun1_4) {
+ // possibleComplianceLevels |= F_1_4;
+ // }
+ // boolean canRun1_5 = canRun1_4 && !"1.4".equals(specVersion);
+ // if (canRun1_5) {
+ // possibleComplianceLevels |= F_1_5;
+ // }
+ // }
+ // }
+ // return possibleComplianceLevels;
+ // }
/*
- * Returns a test suite including the tests defined by the given classes for the given complianceLevel
- * (see AbstractCompilerTest for valid values) and using the given setup class (CompilerTestSetup or a subclass)
+ * Returns a test suite including the tests defined by the given classes for
+ * the given complianceLevel (see AbstractCompilerTest for valid values) and
+ * using the given setup class (CompilerTestSetup or a subclass)
*/
- public static Test suiteForComplianceLevel(String complianceLevel, Class setupClass, ArrayList testClasses) {
+ public static Test suiteForComplianceLevel(String complianceLevel,
+ Class setupClass, ArrayList testClasses) {
TestSuite suite;
if (testClasses.size() == 1) {
- suite = new TestSuite((Class)testClasses.get(0), complianceLevel);
+ suite = new TestSuite((Class) testClasses.get(0), complianceLevel);
} else {
suite = new TestSuite(complianceLevel);
for (int i = 0, length = testClasses.size(); i < length; i++) {
- Class testClass = (Class)testClasses.get(i);
+ Class testClass = (Class) testClasses.get(i);
TestSuite innerSuite = new TestSuite(testClass);
suite.addTest(innerSuite);
}
@@ -212,8 +228,10 @@ public class AbstractCompilerTest extends TestCase {
// call the setup constructor with the suite and compliance level
try {
- Constructor constructor = setupClass.getConstructor(new Class[]{Test.class, String.class});
- Test setUp = (Test)constructor.newInstance(new Object[]{suite, complianceLevel});
+ Constructor constructor = setupClass.getConstructor(new Class[] {
+ Test.class, String.class });
+ Test setUp = (Test) constructor.newInstance(new Object[] { suite,
+ complianceLevel });
return setUp;
} catch (IllegalAccessException e) {
e.printStackTrace();
@@ -235,12 +253,19 @@ public class AbstractCompilerTest extends TestCase {
protected Map getCompilerOptions() {
Map options = new CompilerOptions().getMap();
// ignore warnings
- options.put(CompilerOptions.OPTION_PHPVarDeprecatedWarning, CompilerOptions.IGNORE);
- options.put(CompilerOptions.OPTION_PHPBadStyleKeywordWarning, CompilerOptions.IGNORE);
- options.put(CompilerOptions.OPTION_PHPBadStyleUppercaseIdentifierWarning, CompilerOptions.IGNORE);
- options.put(CompilerOptions.OPTION_PHPIncludeNotExistWarning, CompilerOptions.IGNORE);
- options.put(CompilerOptions.OPTION_UninitializedLocalVariableWarning, CompilerOptions.IGNORE);
- options.put(CompilerOptions.OPTION_CodeCannotBeReachedWarning, CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_PHPVarDeprecatedWarning,
+ CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_PHPBadStyleKeywordWarning,
+ CompilerOptions.IGNORE);
+ options.put(
+ CompilerOptions.OPTION_PHPBadStyleUppercaseIdentifierWarning,
+ CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_PHPIncludeNotExistWarning,
+ CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_UninitializedLocalVariableWarning,
+ CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_CodeCannotBeReachedWarning,
+ CompilerOptions.IGNORE);
return options;
}
@@ -251,11 +276,12 @@ public class AbstractCompilerTest extends TestCase {
}
return name;
}
-
+
protected void checkPHP(String strEval) {
- checkPHP(strEval,"");
+ checkPHP(strEval, "");
}
- protected void checkPHP(String strEval, String expectedSyntaxErrorDiagnosis ) {
+
+ protected void checkPHP(String strEval, String expectedSyntaxErrorDiagnosis) {
if (Scanner.DEBUG) {
System.out.println("\n------------------------------------");
System.out.println(strEval);
@@ -264,12 +290,10 @@ public class AbstractCompilerTest extends TestCase {
}
protected void checkHTML(String strEval) {
- if (Scanner.DEBUG) {
- System.out.println("\n------------------------------------");
- System.out.println(strEval);
- }
- checkParseHTML(
- strEval.toCharArray(),
- "");
- }
+ if (Scanner.DEBUG) {
+ System.out.println("\n------------------------------------");
+ System.out.println(strEval);
+ }
+ checkParseHTML(strEval.toCharArray(), "");
+ }
}
diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/Util.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/Util.java
index 5c91332..5316029 100644
--- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/Util.java
+++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/Util.java
@@ -10,21 +10,15 @@
*******************************************************************************/
package net.sourceforge.phpdt.core.tests.util;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
import java.net.ServerSocket;
-import java.util.Locale;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-// import net.sourceforge.phpdt.core.tests.compiler.regression.Requestor;
-import net.sourceforge.phpdt.internal.compiler.Compiler;
-import net.sourceforge.phpdt.internal.compiler.IErrorHandlingPolicy;
-import net.sourceforge.phpdt.internal.compiler.IProblemFactory;
import net.sourceforge.phpdt.internal.compiler.batch.CompilationUnit;
-// import net.sourceforge.phpdt.internal.compiler.batch.FileSystem;
-import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment;
-import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory;
public class Util {
public static String OUTPUT_DIRECTORY = "comptest";
@@ -34,7 +28,8 @@ public class Util {
CompilationUnit[] result = new CompilationUnit[length];
int index = 0;
for (int i = 0; i < length; i++) {
- result[i] = new CompilationUnit(testFiles[index + 1].toCharArray(), testFiles[index], null);
+ result[i] = new CompilationUnit(testFiles[index + 1].toCharArray(),
+ testFiles[index], null);
index += 2;
}
return result;
@@ -71,8 +66,8 @@ public class Util {
}
/**
- * Copy the given source (a file or a directory that must exists) to the given
- * destination (a directory that must exists).
+ * Copy the given source (a file or a directory that must exists) to the
+ * given destination (a directory that must exists).
*/
public static void copy(String sourcePath, String destPath) {
sourcePath = toNativePath(sourcePath);
@@ -136,7 +131,8 @@ public class Util {
}
}
- // public static void createJar(String[] pathsAndContents, Map options, String
+ // public static void createJar(String[] pathsAndContents, Map options,
+ // String
// jarPath) throws IOException {
// String classesPath = getOutputDirectory() + File.separator + "classes";
// File classesDir = new File(classesPath);
@@ -148,7 +144,7 @@ public class Util {
* Generate a display string from the given String.
*
* @param indent
- * number of tabs are added at the begining of each line.
+ * number of tabs are added at the begining of each line.
*
* Example of use:
* [org.eclipse.jdt.core.tests.util.Util.displayString("abc\ndef\tghi")]
@@ -176,30 +172,30 @@ public class Util {
*
- * Value is of type Sring. All characters that trigger auto code assist in XML/HTML.
- *
- */
- public final static String CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML = "content_assist_autoactivation_triggers_html"; //$NON-NLS-1$
+ /**
+ * A named preference that holds the characters that auto activate code
+ * assist in XML/HTML.
+ *
+ * Value is of type Sring. All characters that trigger auto
+ * code assist in XML/HTML.
+ *
+ */
+ public final static String CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML = "content_assist_autoactivation_triggers_html"; //$NON-NLS-1$
- /**
- * A named preference that defines if code assist proposals are sorted in alphabetical order.
- *
- * Value is of type Boolean. If true that are sorted in alphabetical
- * order. If false that are unsorted.
- *
- */
- public final static String CODEASSIST_ORDER_PROPOSALS = "content_assist_order_proposals"; //$NON-NLS-1$
+ /**
+ * A named preference that defines if code assist proposals are sorted in
+ * alphabetical order.
+ *
+ * Value is of type Boolean. If true that are
+ * sorted in alphabetical order. If false that are unsorted.
+ *
+ */
+ public final static String CODEASSIST_ORDER_PROPOSALS = "content_assist_order_proposals"; //$NON-NLS-1$
- public static void initializeDefaultValues(IPreferenceStore store) {
- store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, "<"); //$NON-NLS-1$
- store.setDefault(PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, false);
+ public static void initializeDefaultValues(IPreferenceStore store) {
+ store.setDefault(
+ PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML,
+ "<"); //$NON-NLS-1$
+ store.setDefault(PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, false);
- }
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java
index 76ccbd5..8404335 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial implementation
*
- * $Id: WebUI.java,v 1.6 2005-10-13 18:38:19 axelcl Exp $
+ * $Id: WebUI.java,v 1.7 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui;
@@ -41,139 +41,150 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
* The web development tools UI plugin.
*/
public class WebUI extends AbstractUIPlugin implements IPreferenceConstants {
- private static final String CUSTOM_TEMPLATES_KEY = "net.sourceforge.phpeclipse.ui.templates"; //$NON-NLS-1$
-
- // Constants ---------------------------------------------------------------
-
- public static final String ICON_OVERLAY_ERROR = "full/ovr16/error_co.gif"; //$NON-NLS-1$
-
- public static final String ICON_OVERLAY_WARNING = "full/ovr16/warning_co.gif"; //$NON-NLS-1$
-
- // Instance Variables ------------------------------------------------------
-
- /** The shared instance. */
- private static WebUI plugin;
-
- public static IWorkbenchPage getActivePage() {
- return getDefault().internalGetActivePage();
- }
-
- private IWorkbenchPage internalGetActivePage() {
- return getWorkbench().getActiveWorkbenchWindow().getActivePage();
- }
-
- public static Shell getActiveWorkbenchShell() {
- return getActiveWorkbenchWindow().getShell();
- }
-
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return getDefault().getWorkbench().getActiveWorkbenchWindow();
- }
- // Public Methods ----------------------------------------------------------
-
- /**
- * Returns the shared instance.
- */
- public static WebUI getDefault() {
- return plugin;
- }
-
- /**
- * Returns the workspace instance.
- */
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /** The context type registry. */
- private ContributionContextTypeRegistry fRegistry;
-
- /** The template store. */
- private TemplateStore fStore;
-
- // Constructors ------------------------------------------------------------
-
- /**
- * The constructor.
- */
- public WebUI() {
- plugin = this;
- }
-
- /**
- * Returns this plug-in's context type registry.
- *
- * @return the context type registry for this plug-in instance
- */
- public ContextTypeRegistry getContextTypeRegistry() {
- if (fRegistry == null) {
- // create an configure the contexts available in the editor
- fRegistry = new ContributionContextTypeRegistry();
- fRegistry.addContextType(XMLContextType.XML_CONTEXT_TYPE);
- fRegistry.addContextType(HTMLContextType.HTML_CONTEXT_TYPE);
- fRegistry.addContextType(SmartyContextType.SMARTY_CONTEXT_TYPE);
- fRegistry.addContextType(JSContextType.JS_CONTEXT_TYPE);
- }
- return fRegistry;
- }
-
- // Private Methods ---------------------------------------------------------
-
- /**
- * Returns an image descriptor for the image corresponding to the specified key (which is the name of the image file).
- *
- * @param key
- * The key of the image
- * @return The descriptor for the requested image, or null if the image could not be found
- */
- private ImageDescriptor getImageDescriptor(String key) {
- try {
- URL url = getBundle().getEntry("/icons/" + key); //$NON-NLS-1$
- return ImageDescriptor.createFromURL(url);
- } catch (IllegalStateException e) {
- return null;
- }
- }
-
- /**
- * Returns this plug-in's template store.
- *
- * @return the template store of this plug-in instance
- */
- public TemplateStore getTemplateStore() {
- if (fStore == null) {
- fStore = new ContributionTemplateStore(getContextTypeRegistry(), getDefault().getPreferenceStore(), CUSTOM_TEMPLATES_KEY);
- try {
- fStore.load();
- } catch (IOException e) {
- WebUI.getDefault().getLog().log(new Status(IStatus.ERROR, "net.sourceforge.phpeclipse.ui", IStatus.OK, "", e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return fStore;
- }
-
- protected void initializeDefaultPreferences(IPreferenceStore store) {
- store.setDefault(PHP_LOCALHOST_PREF, "http://localhost");
- store.setDefault(PHP_DOCUMENTROOT_PREF, getWorkspace().getRoot().getLocation().toString());
-// store.setDefault(PHP_BOOKMARK_DEFAULT, "");
-
- store.setDefault(PHP_AUTO_PREVIEW_DEFAULT, "true");
- store.setDefault(PHP_BRING_TO_TOP_PREVIEW_DEFAULT, "true");
-// store.setDefault(PHP_SHOW_HTML_FILES_LOCAL, "true");
-// store.setDefault(PHP_SHOW_XML_FILES_LOCAL, "false");
- }
-
- /*
- * @see AbstractUIPlugin#initializeImageRegistry(ImageRegistry)
- */
- protected void initializeImageRegistry(ImageRegistry reg) {
- reg.put(ICON_OVERLAY_ERROR, getImageDescriptor(ICON_OVERLAY_ERROR));
- reg.put(ICON_OVERLAY_WARNING, getImageDescriptor(ICON_OVERLAY_WARNING));
- }
- // private IWorkbenchPage internalGetActivePage() {
- // IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
- // if (window != null)
- // return window.getActivePage();
- // return null;
- // }
+ private static final String CUSTOM_TEMPLATES_KEY = "net.sourceforge.phpeclipse.ui.templates"; //$NON-NLS-1$
+
+ // Constants ---------------------------------------------------------------
+
+ public static final String ICON_OVERLAY_ERROR = "full/ovr16/error_co.gif"; //$NON-NLS-1$
+
+ public static final String ICON_OVERLAY_WARNING = "full/ovr16/warning_co.gif"; //$NON-NLS-1$
+
+ // Instance Variables ------------------------------------------------------
+
+ /** The shared instance. */
+ private static WebUI plugin;
+
+ public static IWorkbenchPage getActivePage() {
+ return getDefault().internalGetActivePage();
+ }
+
+ private IWorkbenchPage internalGetActivePage() {
+ return getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ }
+
+ public static Shell getActiveWorkbenchShell() {
+ return getActiveWorkbenchWindow().getShell();
+ }
+
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ }
+
+ // Public Methods ----------------------------------------------------------
+
+ /**
+ * Returns the shared instance.
+ */
+ public static WebUI getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the workspace instance.
+ */
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ /** The context type registry. */
+ private ContributionContextTypeRegistry fRegistry;
+
+ /** The template store. */
+ private TemplateStore fStore;
+
+ // Constructors ------------------------------------------------------------
+
+ /**
+ * The constructor.
+ */
+ public WebUI() {
+ plugin = this;
+ }
+
+ /**
+ * Returns this plug-in's context type registry.
+ *
+ * @return the context type registry for this plug-in instance
+ */
+ public ContextTypeRegistry getContextTypeRegistry() {
+ if (fRegistry == null) {
+ // create an configure the contexts available in the editor
+ fRegistry = new ContributionContextTypeRegistry();
+ fRegistry.addContextType(XMLContextType.XML_CONTEXT_TYPE);
+ fRegistry.addContextType(HTMLContextType.HTML_CONTEXT_TYPE);
+ fRegistry.addContextType(SmartyContextType.SMARTY_CONTEXT_TYPE);
+ fRegistry.addContextType(JSContextType.JS_CONTEXT_TYPE);
+ }
+ return fRegistry;
+ }
+
+ // Private Methods ---------------------------------------------------------
+
+ /**
+ * Returns an image descriptor for the image corresponding to the specified
+ * key (which is the name of the image file).
+ *
+ * @param key
+ * The key of the image
+ * @return The descriptor for the requested image, or null if
+ * the image could not be found
+ */
+ private ImageDescriptor getImageDescriptor(String key) {
+ try {
+ URL url = getBundle().getEntry("/icons/" + key); //$NON-NLS-1$
+ return ImageDescriptor.createFromURL(url);
+ } catch (IllegalStateException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns this plug-in's template store.
+ *
+ * @return the template store of this plug-in instance
+ */
+ public TemplateStore getTemplateStore() {
+ if (fStore == null) {
+ fStore = new ContributionTemplateStore(getContextTypeRegistry(),
+ getDefault().getPreferenceStore(), CUSTOM_TEMPLATES_KEY);
+ try {
+ fStore.load();
+ } catch (IOException e) {
+ WebUI
+ .getDefault()
+ .getLog()
+ .log(
+ new Status(
+ IStatus.ERROR,
+ "net.sourceforge.phpeclipse.ui", IStatus.OK, "", e)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return fStore;
+ }
+
+ protected void initializeDefaultPreferences(IPreferenceStore store) {
+ store.setDefault(PHP_LOCALHOST_PREF, "http://localhost");
+ store.setDefault(PHP_DOCUMENTROOT_PREF, getWorkspace().getRoot()
+ .getLocation().toString());
+ // store.setDefault(PHP_BOOKMARK_DEFAULT, "");
+
+ store.setDefault(PHP_AUTO_PREVIEW_DEFAULT, "true");
+ store.setDefault(PHP_BRING_TO_TOP_PREVIEW_DEFAULT, "true");
+ // store.setDefault(PHP_SHOW_HTML_FILES_LOCAL, "true");
+ // store.setDefault(PHP_SHOW_XML_FILES_LOCAL, "false");
+ }
+
+ /*
+ * @see AbstractUIPlugin#initializeImageRegistry(ImageRegistry)
+ */
+ protected void initializeImageRegistry(ImageRegistry reg) {
+ reg.put(ICON_OVERLAY_ERROR, getImageDescriptor(ICON_OVERLAY_ERROR));
+ reg.put(ICON_OVERLAY_WARNING, getImageDescriptor(ICON_OVERLAY_WARNING));
+ }
+ // private IWorkbenchPage internalGetActivePage() {
+ // IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
+ // if (window != null)
+ // return window.getActivePage();
+ // return null;
+ // }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/BrowserUtil.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/BrowserUtil.java
index a70b636..f5781be 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/BrowserUtil.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/BrowserUtil.java
@@ -18,7 +18,8 @@ import org.eclipse.ui.part.ShowInContext;
public class BrowserUtil {
- public static ShowInContextBrowser getShowInContext(IFile previewFile, boolean forceDBGPreview, String postFix) {
+ public static ShowInContextBrowser getShowInContext(IFile previewFile,
+ boolean forceDBGPreview, String postFix) {
String extension = previewFile.getFileExtension().toLowerCase();
// boolean showHTMLFilesLocal = false;
// boolean showXMLFilesLocal = false;
@@ -29,17 +30,21 @@ public class BrowserUtil {
// showHTMLFilesLocal =
// ProjectPrefUtil.getPreviewBooleanValue(previewFile,
// IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL);
- // showXMLFilesLocal = ProjectPrefUtil.getPreviewBooleanValue(previewFile,
+ // showXMLFilesLocal =
+ // ProjectPrefUtil.getPreviewBooleanValue(previewFile,
// IPreferenceConstants.PHP_SHOW_XML_FILES_LOCAL);
- isHTMLFileName = "html".equals(extension) || "htm".equals(extension) || "xhtml".equals(extension);
- isXMLFileName = "xml".equals(extension) || "xsd".equals(extension) || "dtd".equals(extension);
+ isHTMLFileName = "html".equals(extension)
+ || "htm".equals(extension) || "xhtml".equals(extension);
+ isXMLFileName = "xml".equals(extension) || "xsd".equals(extension)
+ || "dtd".equals(extension);
}
// if (showHTMLFilesLocal && isHTMLFileName) {
// localhostURL = previewFile.getLocation().toString();
// } else if (showXMLFilesLocal && isXMLFileName) {
// localhostURL = previewFile.getLocation().toString();
// } else
- if ((localhostURL = ShowExternalPreviewAction.getLocalhostURL(null, previewFile)) == null) {
+ if ((localhostURL = ShowExternalPreviewAction.getLocalhostURL(null,
+ previewFile)) == null) {
return new ShowInContextBrowser(previewFile, null, null);
}
localhostURL += postFix;
@@ -49,9 +54,9 @@ public class BrowserUtil {
/**
* Returns the IShowInTarget for the given part, or
* null if it does not provide one.
- *
+ *
* @param targetPart
- * the target part
+ * the target part
* @return the IShowInTarget or null
*/
private static IShowInTarget getShowInTarget(IWorkbenchPart targetPart) {
@@ -65,7 +70,8 @@ public class BrowserUtil {
return null;
}
- public static void showPreview(IFile previewFile, boolean forceDBGPreview, String postFix) {
+ public static void showPreview(IFile previewFile, boolean forceDBGPreview,
+ String postFix) {
if (previewFile == null) {
// should never happen
return;
@@ -79,7 +85,9 @@ public class BrowserUtil {
// boolean isHTMLFileName = false;
// boolean isXMLFileName = false;
if (!forceDBGPreview) {
- autoPreview = ProjectPrefUtil.getPreviewBooleanValue(previewFile, IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT);
+ autoPreview = ProjectPrefUtil.getPreviewBooleanValue(
+ previewFile,
+ IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT);
// showHTMLFilesLocal =
// ProjectPrefUtil.getPreviewBooleanValue(previewFile,
@@ -87,9 +95,11 @@ public class BrowserUtil {
// showXMLFilesLocal =
// ProjectPrefUtil.getPreviewBooleanValue(previewFile,
// IPreferenceConstants.PHP_SHOW_XML_FILES_LOCAL);
- // isHTMLFileName = "html".equals(extension) || "htm".equals(extension)
+ // isHTMLFileName = "html".equals(extension) ||
+ // "htm".equals(extension)
// || "xhtml".equals(extension);
- // isXMLFileName = "xml".equals(extension) || "xsd".equals(extension) ||
+ // isXMLFileName = "xml".equals(extension) ||
+ // "xsd".equals(extension) ||
// "dtd".equals(extension);
}
if (autoPreview) {
@@ -99,23 +109,27 @@ public class BrowserUtil {
// } else if (showXMLFilesLocal && isXMLFileName) {
// localhostURL = previewFile.getLocation().toString();
// } else if ((localhostURL =
- // ShowExternalPreviewAction.getLocalhostURL(null, previewFile)) ==
+ // ShowExternalPreviewAction.getLocalhostURL(null, previewFile))
+ // ==
// null) {
// return;
// }
// localhostURL += postFix;
- ShowInContext context = getShowInContext(previewFile, forceDBGPreview, postFix);
+ ShowInContext context = getShowInContext(previewFile,
+ forceDBGPreview, postFix);
IWorkbenchPart sourcePart = page.getActivePart();
if (sourcePart == null && context != null) {
return;
}
// try {
- Perspective persp = ((WorkbenchPage) page).getActivePerspective();
+ Perspective persp = ((WorkbenchPage) page)
+ .getActivePerspective();
if (persp != null) {
// If this view is already visible just return.
- IViewReference ref = persp.findView(BrowserView.ID_BROWSER, null);
+ IViewReference ref = persp.findView(BrowserView.ID_BROWSER,
+ null);
IViewPart view = null;
if (ref != null) {
view = ref.getView(true);
@@ -125,17 +139,20 @@ public class BrowserUtil {
if (target != null && target.show(context)) {
// success
}
- ((WorkbenchPage) page).performedShowIn(BrowserView.ID_BROWSER);
+ ((WorkbenchPage) page)
+ .performedShowIn(BrowserView.ID_BROWSER);
}
}
// IViewPart view = page.showView(BrowserView.ID_BROWSER);
// IShowInTarget target = getShowInTarget(view);
- // if (target != null && target.show(new ShowInContext(localhostURL,
+ // if (target != null && target.show(new
+ // ShowInContext(localhostURL,
// null))) {
// // success
// }
- // ((WorkbenchPage) page).performedShowIn(BrowserView.ID_BROWSER); //
+ // ((WorkbenchPage)
+ // page).performedShowIn(BrowserView.ID_BROWSER); //
// TODO: move back up
// } catch (PartInitException e) {
// WorkbenchPlugin.log(
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/EditorMessages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/EditorMessages.java
index 2f7b552..2c826cd 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/EditorMessages.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/EditorMessages.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: EditorMessages.java,v 1.2 2004-09-03 17:30:33 jsurfer Exp $
+ * $Id: EditorMessages.java,v 1.3 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.editor;
@@ -21,21 +21,23 @@ import java.util.ResourceBundle;
*/
public class EditorMessages {
private static ResourceBundle bundle = ResourceBundle
- .getBundle("net.sourceforge.phpeclipse.ui.editor.EditorMessages"); //$NON-NLS-1$
+ .getBundle("net.sourceforge.phpeclipse.ui.editor.EditorMessages"); //$NON-NLS-1$
- private EditorMessages() {}
+ private EditorMessages() {
+ }
- public static String getString( String key ) {
+ public static String getString(String key) {
try {
- return bundle.getString( key );
- } catch ( MissingResourceException e ) {
+ return bundle.getString(key);
+ } catch (MissingResourceException e) {
return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
- /**
- * @return Returns the bundle.
- */
- public static ResourceBundle getResourceBundle() {
- return bundle;
- }
+
+ /**
+ * @return Returns the bundle.
+ */
+ public static ResourceBundle getResourceBundle() {
+ return bundle;
+ }
}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/I18NDocumentProvider.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/I18NDocumentProvider.java
index 7aaf2ed..6c4c71a 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/I18NDocumentProvider.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/I18NDocumentProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: I18NDocumentProvider.java,v 1.1 2004-09-02 18:26:30 jsurfer Exp $
+ * $Id: I18NDocumentProvider.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.editor;
@@ -81,10 +81,11 @@ public class I18NDocumentProvider extends FileDocumentProvider {
throw new CoreException(s);
} finally {
- if (in != null) try {
- in.close();
- } catch (IOException x) {
- }
+ if (in != null)
+ try {
+ in.close();
+ } catch (IOException x) {
+ }
}
}
@@ -240,16 +241,16 @@ public class I18NDocumentProvider extends FileDocumentProvider {
}
/**
- * Tries to determine encoding from contents of the stream. Returns null
- * if encoding is unknown.
+ * Tries to determine encoding from contents of the stream. Returns
+ * null if encoding is unknown.
*/
public String getDeclaredEncoding(InputStream in) throws IOException {
return getBOMEncoding(in);
}
/**
- * Tries to determine encoding from the byte order mark. Returns null
- * if encoding is unknown.
+ * Tries to determine encoding from the byte order mark. Returns
+ * null if encoding is unknown.
*/
private String getBOMEncoding(InputStream in) throws IOException {
int first = in.read();
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java
index 8ba89aa..abe117e 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java
@@ -19,105 +19,111 @@ import org.eclipse.ui.texteditor.TextEditorAction;
* ClassDeclaration that defines the action for parsing the current PHP file
*/
public class ShowExternalPreviewAction extends TextEditorAction {
- public final static int XML_TYPE = 1;
+ public final static int XML_TYPE = 1;
- public final static int HTML_TYPE = 2;
+ public final static int HTML_TYPE = 2;
- public final static int SMARTY_TYPE = 3;
+ public final static int SMARTY_TYPE = 3;
- public final static int PHP_TYPE = 4;
+ public final static int PHP_TYPE = 4;
- private static ShowExternalPreviewAction instance = new ShowExternalPreviewAction();
+ private static ShowExternalPreviewAction instance = new ShowExternalPreviewAction();
- /**
- * Constructs and updates the action.
- */
- private ShowExternalPreviewAction() {
- super(EditorMessages.getResourceBundle(), "ParserAction.", null); //$NON-NLS-1$
- update();
- }
+ /**
+ * Constructs and updates the action.
+ */
+ private ShowExternalPreviewAction() {
+ super(EditorMessages.getResourceBundle(), "ParserAction.", null); //$NON-NLS-1$
+ update();
+ }
- public static ShowExternalPreviewAction getInstance() {
- return instance;
- }
+ public static ShowExternalPreviewAction getInstance() {
+ return instance;
+ }
- /**
- * Code called when the action is fired.
- */
- public void run() {
- doRun(PHP_TYPE);
- }
+ /**
+ * Code called when the action is fired.
+ */
+ public void run() {
+ doRun(PHP_TYPE);
+ }
- public void doRun(int type) {
- IFile previewFile = getFile();
- BrowserUtil.showPreview(previewFile, false, "");
- }
+ public void doRun(int type) {
+ IFile previewFile = getFile();
+ BrowserUtil.showPreview(previewFile, false, "");
+ }
- public void refresh(int type) {
- IFile fileToParse = getFile();
- if (fileToParse == null) {
- // should never happen
- return;
- }
- boolean autoPreview = ProjectPrefUtil.getPreviewBooleanValue(fileToParse, IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT);
- boolean bringToTopPreview = ProjectPrefUtil.getPreviewBooleanValue(fileToParse,
- IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT);
+ public void refresh(int type) {
+ IFile fileToParse = getFile();
+ if (fileToParse == null) {
+ // should never happen
+ return;
+ }
+ boolean autoPreview = ProjectPrefUtil.getPreviewBooleanValue(
+ fileToParse, IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT);
+ boolean bringToTopPreview = ProjectPrefUtil.getPreviewBooleanValue(
+ fileToParse,
+ IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT);
- if (autoPreview) {
- IWorkbenchPage page = WebUI.getActivePage();
- try {
- IViewPart part = page.findView(BrowserView.ID_BROWSER);
- if (part == null) {
- part = page.showView(BrowserView.ID_BROWSER);
- } else {
- if (bringToTopPreview) {
- page.bringToTop(part);
- }
- }
- if (part != null) {
- ((BrowserView) part).refresh();
- }
- } catch (Exception e) {
- // PHPeclipsePlugin.log(e);
- }
- }
- }
+ if (autoPreview) {
+ IWorkbenchPage page = WebUI.getActivePage();
+ try {
+ IViewPart part = page.findView(BrowserView.ID_BROWSER);
+ if (part == null) {
+ part = page.showView(BrowserView.ID_BROWSER);
+ } else {
+ if (bringToTopPreview) {
+ page.bringToTop(part);
+ }
+ }
+ if (part != null) {
+ ((BrowserView) part).refresh();
+ }
+ } catch (Exception e) {
+ // PHPeclipsePlugin.log(e);
+ }
+ }
+ }
- /**
- * Finds the file that's currently opened in the PHP Text Editor
- */
- protected IFile getFile() {
- ITextEditor editor = getTextEditor();
- IEditorInput editorInput = null;
- if (editor != null) {
- editorInput = editor.getEditorInput();
- }
- if (editorInput instanceof IFileEditorInput)
- return ((IFileEditorInput) editorInput).getFile();
- // if nothing was found, which should never happen
- return null;
- }
+ /**
+ * Finds the file that's currently opened in the PHP Text Editor
+ */
+ protected IFile getFile() {
+ ITextEditor editor = getTextEditor();
+ IEditorInput editorInput = null;
+ if (editor != null) {
+ editorInput = editor.getEditorInput();
+ }
+ if (editorInput instanceof IFileEditorInput)
+ return ((IFileEditorInput) editorInput).getFile();
+ // if nothing was found, which should never happen
+ return null;
+ }
- public static String getLocalhostURL(IPreferenceStore store, IFile file) {
- if (file != null) {
- if (store == null) {
- store = WebUI.getDefault().getPreferenceStore();
- }
- // IPath path = file.getFullPath();
- String localhostURL = file.getLocation().toString();
- String lowerCaseFileName = localhostURL.toLowerCase();
- // String documentRoot = store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF);
- IPath documentRootPath = ProjectPrefUtil.getDocumentRoot(file.getProject());
- String documentRoot = documentRootPath.toString().toLowerCase();
- if (lowerCaseFileName.startsWith(documentRoot)) {
- localhostURL = localhostURL.substring(documentRoot.length());
- } else {
- return null;
- }
- // return store.getString(PHPeclipsePlugin.LOCALHOST_PREF) + localhostURL;
- return ProjectPrefUtil.getMiscProjectsPreferenceValue(file.getProject(), IPreferenceConstants.PHP_LOCALHOST_PREF)
- + localhostURL;
- }
- return "http://localhost";
- }
+ public static String getLocalhostURL(IPreferenceStore store, IFile file) {
+ if (file != null) {
+ if (store == null) {
+ store = WebUI.getDefault().getPreferenceStore();
+ }
+ // IPath path = file.getFullPath();
+ String localhostURL = file.getLocation().toString();
+ String lowerCaseFileName = localhostURL.toLowerCase();
+ // String documentRoot =
+ // store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF);
+ IPath documentRootPath = ProjectPrefUtil.getDocumentRoot(file
+ .getProject());
+ String documentRoot = documentRootPath.toString().toLowerCase();
+ if (lowerCaseFileName.startsWith(documentRoot)) {
+ localhostURL = localhostURL.substring(documentRoot.length());
+ } else {
+ return null;
+ }
+ // return store.getString(PHPeclipsePlugin.LOCALHOST_PREF) +
+ // localhostURL;
+ return ProjectPrefUtil.getMiscProjectsPreferenceValue(file
+ .getProject(), IPreferenceConstants.PHP_LOCALHOST_PREF)
+ + localhostURL;
+ }
+ return "http://localhost";
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/StructuredTextEditor.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/StructuredTextEditor.java
index c09a5be..5ee45b2 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/StructuredTextEditor.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/StructuredTextEditor.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: StructuredTextEditor.java,v 1.1 2004-09-02 18:26:30 jsurfer Exp $
+ * $Id: StructuredTextEditor.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.editor;
@@ -34,34 +34,34 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
* Abstract base class for editors that keep a source model synchronized with
* the textual contants being edited.
*/
-public abstract class StructuredTextEditor extends TextEditor
- implements IReconcilingParticipant {
+public abstract class StructuredTextEditor extends TextEditor implements
+ IReconcilingParticipant {
// Inner Classes -----------------------------------------------------------
- /**
- * Listens to changes to the selection in the outline page, and changes the
- * selection and highlight range in the editor accordingly.
- */
- private class OutlineSelectionChangedListener
- implements ISelectionChangedListener {
-
- /*
- * @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection =
- (IStructuredSelection) event.getSelection();
- if (selection.isEmpty()) {
- resetHighlightRange();
- } else {
- ISourceReference element = (ISourceReference)
- selection.getFirstElement();
- highlightElement(element, true);
- }
- }
-
- }
+ /**
+ * Listens to changes to the selection in the outline page, and changes the
+ * selection and highlight range in the editor accordingly.
+ */
+ private class OutlineSelectionChangedListener implements
+ ISelectionChangedListener {
+
+ /*
+ * @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event
+ .getSelection();
+ if (selection.isEmpty()) {
+ resetHighlightRange();
+ } else {
+ ISourceReference element = (ISourceReference) selection
+ .getFirstElement();
+ highlightElement(element, true);
+ }
+ }
+
+ }
// Instance Variables ------------------------------------------------------
@@ -85,10 +85,9 @@ public abstract class StructuredTextEditor extends TextEditor
if (adapter.equals(IContentOutlinePage.class)) {
if (outlinePage == null) {
outlinePage = createOutlinePage();
- outlinePageSelectionListener =
- new OutlineSelectionChangedListener();
- outlinePage.addSelectionChangedListener(
- outlinePageSelectionListener);
+ outlinePageSelectionListener = new OutlineSelectionChangedListener();
+ outlinePage
+ .addSelectionChangedListener(outlinePageSelectionListener);
}
return outlinePage;
}
@@ -106,7 +105,7 @@ public abstract class StructuredTextEditor extends TextEditor
// IReconcilingParticipant Implementation ----------------------------------
- /*
+ /*
* @see IReconcilingParticipant#reconciled()
*/
public void reconciled() {
@@ -150,9 +149,10 @@ public abstract class StructuredTextEditor extends TextEditor
/**
* Returns the source model element at the specified offset.
*
- * @param offset the offset into the document
- * @return the element at the given offset, or null if no model is
- * available or there is no element at the offset
+ * @param offset
+ * the offset into the document
+ * @return the element at the given offset, or null if no model
+ * is available or there is no element at the offset
*/
public ISourceReference getElementAt(int offset) {
ISourceReference retVal = null;
@@ -178,33 +178,34 @@ public abstract class StructuredTextEditor extends TextEditor
/**
* Informs the editor that its outliner has been closed.
*
- * TODO There must be a more elegant way to get notified when the outline
- * page was closed. Otherwise move this method into an interface
+ * TODO There must be a more elegant way to get notified when the outline
+ * page was closed. Otherwise move this method into an interface
*/
public void outlinePageClosed() {
if (outlinePage != null) {
- outlinePage.removeSelectionChangedListener(
- outlinePageSelectionListener);
+ outlinePage
+ .removeSelectionChangedListener(outlinePageSelectionListener);
outlinePage = null;
resetHighlightRange();
}
}
/**
- * Synchronizes the outliner selection with the given element position in
+ * Synchronizes the outliner selection with the given element position in
* the editor.
*
- * @param element the java element to select
+ * @param element
+ * the java element to select
*/
public void synchronizeOutlinePage(ISourceReference element) {
if (outlinePage != null) {
- outlinePage.removeSelectionChangedListener(
- outlinePageSelectionListener);
+ outlinePage
+ .removeSelectionChangedListener(outlinePageSelectionListener);
if (outlinePage instanceof ModelBasedOutlinePage) {
((ModelBasedOutlinePage) outlinePage).select(element);
}
- outlinePage.addSelectionChangedListener(
- outlinePageSelectionListener);
+ outlinePage
+ .addSelectionChangedListener(outlinePageSelectionListener);
}
}
@@ -224,15 +225,17 @@ public abstract class StructuredTextEditor extends TextEditor
/**
* Highlights the given element.
*
- * @param element the element that should be highlighted
- * @param moveCursor whether the cursor should be moved to the element
+ * @param element
+ * the element that should be highlighted
+ * @param moveCursor
+ * whether the cursor should be moved to the element
*/
protected final void highlightElement(ISourceReference element,
boolean moveCursor) {
if (element != null) {
IRegion highlightRegion = element.getSourceRegion();
- setHighlightRange(highlightRegion.getOffset(),
- highlightRegion.getLength(), moveCursor);
+ setHighlightRange(highlightRegion.getOffset(), highlightRegion
+ .getLength(), moveCursor);
} else {
resetHighlightRange();
}
@@ -252,23 +255,26 @@ public abstract class StructuredTextEditor extends TextEditor
/**
* Recursively searches the specified list of elements managed by the given
- * model for the element that covers the specified offfset with minimal
+ * model for the element that covers the specified offfset with minimal
* padding.
*
- * @param model the source model
- * @param elements the current list of elements
- * @param offset the offset into the document
+ * @param model
+ * the source model
+ * @param elements
+ * the current list of elements
+ * @param offset
+ * the offset into the document
* @return the model element at the specified offset, or null if
* no element could be found
*/
- private static ISourceReference getElementAt(
- ISourceModel model, ISourceReference elements[], int offset) {
+ private static ISourceReference getElementAt(ISourceModel model,
+ ISourceReference elements[], int offset) {
ISourceReference retVal = null;
for (int i = 0; i < elements.length; i++) {
ISourceReference element = elements[i];
IRegion region = element.getSourceRegion();
if ((offset > region.getOffset())
- && (offset < (region.getOffset() + region.getLength()))) {
+ && (offset < (region.getOffset() + region.getLength()))) {
ISourceReference[] children = model.getChildren(element);
if (children.length > 0) {
retVal = getElementAt(model, children, offset);
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/internal/WebUIMessages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/internal/WebUIMessages.java
index 885d41b..874983b 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/internal/WebUIMessages.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/internal/WebUIMessages.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: WebUIMessages.java,v 1.1 2004-09-02 18:26:29 jsurfer Exp $
+ * $Id: WebUIMessages.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.internal;
@@ -27,16 +27,15 @@ public final class WebUIMessages {
/**
* Qualified name of the resource bundle containing the localized messages.
*/
- private static final String RESOURCE_BUNDLE =
- "net.sourceforge.phpeclipse.ui.internal.WebUIMessages"; //$NON-NLS-1$
+ private static final String RESOURCE_BUNDLE = "net.sourceforge.phpeclipse.ui.internal.WebUIMessages"; //$NON-NLS-1$
// Class Variables ---------------------------------------------------------
/**
* The resource bundle.
*/
- private static ResourceBundle resourceBundle =
- ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ private static ResourceBundle resourceBundle = ResourceBundle
+ .getBundle(RESOURCE_BUNDLE);
// Constructors ------------------------------------------------------------
@@ -61,7 +60,8 @@ public final class WebUIMessages {
/**
* Returns the message identified by the specified key.
*
- * @param key the message key
+ * @param key
+ * the message key
* @return the localized message, or the key enclosed by exclamation marks
* if no message was found for the key
*/
@@ -77,10 +77,12 @@ public final class WebUIMessages {
* Returns the message identified by the specified key, replacing a single
* parameter with the provided value.
*
- * @param key the message key
- * @param arg the parameter value
- * @return the formatted string, or the key enclosed by exclamation marks
- * if no message was found for the key
+ * @param key
+ * the message key
+ * @param arg
+ * the parameter value
+ * @return the formatted string, or the key enclosed by exclamation marks if
+ * no message was found for the key
*/
public static String getString(String key, String arg) {
return getString(key, new String[] { arg });
@@ -90,13 +92,15 @@ public final class WebUIMessages {
* Returns the message identified by the specified key, replacing all
* parameters with the provided values.
*
- * @param key the message key
- * @param args the parameter values
- * @return the formatted string, or the key enclosed by exclamation marks
- * if no message was found for the key
+ * @param key
+ * the message key
+ * @param args
+ * the parameter values
+ * @return the formatted string, or the key enclosed by exclamation marks if
+ * no message was found for the key
*/
public static String getString(String key, String[] args) {
- return MessageFormat.format(getString(key), args);
+ return MessageFormat.format(getString(key), args);
}
}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/FieldEditorOverlayPage.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/FieldEditorOverlayPage.java
index 7564fe2..fd3fa65 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/FieldEditorOverlayPage.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/FieldEditorOverlayPage.java
@@ -9,6 +9,7 @@
* Berthold Daum
*******************************************************************************/
package net.sourceforge.phpeclipse.ui.overlaypages;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -36,331 +37,366 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbenchPropertyPage;
+
/**
* @author Berthold Daum
*/
public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage
- implements
- IWorkbenchPropertyPage {
- /**
- * * Name of resource property for the selection of workbench or project
- * settings **
- */
- public static final String USEPROJECTSETTINGS = "useProjectSettings"; //$NON-NLS-1$
- private static final String FALSE = "false"; //$NON-NLS-1$
- private static final String TRUE = "true"; //$NON-NLS-1$
- private boolean fUseFileSettings = false;
- // Stores all created field editors
- private List editors = new ArrayList();
- // Stores owning element of properties
- private IAdaptable element;
- // Additional buttons for property pages
- private Button useWorkspaceSettingsButton, useProjectSettingsButton,
- configureButton;
- // Overlay preference store for property pages
- private IPreferenceStore overlayStore;
- // The image descriptor of this pages title image
- private ImageDescriptor image;
- // Cache for page id
- private String pageId;
- /**
- * Constructor
- *
- * @param style -
- * layout style
- */
- public FieldEditorOverlayPage(int style) {
- super(style);
- }
- /**
- * Constructor
- *
- * @param style -
- * layout style
- */
- public FieldEditorOverlayPage(int style, boolean isFileSettings) {
- super(style);
- fUseFileSettings = isFileSettings;
- }
- /**
- * Constructor
- *
- * @param title -
- * title string
- * @param style -
- * layout style
- */
- public FieldEditorOverlayPage(String title, int style) {
- super(title, style);
- }
- public FieldEditorOverlayPage(String title, int style, boolean isFileSettings) {
- super(title, style);
- fUseFileSettings = isFileSettings;
- }
- /**
- * Constructor
- *
- * @param title -
- * title string
- * @param image -
- * title image
- * @param style -
- * layout style
- */
- public FieldEditorOverlayPage(String title, ImageDescriptor image, int style) {
- super(title, image, style);
- this.image = image;
- }
- /**
- * Returns the id of the current preference page as defined in plugin.xml
- * Subclasses must implement.
- *
- * @return - the qualifier
- */
- protected abstract String getPageId();
- /**
- * Receives the object that owns the properties shown in this property page.
- *
- * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
- */
- public void setElement(IAdaptable element) {
- this.element = element;
- }
- /**
- * Delivers the object that owns the properties shown in this property page.
- *
- * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
- */
- public IAdaptable getElement() {
- return element;
- }
- /**
- * Returns true if this instance represents a property page
- *
- * @return - true for property pages, false for preference pages
- */
- public boolean isPropertyPage() {
- return getElement() != null;
- }
- /**
- * We override the addField method. This allows us to store each field editor
- * added by subclasses in a list for later processing.
- *
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#addField(org.eclipse.jface.preference.FieldEditor)
- */
- protected void addField(FieldEditor editor) {
- editors.add(editor);
- super.addField(editor);
- }
- /**
- * We override the createControl method. In case of property pages we create
- * a new PropertyStore as local preference store. After all control have been
- * create, we enable/disable these controls.
- *
- * @see org.eclipse.jface.preference.PreferencePage#createControl()
- */
- public void createControl(Composite parent) {
- // Special treatment for property pages
- if (isPropertyPage()) {
- // Cache the page id
- pageId = getPageId();
- // Create an overlay preference store and fill it with properties
- overlayStore = new PropertyStore((IResource) getElement(), super
- .getPreferenceStore(), pageId);
- // Set overlay store as current preference store
- }
- super.createControl(parent);
- // Update state of all subclass controls
- if (isPropertyPage())
- updateFieldEditors();
- }
- /**
- * We override the createContents method. In case of property pages we insert
- * two radio buttons at the top of the page.
- *
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- if (isPropertyPage())
- createSelectionGroup(parent);
- return super.createContents(parent);
- }
- /**
- * Creates and initializes a selection group with two choice buttons and one
- * push button.
- *
- * @param parent -
- * the parent composite
- */
- private void createSelectionGroup(Composite parent) {
- Composite comp = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- comp.setLayout(layout);
- comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Composite radioGroup = new Composite(comp, SWT.NONE);
- radioGroup.setLayout(new GridLayout());
- radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages
- .getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$
- if (fUseFileSettings) {
- useProjectSettingsButton = createRadioButton(radioGroup, Messages
- .getString("OverlayPage.Use_File_Settings")); //$NON-NLS-1$
- } else {
- useProjectSettingsButton = createRadioButton(radioGroup, Messages
- .getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$
- }
- configureButton = new Button(comp, SWT.PUSH);
- configureButton.setText(Messages
- .getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
- configureButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- configureWorkspaceSettings();
- }
- });
- // Set workspace/project radio buttons
- try {
- String use = ((IResource) getElement())
- .getPersistentProperty(new QualifiedName(pageId, USEPROJECTSETTINGS));
- if (TRUE.equals(use)) {
- useProjectSettingsButton.setSelection(true);
- configureButton.setEnabled(false);
- } else
- useWorkspaceSettingsButton.setSelection(true);
- } catch (CoreException e) {
- useWorkspaceSettingsButton.setSelection(true);
- }
- }
- /**
- * Convenience method creating a radio button
- *
- * @param parent -
- * the parent composite
- * @param label -
- * the button label
- * @return - the new button
- */
- private Button createRadioButton(Composite parent, String label) {
- final Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- configureButton.setEnabled(button == useWorkspaceSettingsButton);
- updateFieldEditors();
- }
- });
- return button;
- }
- /**
- * Returns in case of property pages the overlay store, in case of preference
- * pages the standard preference store
- *
- * @see org.eclipse.jface.preference.PreferencePage#getPreferenceStore()
- */
- public IPreferenceStore getPreferenceStore() {
- if (isPropertyPage())
- return overlayStore;
- return super.getPreferenceStore();
- }
- /*
- * Enables or disables the field editors and buttons of this page
- */
- private void updateFieldEditors() {
- // We iterate through all field editors
- boolean enabled = useProjectSettingsButton.getSelection();
- updateFieldEditors(enabled);
- }
- /**
- * Enables or disables the field editors and buttons of this page Subclasses
- * may override.
- *
- * @param enabled -
- * true if enabled
- */
- protected void updateFieldEditors(boolean enabled) {
- Composite parent = getFieldEditorParent();
- Iterator it = editors.iterator();
- while (it.hasNext()) {
- FieldEditor editor = (FieldEditor) it.next();
- editor.setEnabled(enabled, parent);
- }
- }
- /**
- * We override the performOk method. In case of property pages we copy the
- * values in the overlay store into the property values of the selected
- * project. We also save the state of the radio buttons.
- *
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- boolean result = super.performOk();
- if (result && isPropertyPage()) {
- // Save state of radiobuttons in project properties
- IResource resource = (IResource) getElement();
- try {
- String value = (useProjectSettingsButton.getSelection()) ? TRUE : FALSE;
- resource.setPersistentProperty(new QualifiedName(pageId,
- USEPROJECTSETTINGS), value);
- } catch (CoreException e) {
- }
- }
- return result;
- }
- /**
- * We override the performDefaults method. In case of property pages we
- * switch back to the workspace settings and disable the field editors.
- *
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- if (isPropertyPage()) {
- useWorkspaceSettingsButton.setSelection(true);
- useProjectSettingsButton.setSelection(false);
- configureButton.setEnabled(true);
- updateFieldEditors();
- }
- super.performDefaults();
- }
- /**
- * Creates a new preferences page and opens it
- *
- * @see com.bdaum.SpellChecker.preferences.SpellCheckerPreferencePage#configureWorkspaceSettings()
- */
- protected void configureWorkspaceSettings() {
- try {
- // create a new instance of the current class
- IPreferencePage page = (IPreferencePage) this.getClass().newInstance();
- page.setTitle(getTitle());
- page.setImageDescriptor(image);
- // and show it
- showPreferencePage(pageId, page);
- } catch (InstantiationException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- }
- /**
- * Show a single preference pages
- *
- * @param id -
- * the preference page identification
- * @param page -
- * the preference page
- */
- protected void showPreferencePage(String id, IPreferencePage page) {
- final IPreferenceNode targetNode = new PreferenceNode(id, page);
- PreferenceManager manager = new PreferenceManager();
- manager.addToRoot(targetNode);
- final PreferenceDialog dialog = new PreferenceDialog(getControl()
- .getShell(), manager);
- BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
- public void run() {
- dialog.create();
- dialog.setMessage(targetNode.getLabelText());
- dialog.open();
- }
- });
- }
+ implements IWorkbenchPropertyPage {
+ /**
+ * * Name of resource property for the selection of workbench or project
+ * settings **
+ */
+ public static final String USEPROJECTSETTINGS = "useProjectSettings"; //$NON-NLS-1$
+
+ private static final String FALSE = "false"; //$NON-NLS-1$
+
+ private static final String TRUE = "true"; //$NON-NLS-1$
+
+ private boolean fUseFileSettings = false;
+
+ // Stores all created field editors
+ private List editors = new ArrayList();
+
+ // Stores owning element of properties
+ private IAdaptable element;
+
+ // Additional buttons for property pages
+ private Button useWorkspaceSettingsButton, useProjectSettingsButton,
+ configureButton;
+
+ // Overlay preference store for property pages
+ private IPreferenceStore overlayStore;
+
+ // The image descriptor of this pages title image
+ private ImageDescriptor image;
+
+ // Cache for page id
+ private String pageId;
+
+ /**
+ * Constructor
+ *
+ * @param style -
+ * layout style
+ */
+ public FieldEditorOverlayPage(int style) {
+ super(style);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param style -
+ * layout style
+ */
+ public FieldEditorOverlayPage(int style, boolean isFileSettings) {
+ super(style);
+ fUseFileSettings = isFileSettings;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param title -
+ * title string
+ * @param style -
+ * layout style
+ */
+ public FieldEditorOverlayPage(String title, int style) {
+ super(title, style);
+ }
+
+ public FieldEditorOverlayPage(String title, int style,
+ boolean isFileSettings) {
+ super(title, style);
+ fUseFileSettings = isFileSettings;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param title -
+ * title string
+ * @param image -
+ * title image
+ * @param style -
+ * layout style
+ */
+ public FieldEditorOverlayPage(String title, ImageDescriptor image, int style) {
+ super(title, image, style);
+ this.image = image;
+ }
+
+ /**
+ * Returns the id of the current preference page as defined in plugin.xml
+ * Subclasses must implement.
+ *
+ * @return - the qualifier
+ */
+ protected abstract String getPageId();
+
+ /**
+ * Receives the object that owns the properties shown in this property page.
+ *
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
+ */
+ public void setElement(IAdaptable element) {
+ this.element = element;
+ }
+
+ /**
+ * Delivers the object that owns the properties shown in this property page.
+ *
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
+ */
+ public IAdaptable getElement() {
+ return element;
+ }
+
+ /**
+ * Returns true if this instance represents a property page
+ *
+ * @return - true for property pages, false for preference pages
+ */
+ public boolean isPropertyPage() {
+ return getElement() != null;
+ }
+
+ /**
+ * We override the addField method. This allows us to store each field
+ * editor added by subclasses in a list for later processing.
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#addField(org.eclipse.jface.preference.FieldEditor)
+ */
+ protected void addField(FieldEditor editor) {
+ editors.add(editor);
+ super.addField(editor);
+ }
+
+ /**
+ * We override the createControl method. In case of property pages we create
+ * a new PropertyStore as local preference store. After all control have
+ * been create, we enable/disable these controls.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createControl()
+ */
+ public void createControl(Composite parent) {
+ // Special treatment for property pages
+ if (isPropertyPage()) {
+ // Cache the page id
+ pageId = getPageId();
+ // Create an overlay preference store and fill it with properties
+ overlayStore = new PropertyStore((IResource) getElement(), super
+ .getPreferenceStore(), pageId);
+ // Set overlay store as current preference store
+ }
+ super.createControl(parent);
+ // Update state of all subclass controls
+ if (isPropertyPage())
+ updateFieldEditors();
+ }
+
+ /**
+ * We override the createContents method. In case of property pages we
+ * insert two radio buttons at the top of the page.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ if (isPropertyPage())
+ createSelectionGroup(parent);
+ return super.createContents(parent);
+ }
+
+ /**
+ * Creates and initializes a selection group with two choice buttons and one
+ * push button.
+ *
+ * @param parent -
+ * the parent composite
+ */
+ private void createSelectionGroup(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ comp.setLayout(layout);
+ comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Composite radioGroup = new Composite(comp, SWT.NONE);
+ radioGroup.setLayout(new GridLayout());
+ radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages
+ .getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$
+ if (fUseFileSettings) {
+ useProjectSettingsButton = createRadioButton(radioGroup, Messages
+ .getString("OverlayPage.Use_File_Settings")); //$NON-NLS-1$
+ } else {
+ useProjectSettingsButton = createRadioButton(radioGroup, Messages
+ .getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$
+ }
+ configureButton = new Button(comp, SWT.PUSH);
+ configureButton.setText(Messages
+ .getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
+ configureButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ configureWorkspaceSettings();
+ }
+ });
+ // Set workspace/project radio buttons
+ try {
+ String use = ((IResource) getElement())
+ .getPersistentProperty(new QualifiedName(pageId,
+ USEPROJECTSETTINGS));
+ if (TRUE.equals(use)) {
+ useProjectSettingsButton.setSelection(true);
+ configureButton.setEnabled(false);
+ } else
+ useWorkspaceSettingsButton.setSelection(true);
+ } catch (CoreException e) {
+ useWorkspaceSettingsButton.setSelection(true);
+ }
+ }
+
+ /**
+ * Convenience method creating a radio button
+ *
+ * @param parent -
+ * the parent composite
+ * @param label -
+ * the button label
+ * @return - the new button
+ */
+ private Button createRadioButton(Composite parent, String label) {
+ final Button button = new Button(parent, SWT.RADIO);
+ button.setText(label);
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ configureButton
+ .setEnabled(button == useWorkspaceSettingsButton);
+ updateFieldEditors();
+ }
+ });
+ return button;
+ }
+
+ /**
+ * Returns in case of property pages the overlay store, in case of
+ * preference pages the standard preference store
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#getPreferenceStore()
+ */
+ public IPreferenceStore getPreferenceStore() {
+ if (isPropertyPage())
+ return overlayStore;
+ return super.getPreferenceStore();
+ }
+
+ /*
+ * Enables or disables the field editors and buttons of this page
+ */
+ private void updateFieldEditors() {
+ // We iterate through all field editors
+ boolean enabled = useProjectSettingsButton.getSelection();
+ updateFieldEditors(enabled);
+ }
+
+ /**
+ * Enables or disables the field editors and buttons of this page Subclasses
+ * may override.
+ *
+ * @param enabled -
+ * true if enabled
+ */
+ protected void updateFieldEditors(boolean enabled) {
+ Composite parent = getFieldEditorParent();
+ Iterator it = editors.iterator();
+ while (it.hasNext()) {
+ FieldEditor editor = (FieldEditor) it.next();
+ editor.setEnabled(enabled, parent);
+ }
+ }
+
+ /**
+ * We override the performOk method. In case of property pages we copy the
+ * values in the overlay store into the property values of the selected
+ * project. We also save the state of the radio buttons.
+ *
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ boolean result = super.performOk();
+ if (result && isPropertyPage()) {
+ // Save state of radiobuttons in project properties
+ IResource resource = (IResource) getElement();
+ try {
+ String value = (useProjectSettingsButton.getSelection()) ? TRUE
+ : FALSE;
+ resource.setPersistentProperty(new QualifiedName(pageId,
+ USEPROJECTSETTINGS), value);
+ } catch (CoreException e) {
+ }
+ }
+ return result;
+ }
+
+ /**
+ * We override the performDefaults method. In case of property pages we
+ * switch back to the workspace settings and disable the field editors.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ protected void performDefaults() {
+ if (isPropertyPage()) {
+ useWorkspaceSettingsButton.setSelection(true);
+ useProjectSettingsButton.setSelection(false);
+ configureButton.setEnabled(true);
+ updateFieldEditors();
+ }
+ super.performDefaults();
+ }
+
+ /**
+ * Creates a new preferences page and opens it
+ *
+ * @see com.bdaum.SpellChecker.preferences.SpellCheckerPreferencePage#configureWorkspaceSettings()
+ */
+ protected void configureWorkspaceSettings() {
+ try {
+ // create a new instance of the current class
+ IPreferencePage page = (IPreferencePage) this.getClass()
+ .newInstance();
+ page.setTitle(getTitle());
+ page.setImageDescriptor(image);
+ // and show it
+ showPreferencePage(pageId, page);
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Show a single preference pages
+ *
+ * @param id -
+ * the preference page identification
+ * @param page -
+ * the preference page
+ */
+ protected void showPreferencePage(String id, IPreferencePage page) {
+ final IPreferenceNode targetNode = new PreferenceNode(id, page);
+ PreferenceManager manager = new PreferenceManager();
+ manager.addToRoot(targetNode);
+ final PreferenceDialog dialog = new PreferenceDialog(getControl()
+ .getShell(), manager);
+ BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
+ public void run() {
+ dialog.create();
+ dialog.setMessage(targetNode.getLabelText());
+ dialog.open();
+ }
+ });
+ }
}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/Messages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/Messages.java
index efc0f8e..417990b 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/Messages.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/Messages.java
@@ -13,29 +13,29 @@ package net.sourceforge.phpeclipse.ui.overlaypages;
import java.util.ResourceBundle;
-
public class Messages {
- private final static String RESOURCE_BUNDLE= "net.sourceforge.phpeclipse.ui.overlaypages.Messages";//$NON-NLS-1$
-
+ private final static String RESOURCE_BUNDLE = "net.sourceforge.phpeclipse.ui.overlaypages.Messages";//$NON-NLS-1$
+
private static ResourceBundle fgResourceBundle = null;
-
+
private static boolean notRead = true;
public Messages() {
}
+
public static ResourceBundle getResourceBundle() {
if (notRead) {
notRead = false;
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
- }
- catch (Exception e) {
+ } catch (Exception e) {
}
}
-
+
return fgResourceBundle;
}
+
public static String getString(String key) {
try {
return getResourceBundle().getString(key);
@@ -44,4 +44,3 @@ public class Messages {
}
}
}
-
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/OverlayPage.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/OverlayPage.java
index a501786..50ecf07 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/OverlayPage.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/OverlayPage.java
@@ -39,16 +39,19 @@ import org.eclipse.ui.part.PageBook;
*/
public abstract class OverlayPage extends PropertyPage {
- /*** Name of resource property for the selection of workbench or project settings ***/
+ /**
+ * * Name of resource property for the selection of workbench or project
+ * settings **
+ */
public static final String USEPROJECTSETTINGS = "useProjectSettings"; //$NON-NLS-1$
-
+
private static final String FALSE = "false"; //$NON-NLS-1$
+
private static final String TRUE = "true"; //$NON-NLS-1$
// Additional buttons for property pages
- private Button useWorkspaceSettingsButton,
- useProjectSettingsButton,
- configureButton;
+ private Button useWorkspaceSettingsButton, useProjectSettingsButton,
+ configureButton;
// Overlay preference store for property pages
private PropertyStore overlayStore;
@@ -71,7 +74,9 @@ public abstract class OverlayPage extends PropertyPage {
/**
* Constructor
- * @param title - title string
+ *
+ * @param title -
+ * title string
*/
public OverlayPage(String title) {
super();
@@ -80,8 +85,11 @@ public abstract class OverlayPage extends PropertyPage {
/**
* Constructor
- * @param title - title string
- * @param image - title image
+ *
+ * @param title -
+ * title string
+ * @param image -
+ * title image
*/
public OverlayPage(String title, ImageDescriptor image) {
super();
@@ -92,7 +100,7 @@ public abstract class OverlayPage extends PropertyPage {
/**
* Returns the id of the current preference page as defined in plugin.xml
- * Subclasses must implement.
+ * Subclasses must implement.
*
* @return - the qualifier
*/
@@ -100,6 +108,7 @@ public abstract class OverlayPage extends PropertyPage {
/**
* Returns true if this instance represents a property page
+ *
* @return - true for property pages, false for preference pages
*/
public boolean isPropertyPage() {
@@ -107,9 +116,10 @@ public abstract class OverlayPage extends PropertyPage {
}
/**
- * We need to implement createContents method. In case of property pages we insert two radio buttons
- * and a push button at the top of the page. Below this group we create a new composite for the contents
- * created by subclasses.
+ * We need to implement createContents method. In case of property pages we
+ * insert two radio buttons and a push button at the top of the page. Below
+ * this group we create a new composite for the contents created by
+ * subclasses.
*
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@@ -126,8 +136,11 @@ public abstract class OverlayPage extends PropertyPage {
}
/**
- * Creates and initializes a selection group with two choice buttons and one push button.
- * @param parent - the parent composite
+ * Creates and initializes a selection group with two choice buttons and one
+ * push button.
+ *
+ * @param parent -
+ * the parent composite
*/
private void createSelectionGroup(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
@@ -139,10 +152,13 @@ public abstract class OverlayPage extends PropertyPage {
Composite radioGroup = new Composite(comp, SWT.NONE);
radioGroup.setLayout(new GridLayout());
radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages.getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$
- useProjectSettingsButton = createRadioButton(radioGroup, Messages.getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$
+ useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages
+ .getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$
+ useProjectSettingsButton = createRadioButton(radioGroup, Messages
+ .getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$
configureButton = new Button(comp, SWT.PUSH);
- configureButton.setText(Messages.getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
+ configureButton.setText(Messages
+ .getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
configureButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
configureWorkspaceSettings();
@@ -150,9 +166,9 @@ public abstract class OverlayPage extends PropertyPage {
});
// Set workspace/project radio buttons
try {
- String use =
- ((IResource) getElement()).getPersistentProperty(
- new QualifiedName(pageId, USEPROJECTSETTINGS));
+ String use = ((IResource) getElement())
+ .getPersistentProperty(new QualifiedName(pageId,
+ USEPROJECTSETTINGS));
if (TRUE.equals(use)) {
useProjectSettingsButton.setSelection(true);
configureButton.setEnabled(false);
@@ -165,8 +181,11 @@ public abstract class OverlayPage extends PropertyPage {
/**
* Convenience method creating a radio button
- * @param parent - the parent composite
- * @param label - the button label
+ *
+ * @param parent -
+ * the parent composite
+ * @param label -
+ * the button label
* @return - the new button
*/
private Button createRadioButton(Composite parent, String label) {
@@ -174,8 +193,8 @@ public abstract class OverlayPage extends PropertyPage {
button.setText(label);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- configureButton.setEnabled(
- button == useWorkspaceSettingsButton);
+ configureButton
+ .setEnabled(button == useWorkspaceSettingsButton);
setControlsEnabled();
}
});
@@ -183,8 +202,9 @@ public abstract class OverlayPage extends PropertyPage {
}
/**
- * In case of property pages we create a new PropertyStore as local overlay store.
- * After all controls have been create, we enable/disable these controls
+ * In case of property pages we create a new PropertyStore as local overlay
+ * store. After all controls have been create, we enable/disable these
+ * controls
*
* @see org.eclipse.jface.preference.PreferencePage#createControl()
*/
@@ -194,11 +214,8 @@ public abstract class OverlayPage extends PropertyPage {
// Cache the page id
pageId = getPageId();
// Create an overlay preference store and fill it with properties
- overlayStore =
- new PropertyStore(
- (IResource) getElement(),
- super.getPreferenceStore(),
- pageId);
+ overlayStore = new PropertyStore((IResource) getElement(), super
+ .getPreferenceStore(), pageId);
// Set overlay store as current preference store
}
super.createControl(parent);
@@ -207,8 +224,10 @@ public abstract class OverlayPage extends PropertyPage {
setControlsEnabled();
}
- /*
- * Returns in case of property pages the overlay store - otherwise the standard preference store
+ /*
+ * Returns in case of property pages the overlay store - otherwise the
+ * standard preference store
+ *
* @see org.eclipse.jface.preference.PreferencePage#getPreferenceStore()
*/
public IPreferenceStore getPreferenceStore() {
@@ -226,36 +245,39 @@ public abstract class OverlayPage extends PropertyPage {
}
/**
- * Enables or disables the controls of this page
- * Subclasses may override.
+ * Enables or disables the controls of this page Subclasses may override.
*
- * @param enabled - true if controls shall be enabled
+ * @param enabled -
+ * true if controls shall be enabled
*/
protected void setControlsEnabled(boolean enabled) {
setControlsEnabled(contents, enabled);
}
/**
- * Enables or disables a tree of controls starting at the specified root.
- * We spare tabbed notebooks and pagebooks to allow for user navigation.
+ * Enables or disables a tree of controls starting at the specified root. We
+ * spare tabbed notebooks and pagebooks to allow for user navigation.
*
- * @param root - the root composite
- * @param enabled - true if controls shall be enabled
+ * @param root -
+ * the root composite
+ * @param enabled -
+ * true if controls shall be enabled
*/
private void setControlsEnabled(Composite root, boolean enabled) {
Control[] children = root.getChildren();
for (int i = 0; i < children.length; i++) {
Control child = children[i];
- if (!(child instanceof CTabFolder) && !(child instanceof TabFolder) && !(child instanceof PageBook))
+ if (!(child instanceof CTabFolder) && !(child instanceof TabFolder)
+ && !(child instanceof PageBook))
child.setEnabled(enabled);
if (child instanceof Composite)
setControlsEnabled((Composite) child, enabled);
}
}
- /**
- * We override the performOk method. In case of property pages
- * we save the state of the radio buttons.
+ /**
+ * We override the performOk method. In case of property pages we save the
+ * state of the radio buttons.
*
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
*/
@@ -265,11 +287,10 @@ public abstract class OverlayPage extends PropertyPage {
// Save state of radiobuttons in project properties
IResource resource = (IResource) getElement();
try {
- String value =
- (useProjectSettingsButton.getSelection()) ? TRUE : FALSE;
- resource.setPersistentProperty(
- new QualifiedName(pageId, USEPROJECTSETTINGS),
- value);
+ String value = (useProjectSettingsButton.getSelection()) ? TRUE
+ : FALSE;
+ resource.setPersistentProperty(new QualifiedName(pageId,
+ USEPROJECTSETTINGS), value);
} catch (CoreException e) {
}
}
@@ -294,13 +315,14 @@ public abstract class OverlayPage extends PropertyPage {
/**
* Creates a new preferences page and opens it
+ *
* @see com.bdaum.SpellChecker.preferences.SpellCheckerPreferencePage#configureWorkspaceSettings()
*/
protected void configureWorkspaceSettings() {
try {
// create a new instance of the current class
- IPreferencePage page =
- (IPreferencePage) this.getClass().newInstance();
+ IPreferencePage page = (IPreferencePage) this.getClass()
+ .newInstance();
page.setTitle(getTitle());
page.setImageDescriptor(image);
// and show it
@@ -314,15 +336,18 @@ public abstract class OverlayPage extends PropertyPage {
/**
* Show a single preference pages
- * @param id - the preference page identification
- * @param page - the preference page
+ *
+ * @param id -
+ * the preference page identification
+ * @param page -
+ * the preference page
*/
protected void showPreferencePage(String id, IPreferencePage page) {
final IPreferenceNode targetNode = new PreferenceNode(id, page);
PreferenceManager manager = new PreferenceManager();
manager.addToRoot(targetNode);
- final PreferenceDialog dialog =
- new PreferenceDialog(getControl().getShell(), manager);
+ final PreferenceDialog dialog = new PreferenceDialog(getControl()
+ .getShell(), manager);
BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
public void run() {
dialog.create();
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/ProjectPrefUtil.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/ProjectPrefUtil.java
index e292e31..7737f47 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/ProjectPrefUtil.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/ProjectPrefUtil.java
@@ -18,68 +18,80 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
public class ProjectPrefUtil {
- public static String getMiscProjectsPreferenceValue(IResource resource, String key) {
- return getOverlayedPrefProjectValue(resource, PHPMiscProjectPreferences.PREF_ID, key);
- }
+ public static String getMiscProjectsPreferenceValue(IResource resource,
+ String key) {
+ return getOverlayedPrefProjectValue(resource,
+ PHPMiscProjectPreferences.PREF_ID, key);
+ }
- public static List getIncludePaths(IResource resource) {
- String includePaths = getMiscProjectsPreferenceValue(resource, IPreferenceConstants.PHP_INCLUDE_PATHS);
- ArrayList list = new ArrayList();
- if (includePaths != null) {
- StringTokenizer st = new StringTokenizer(includePaths, File.pathSeparator + "\n\r");//$NON-NLS-1$
- while (st.hasMoreElements()) {
- list.add(st.nextElement());
- }
- }
- return list;
- }
+ public static List getIncludePaths(IResource resource) {
+ String includePaths = getMiscProjectsPreferenceValue(resource,
+ IPreferenceConstants.PHP_INCLUDE_PATHS);
+ ArrayList list = new ArrayList();
+ if (includePaths != null) {
+ StringTokenizer st = new StringTokenizer(includePaths,
+ File.pathSeparator + "\n\r");//$NON-NLS-1$
+ while (st.hasMoreElements()) {
+ list.add(st.nextElement());
+ }
+ }
+ return list;
+ }
- public static IPath getDocumentRoot(IResource resource) {
- String documentRoot = getMiscProjectsPreferenceValue(resource, IPreferenceConstants.PHP_DOCUMENTROOT_PREF);
- IPath path = new Path(documentRoot);
- // documentRoot = documentRoot.replace('\\', '/');
- return path;
- }
+ public static IPath getDocumentRoot(IResource resource) {
+ String documentRoot = getMiscProjectsPreferenceValue(resource,
+ IPreferenceConstants.PHP_DOCUMENTROOT_PREF);
+ IPath path = new Path(documentRoot);
+ // documentRoot = documentRoot.replace('\\', '/');
+ return path;
+ }
- public static String getOverlayedPrefProjectValue(IResource resource, String pageId, String key) {
- IProject project = resource.getProject();
- String value = null;
- if (useProjectSettings(project, pageId)) {
- value = getProperty(resource, pageId, key);
- }
- if (value != null)
- return value;
- return WebUI.getDefault().getPreferenceStore().getString(key);
- }
+ public static String getOverlayedPrefProjectValue(IResource resource,
+ String pageId, String key) {
+ IProject project = resource.getProject();
+ String value = null;
+ if (useProjectSettings(project, pageId)) {
+ value = getProperty(resource, pageId, key);
+ }
+ if (value != null)
+ return value;
+ return WebUI.getDefault().getPreferenceStore().getString(key);
+ }
- public static String getOverlayedPrefResourceValue(IResource resource, String pageId, String key) {
- String value = null;
- if (useProjectSettings(resource, pageId)) {
- value = getProperty(resource, pageId, key);
- }
- if (value != null)
- return value;
- return WebUI.getDefault().getPreferenceStore().getString(key);
- }
+ public static String getOverlayedPrefResourceValue(IResource resource,
+ String pageId, String key) {
+ String value = null;
+ if (useProjectSettings(resource, pageId)) {
+ value = getProperty(resource, pageId, key);
+ }
+ if (value != null)
+ return value;
+ return WebUI.getDefault().getPreferenceStore().getString(key);
+ }
- public static boolean getPreviewBooleanValue(IResource resource, String key) {
- return getOverlayedPrefResourceValue(resource, PHPPreviewProjectPreferences.PREF_ID, key).equals("true");
- }
+ public static boolean getPreviewBooleanValue(IResource resource, String key) {
+ return getOverlayedPrefResourceValue(resource,
+ PHPPreviewProjectPreferences.PREF_ID, key).equals("true");
+ }
- public static String getPreviewStringValue(IResource resource, String key) {
- return getOverlayedPrefResourceValue(resource, PHPPreviewProjectPreferences.PREF_ID, key);
- }
+ public static String getPreviewStringValue(IResource resource, String key) {
+ return getOverlayedPrefResourceValue(resource,
+ PHPPreviewProjectPreferences.PREF_ID, key);
+ }
- private static String getProperty(IResource resource, String pageId, String key) {
- try {
- return resource.getPersistentProperty(new QualifiedName(pageId, key));
- } catch (CoreException e) {
- }
- return null;
- }
+ private static String getProperty(IResource resource, String pageId,
+ String key) {
+ try {
+ return resource
+ .getPersistentProperty(new QualifiedName(pageId, key));
+ } catch (CoreException e) {
+ }
+ return null;
+ }
- private static boolean useProjectSettings(IResource resource, String pageId) {
- String use = getProperty(resource, pageId, FieldEditorOverlayPage.USEPROJECTSETTINGS);
- return "true".equals(use);
- }
+ private static boolean useProjectSettings(IResource resource, String pageId) {
+ String use = getProperty(resource, pageId,
+ FieldEditorOverlayPage.USEPROJECTSETTINGS);
+ return "true".equals(use);
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/PropertyStore.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/PropertyStore.java
index 8d968e8..60fdcc9 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/PropertyStore.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/overlaypages/PropertyStore.java
@@ -22,35 +22,41 @@ import org.eclipse.jface.preference.PreferenceStore;
/**
* @author Berthold Daum
- *
+ *
*/
public class PropertyStore extends PreferenceStore {
private IResource resource;
+
private IPreferenceStore workbenchStore;
+
private String pageId;
+
private boolean inserting = false;
- public PropertyStore(
- IResource resource,
- IPreferenceStore workbenchStore,
- String pageId) {
+ public PropertyStore(IResource resource, IPreferenceStore workbenchStore,
+ String pageId) {
this.resource = resource;
this.workbenchStore = workbenchStore;
this.pageId = pageId;
}
- /*** Write modified values back to properties ***/
+ /** * Write modified values back to properties ** */
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPersistentPreferenceStore#save()
*/
public void save() throws IOException {
writeProperties();
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferenceStore#save(java.io.OutputStream, java.lang.String)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferenceStore#save(java.io.OutputStream,
+ * java.lang.String)
*/
public void save(OutputStream out, String header) throws IOException {
writeProperties();
@@ -66,68 +72,87 @@ public class PropertyStore extends PreferenceStore {
try {
setProperty(name, getString(name));
} catch (CoreException e) {
- throw new IOException(Messages.getString("PropertyStore.Cannot_write_resource_property") + name); //$NON-NLS-1$
+ throw new IOException(
+ Messages
+ .getString("PropertyStore.Cannot_write_resource_property") + name); //$NON-NLS-1$
}
}
}
/**
* Convenience method to set a property
- * @param name - the preference name
- * @param value - the property value or null to delete the property
+ *
+ * @param name -
+ * the preference name
+ * @param value -
+ * the property value or null to delete the property
* @throws CoreException
*/
private void setProperty(String name, String value) throws CoreException {
resource.setPersistentProperty(new QualifiedName(pageId, name), value);
}
- /*** Get default values (Delegate to workbench store) ***/
+ /** * Get default values (Delegate to workbench store) ** */
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
*/
public boolean getDefaultBoolean(String name) {
return workbenchStore.getDefaultBoolean(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String)
*/
public double getDefaultDouble(String name) {
return workbenchStore.getDefaultDouble(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String)
*/
public float getDefaultFloat(String name) {
return workbenchStore.getDefaultFloat(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String)
*/
public int getDefaultInt(String name) {
return workbenchStore.getDefaultInt(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String)
*/
public long getDefaultLong(String name) {
return workbenchStore.getDefaultLong(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String)
*/
public String getDefaultString(String name) {
return workbenchStore.getDefaultString(name);
}
- /*** Get property values ***/
+ /** * Get property values ** */
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
*/
public boolean getBoolean(String name) {
@@ -135,7 +160,9 @@ public class PropertyStore extends PreferenceStore {
return super.getBoolean(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String)
*/
public double getDouble(String name) {
@@ -143,7 +170,9 @@ public class PropertyStore extends PreferenceStore {
return super.getDouble(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String)
*/
public float getFloat(String name) {
@@ -151,7 +180,9 @@ public class PropertyStore extends PreferenceStore {
return super.getFloat(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String)
*/
public int getInt(String name) {
@@ -159,7 +190,9 @@ public class PropertyStore extends PreferenceStore {
return super.getInt(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
*/
public long getLong(String name) {
@@ -167,7 +200,9 @@ public class PropertyStore extends PreferenceStore {
return super.getLong(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
*/
public String getString(String name) {
@@ -198,7 +233,9 @@ public class PropertyStore extends PreferenceStore {
/**
* Convenience method to fetch a property
- * @param name - the preference name
+ *
+ * @param name -
+ * the preference name
* @return - the property value
* @throws CoreException
*/
@@ -206,28 +243,35 @@ public class PropertyStore extends PreferenceStore {
return resource.getPersistentProperty(new QualifiedName(pageId, name));
}
- /*** Misc ***/
+ /** * Misc ** */
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
*/
public boolean contains(String name) {
return workbenchStore.contains(name);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String)
*/
public void setToDefault(String name) {
- setValue(name, getDefaultString(name));
+ setValue(name, getDefaultString(name));
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
*/
public boolean isDefault(String name) {
String defaultValue = getDefaultString(name);
- if (defaultValue == null) return false;
+ if (defaultValue == null)
+ return false;
return defaultValue.equals(getString(name));
}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/IMiscProjectPreferences.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/IMiscProjectPreferences.java
index ef42982..5a0959a 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/IMiscProjectPreferences.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/IMiscProjectPreferences.java
@@ -1,32 +1,30 @@
package net.sourceforge.phpeclipse.ui.preferences;
-
/**
* constnats for project preferences
*/
public interface IMiscProjectPreferences {
- /**
- * namespace URI for the properties
- */
-// public static final String PROPERTY_NAMESPACE = "http://phpeclipse.org";
-
- // public static final String PREF_ID = "net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences";
-// /**
-// * property local name for the publish directory
-// */
-// public static final String PUBLISH_PROPERTY = "publish";
-//
-// /**
-// * property qualified name for the publish directory
-// */
-// public static final QualifiedName PUBLISH_PROPERTY_NAME =
-// new QualifiedName(PROPERTY_NAMESPACE,PUBLISH_PROPERTY);
-//
-// /**
-// * default value for the publish directory name
-// */
-// public static final String DEFAULT_PUBLISH_DIR = "c:\\temp";
-
+ /**
+ * namespace URI for the properties
+ */
+ // public static final String PROPERTY_NAMESPACE = "http://phpeclipse.org";
+ // public static final String PREF_ID =
+ // "net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences";
+ // /**
+ // * property local name for the publish directory
+ // */
+ // public static final String PUBLISH_PROPERTY = "publish";
+ //
+ // /**
+ // * property qualified name for the publish directory
+ // */
+ // public static final QualifiedName PUBLISH_PROPERTY_NAME =
+ // new QualifiedName(PROPERTY_NAMESPACE,PUBLISH_PROPERTY);
+ //
+ // /**
+ // * default value for the publish directory name
+ // */
+ // public static final String DEFAULT_PUBLISH_DIR = "c:\\temp";
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/ITextStylePreferences.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/ITextStylePreferences.java
index 6235a01..71ac80b 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/ITextStylePreferences.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/ITextStylePreferences.java
@@ -8,12 +8,11 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: ITextStylePreferences.java,v 1.1 2004-09-02 18:26:30 jsurfer Exp $
+ * $Id: ITextStylePreferences.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.preferences;
-
/**
*
*
@@ -21,9 +20,12 @@ package net.sourceforge.phpeclipse.ui.preferences;
*/
public interface ITextStylePreferences {
public static final String SUFFIX_FOREGROUND = "_foreground"; //$NON-NLS-1$
+
public static final String SUFFIX_BACKGROUND = "_background"; //$NON-NLS-1$
- public static final String SUFFIX_STYLE = "_style"; //$NON-NLS-1$
+
+ public static final String SUFFIX_STYLE = "_style"; //$NON-NLS-1$
public static final String STYLE_NORMAL = "normal"; //$NON-NLS-1$
- public static final String STYLE_BOLD = "bold"; //$NON-NLS-1$
+
+ public static final String STYLE_BOLD = "bold"; //$NON-NLS-1$
}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/OverlayPreferenceStore.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/OverlayPreferenceStore.java
index 61951fa..e1f123c 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/OverlayPreferenceStore.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/OverlayPreferenceStore.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: OverlayPreferenceStore.java,v 1.1 2004-09-02 18:26:30 jsurfer Exp $
+ * $Id: OverlayPreferenceStore.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.preferences;
@@ -18,7 +18,6 @@ import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-
/**
* An overlaying preference store.
*/
@@ -33,15 +32,15 @@ public class OverlayPreferenceStore implements IPreferenceStore {
}
IPreferenceStore parent;
+
IPreferenceStore store;
private PreferenceDescriptor[] keys;
private PropertyListener fPropertyListener;
- public OverlayPreferenceStore(
- IPreferenceStore parent, PreferenceDescriptor[] overlayKeys
- ) {
+ public OverlayPreferenceStore(IPreferenceStore parent,
+ PreferenceDescriptor[] overlayKeys) {
this.parent = parent;
this.keys = overlayKeys;
@@ -62,10 +61,8 @@ public class OverlayPreferenceStore implements IPreferenceStore {
return (findOverlayKey(key) != null);
}
- void propagateProperty(
- IPreferenceStore orgin, PreferenceDescriptor key,
- IPreferenceStore target
- ) {
+ void propagateProperty(IPreferenceStore orgin, PreferenceDescriptor key,
+ IPreferenceStore target) {
if (orgin.isDefault(key.key)) {
if (!target.isDefault(key.key)) {
target.setToDefault(key.key);
@@ -121,10 +118,8 @@ public class OverlayPreferenceStore implements IPreferenceStore {
}
}
- private void loadProperty(
- IPreferenceStore orgin, PreferenceDescriptor key,
- IPreferenceStore target, boolean forceInitialization
- ) {
+ private void loadProperty(IPreferenceStore orgin, PreferenceDescriptor key,
+ IPreferenceStore target, boolean forceInitialization) {
PreferenceDescriptor.Type d = key.type;
if (PreferenceDescriptor.BOOLEAN == d) {
if (forceInitialization) {
@@ -208,9 +203,8 @@ public class OverlayPreferenceStore implements IPreferenceStore {
/*
* @see IPreferenceStore#firePropertyChangeEvent(String, Object, Object)
*/
- public void firePropertyChangeEvent(
- String name, Object oldValue, Object newValue
- ) {
+ public void firePropertyChangeEvent(String name, Object oldValue,
+ Object newValue) {
store.firePropertyChangeEvent(name, oldValue, newValue);
}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPMiscProjectPreferences.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPMiscProjectPreferences.java
index 40d9136..cd74b70 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPMiscProjectPreferences.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPMiscProjectPreferences.java
@@ -1,4 +1,5 @@
package net.sourceforge.phpeclipse.ui.preferences;
+
import net.sourceforge.phpeclipse.ui.IPreferenceConstants;
import net.sourceforge.phpeclipse.ui.WebUI;
import net.sourceforge.phpeclipse.ui.overlaypages.FieldEditorOverlayPage;
@@ -9,64 +10,73 @@ import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+
/**
- *
+ *
* This page will be added to the project's property page dialog when the
* "Properties..." popup menu item is selected
*/
-public class PHPMiscProjectPreferences extends FieldEditorOverlayPage
- implements
- IWorkbenchPreferencePage,
- IMiscProjectPreferences {
+public class PHPMiscProjectPreferences extends FieldEditorOverlayPage implements
+ IWorkbenchPreferencePage, IMiscProjectPreferences {
+
+ public final static String PREF_ID = "net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences";
+
+ public PHPMiscProjectPreferences() {
+ super(GRID);
+ }
- public final static String PREF_ID = "net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences";
- public PHPMiscProjectPreferences() {
- super(GRID);
- }
- /*
- * (non-Javadoc)
- *
- * @see com.bdaum.overlayPages.FieldEditorOverlayPage#getPageId()
- */
- protected String getPageId() {
- return PREF_ID;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.bdaum.overlayPages.FieldEditorOverlayPage#getPageId()
+ */
+ protected String getPageId() {
+ return PREF_ID;
+ }
- protected void createFieldEditors() {
- Composite composite = getFieldEditorParent();
+ protected void createFieldEditors() {
+ Composite composite = getFieldEditorParent();
- addField(new StringFieldEditor(IPreferenceConstants.PHP_LOCALHOST_PREF,
- PHPPreferencesMessages.getString("PHPMiscProjectPreferences.localhost"),
- composite));
-// addField(new StringFieldEditor(IPreferenceConstants.PHP_BOOKMARK_DEFAULT,
-// PHPPreferencesMessages.getString("PHPMiscProjectPreferences.bookmark"),
-// composite));
- addField(new StringFieldEditor(IPreferenceConstants.PHP_DOCUMENTROOT_PREF,
- PHPPreferencesMessages.getString("PHPMiscProjectPreferences.documentroot"),
- composite));
+ addField(new StringFieldEditor(IPreferenceConstants.PHP_LOCALHOST_PREF,
+ PHPPreferencesMessages
+ .getString("PHPMiscProjectPreferences.localhost"),
+ composite));
+ // addField(new
+ // StringFieldEditor(IPreferenceConstants.PHP_BOOKMARK_DEFAULT,
+ // PHPPreferencesMessages.getString("PHPMiscProjectPreferences.bookmark"),
+ // composite));
+ addField(new StringFieldEditor(
+ IPreferenceConstants.PHP_DOCUMENTROOT_PREF,
+ PHPPreferencesMessages
+ .getString("PHPMiscProjectPreferences.documentroot"),
+ composite));
- PathEditor pe = new PathEditor(IPreferenceConstants.PHP_INCLUDE_PATHS,
- PHPPreferencesMessages.getString("PHPMiscProjectPreferences.include_paths"),
- "Choose Path...",
- composite);
- addField(pe);
+ PathEditor pe = new PathEditor(IPreferenceConstants.PHP_INCLUDE_PATHS,
+ PHPPreferencesMessages
+ .getString("PHPMiscProjectPreferences.include_paths"),
+ "Choose Path...", composite);
+ addField(pe);
+ // if (!isPropertyPage)) {
+ //
+ // }
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
+ */
+ protected IPreferenceStore doGetPreferenceStore() {
+ return WebUI.getDefault().getPreferenceStore();
+ }
- //if (!isPropertyPage)) {
- //
- //}
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return WebUI.getDefault().getPreferenceStore();
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- setDescription("Default entries for PHP projects.");
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ setDescription("Default entries for PHP projects.");
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPPreferencesMessages.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPPreferencesMessages.java
index f1a4928..7426439 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPPreferencesMessages.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/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.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPPreviewProjectPreferences.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPPreviewProjectPreferences.java
index 8ff6e31..4c521b3 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPPreviewProjectPreferences.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PHPPreviewProjectPreferences.java
@@ -1,4 +1,5 @@
package net.sourceforge.phpeclipse.ui.preferences;
+
import net.sourceforge.phpeclipse.ui.IPreferenceConstants;
import net.sourceforge.phpeclipse.ui.WebUI;
import net.sourceforge.phpeclipse.ui.overlaypages.FieldEditorOverlayPage;
@@ -8,64 +9,75 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+
/**
- *
+ *
* This page will be added to the project's property page dialog when the
* "Properties..." popup menu item is selected
*/
public class PHPPreviewProjectPreferences extends FieldEditorOverlayPage
- implements
- IWorkbenchPreferencePage {
- public final static String PREF_ID = "net.sourceforge.phpeclipse.preferences.PHPPreviewProjectPreferences";
+ implements IWorkbenchPreferencePage {
+ public final static String PREF_ID = "net.sourceforge.phpeclipse.preferences.PHPPreviewProjectPreferences";
+
+ public PHPPreviewProjectPreferences() {
+ super(GRID, true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.bdaum.overlayPages.FieldEditorOverlayPage#getPageId()
+ */
+ protected String getPageId() {
+ return PREF_ID;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ protected void createFieldEditors() {
+ Composite composite = getFieldEditorParent();
+ addField(new BooleanFieldEditor(
+ IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT,
+ PHPPreferencesMessages
+ .getString("PHPPreviewProjectPreferences.auto_preview"),
+ composite));
+ addField(new BooleanFieldEditor(
+ IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT,
+ PHPPreferencesMessages
+ .getString("PHPPreviewProjectPreferences.bring_to_top_preview"),
+ composite));
+ // addField(new BooleanFieldEditor(
+ // IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL,
+ // PHPPreferencesMessages
+ // .getString("PHPPreviewProjectPreferences.show_html_files_local"),
+ // composite));
+ // addField(new BooleanFieldEditor(
+ // IPreferenceConstants.PHP_SHOW_XML_FILES_LOCAL, PHPPreferencesMessages
+ // .getString("PHPPreviewProjectPreferences.show_xml_files_local"),
+ // composite));
+ // if (!isPropertyPage)) {
+ //
+ // }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
+ */
+ protected IPreferenceStore doGetPreferenceStore() {
+ return WebUI.getDefault().getPreferenceStore();
+ }
- public PHPPreviewProjectPreferences() {
- super(GRID, true);
- }
- /*
- * (non-Javadoc)
- *
- * @see com.bdaum.overlayPages.FieldEditorOverlayPage#getPageId()
- */
- protected String getPageId() {
- return PREF_ID;
- }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- protected void createFieldEditors() {
- Composite composite = getFieldEditorParent();
- addField(new BooleanFieldEditor(
- IPreferenceConstants.PHP_AUTO_PREVIEW_DEFAULT, PHPPreferencesMessages
- .getString("PHPPreviewProjectPreferences.auto_preview"), composite));
- addField(new BooleanFieldEditor(
- IPreferenceConstants.PHP_BRING_TO_TOP_PREVIEW_DEFAULT, PHPPreferencesMessages
- .getString("PHPPreviewProjectPreferences.bring_to_top_preview"), composite));
-// addField(new BooleanFieldEditor(
-// IPreferenceConstants.PHP_SHOW_HTML_FILES_LOCAL, PHPPreferencesMessages
-// .getString("PHPPreviewProjectPreferences.show_html_files_local"), composite));
-// addField(new BooleanFieldEditor(
-// IPreferenceConstants.PHP_SHOW_XML_FILES_LOCAL, PHPPreferencesMessages
-// .getString("PHPPreviewProjectPreferences.show_xml_files_local"), composite));
- //if (!isPropertyPage)) {
- //
- //}
- }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return WebUI.getDefault().getPreferenceStore();
- }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- setDescription("Default entries for Previewer.");
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ setDescription("Default entries for Previewer.");
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PreferenceDescriptor.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PreferenceDescriptor.java
index d8b8610..46bf488 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PreferenceDescriptor.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/preferences/PreferenceDescriptor.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: PreferenceDescriptor.java,v 1.1 2004-09-02 18:26:30 jsurfer Exp $
+ * $Id: PreferenceDescriptor.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.preferences;
@@ -20,17 +20,24 @@ package net.sourceforge.phpeclipse.ui.preferences;
*/
public final class PreferenceDescriptor {
public static final Type BOOLEAN = new Type();
- public static final Type DOUBLE = new Type();
- public static final Type FLOAT = new Type();
- public static final Type INT = new Type();
- public static final Type LONG = new Type();
- public static final Type STRING = new Type();
+
+ public static final Type DOUBLE = new Type();
+
+ public static final Type FLOAT = new Type();
+
+ public static final Type INT = new Type();
+
+ public static final Type LONG = new Type();
+
+ public static final Type STRING = new Type();
public static final class Type {
- Type() {}
+ Type() {
+ }
}
- public final Type type;
+ public final Type type;
+
public final String key;
public PreferenceDescriptor(Type type, String key) {
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/preferences/TemplatesPreferencePage.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/preferences/TemplatesPreferencePage.java
index ecdc770..b40982d 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/preferences/TemplatesPreferencePage.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/preferences/TemplatesPreferencePage.java
@@ -14,11 +14,13 @@ import net.sourceforge.phpeclipse.ui.WebUI;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.texteditor.templates.TemplatePreferencePage;
+
/**
* @see org.eclipse.jface.preference.PreferencePage
*/
-public class TemplatesPreferencePage extends TemplatePreferencePage implements IWorkbenchPreferencePage {
-
+public class TemplatesPreferencePage extends TemplatePreferencePage implements
+ IWorkbenchPreferencePage {
+
public TemplatesPreferencePage() {
setPreferenceStore(WebUI.getDefault().getPreferenceStore());
setTemplateStore(WebUI.getDefault().getTemplateStore());
@@ -28,13 +30,12 @@ public class TemplatesPreferencePage extends TemplatePreferencePage implements I
protected boolean isShowFormatterSetting() {
return false;
}
-
-
+
public boolean performOk() {
- boolean ok= super.performOk();
-
+ boolean ok = super.performOk();
+
WebUI.getDefault().savePluginPreferences();
-
+
return ok;
}
}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java
index fcffda1..5e355e3 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java
@@ -31,151 +31,175 @@ import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.jface.text.templates.TemplateContextType;
import org.eclipse.jface.text.templates.TemplateException;
import org.eclipse.swt.graphics.Image;
+
/**
* A completion processor for XML templates.
*/
public class BasicCompletionProcessor extends TemplateCompletionProcessor {
- private static final String DEFAULT_IMAGE = "icons/template.gif"; //$NON-NLS-1$
- private char[] fProposalAutoActivationSet;
-// private PHPCompletionProposalComparator fComparator;
- public BasicCompletionProcessor() {
- super();
-// fComparator = new PHPCompletionProposalComparator();
- }
- /**
- * We watch for angular brackets since those are often part of XML templates.
- */
- protected String extractPrefix(ITextViewer viewer, int offset) {
- IDocument document = viewer.getDocument();
- int i = offset;
- if (i > document.getLength())
- return ""; //$NON-NLS-1$
-
- try {
- while (i > 0) {
- char ch = document.getChar(i - 1);
- if (ch != '<' && ch != '&' && ch != '{' && !Character.isJavaIdentifierPart(ch))
- break;
- i--;
- }
-
- return document.get(i, offset - i);
- } catch (BadLocationException e) {
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * Cut out angular brackets for relevance sorting, since the template name does not contain the brackets.
- */
- protected int getRelevance(Template template, String prefix) {
- // if (prefix.startsWith("<")) //$NON-NLS-1$
- // prefix= prefix.substring(1);
- if (template.getName().startsWith(prefix))
- return 90;
- return 0;
- }
-
- /**
- * Simply return all templates.
- */
- protected Template[] getTemplates(String contextTypeId) {
- return WebUI.getDefault().getTemplateStore().getTemplates();
- }
-
- /**
- * Return the XML context type that is supported by this plugin.
- */
- protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) {
- return WebUI.getDefault().getContextTypeRegistry().getContextType(XMLContextType.XML_CONTEXT_TYPE);
- }
-
- /**
- * Always return the default image.
- */
- protected Image getImage(Template template) {
- ImageRegistry registry = WebUI.getDefault().getImageRegistry();
- Image image = registry.get(DEFAULT_IMAGE);
- if (image == null) {
- ImageDescriptor desc = WebUI.imageDescriptorFromPlugin("org.eclipse.ui.examples.javaeditor", DEFAULT_IMAGE); //$NON-NLS-1$
- registry.put(DEFAULT_IMAGE, desc);
- image = registry.get(DEFAULT_IMAGE);
- }
- return image;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer,
- * int)
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- ITextSelection selection = (ITextSelection) viewer.getSelectionProvider().getSelection();
-
- // adjust offset to end of normalized selection
- if (selection.getOffset() == offset)
- offset = selection.getOffset() + selection.getLength();
-
- String prefix = extractPrefix(viewer, offset);
- prefix = prefix.toLowerCase();
- IRegion region = new Region(offset - prefix.length(), prefix.length());
- TemplateContext context = createContext(viewer, region);
- if (context == null)
- return new ICompletionProposal[0];
-
- context.setVariable("selection", selection.getText()); // name of the selection variables {line, word}_selection //$NON-NLS-1$
-
- Template[] templates = getTemplates(context.getContextType().getId());
-
- List matches = new ArrayList();
- for (int i = 0; i < templates.length; i++) {
- Template template = templates[i];
- try {
- context.getContextType().validate(template.getPattern());
- } catch (TemplateException e) {
- continue;
- }
-
- if (template.getName().startsWith(prefix)) { //&& template.matches(prefix, context.getContextType().getId()))
- matches.add(createProposal(template, context, region, getRelevance(template, prefix)));
- }
- }
-
- return (ICompletionProposal[]) matches.toArray(new ICompletionProposal[matches.size()]);
-
- }
- /**
- * @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- return fProposalAutoActivationSet;
- }
-
- /**
- * Sets this processor's set of characters triggering the activation of the
- * completion proposal computation.
- *
- * @param activationSet the activation set
- */
- public void setCompletionProposalAutoActivationCharacters(char[] activationSet) {
- fProposalAutoActivationSet= activationSet;
- }
-
- /**
- * Order the given proposals.
- */
-// private ICompletionProposal[] order(ICompletionProposal[] proposals) {
-// Arrays.sort(proposals, fComparator);
-// return proposals;
-// }
-
- /**
- * Tells this processor to order the proposals alphabetically.
- *
- * @param order true if proposals should be ordered.
- */
-// public void orderProposalsAlphabetically(boolean order) {
-// fComparator.setOrderAlphabetically(order);
-// }
+ private static final String DEFAULT_IMAGE = "icons/template.gif"; //$NON-NLS-1$
+
+ private char[] fProposalAutoActivationSet;
+
+ // private PHPCompletionProposalComparator fComparator;
+ public BasicCompletionProcessor() {
+ super();
+ // fComparator = new PHPCompletionProposalComparator();
+ }
+
+ /**
+ * We watch for angular brackets since those are often part of XML
+ * templates.
+ */
+ protected String extractPrefix(ITextViewer viewer, int offset) {
+ IDocument document = viewer.getDocument();
+ int i = offset;
+ if (i > document.getLength())
+ return ""; //$NON-NLS-1$
+
+ try {
+ while (i > 0) {
+ char ch = document.getChar(i - 1);
+ if (ch != '<' && ch != '&' && ch != '{'
+ && !Character.isJavaIdentifierPart(ch))
+ break;
+ i--;
+ }
+
+ return document.get(i, offset - i);
+ } catch (BadLocationException e) {
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Cut out angular brackets for relevance sorting, since the template name
+ * does not contain the brackets.
+ */
+ protected int getRelevance(Template template, String prefix) {
+ // if (prefix.startsWith("<")) //$NON-NLS-1$
+ // prefix= prefix.substring(1);
+ if (template.getName().startsWith(prefix))
+ return 90;
+ return 0;
+ }
+
+ /**
+ * Simply return all templates.
+ */
+ protected Template[] getTemplates(String contextTypeId) {
+ return WebUI.getDefault().getTemplateStore().getTemplates();
+ }
+
+ /**
+ * Return the XML context type that is supported by this plugin.
+ */
+ protected TemplateContextType getContextType(ITextViewer viewer,
+ IRegion region) {
+ return WebUI.getDefault().getContextTypeRegistry().getContextType(
+ XMLContextType.XML_CONTEXT_TYPE);
+ }
+
+ /**
+ * Always return the default image.
+ */
+ protected Image getImage(Template template) {
+ ImageRegistry registry = WebUI.getDefault().getImageRegistry();
+ Image image = registry.get(DEFAULT_IMAGE);
+ if (image == null) {
+ ImageDescriptor desc = WebUI.imageDescriptorFromPlugin(
+ "org.eclipse.ui.examples.javaeditor", DEFAULT_IMAGE); //$NON-NLS-1$
+ registry.put(DEFAULT_IMAGE, desc);
+ image = registry.get(DEFAULT_IMAGE);
+ }
+ return image;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer,
+ * int)
+ */
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
+ int offset) {
+ ITextSelection selection = (ITextSelection) viewer
+ .getSelectionProvider().getSelection();
+
+ // adjust offset to end of normalized selection
+ if (selection.getOffset() == offset)
+ offset = selection.getOffset() + selection.getLength();
+
+ String prefix = extractPrefix(viewer, offset);
+ prefix = prefix.toLowerCase();
+ IRegion region = new Region(offset - prefix.length(), prefix.length());
+ TemplateContext context = createContext(viewer, region);
+ if (context == null)
+ return new ICompletionProposal[0];
+
+ context.setVariable("selection", selection.getText()); // name of the
+ // selection
+ // variables
+ // {line,
+ // word}_selection
+ // //$NON-NLS-1$
+
+ Template[] templates = getTemplates(context.getContextType().getId());
+
+ List matches = new ArrayList();
+ for (int i = 0; i < templates.length; i++) {
+ Template template = templates[i];
+ try {
+ context.getContextType().validate(template.getPattern());
+ } catch (TemplateException e) {
+ continue;
+ }
+
+ if (template.getName().startsWith(prefix)) { // &&
+ // template.matches(prefix,
+ // context.getContextType().getId()))
+ matches.add(createProposal(template, context, region,
+ getRelevance(template, prefix)));
+ }
+ }
+
+ return (ICompletionProposal[]) matches
+ .toArray(new ICompletionProposal[matches.size()]);
+
+ }
+
+ /**
+ * @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
+ */
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return fProposalAutoActivationSet;
+ }
+
+ /**
+ * Sets this processor's set of characters triggering the activation of the
+ * completion proposal computation.
+ *
+ * @param activationSet
+ * the activation set
+ */
+ public void setCompletionProposalAutoActivationCharacters(
+ char[] activationSet) {
+ fProposalAutoActivationSet = activationSet;
+ }
+
+ /**
+ * Order the given proposals.
+ */
+ // private ICompletionProposal[] order(ICompletionProposal[] proposals) {
+ // Arrays.sort(proposals, fComparator);
+ // return proposals;
+ // }
+ /**
+ * Tells this processor to order the proposals alphabetically.
+ *
+ * @param order
+ * true if proposals should be ordered.
+ */
+ // public void orderProposalsAlphabetically(boolean order) {
+ // fComparator.setOrderAlphabetically(order);
+ // }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/HTMLContextType.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/HTMLContextType.java
index 908b084..365f53d 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/HTMLContextType.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/HTMLContextType.java
@@ -13,17 +13,16 @@ package net.sourceforge.phpeclipse.ui.templates.template;
import org.eclipse.jface.text.templates.GlobalTemplateVariables;
import org.eclipse.jface.text.templates.TemplateContextType;
-
/**
* A very simple context type.
*/
public class HTMLContextType extends TemplateContextType {
/** This context's id */
- public static final String HTML_CONTEXT_TYPE= "html"; //$NON-NLS-1$
+ public static final String HTML_CONTEXT_TYPE = "html"; //$NON-NLS-1$
/**
- * Creates a new XML context type.
+ * Creates a new XML context type.
*/
public HTMLContextType() {
addGlobalResolvers();
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/JSContextType.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/JSContextType.java
index 63d51da..e0dca6a 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/JSContextType.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/JSContextType.java
@@ -13,17 +13,16 @@ package net.sourceforge.phpeclipse.ui.templates.template;
import org.eclipse.jface.text.templates.GlobalTemplateVariables;
import org.eclipse.jface.text.templates.TemplateContextType;
-
/**
* A very simple context type.
*/
public class JSContextType extends TemplateContextType {
/** This context's id */
- public static final String JS_CONTEXT_TYPE= "javascript"; //$NON-NLS-1$
+ public static final String JS_CONTEXT_TYPE = "javascript"; //$NON-NLS-1$
/**
- * Creates a new XML context type.
+ * Creates a new XML context type.
*/
public JSContextType() {
addGlobalResolvers();
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/SmartyContextType.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/SmartyContextType.java
index e42270e..d5d9efa 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/SmartyContextType.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/SmartyContextType.java
@@ -13,17 +13,16 @@ package net.sourceforge.phpeclipse.ui.templates.template;
import org.eclipse.jface.text.templates.GlobalTemplateVariables;
import org.eclipse.jface.text.templates.TemplateContextType;
-
/**
* A very simple context type.
*/
public class SmartyContextType extends TemplateContextType {
/** This context's id */
- public static final String SMARTY_CONTEXT_TYPE= "smarty"; //$NON-NLS-1$
+ public static final String SMARTY_CONTEXT_TYPE = "smarty"; //$NON-NLS-1$
/**
- * Creates a new XML context type.
+ * Creates a new XML context type.
*/
public SmartyContextType() {
addGlobalResolvers();
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/XMLContextType.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/XMLContextType.java
index 9944dfb..7765baa 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/XMLContextType.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/XMLContextType.java
@@ -13,17 +13,16 @@ package net.sourceforge.phpeclipse.ui.templates.template;
import org.eclipse.jface.text.templates.GlobalTemplateVariables;
import org.eclipse.jface.text.templates.TemplateContextType;
-
/**
* A very simple context type.
*/
public class XMLContextType extends TemplateContextType {
/** This context's id */
- public static final String XML_CONTEXT_TYPE= "xml"; //$NON-NLS-1$
+ public static final String XML_CONTEXT_TYPE = "xml"; //$NON-NLS-1$
/**
- * Creates a new XML context type.
+ * Creates a new XML context type.
*/
public XMLContextType() {
addGlobalResolvers();
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/AbstractTextTools.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/AbstractTextTools.java
index 8fbea65..cfa3247 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/AbstractTextTools.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/AbstractTextTools.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: AbstractTextTools.java,v 1.2 2004-09-22 18:51:51 jsurfer Exp $
+ * $Id: AbstractTextTools.java,v 1.3 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.text;
@@ -55,12 +55,14 @@ public class AbstractTextTools {
* Creates a new text tools collection.
*/
public AbstractTextTools(IPreferenceStore store, String[] properties) {
- this(store, properties, new ColorManager());
+ this(store, properties, new ColorManager());
}
+
/**
* Creates a new text tools collection.
*/
- public AbstractTextTools(IPreferenceStore store, String[] properties, ColorManager manager) {
+ public AbstractTextTools(IPreferenceStore store, String[] properties,
+ ColorManager manager) {
this.store = store;
this.properties = properties;
@@ -140,8 +142,8 @@ public class AbstractTextTools {
}
/**
- * Returns the color manager which is used to manage any XML-specific
- * colors needed for such things like syntax highlighting.
+ * Returns the color manager which is used to manage any XML-specific colors
+ * needed for such things like syntax highlighting.
*
* @return the color manager to be used for XML text viewers
*/
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/IReconcilingParticipant.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/IReconcilingParticipant.java
index 26f9f62..b232899 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/IReconcilingParticipant.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/IReconcilingParticipant.java
@@ -8,16 +8,16 @@
* Contributors:
* Christopher Lenz - initial API
*
- * $Id: IReconcilingParticipant.java,v 1.1 2004-09-02 18:26:49 jsurfer Exp $
+ * $Id: IReconcilingParticipant.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.text;
/**
- * Interface for classes participating in reconciling.
+ * Interface for classes participating in reconciling.
*/
public interface IReconcilingParticipant {
-
+
/**
* Called after reconciling has been finished.
*/
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/TextDoubleClickStrategy.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/TextDoubleClickStrategy.java
index c3e70a5..def4daf 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/TextDoubleClickStrategy.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/TextDoubleClickStrategy.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: TextDoubleClickStrategy.java,v 1.1 2004-09-02 18:26:49 jsurfer Exp $
+ * $Id: TextDoubleClickStrategy.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.text;
@@ -28,7 +28,9 @@ public class TextDoubleClickStrategy implements ITextDoubleClickStrategy {
*/
public void doubleClicked(ITextViewer viewer) {
int offset = viewer.getSelectedRange().x;
- if (offset < 0) { return; }
+ if (offset < 0) {
+ return;
+ }
selectWord(viewer, viewer.getDocument(), offset);
}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/AbstractPartitioner.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/AbstractPartitioner.java
index ab96dd5..04819c8 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/AbstractPartitioner.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/AbstractPartitioner.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: AbstractPartitioner.java,v 1.3 2004-12-29 21:42:31 axelcl Exp $
+ * $Id: AbstractPartitioner.java,v 1.4 2006-10-21 23:13:53 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.text.rules;
@@ -29,548 +29,568 @@ import org.eclipse.jface.text.rules.IPartitionTokenScanner;
import org.eclipse.jface.text.rules.IToken;
/**
- * Advanced partitioner which maintains partitions as views to connected document. Views have own partitioners themselves. This
- * class is designed as a base for complex partitioners such as for JSP, PHP, ASP, etc. languages.
+ * Advanced partitioner which maintains partitions as views to connected
+ * document. Views have own partitioners themselves. This class is designed as a
+ * base for complex partitioners such as for JSP, PHP, ASP, etc. languages.
*
* @author Igor Malinin
*/
-public abstract class AbstractPartitioner implements IDocumentPartitioner, IDocumentPartitionerExtension {
- public final static boolean DEBUG = false;
-
- /** Partition scanner */
- protected IPartitionTokenScanner scanner;
-
- /** Connected document */
- protected IDocument document;
-
- /** Flat structure of the document */
- protected List nodes = new ArrayList();
-
- /** The offset at which the first changed partition starts */
- protected int regionStart;
-
- /** The offset at which the last changed partition ends */
- protected int regionEnd;
-
- public AbstractPartitioner(IPartitionTokenScanner scanner) {
- this.scanner = scanner;
- }
-
- protected FlatNode createNode(String type, int offset, int length) {
- if (DEBUG) {
- Assert.isTrue(offset >= 0, Integer.toString(offset));
- }
- FlatNode node = new FlatNode(type);
- node.offset = offset;
- node.length = length;
- return node;
- }
-
- protected void addInnerRegion(FlatNode position) {
- nodes.add(computeFlatNodeIndex(position.offset), position);
- }
-
- protected void removeInnerRegion(FlatNode position) {
- nodes.remove(position); // TODO: Indexed remove?
- }
-
- protected void deleteInnerRegion(FlatNode position) {
- nodes.remove(position); // TODO: Indexed remove?
- }
-
- protected void resizeInnerRegion(FlatNode position) {
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#connect(IDocument)
- */
- public void connect(IDocument document) {
- this.document = document;
-
- initialize();
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#disconnect()
- */
- public void disconnect() {
- nodes.clear();
- document = null;
- }
-
- /**
- * Performs the initial partitioning of the partitioner's document.
- */
- protected void initialize() {
- scanner.setRange(document, 0, document.getLength());
- // axelcl start
- nodes.clear();
- // axelcl end
- IToken token = scanner.nextToken();
- while (!token.isEOF()) {
- String contentType = getTokenContentType(token);
-
- if (isSupportedContentType(contentType)) {
- addInnerRegion(createNode(contentType, scanner.getTokenOffset(), scanner.getTokenLength()));
- }
-
- token = scanner.nextToken();
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- regionStart = regionEnd = -1;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#documentChanged(DocumentEvent)
- */
- public boolean documentChanged(DocumentEvent event) {
- return (documentChanged2(event) != null);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitionerExtension#documentChanged2(DocumentEvent)
- */
- public IRegion documentChanged2(DocumentEvent event) {
- int first = fixupPartitions(event);
-
- FlatNode[] category = (FlatNode[]) nodes.toArray(new FlatNode[nodes.size()]);
-
- // repartition changed region
-
- String contentType = IDocument.DEFAULT_CONTENT_TYPE;
-
- int offset;
-
- if (first == 0) {
- offset = 0; // Bug #697414: first offset
- } else {
- offset = event.getOffset();
-
- FlatNode partition = category[first - 1];
- if (partition.includes(offset)) {
- offset = partition.offset;
- contentType = partition.type;
- --first;
- } else if (offset == partition.offset + partition.length) {
- offset = partition.offset;
- contentType = partition.type;
- --first;
- } else {
- offset = partition.offset + partition.length;
- }
- }
-
- // should not be changed since last conversion
- // category = (FlatNode[]) nodes.toArray(new FlatNode[nodes.size()]);
- if (DEBUG) {
- Assert.isTrue(offset >= 0, Integer.toString(offset));
- }
- scanner.setPartialRange(document, offset, document.getLength(), contentType, offset);
-
- int lastScannedPosition = offset;
- IToken token = scanner.nextToken();
- while (!token.isEOF()) {
- contentType = getTokenContentType(token);
-
- if (!isSupportedContentType(contentType)) {
- token = scanner.nextToken();
- continue;
- }
-
- offset = scanner.getTokenOffset();
- if (DEBUG) {
- Assert.isTrue(offset >= 0, scanner.toString());
- }
- int length = scanner.getTokenLength();
-
- lastScannedPosition = offset + length;
-
- // remove all affected positions
- while (first < category.length) {
- FlatNode p = category[first];
- if (p.offset + p.length < lastScannedPosition
- || (p.overlapsWith(offset, length) && (!containsPosition(offset, length) || !contentType.equals(p.type)))) {
- removeInnerRegion(p);
- rememberRegion(p.offset, p.length);
- ++first;
- } else {
- break;
- }
- }
-
- // if position already exists we are done
- if (containsPosition(offset, length)) {
- if (lastScannedPosition > event.getOffset()) {
- // TODO: optional repartition till end of doc
- return createRegion();
- }
-
- ++first;
- } else {
- // insert the new type position
- addInnerRegion(createNode(contentType, offset, length));
- rememberRegion(offset, length);
- }
- // try {
- token = scanner.nextToken();
- // } catch (ArrayIndexOutOfBoundsException e) {
- // System.out.println(this.getClass().toString());
- // throw e;
- // }
- }
-
- // remove all positions behind lastScannedPosition
- // since there aren't any further types
-
- // Do not need to recalculate (lost remove events)!
- // first = computeIndexInInnerDocuments(lastScannedPosition);
- while (first < category.length) {
- FlatNode p = category[first++];
- removeInnerRegion(p);
- rememberRegion(p.offset, p.length);
- }
-
- return createRegion();
- }
-
- protected int fixupPartitions(DocumentEvent event) {
- int offset = event.getOffset();
- int length = event.getLength();
- int end = offset + length;
-
- // fixup flat nodes laying on change boundaries
-
- int first = computeFlatNodeIndex(offset);
- if (first > 0) {
- FlatNode p = (FlatNode) nodes.get(first - 1);
-
- int right = p.offset + p.length;
- if (offset < right) {
- // change overlaps with partition
- if (end < right) {
- // cahnge completely inside partition
- String text = event.getText();
- p.length -= length;
- if (text != null) {
- p.length += text.length();
- }
- } else {
- // cut partition at right
- int cut = p.offset + p.length - offset;
- p.length -= cut;
- }
- }
- }
-
- int last = computeFlatNodeIndex(end);
- if (first < last) {
- FlatNode p = (FlatNode) nodes.get(last - 1);
-
- int right = p.offset + p.length;
- if (end < right) {
- // cut partition at left
- int cut = end - p.offset;
- p.length -= cut;
- p.offset = offset;
-
- String text = event.getText();
- if (text != null) {
- p.offset += text.length();
- }
-
- --last;
- }
- }
-
- // fixup flat nodes laying afrer change
-
- String text = event.getText();
- if (text != null) {
- length -= text.length();
- }
-
- for (int i = last, size = nodes.size(); i < size; i++) {
- ((FlatNode) nodes.get(i)).offset -= length;
- }
-
- // delete flat nodes laying completely inside change boundaries
-
- if (first < last) {
- do {
- deleteInnerRegion((FlatNode) nodes.get(--last));
- } while (first < last);
-
- rememberRegion(offset, 0);
- }
-
- return first;
- }
-
- /**
- * Returns whether the given type is one of the legal content types.
- *
- * @param contentType
- * the content type to check
- * @return true if the content type is a legal content type
- */
- protected boolean isSupportedContentType(String contentType) {
- /* TODO: implementation */
- // if (contentType != null) {
- // for (int i= 0; i < fLegalContentTypes.length; i++) {
- // if (fLegalContentTypes[i].equals(contentType)) {
- // return true;
- // }
- // }
- // }
- // return false;
- return (contentType != null);
- }
-
- /**
- * Returns a content type encoded in the given token. If the token's data is not null and a string it is assumed
- * that it is the encoded content type.
- *
- * @param token
- * the token whose content type is to be determined
- * @return the token's content type
- */
- protected String getTokenContentType(IToken token) {
- Object data = token.getData();
- if (data instanceof String) {
- return (String) data;
- }
-
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#getLegalContentTypes()
- */
- public String[] getLegalContentTypes() {
- // TODO: implementation
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#getContentType(int)
- */
- public String getContentType(int offset) {
- return getPartition(offset).getType();
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#getPartition(int)
- */
- public ITypedRegion getPartition(int offset) {
- if (nodes.size() == 0) {
- return new TypedRegion(0, document.getLength(), IDocument.DEFAULT_CONTENT_TYPE);
- }
-
- int index = computeFlatNodeIndex(offset);
- if (index < nodes.size()) {
- FlatNode next = (FlatNode) nodes.get(index);
-
- if (offset == next.offset) {
- return new TypedRegion(next.offset, next.length, next.type);
- }
-
- if (index == 0) {
- return new TypedRegion(0, next.offset, IDocument.DEFAULT_CONTENT_TYPE);
- }
-
- FlatNode prev = (FlatNode) nodes.get(index - 1);
-
- if (prev.includes(offset)) {
- return new TypedRegion(prev.offset, prev.length, prev.type);
- }
-
- int end = prev.offset + prev.length;
- return new TypedRegion(end, next.offset - end, IDocument.DEFAULT_CONTENT_TYPE);
- }
-
- FlatNode prev = (FlatNode) nodes.get(nodes.size() - 1);
-
- if (prev.includes(offset)) {
- return new TypedRegion(prev.offset, prev.length, prev.type);
- }
-
- int end = prev.offset + prev.length;
-
- return new TypedRegion(end, document.getLength() - end, IDocument.DEFAULT_CONTENT_TYPE);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#computePartitioning(int, int)
- */
- public ITypedRegion[] computePartitioning(int offset, int length) {
- List list = new ArrayList();
-
- int end = offset + length;
-
- int index = computeFlatNodeIndex(offset);
- while (true) {
- FlatNode prev = (index > 0) ? (FlatNode) nodes.get(index - 1) : null;
-
- if (prev != null) {
- if (prev.overlapsWith(offset, length)) {
- list.add(new TypedRegion(prev.offset, prev.length, prev.type));
- }
-
- if (end <= prev.offset + prev.length) {
- break;
- }
- }
-
- FlatNode next = (index < nodes.size()) ? (FlatNode) nodes.get(index) : null;
-
- if (next == null || offset < next.offset) {
- int off0 = offset;
- int off1 = offset + length;
-
- if (prev != null && off0 < prev.offset + prev.length) {
- off0 = prev.offset + prev.length;
- }
-
- if (next != null && next.offset < off1) {
- off1 = next.offset;
- }
-
- if (off0 < off1) {
- list.add(new TypedRegion(off0, off1 - off0, IDocument.DEFAULT_CONTENT_TYPE));
- }
- }
-
- if (next == null) {
- break;
- }
-
- ++index;
- }
-
- return (TypedRegion[]) list.toArray(new TypedRegion[list.size()]);
- }
-
- /**
- * Computes the index in the list of flat nodes at which an flat node with the given offset would be inserted. The flat node is
- * supposed to become the first in this list of all flat nodes with the same offset.
- *
- * @param offset
- * the offset for which the index is computed
- * @return the computed index
- */
- protected int computeFlatNodeIndex(int offset) {
- if (nodes.size() == 0) {
- return 0;
- }
-
- int left = 0, mid = 0;
- int right = nodes.size() - 1;
-
- FlatNode p = null;
-
- while (left < right) {
- mid = (left + right) / 2;
-
- p = (FlatNode) nodes.get(mid);
-
- if (offset < p.offset) {
- right = (left == mid) ? left : mid - 1;
- } else if (offset > p.offset) {
- left = (right == mid) ? right : mid + 1;
- } else if (offset == p.offset) {
- left = right = mid;
- }
- }
-
- int pos = left;
- p = (FlatNode) nodes.get(pos);
- if (offset > p.offset) {
- // append to the end
- pos++;
- } else {
- // entry will became the first of all entries with the same offset
- do {
- --pos;
- if (pos < 0) {
- break;
- }
- p = (FlatNode) nodes.get(pos);
- } while (offset == p.offset);
- ++pos;
- }
-
- return pos;
- }
-
- public boolean containsPosition(int offset, int length) {
- int size = nodes.size();
- if (size == 0) {
- return false;
- }
-
- int index = computeFlatNodeIndex(offset);
- if (index < size) {
- FlatNode p = (FlatNode) nodes.get(index);
-
- while (p.offset == offset) {
- if (p.length == length) {
- return true;
- }
-
- if (++index < size) {
- p = (FlatNode) nodes.get(index);
- } else {
- break;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Helper method for tracking the minimal region containg all partition changes. If offset is smaller than the
- * remembered offset, offset will from now on be remembered. If offset + length is greater than the
- * remembered end offset, it will be remembered from now on.
- *
- * @param offset
- * the offset
- * @param length
- * the length
- */
- protected final void rememberRegion(int offset, int length) {
- // remember start offset
- if (regionStart == -1) {
- regionStart = offset;
- } else if (offset < regionStart) {
- regionStart = offset;
- }
-
- // remember end offset
- int endOffset = offset + length;
-
- if (regionEnd == -1) {
- regionEnd = endOffset;
- } else if (endOffset > regionEnd) {
- regionEnd = endOffset;
- }
- }
-
- /**
- * Creates the minimal region containing all partition changes using the remembered offsets.
- *
- * @return the minimal region containing all the partition changes
- */
- protected final IRegion createRegion() {
- if (regionStart == -1 || regionEnd == -1) {
- return null;
- }
-
- return new Region(regionStart, regionEnd - regionStart);
- }
+public abstract class AbstractPartitioner implements IDocumentPartitioner,
+ IDocumentPartitionerExtension {
+ public final static boolean DEBUG = false;
+
+ /** Partition scanner */
+ protected IPartitionTokenScanner scanner;
+
+ /** Connected document */
+ protected IDocument document;
+
+ /** Flat structure of the document */
+ protected List nodes = new ArrayList();
+
+ /** The offset at which the first changed partition starts */
+ protected int regionStart;
+
+ /** The offset at which the last changed partition ends */
+ protected int regionEnd;
+
+ public AbstractPartitioner(IPartitionTokenScanner scanner) {
+ this.scanner = scanner;
+ }
+
+ protected FlatNode createNode(String type, int offset, int length) {
+ if (DEBUG) {
+ Assert.isTrue(offset >= 0, Integer.toString(offset));
+ }
+ FlatNode node = new FlatNode(type);
+ node.offset = offset;
+ node.length = length;
+ return node;
+ }
+
+ protected void addInnerRegion(FlatNode position) {
+ nodes.add(computeFlatNodeIndex(position.offset), position);
+ }
+
+ protected void removeInnerRegion(FlatNode position) {
+ nodes.remove(position); // TODO: Indexed remove?
+ }
+
+ protected void deleteInnerRegion(FlatNode position) {
+ nodes.remove(position); // TODO: Indexed remove?
+ }
+
+ protected void resizeInnerRegion(FlatNode position) {
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#connect(IDocument)
+ */
+ public void connect(IDocument document) {
+ this.document = document;
+
+ initialize();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#disconnect()
+ */
+ public void disconnect() {
+ nodes.clear();
+ document = null;
+ }
+
+ /**
+ * Performs the initial partitioning of the partitioner's document.
+ */
+ protected void initialize() {
+ scanner.setRange(document, 0, document.getLength());
+ // axelcl start
+ nodes.clear();
+ // axelcl end
+ IToken token = scanner.nextToken();
+ while (!token.isEOF()) {
+ String contentType = getTokenContentType(token);
+
+ if (isSupportedContentType(contentType)) {
+ addInnerRegion(createNode(contentType,
+ scanner.getTokenOffset(), scanner.getTokenLength()));
+ }
+
+ token = scanner.nextToken();
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#documentAboutToBeChanged(DocumentEvent)
+ */
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ regionStart = regionEnd = -1;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#documentChanged(DocumentEvent)
+ */
+ public boolean documentChanged(DocumentEvent event) {
+ return (documentChanged2(event) != null);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitionerExtension#documentChanged2(DocumentEvent)
+ */
+ public IRegion documentChanged2(DocumentEvent event) {
+ int first = fixupPartitions(event);
+
+ FlatNode[] category = (FlatNode[]) nodes.toArray(new FlatNode[nodes
+ .size()]);
+
+ // repartition changed region
+
+ String contentType = IDocument.DEFAULT_CONTENT_TYPE;
+
+ int offset;
+
+ if (first == 0) {
+ offset = 0; // Bug #697414: first offset
+ } else {
+ offset = event.getOffset();
+
+ FlatNode partition = category[first - 1];
+ if (partition.includes(offset)) {
+ offset = partition.offset;
+ contentType = partition.type;
+ --first;
+ } else if (offset == partition.offset + partition.length) {
+ offset = partition.offset;
+ contentType = partition.type;
+ --first;
+ } else {
+ offset = partition.offset + partition.length;
+ }
+ }
+
+ // should not be changed since last conversion
+ // category = (FlatNode[]) nodes.toArray(new FlatNode[nodes.size()]);
+ if (DEBUG) {
+ Assert.isTrue(offset >= 0, Integer.toString(offset));
+ }
+ scanner.setPartialRange(document, offset, document.getLength(),
+ contentType, offset);
+
+ int lastScannedPosition = offset;
+ IToken token = scanner.nextToken();
+ while (!token.isEOF()) {
+ contentType = getTokenContentType(token);
+
+ if (!isSupportedContentType(contentType)) {
+ token = scanner.nextToken();
+ continue;
+ }
+
+ offset = scanner.getTokenOffset();
+ if (DEBUG) {
+ Assert.isTrue(offset >= 0, scanner.toString());
+ }
+ int length = scanner.getTokenLength();
+
+ lastScannedPosition = offset + length;
+
+ // remove all affected positions
+ while (first < category.length) {
+ FlatNode p = category[first];
+ if (p.offset + p.length < lastScannedPosition
+ || (p.overlapsWith(offset, length) && (!containsPosition(
+ offset, length) || !contentType.equals(p.type)))) {
+ removeInnerRegion(p);
+ rememberRegion(p.offset, p.length);
+ ++first;
+ } else {
+ break;
+ }
+ }
+
+ // if position already exists we are done
+ if (containsPosition(offset, length)) {
+ if (lastScannedPosition > event.getOffset()) {
+ // TODO: optional repartition till end of doc
+ return createRegion();
+ }
+
+ ++first;
+ } else {
+ // insert the new type position
+ addInnerRegion(createNode(contentType, offset, length));
+ rememberRegion(offset, length);
+ }
+ // try {
+ token = scanner.nextToken();
+ // } catch (ArrayIndexOutOfBoundsException e) {
+ // System.out.println(this.getClass().toString());
+ // throw e;
+ // }
+ }
+
+ // remove all positions behind lastScannedPosition
+ // since there aren't any further types
+
+ // Do not need to recalculate (lost remove events)!
+ // first = computeIndexInInnerDocuments(lastScannedPosition);
+ while (first < category.length) {
+ FlatNode p = category[first++];
+ removeInnerRegion(p);
+ rememberRegion(p.offset, p.length);
+ }
+
+ return createRegion();
+ }
+
+ protected int fixupPartitions(DocumentEvent event) {
+ int offset = event.getOffset();
+ int length = event.getLength();
+ int end = offset + length;
+
+ // fixup flat nodes laying on change boundaries
+
+ int first = computeFlatNodeIndex(offset);
+ if (first > 0) {
+ FlatNode p = (FlatNode) nodes.get(first - 1);
+
+ int right = p.offset + p.length;
+ if (offset < right) {
+ // change overlaps with partition
+ if (end < right) {
+ // cahnge completely inside partition
+ String text = event.getText();
+ p.length -= length;
+ if (text != null) {
+ p.length += text.length();
+ }
+ } else {
+ // cut partition at right
+ int cut = p.offset + p.length - offset;
+ p.length -= cut;
+ }
+ }
+ }
+
+ int last = computeFlatNodeIndex(end);
+ if (first < last) {
+ FlatNode p = (FlatNode) nodes.get(last - 1);
+
+ int right = p.offset + p.length;
+ if (end < right) {
+ // cut partition at left
+ int cut = end - p.offset;
+ p.length -= cut;
+ p.offset = offset;
+
+ String text = event.getText();
+ if (text != null) {
+ p.offset += text.length();
+ }
+
+ --last;
+ }
+ }
+
+ // fixup flat nodes laying afrer change
+
+ String text = event.getText();
+ if (text != null) {
+ length -= text.length();
+ }
+
+ for (int i = last, size = nodes.size(); i < size; i++) {
+ ((FlatNode) nodes.get(i)).offset -= length;
+ }
+
+ // delete flat nodes laying completely inside change boundaries
+
+ if (first < last) {
+ do {
+ deleteInnerRegion((FlatNode) nodes.get(--last));
+ } while (first < last);
+
+ rememberRegion(offset, 0);
+ }
+
+ return first;
+ }
+
+ /**
+ * Returns whether the given type is one of the legal content types.
+ *
+ * @param contentType
+ * the content type to check
+ * @return true if the content type is a legal content type
+ */
+ protected boolean isSupportedContentType(String contentType) {
+ /* TODO: implementation */
+ // if (contentType != null) {
+ // for (int i= 0; i < fLegalContentTypes.length; i++) {
+ // if (fLegalContentTypes[i].equals(contentType)) {
+ // return true;
+ // }
+ // }
+ // }
+ // return false;
+ return (contentType != null);
+ }
+
+ /**
+ * Returns a content type encoded in the given token. If the token's data is
+ * not null and a string it is assumed that it is the encoded
+ * content type.
+ *
+ * @param token
+ * the token whose content type is to be determined
+ * @return the token's content type
+ */
+ protected String getTokenContentType(IToken token) {
+ Object data = token.getData();
+ if (data instanceof String) {
+ return (String) data;
+ }
+
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#getLegalContentTypes()
+ */
+ public String[] getLegalContentTypes() {
+ // TODO: implementation
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#getContentType(int)
+ */
+ public String getContentType(int offset) {
+ return getPartition(offset).getType();
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#getPartition(int)
+ */
+ public ITypedRegion getPartition(int offset) {
+ if (nodes.size() == 0) {
+ return new TypedRegion(0, document.getLength(),
+ IDocument.DEFAULT_CONTENT_TYPE);
+ }
+
+ int index = computeFlatNodeIndex(offset);
+ if (index < nodes.size()) {
+ FlatNode next = (FlatNode) nodes.get(index);
+
+ if (offset == next.offset) {
+ return new TypedRegion(next.offset, next.length, next.type);
+ }
+
+ if (index == 0) {
+ return new TypedRegion(0, next.offset,
+ IDocument.DEFAULT_CONTENT_TYPE);
+ }
+
+ FlatNode prev = (FlatNode) nodes.get(index - 1);
+
+ if (prev.includes(offset)) {
+ return new TypedRegion(prev.offset, prev.length, prev.type);
+ }
+
+ int end = prev.offset + prev.length;
+ return new TypedRegion(end, next.offset - end,
+ IDocument.DEFAULT_CONTENT_TYPE);
+ }
+
+ FlatNode prev = (FlatNode) nodes.get(nodes.size() - 1);
+
+ if (prev.includes(offset)) {
+ return new TypedRegion(prev.offset, prev.length, prev.type);
+ }
+
+ int end = prev.offset + prev.length;
+
+ return new TypedRegion(end, document.getLength() - end,
+ IDocument.DEFAULT_CONTENT_TYPE);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#computePartitioning(int,
+ * int)
+ */
+ public ITypedRegion[] computePartitioning(int offset, int length) {
+ List list = new ArrayList();
+
+ int end = offset + length;
+
+ int index = computeFlatNodeIndex(offset);
+ while (true) {
+ FlatNode prev = (index > 0) ? (FlatNode) nodes.get(index - 1)
+ : null;
+
+ if (prev != null) {
+ if (prev.overlapsWith(offset, length)) {
+ list.add(new TypedRegion(prev.offset, prev.length,
+ prev.type));
+ }
+
+ if (end <= prev.offset + prev.length) {
+ break;
+ }
+ }
+
+ FlatNode next = (index < nodes.size()) ? (FlatNode) nodes
+ .get(index) : null;
+
+ if (next == null || offset < next.offset) {
+ int off0 = offset;
+ int off1 = offset + length;
+
+ if (prev != null && off0 < prev.offset + prev.length) {
+ off0 = prev.offset + prev.length;
+ }
+
+ if (next != null && next.offset < off1) {
+ off1 = next.offset;
+ }
+
+ if (off0 < off1) {
+ list.add(new TypedRegion(off0, off1 - off0,
+ IDocument.DEFAULT_CONTENT_TYPE));
+ }
+ }
+
+ if (next == null) {
+ break;
+ }
+
+ ++index;
+ }
+
+ return (TypedRegion[]) list.toArray(new TypedRegion[list.size()]);
+ }
+
+ /**
+ * Computes the index in the list of flat nodes at which an flat node with
+ * the given offset would be inserted. The flat node is supposed to become
+ * the first in this list of all flat nodes with the same offset.
+ *
+ * @param offset
+ * the offset for which the index is computed
+ * @return the computed index
+ */
+ protected int computeFlatNodeIndex(int offset) {
+ if (nodes.size() == 0) {
+ return 0;
+ }
+
+ int left = 0, mid = 0;
+ int right = nodes.size() - 1;
+
+ FlatNode p = null;
+
+ while (left < right) {
+ mid = (left + right) / 2;
+
+ p = (FlatNode) nodes.get(mid);
+
+ if (offset < p.offset) {
+ right = (left == mid) ? left : mid - 1;
+ } else if (offset > p.offset) {
+ left = (right == mid) ? right : mid + 1;
+ } else if (offset == p.offset) {
+ left = right = mid;
+ }
+ }
+
+ int pos = left;
+ p = (FlatNode) nodes.get(pos);
+ if (offset > p.offset) {
+ // append to the end
+ pos++;
+ } else {
+ // entry will became the first of all entries with the same offset
+ do {
+ --pos;
+ if (pos < 0) {
+ break;
+ }
+ p = (FlatNode) nodes.get(pos);
+ } while (offset == p.offset);
+ ++pos;
+ }
+
+ return pos;
+ }
+
+ public boolean containsPosition(int offset, int length) {
+ int size = nodes.size();
+ if (size == 0) {
+ return false;
+ }
+
+ int index = computeFlatNodeIndex(offset);
+ if (index < size) {
+ FlatNode p = (FlatNode) nodes.get(index);
+
+ while (p.offset == offset) {
+ if (p.length == length) {
+ return true;
+ }
+
+ if (++index < size) {
+ p = (FlatNode) nodes.get(index);
+ } else {
+ break;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Helper method for tracking the minimal region containg all partition
+ * changes. If offset is smaller than the remembered offset,
+ * offset will from now on be remembered. If
+ * offset + length is greater than the remembered end offset,
+ * it will be remembered from now on.
+ *
+ * @param offset
+ * the offset
+ * @param length
+ * the length
+ */
+ protected final void rememberRegion(int offset, int length) {
+ // remember start offset
+ if (regionStart == -1) {
+ regionStart = offset;
+ } else if (offset < regionStart) {
+ regionStart = offset;
+ }
+
+ // remember end offset
+ int endOffset = offset + length;
+
+ if (regionEnd == -1) {
+ regionEnd = endOffset;
+ } else if (endOffset > regionEnd) {
+ regionEnd = endOffset;
+ }
+ }
+
+ /**
+ * Creates the minimal region containing all partition changes using the
+ * remembered offsets.
+ *
+ * @return the minimal region containing all the partition changes
+ */
+ protected final IRegion createRegion() {
+ if (regionStart == -1 || regionEnd == -1) {
+ return null;
+ }
+
+ return new Region(regionStart, regionEnd - regionStart);
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/InnerDocumentView.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/InnerDocumentView.java
index f1b0ce2..be8ed24 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/InnerDocumentView.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/InnerDocumentView.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: InnerDocumentView.java,v 1.2 2004-09-22 18:51:51 jsurfer Exp $
+ * $Id: InnerDocumentView.java,v 1.3 2006-10-21 23:13:53 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.text.rules;
@@ -25,126 +25,128 @@ import org.eclipse.jface.text.ITextStore;
*
* @author Igor Malinin
*/
-public class InnerDocumentView extends AbstractDocument implements IDocumentView {
-
- /**
- * Implements ITextStore based on IDocument.
- */
- class TextStore implements ITextStore {
-
- /*
- * @see ITextStore#set
- */
- public void set(String txt) {
- try {
- parent.replace(range.offset, range.length, txt);
- } catch (BadLocationException x) {
- }
- }
-
- /*
- * @see ITextStore#replace
- */
- public void replace(int offset, int length, String txt) {
- try {
- parent.replace(range.offset + offset, length, txt);
- } catch (BadLocationException x) {
- }
- }
-
- /*
- * @see ITextStore#getLength
- */
- public int getLength() {
- return range.length;
- }
-
- /*
- * @see ITextStore#get
- */
- public String get(int offset, int length) {
- try {
- return parent.get(range.offset + offset, length);
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /*
- * @see ITextStore#get
- */
- public char get(int offset) {
- try {
- return parent.getChar(range.offset + offset);
- } catch (BadLocationException x) {
- }
-
- return (char) 0;
- }
- }
-
- /** The parent document */
- IDocument parent;
-
- /** The section inside the parent document */
- ViewNode range;
-
- /**
- * Constructs inner view to parent document.
- *
- * @param parent
- * parent document
- * @param range
- */
- public InnerDocumentView(IDocument parent, ViewNode range) {
- this.parent = parent;
- this.range = range;
-
- setTextStore(new TextStore());
- setLineTracker(new DefaultLineTracker());
- getTracker().set(getStore().get(0, getLength()));
- completeInitialization();
- }
-
- /*
- * @see net.sourceforge.phpeclipse.text.rules.IDocumentView#getParentDocument()
- */
- public IDocument getParentDocument() {
- return parent;
- }
-
- /*
- * @see org.eclipse.jface.text.AbstractDocument#fireDocumentAboutToBeChanged(DocumentEvent)
- */
- protected void fireDocumentAboutToBeChanged(DocumentEvent event) {
- super.fireDocumentAboutToBeChanged(event);
- }
-
- /*
- * @see org.eclipse.jface.text.AbstractDocument#fireDocumentChanged(DocumentEvent)
- */
- protected void fireDocumentChanged(DocumentEvent event) {
- try {
- // TODO: move to a better place
- getTracker().replace(event.getOffset(), event.getLength(), event.getText());
- } catch (BadLocationException x) {
- }
-
- super.fireDocumentChanged(event);
- }
-
- /*
- * @see net.sf.wdte.text.rules.IDocumentView#getParentOffset(int)
- */
- public int getParentOffset(int localOffset) {
- return localOffset + range.offset;
- }
-
- /*
- * @see net.sf.wdte.text.rules.IDocumentView#getLocalOffset(int)
- */
- public int getLocalOffset(int parentOffset) {
- return parentOffset - range.offset;
- }
+public class InnerDocumentView extends AbstractDocument implements
+ IDocumentView {
+
+ /**
+ * Implements ITextStore based on IDocument.
+ */
+ class TextStore implements ITextStore {
+
+ /*
+ * @see ITextStore#set
+ */
+ public void set(String txt) {
+ try {
+ parent.replace(range.offset, range.length, txt);
+ } catch (BadLocationException x) {
+ }
+ }
+
+ /*
+ * @see ITextStore#replace
+ */
+ public void replace(int offset, int length, String txt) {
+ try {
+ parent.replace(range.offset + offset, length, txt);
+ } catch (BadLocationException x) {
+ }
+ }
+
+ /*
+ * @see ITextStore#getLength
+ */
+ public int getLength() {
+ return range.length;
+ }
+
+ /*
+ * @see ITextStore#get
+ */
+ public String get(int offset, int length) {
+ try {
+ return parent.get(range.offset + offset, length);
+ } catch (BadLocationException x) {
+ }
+
+ return null;
+ }
+
+ /*
+ * @see ITextStore#get
+ */
+ public char get(int offset) {
+ try {
+ return parent.getChar(range.offset + offset);
+ } catch (BadLocationException x) {
+ }
+
+ return (char) 0;
+ }
+ }
+
+ /** The parent document */
+ IDocument parent;
+
+ /** The section inside the parent document */
+ ViewNode range;
+
+ /**
+ * Constructs inner view to parent document.
+ *
+ * @param parent
+ * parent document
+ * @param range
+ */
+ public InnerDocumentView(IDocument parent, ViewNode range) {
+ this.parent = parent;
+ this.range = range;
+
+ setTextStore(new TextStore());
+ setLineTracker(new DefaultLineTracker());
+ getTracker().set(getStore().get(0, getLength()));
+ completeInitialization();
+ }
+
+ /*
+ * @see net.sourceforge.phpeclipse.text.rules.IDocumentView#getParentDocument()
+ */
+ public IDocument getParentDocument() {
+ return parent;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractDocument#fireDocumentAboutToBeChanged(DocumentEvent)
+ */
+ protected void fireDocumentAboutToBeChanged(DocumentEvent event) {
+ super.fireDocumentAboutToBeChanged(event);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.AbstractDocument#fireDocumentChanged(DocumentEvent)
+ */
+ protected void fireDocumentChanged(DocumentEvent event) {
+ try {
+ // TODO: move to a better place
+ getTracker().replace(event.getOffset(), event.getLength(),
+ event.getText());
+ } catch (BadLocationException x) {
+ }
+
+ super.fireDocumentChanged(event);
+ }
+
+ /*
+ * @see net.sf.wdte.text.rules.IDocumentView#getParentOffset(int)
+ */
+ public int getParentOffset(int localOffset) {
+ return localOffset + range.offset;
+ }
+
+ /*
+ * @see net.sf.wdte.text.rules.IDocumentView#getLocalOffset(int)
+ */
+ public int getLocalOffset(int parentOffset) {
+ return parentOffset - range.offset;
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java
index b33b381..c51a4aa 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: MultiViewPartitioner.java,v 1.9 2005-05-13 20:17:31 axelcl Exp $
+ * $Id: MultiViewPartitioner.java,v 1.10 2006-10-21 23:13:53 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.text.rules;
@@ -29,723 +29,778 @@ import org.eclipse.jface.text.TypedRegion;
import org.eclipse.jface.text.rules.IPartitionTokenScanner;
/**
- * Advanced partitioner which maintains partitions as views to connected document. Views have own partitioners themselves. This
- * class is designed as a base for complex partitioners such as for JSP, PHP, ASP, etc. languages.
+ * Advanced partitioner which maintains partitions as views to connected
+ * document. Views have own partitioners themselves. This class is designed as a
+ * base for complex partitioners such as for JSP, PHP, ASP, etc. languages.
*
* @author Igor Malinin
*/
public abstract class MultiViewPartitioner extends AbstractPartitioner {
- class ViewListener implements IDocumentPartitioningListener, IDocumentPartitioningListenerExtension {
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioningListener#documentPartitioningChanged(IDocument)
- */
- public void documentPartitioningChanged(IDocument document) {
- IDocumentView view = (IDocumentView) document;
-
- int start = view.getParentOffset(0);
- int end = view.getParentOffset(view.getLength());
-
- rememberRegion(start, end - start);
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioningListenerExtension#documentPartitioningChanged(IDocument, IRegion)
- */
- public void documentPartitioningChanged(IDocument document, IRegion region) {
- IDocumentView view = (IDocumentView) document;
-
- int offset = region.getOffset();
-
- int start = view.getParentOffset(offset);
- int end = view.getParentOffset(offset + region.getLength());
-
- rememberRegion(start, end - start);
- }
- }
-
- private ViewListener viewListener = new ViewListener();
-
- private OuterDocumentView outerDocument;
-
- private DocumentEvent outerDocumentEvent;
-
- public MultiViewPartitioner(IPartitionTokenScanner scanner) {
- super(scanner);
- }
-
- public void setOuterPartitioner(IDocumentPartitioner partitioner) {
- if (outerDocument == null) {
- if (partitioner == null) {
- return;
- }
-
- outerDocument = new OuterDocumentView(document, nodes);
- outerDocument.addDocumentPartitioningListener(viewListener);
- }
-
- IDocumentPartitioner old = outerDocument.getDocumentPartitioner();
- if (old != null) {
- outerDocument.setDocumentPartitioner(null);
- old.disconnect();
- }
-
- if (partitioner != null) {
- partitioner.connect(outerDocument);
- }
-
- outerDocument.setDocumentPartitioner(partitioner);
-
- if (partitioner == null) {
- outerDocument.removeDocumentPartitioningListener(viewListener);
- outerDocument = null;
- }
- }
-
- /**
- * Create subpartitioner.
- *
- * @param contentType
- * name of inner partition or null for outer partition
- */
- protected abstract IDocumentPartitioner createPartitioner(String contentType);
-
- protected void addInnerRegion(FlatNode position) {
- if (outerDocument != null) {
- if (DEBUG) {
- Assert.isTrue(position.offset >= 0, Integer.toString(position.offset));
- }
- int outerOffset = outerDocument.getLocalOffset(position.offset);
- // axelcl start
- DocumentEvent event = null;
- if (outerOffset >= 0) {
- // axelcl end
- event = new DocumentEvent(outerDocument, outerOffset, position.length, null);
-
- outerDocument.fireDocumentAboutToBeChanged(event);
- }
- super.addInnerRegion(position);
- // axelcl start
- if (event != null) {
- // axelcl end
- outerDocument.fireDocumentChanged(event);
- }
- } else {
- super.addInnerRegion(position);
- }
-
- if (position instanceof ViewNode) {
- // TODO: revisit condition
- IDocumentPartitioner partitioner = createPartitioner(position.type);
- if (partitioner != null) {
- InnerDocumentView innerDocument = new InnerDocumentView(document, (ViewNode) position);
-
- ((ViewNode) position).view = innerDocument;
-
- partitioner.connect(innerDocument);
- innerDocument.setDocumentPartitioner(partitioner);
- innerDocument.addDocumentPartitioningListener(viewListener);
- }
- }
- }
-
- protected void removeInnerRegion(FlatNode position) {
- try {
- if (outerDocument != null) {
- DocumentEvent event = null;
- if (position.offset >= 0 && position.length >= 0) {
- int outerOffset = outerDocument.getLocalOffset(position.offset);
- if (outerOffset > 0) {
- event = new DocumentEvent(outerDocument, outerOffset, 0, document.get(position.offset, position.length));
-
- outerDocument.fireDocumentAboutToBeChanged(event);
- }
- }
- super.removeInnerRegion(position);
- if (position.offset >= 0) {
- if (event != null) {
- outerDocument.fireDocumentChanged(event);
- }
- }
- } else {
- super.removeInnerRegion(position);
- }
-
- if (position instanceof ViewNode) {
- // TODO: revisit condition
- InnerDocumentView innerDocument = ((ViewNode) position).view;
- if (innerDocument != null) {
- IDocumentPartitioner partitioner = innerDocument.getDocumentPartitioner();
-
- innerDocument.removeDocumentPartitioningListener(viewListener);
- innerDocument.setDocumentPartitioner(null);
- partitioner.disconnect();
- }
- }
- } catch (BadLocationException e) {
- }
- }
-
- protected void deleteInnerRegion(FlatNode position) {
- super.deleteInnerRegion(position);
-
- if (position instanceof ViewNode) {
- // TODO: revisit condition
- InnerDocumentView innerDocument = ((ViewNode) position).view;
- if (innerDocument != null) {
- IDocumentPartitioner partitioner = innerDocument.getDocumentPartitioner();
-
- innerDocument.removeDocumentPartitioningListener(viewListener);
- innerDocument.setDocumentPartitioner(null);
- partitioner.disconnect();
- }
- }
- }
-
- public void connect(IDocument document) {
- // outerDocument = new OuterDocumentView(document, innerPositions);
-
- super.connect(document);
-
- setOuterPartitioner(createPartitioner(null));
- // IDocumentPartitioner partitioner =
- // partitioner.connect(outerDocument);
- // outerDocument.setDocumentPartitioner(partitioner);
- // outerDocument.addDocumentPartitioningListener(viewListener);
- }
-
- public void disconnect() {
- try {
- if (outerDocument != null) {
- outerDocument.removeDocumentPartitioningListener(viewListener);
-
- IDocumentPartitioner partitioner = outerDocument.getDocumentPartitioner();
-
- outerDocument.setDocumentPartitioner(null);
- partitioner.disconnect();
- }
- } finally {
- // TODO: cleanup listeners
- outerDocument = null;
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- super.documentAboutToBeChanged(event);
-
- outerDocumentEvent = null;
-
- int offset = event.getOffset();
- int length = event.getLength();
- int end = offset + length;
-
- // find left partition
- int first = computeFlatNodeIndex(offset);
- if (first > 0) {
- FlatNode p = (FlatNode) nodes.get(first - 1);
-
- int right = p.offset + p.length;
- if (offset < right) {
- // change overlaps with partition
- InnerDocumentView innerDocument = null;
- if (p instanceof ViewNode) {
- // TODO: revisit condition
- innerDocument = ((ViewNode) p).view;
- }
-
- if (end < right) {
- if (innerDocument != null) {
- // cahnge completely inside partition
- int start = innerDocument.getLocalOffset(offset);
- innerDocument.fireDocumentAboutToBeChanged(new DocumentEvent(innerDocument, start, length, event.getText()));
- }
-
- return;
- }
-
- if (innerDocument != null) {
- // cut partition at right
- int start = innerDocument.getLocalOffset(offset);
- innerDocument.fireDocumentAboutToBeChanged(new DocumentEvent(innerDocument, start, innerDocument.getLength() - start,
- null));
- }
- }
- }
-
- // find right partition
- int last = computeFlatNodeIndex(end);
- if (last > 0) {
- FlatNode p = (FlatNode) nodes.get(last - 1);
-
- if (p instanceof ViewNode) {
- // TODO: revisit condition
- InnerDocumentView innerDocument = ((ViewNode) p).view;
- if (innerDocument != null) {
- int right = p.offset + p.length;
- if (end < right) {
- // cut partition at left
- int cut = innerDocument.getLocalOffset(end);
- innerDocument.fireDocumentAboutToBeChanged(new DocumentEvent(innerDocument, 0, cut, null));
- }
- }
- }
- }
-
- if (outerDocument != null) {
- int left = outerDocument.getLocalOffset(offset);
- int right = outerDocument.getLocalOffset(end);
-
- String text = event.getText();
-
- if (left >= 0 && (right - left >= 0)) {
- if (left != right || text != null && text.length() > 0) {
- outerDocumentEvent = new DocumentEvent(outerDocument, left, right - left, text);
-
- outerDocument.fireDocumentAboutToBeChanged(outerDocumentEvent);
- }
- }
- }
- }
-
- protected int fixupPartitions(DocumentEvent event) {
- int offset = event.getOffset();
- int length = event.getLength();
- int end = offset + length;
-
- // fixup/notify inner views laying on change boundaries
-
- int first = computeFlatNodeIndex(offset);
- if (first > 0) {
- FlatNode p = (FlatNode) nodes.get(first - 1);
-
- int right = p.offset + p.length;
- if (offset < right) {
- // change overlaps with partition
- if (end < right) {
- // cahnge completely inside partition
- String text = event.getText();
- p.length -= length;
- if (text != null) {
- p.length += text.length();
- }
-
- if (p instanceof ViewNode) {
- // TODO: revisit condition
- InnerDocumentView innerDocument = ((ViewNode) p).view;
- if (innerDocument != null) {
- int start = innerDocument.getLocalOffset(offset);
- innerDocument.fireDocumentChanged(new DocumentEvent(innerDocument, start, length, text));
- }
- }
- } else {
- // cut partition at right
- int cut = p.offset + p.length - offset;
- p.length -= cut;
-
- if (p instanceof ViewNode) {
- // TODO: revisit condition
- InnerDocumentView innerDocument = ((ViewNode) p).view;
- if (innerDocument != null) {
- int start = innerDocument.getLocalOffset(offset);
- // TODO: ???fireDocumentAboutToBeChanged???
- innerDocument.fireDocumentChanged(new DocumentEvent(innerDocument, start, cut, null));
- }
- }
- }
- }
- }
-
- int last = computeFlatNodeIndex(end);
- if (last > 0 && first != last) {
- FlatNode p = (FlatNode) nodes.get(last - 1);
-
- int right = p.offset + p.length;
- if (end < right) {
- // cut partition at left
- int cut = end - p.offset;
- p.length -= cut;
- p.offset = offset;
-
- String text = event.getText();
- if (text != null) {
- p.offset += text.length();
- }
-
- if (p instanceof ViewNode) {
- // TODO: revisit condition
- InnerDocumentView innerDocument = ((ViewNode) p).view;
- if (innerDocument != null) {
- // TODO: ???fireDocumentAboutToBeChanged???
- innerDocument.fireDocumentChanged(new DocumentEvent(innerDocument, 0, cut, null));
- }
- }
-
- --last;
- }
- }
-
- // fixup inner views laying afrer change
-
- String text = event.getText();
- if (text != null) {
- length -= text.length();
- }
-
- for (int i = last, size = nodes.size(); i < size; i++) {
- ((FlatNode) nodes.get(i)).offset -= length;
- }
-
- // delete inner views laying completely inside change boundaries
-
- if (first < last) {
- do {
- deleteInnerRegion((FlatNode) nodes.get(--last));
- } while (first < last);
-
- rememberRegion(offset, 0);
- }
-
- // notify outer view
-
- if (outerDocumentEvent != null) {
- outerDocument.fireDocumentChanged(outerDocumentEvent);
- }
-
- return first;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#computePartitioning(int, int)
- */
- protected String getContentType(String parent, String view) {
- if (view != null) {
- return view;
- }
-
- if (parent != null) {
- return parent;
- }
-
- return IDocument.DEFAULT_CONTENT_TYPE;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#computePartitioning(int, int)
- */
- public ITypedRegion[] computePartitioning(int offset, int length) {
- List list = new ArrayList();
-// if (DEBUG) {
-// if (length>=9400) {
-// length--;
-// }
-// System.out.print("MultiViewPartitioner::computePartitioning - Offset: ");
-// System.out.print(offset);
-// System.out.print(", Length: ");
-// System.out.print(length);
-// System.out.println("");
-// }
- int end = offset + length;
-
- int index = computeFlatNodeIndex(offset);
- while (true) {
- FlatNode prev = (index > 0) ? (FlatNode) nodes.get(index - 1) : null;
-
- if (prev != null) {
- if (prev.overlapsWith(offset, length)) {
- addInnerPartitions(list, offset, length, prev);
- }
-
- if (end <= prev.offset + prev.length) {
- break;
- }
- }
-
- FlatNode next = (index < nodes.size()) ? (FlatNode) nodes.get(index) : null;
-
- if (next == null || offset < next.offset) {
- addOuterPartitions(list, offset, length, prev, next);
- }
-
- if (next == null) {
- break;
- }
-
- ++index;
- }
- // if (DEBUG) {
- // showList(list);
- // }
-
- return (TypedRegion[]) list.toArray(new TypedRegion[list.size()]);
- }
-
- private void showList(List list) {
- try {
- throw new NullPointerException();
- } catch (Exception e) {
- e.printStackTrace();
- }
- System.out.println(">>>>>List start");
- TypedRegion temp;
- for (int i = 0; i < list.size(); i++) {
- temp = (TypedRegion) list.get(i);
- System.out.print("Offset: ");
- System.out.print(temp.getOffset());
- System.out.print(", Length: ");
- System.out.print(temp.getLength());
- System.out.print(", Type: ");
- System.out.print(temp.getType());
- System.out.println("");
- }
- System.out.println("<<<<= 0) {
- ITypedRegion[] regions = null;
- try {
- regions = outerDocument.computePartitioning(start, len);
- } catch (Exception e) {
- // nasty workaround, which prevents cursor from moveing backwards in the editor
- // but doesn't solve the partitioning problem
- regions = new ITypedRegion[0];
- System.out.println("MultiViewerPartitioner#addOuterPartitions failure\n"+"start:"+start +" length:" +len+"\n"+outerDocument.get(start,len));
- }
- for (int i = 0; i < regions.length; i++) {
- ITypedRegion region = regions[i];
-
- // convert back to parent offsets
- start = outerDocument.getParentOffset(region.getOffset());
- end = start + region.getLength();
-
- if (prev != null) {
- offset = prev.offset + prev.length;
- if (start < offset) {
- start = offset;
- }
- }
-
- if (next != null) {
- offset = next.offset;
- if (offset < end) {
- end = offset;
- }
- }
- // if (DEBUG) {
- // if (end - start<0) {
- // showList(list);
- // System.out.print("MultiViewPartitioner::addOuterPartitions - Offset: ");
- // System.out.print(offset);
- // System.out.print(", Start: ");
- // System.out.print(start);
- // System.out.print(", End: ");
- // System.out.print(end);
- // System.out.print(", Type: ");
- // System.out.print(region.getType());
- // System.out.println("");
- // throw new IndexOutOfBoundsException();
- // }
- // }
- list.add(new TypedRegion(start, end - start, getContentType(null, region.getType())));
- }
- }
- } catch (BadLocationException x) {
- }
- }
-
- private void addInnerPartitions(List list, int offset, int length, FlatNode position) {
- InnerDocumentView innerDocument = null;
- if (position instanceof ViewNode) {
- // TODO: revisit condition
- innerDocument = ((ViewNode) position).view;
- }
-
- if (innerDocument == null) {
- // simple partition
- // if (DEBUG) {
- // if (position.length<0) {
- // throw new IndexOutOfBoundsException();
- // }
- // }
- list.add(new TypedRegion(position.offset, position.length, getContentType(position.type, null)));
- return;
- }
-
- // multiplexing to inner view
- try {
- // limit region
- int start = Math.max(offset, position.offset);
- int end = Math.min(offset + length, position.offset + position.length);
-
- // convert to document offsets
- length = end - start;
- offset = innerDocument.getLocalOffset(start);
-
- ITypedRegion[] regions = innerDocument.computePartitioning(offset, length);
-
- for (int i = 0; i < regions.length; i++) {
- ITypedRegion region = regions[i];
-
- // convert back to parent offsets
- offset = innerDocument.getParentOffset(region.getOffset());
- length = region.getLength();
- // if (DEBUG) {
- // if (length<0) {
- // throw new IndexOutOfBoundsException();
- // }
- // }
- list.add(new TypedRegion(offset, length, getContentType(position.type, region.getType())));
- }
- } catch (BadLocationException x) {
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentPartitioner#getPartition(int)
- */
- public ITypedRegion getPartition(int offset) {
- if (nodes.size() == 0) {
- return getOuterPartition(offset, null, null);
- }
-
- int index = computeFlatNodeIndex(offset);
- if (index < nodes.size()) {
- FlatNode next = (FlatNode) nodes.get(index);
-
- if (offset == next.offset) {
- return getInnerPartition(offset, next);
- }
-
- if (index == 0) {
- return getOuterPartition(offset, null, next);
- }
-
- FlatNode prev = (FlatNode) nodes.get(index - 1);
-
- if (prev.includes(offset)) {
- return getInnerPartition(offset, prev);
- }
-
- return getOuterPartition(offset, prev, next);
- }
-
- FlatNode prev = (FlatNode) nodes.get(nodes.size() - 1);
-
- if (prev.includes(offset)) {
- return getInnerPartition(offset, prev);
- }
-
- return getOuterPartition(offset, prev, null);
- }
-
- protected ITypedRegion getOuterPartition(int offset, FlatNode prev, FlatNode next) {
- try {
- int start, end;
- String type;
-
- if (outerDocument == null) {
- start = 0;
- end = document.getLength();
- type = getContentType(null, IDocument.DEFAULT_CONTENT_TYPE);
- } else {
- int outerOffset = outerDocument.getLocalOffset(offset);
- //axelcl start
- if (outerOffset < 0) {
- start = 0;
- end = document.getLength();
- type = getContentType(null, IDocument.DEFAULT_CONTENT_TYPE);
- } else {
- // axelcl end
- ITypedRegion region = outerDocument.getPartition(outerOffset);
-
- start = region.getOffset();
- end = start + region.getLength();
-
- // convert to parent offset
- start = outerDocument.getParentOffset(start);
- end = outerDocument.getParentOffset(end);
-
- type = getContentType(null, region.getType());
- }
- }
-
- if (prev != null) {
- offset = prev.offset + prev.length;
- if (start < offset) {
- start = offset;
- }
- }
-
- if (next != null) {
- offset = next.offset;
- if (offset < end) {
- end = offset;
- }
- }
-
- return new TypedRegion(start, end - start, type);
- } catch (BadLocationException x) {
- x.printStackTrace();
- throw new IllegalArgumentException();
- }
- }
-
- protected ITypedRegion getInnerPartition(int offset, FlatNode position) {
- if (position instanceof ViewNode) {
- // TODO: revisit condition
- InnerDocumentView innerDocument = ((ViewNode) position).view;
-
- if (innerDocument != null) {
- // multiplexing to inner view
- try {
- // convert to inner offset
- ITypedRegion region = innerDocument.getPartition(innerDocument.getLocalOffset(offset));
-
- // convert to parent offset
- offset = innerDocument.getParentOffset(region.getOffset());
-
- return new TypedRegion(offset, region.getLength(), getContentType(position.type, region.getType()));
- } catch (BadLocationException x) {
- }
- }
- }
-
- // simple partition
- return new TypedRegion(position.offset, position.length, position.type);
- }
+ class ViewListener implements IDocumentPartitioningListener,
+ IDocumentPartitioningListenerExtension {
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioningListener#documentPartitioningChanged(IDocument)
+ */
+ public void documentPartitioningChanged(IDocument document) {
+ IDocumentView view = (IDocumentView) document;
+
+ int start = view.getParentOffset(0);
+ int end = view.getParentOffset(view.getLength());
+
+ rememberRegion(start, end - start);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioningListenerExtension#documentPartitioningChanged(IDocument,
+ * IRegion)
+ */
+ public void documentPartitioningChanged(IDocument document,
+ IRegion region) {
+ IDocumentView view = (IDocumentView) document;
+
+ int offset = region.getOffset();
+
+ int start = view.getParentOffset(offset);
+ int end = view.getParentOffset(offset + region.getLength());
+
+ rememberRegion(start, end - start);
+ }
+ }
+
+ private ViewListener viewListener = new ViewListener();
+
+ private OuterDocumentView outerDocument;
+
+ private DocumentEvent outerDocumentEvent;
+
+ public MultiViewPartitioner(IPartitionTokenScanner scanner) {
+ super(scanner);
+ }
+
+ public void setOuterPartitioner(IDocumentPartitioner partitioner) {
+ if (outerDocument == null) {
+ if (partitioner == null) {
+ return;
+ }
+
+ outerDocument = new OuterDocumentView(document, nodes);
+ outerDocument.addDocumentPartitioningListener(viewListener);
+ }
+
+ IDocumentPartitioner old = outerDocument.getDocumentPartitioner();
+ if (old != null) {
+ outerDocument.setDocumentPartitioner(null);
+ old.disconnect();
+ }
+
+ if (partitioner != null) {
+ partitioner.connect(outerDocument);
+ }
+
+ outerDocument.setDocumentPartitioner(partitioner);
+
+ if (partitioner == null) {
+ outerDocument.removeDocumentPartitioningListener(viewListener);
+ outerDocument = null;
+ }
+ }
+
+ /**
+ * Create subpartitioner.
+ *
+ * @param contentType
+ * name of inner partition or null for outer
+ * partition
+ */
+ protected abstract IDocumentPartitioner createPartitioner(String contentType);
+
+ protected void addInnerRegion(FlatNode position) {
+ if (outerDocument != null) {
+ if (DEBUG) {
+ Assert.isTrue(position.offset >= 0, Integer
+ .toString(position.offset));
+ }
+ int outerOffset = outerDocument.getLocalOffset(position.offset);
+ // axelcl start
+ DocumentEvent event = null;
+ if (outerOffset >= 0) {
+ // axelcl end
+ event = new DocumentEvent(outerDocument, outerOffset,
+ position.length, null);
+
+ outerDocument.fireDocumentAboutToBeChanged(event);
+ }
+ super.addInnerRegion(position);
+ // axelcl start
+ if (event != null) {
+ // axelcl end
+ outerDocument.fireDocumentChanged(event);
+ }
+ } else {
+ super.addInnerRegion(position);
+ }
+
+ if (position instanceof ViewNode) {
+ // TODO: revisit condition
+ IDocumentPartitioner partitioner = createPartitioner(position.type);
+ if (partitioner != null) {
+ InnerDocumentView innerDocument = new InnerDocumentView(
+ document, (ViewNode) position);
+
+ ((ViewNode) position).view = innerDocument;
+
+ partitioner.connect(innerDocument);
+ innerDocument.setDocumentPartitioner(partitioner);
+ innerDocument.addDocumentPartitioningListener(viewListener);
+ }
+ }
+ }
+
+ protected void removeInnerRegion(FlatNode position) {
+ try {
+ if (outerDocument != null) {
+ DocumentEvent event = null;
+ if (position.offset >= 0 && position.length >= 0) {
+ int outerOffset = outerDocument
+ .getLocalOffset(position.offset);
+ if (outerOffset > 0) {
+ event = new DocumentEvent(outerDocument, outerOffset,
+ 0, document.get(position.offset,
+ position.length));
+
+ outerDocument.fireDocumentAboutToBeChanged(event);
+ }
+ }
+ super.removeInnerRegion(position);
+ if (position.offset >= 0) {
+ if (event != null) {
+ outerDocument.fireDocumentChanged(event);
+ }
+ }
+ } else {
+ super.removeInnerRegion(position);
+ }
+
+ if (position instanceof ViewNode) {
+ // TODO: revisit condition
+ InnerDocumentView innerDocument = ((ViewNode) position).view;
+ if (innerDocument != null) {
+ IDocumentPartitioner partitioner = innerDocument
+ .getDocumentPartitioner();
+
+ innerDocument
+ .removeDocumentPartitioningListener(viewListener);
+ innerDocument.setDocumentPartitioner(null);
+ partitioner.disconnect();
+ }
+ }
+ } catch (BadLocationException e) {
+ }
+ }
+
+ protected void deleteInnerRegion(FlatNode position) {
+ super.deleteInnerRegion(position);
+
+ if (position instanceof ViewNode) {
+ // TODO: revisit condition
+ InnerDocumentView innerDocument = ((ViewNode) position).view;
+ if (innerDocument != null) {
+ IDocumentPartitioner partitioner = innerDocument
+ .getDocumentPartitioner();
+
+ innerDocument.removeDocumentPartitioningListener(viewListener);
+ innerDocument.setDocumentPartitioner(null);
+ partitioner.disconnect();
+ }
+ }
+ }
+
+ public void connect(IDocument document) {
+ // outerDocument = new OuterDocumentView(document, innerPositions);
+
+ super.connect(document);
+
+ setOuterPartitioner(createPartitioner(null));
+ // IDocumentPartitioner partitioner =
+ // partitioner.connect(outerDocument);
+ // outerDocument.setDocumentPartitioner(partitioner);
+ // outerDocument.addDocumentPartitioningListener(viewListener);
+ }
+
+ public void disconnect() {
+ try {
+ if (outerDocument != null) {
+ outerDocument.removeDocumentPartitioningListener(viewListener);
+
+ IDocumentPartitioner partitioner = outerDocument
+ .getDocumentPartitioner();
+
+ outerDocument.setDocumentPartitioner(null);
+ partitioner.disconnect();
+ }
+ } finally {
+ // TODO: cleanup listeners
+ outerDocument = null;
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#documentAboutToBeChanged(DocumentEvent)
+ */
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ super.documentAboutToBeChanged(event);
+
+ outerDocumentEvent = null;
+
+ int offset = event.getOffset();
+ int length = event.getLength();
+ int end = offset + length;
+
+ // find left partition
+ int first = computeFlatNodeIndex(offset);
+ if (first > 0) {
+ FlatNode p = (FlatNode) nodes.get(first - 1);
+
+ int right = p.offset + p.length;
+ if (offset < right) {
+ // change overlaps with partition
+ InnerDocumentView innerDocument = null;
+ if (p instanceof ViewNode) {
+ // TODO: revisit condition
+ innerDocument = ((ViewNode) p).view;
+ }
+
+ if (end < right) {
+ if (innerDocument != null) {
+ // cahnge completely inside partition
+ int start = innerDocument.getLocalOffset(offset);
+ innerDocument
+ .fireDocumentAboutToBeChanged(new DocumentEvent(
+ innerDocument, start, length, event
+ .getText()));
+ }
+
+ return;
+ }
+
+ if (innerDocument != null) {
+ // cut partition at right
+ int start = innerDocument.getLocalOffset(offset);
+ innerDocument
+ .fireDocumentAboutToBeChanged(new DocumentEvent(
+ innerDocument, start, innerDocument
+ .getLength()
+ - start, null));
+ }
+ }
+ }
+
+ // find right partition
+ int last = computeFlatNodeIndex(end);
+ if (last > 0) {
+ FlatNode p = (FlatNode) nodes.get(last - 1);
+
+ if (p instanceof ViewNode) {
+ // TODO: revisit condition
+ InnerDocumentView innerDocument = ((ViewNode) p).view;
+ if (innerDocument != null) {
+ int right = p.offset + p.length;
+ if (end < right) {
+ // cut partition at left
+ int cut = innerDocument.getLocalOffset(end);
+ innerDocument
+ .fireDocumentAboutToBeChanged(new DocumentEvent(
+ innerDocument, 0, cut, null));
+ }
+ }
+ }
+ }
+
+ if (outerDocument != null) {
+ int left = outerDocument.getLocalOffset(offset);
+ int right = outerDocument.getLocalOffset(end);
+
+ String text = event.getText();
+
+ if (left >= 0 && (right - left >= 0)) {
+ if (left != right || text != null && text.length() > 0) {
+ outerDocumentEvent = new DocumentEvent(outerDocument, left,
+ right - left, text);
+
+ outerDocument
+ .fireDocumentAboutToBeChanged(outerDocumentEvent);
+ }
+ }
+ }
+ }
+
+ protected int fixupPartitions(DocumentEvent event) {
+ int offset = event.getOffset();
+ int length = event.getLength();
+ int end = offset + length;
+
+ // fixup/notify inner views laying on change boundaries
+
+ int first = computeFlatNodeIndex(offset);
+ if (first > 0) {
+ FlatNode p = (FlatNode) nodes.get(first - 1);
+
+ int right = p.offset + p.length;
+ if (offset < right) {
+ // change overlaps with partition
+ if (end < right) {
+ // cahnge completely inside partition
+ String text = event.getText();
+ p.length -= length;
+ if (text != null) {
+ p.length += text.length();
+ }
+
+ if (p instanceof ViewNode) {
+ // TODO: revisit condition
+ InnerDocumentView innerDocument = ((ViewNode) p).view;
+ if (innerDocument != null) {
+ int start = innerDocument.getLocalOffset(offset);
+ innerDocument
+ .fireDocumentChanged(new DocumentEvent(
+ innerDocument, start, length, text));
+ }
+ }
+ } else {
+ // cut partition at right
+ int cut = p.offset + p.length - offset;
+ p.length -= cut;
+
+ if (p instanceof ViewNode) {
+ // TODO: revisit condition
+ InnerDocumentView innerDocument = ((ViewNode) p).view;
+ if (innerDocument != null) {
+ int start = innerDocument.getLocalOffset(offset);
+ // TODO: ???fireDocumentAboutToBeChanged???
+ innerDocument
+ .fireDocumentChanged(new DocumentEvent(
+ innerDocument, start, cut, null));
+ }
+ }
+ }
+ }
+ }
+
+ int last = computeFlatNodeIndex(end);
+ if (last > 0 && first != last) {
+ FlatNode p = (FlatNode) nodes.get(last - 1);
+
+ int right = p.offset + p.length;
+ if (end < right) {
+ // cut partition at left
+ int cut = end - p.offset;
+ p.length -= cut;
+ p.offset = offset;
+
+ String text = event.getText();
+ if (text != null) {
+ p.offset += text.length();
+ }
+
+ if (p instanceof ViewNode) {
+ // TODO: revisit condition
+ InnerDocumentView innerDocument = ((ViewNode) p).view;
+ if (innerDocument != null) {
+ // TODO: ???fireDocumentAboutToBeChanged???
+ innerDocument.fireDocumentChanged(new DocumentEvent(
+ innerDocument, 0, cut, null));
+ }
+ }
+
+ --last;
+ }
+ }
+
+ // fixup inner views laying afrer change
+
+ String text = event.getText();
+ if (text != null) {
+ length -= text.length();
+ }
+
+ for (int i = last, size = nodes.size(); i < size; i++) {
+ ((FlatNode) nodes.get(i)).offset -= length;
+ }
+
+ // delete inner views laying completely inside change boundaries
+
+ if (first < last) {
+ do {
+ deleteInnerRegion((FlatNode) nodes.get(--last));
+ } while (first < last);
+
+ rememberRegion(offset, 0);
+ }
+
+ // notify outer view
+
+ if (outerDocumentEvent != null) {
+ outerDocument.fireDocumentChanged(outerDocumentEvent);
+ }
+
+ return first;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#computePartitioning(int,
+ * int)
+ */
+ protected String getContentType(String parent, String view) {
+ if (view != null) {
+ return view;
+ }
+
+ if (parent != null) {
+ return parent;
+ }
+
+ return IDocument.DEFAULT_CONTENT_TYPE;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#computePartitioning(int,
+ * int)
+ */
+ public ITypedRegion[] computePartitioning(int offset, int length) {
+ List list = new ArrayList();
+ // if (DEBUG) {
+ // if (length>=9400) {
+ // length--;
+ // }
+ // System.out.print("MultiViewPartitioner::computePartitioning - Offset:
+ // ");
+ // System.out.print(offset);
+ // System.out.print(", Length: ");
+ // System.out.print(length);
+ // System.out.println("");
+ // }
+ int end = offset + length;
+
+ int index = computeFlatNodeIndex(offset);
+ while (true) {
+ FlatNode prev = (index > 0) ? (FlatNode) nodes.get(index - 1)
+ : null;
+
+ if (prev != null) {
+ if (prev.overlapsWith(offset, length)) {
+ addInnerPartitions(list, offset, length, prev);
+ }
+
+ if (end <= prev.offset + prev.length) {
+ break;
+ }
+ }
+
+ FlatNode next = (index < nodes.size()) ? (FlatNode) nodes
+ .get(index) : null;
+
+ if (next == null || offset < next.offset) {
+ addOuterPartitions(list, offset, length, prev, next);
+ }
+
+ if (next == null) {
+ break;
+ }
+
+ ++index;
+ }
+ // if (DEBUG) {
+ // showList(list);
+ // }
+
+ return (TypedRegion[]) list.toArray(new TypedRegion[list.size()]);
+ }
+
+ private void showList(List list) {
+ try {
+ throw new NullPointerException();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.out.println(">>>>>List start");
+ TypedRegion temp;
+ for (int i = 0; i < list.size(); i++) {
+ temp = (TypedRegion) list.get(i);
+ System.out.print("Offset: ");
+ System.out.print(temp.getOffset());
+ System.out.print(", Length: ");
+ System.out.print(temp.getLength());
+ System.out.print(", Type: ");
+ System.out.print(temp.getType());
+ System.out.println("");
+ }
+ System.out.println("<<<<= 0) {
+ ITypedRegion[] regions = null;
+ try {
+ regions = outerDocument.computePartitioning(start, len);
+ } catch (Exception e) {
+ // nasty workaround, which prevents cursor from moveing
+ // backwards in the editor
+ // but doesn't solve the partitioning problem
+ regions = new ITypedRegion[0];
+ System.out
+ .println("MultiViewerPartitioner#addOuterPartitions failure\n"
+ + "start:"
+ + start
+ + " length:"
+ + len
+ + "\n" + outerDocument.get(start, len));
+ }
+ for (int i = 0; i < regions.length; i++) {
+ ITypedRegion region = regions[i];
+
+ // convert back to parent offsets
+ start = outerDocument.getParentOffset(region.getOffset());
+ end = start + region.getLength();
+
+ if (prev != null) {
+ offset = prev.offset + prev.length;
+ if (start < offset) {
+ start = offset;
+ }
+ }
+
+ if (next != null) {
+ offset = next.offset;
+ if (offset < end) {
+ end = offset;
+ }
+ }
+ // if (DEBUG) {
+ // if (end - start<0) {
+ // showList(list);
+ // System.out.print("MultiViewPartitioner::addOuterPartitions
+ // - Offset: ");
+ // System.out.print(offset);
+ // System.out.print(", Start: ");
+ // System.out.print(start);
+ // System.out.print(", End: ");
+ // System.out.print(end);
+ // System.out.print(", Type: ");
+ // System.out.print(region.getType());
+ // System.out.println("");
+ // throw new IndexOutOfBoundsException();
+ // }
+ // }
+ list.add(new TypedRegion(start, end - start,
+ getContentType(null, region.getType())));
+ }
+ }
+ } catch (BadLocationException x) {
+ }
+ }
+
+ private void addInnerPartitions(List list, int offset, int length,
+ FlatNode position) {
+ InnerDocumentView innerDocument = null;
+ if (position instanceof ViewNode) {
+ // TODO: revisit condition
+ innerDocument = ((ViewNode) position).view;
+ }
+
+ if (innerDocument == null) {
+ // simple partition
+ // if (DEBUG) {
+ // if (position.length<0) {
+ // throw new IndexOutOfBoundsException();
+ // }
+ // }
+ list.add(new TypedRegion(position.offset, position.length,
+ getContentType(position.type, null)));
+ return;
+ }
+
+ // multiplexing to inner view
+ try {
+ // limit region
+ int start = Math.max(offset, position.offset);
+ int end = Math.min(offset + length, position.offset
+ + position.length);
+
+ // convert to document offsets
+ length = end - start;
+ offset = innerDocument.getLocalOffset(start);
+
+ ITypedRegion[] regions = innerDocument.computePartitioning(offset,
+ length);
+
+ for (int i = 0; i < regions.length; i++) {
+ ITypedRegion region = regions[i];
+
+ // convert back to parent offsets
+ offset = innerDocument.getParentOffset(region.getOffset());
+ length = region.getLength();
+ // if (DEBUG) {
+ // if (length<0) {
+ // throw new IndexOutOfBoundsException();
+ // }
+ // }
+ list.add(new TypedRegion(offset, length, getContentType(
+ position.type, region.getType())));
+ }
+ } catch (BadLocationException x) {
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.text.IDocumentPartitioner#getPartition(int)
+ */
+ public ITypedRegion getPartition(int offset) {
+ if (nodes.size() == 0) {
+ return getOuterPartition(offset, null, null);
+ }
+
+ int index = computeFlatNodeIndex(offset);
+ if (index < nodes.size()) {
+ FlatNode next = (FlatNode) nodes.get(index);
+
+ if (offset == next.offset) {
+ return getInnerPartition(offset, next);
+ }
+
+ if (index == 0) {
+ return getOuterPartition(offset, null, next);
+ }
+
+ FlatNode prev = (FlatNode) nodes.get(index - 1);
+
+ if (prev.includes(offset)) {
+ return getInnerPartition(offset, prev);
+ }
+
+ return getOuterPartition(offset, prev, next);
+ }
+
+ FlatNode prev = (FlatNode) nodes.get(nodes.size() - 1);
+
+ if (prev.includes(offset)) {
+ return getInnerPartition(offset, prev);
+ }
+
+ return getOuterPartition(offset, prev, null);
+ }
+
+ protected ITypedRegion getOuterPartition(int offset, FlatNode prev,
+ FlatNode next) {
+ try {
+ int start, end;
+ String type;
+
+ if (outerDocument == null) {
+ start = 0;
+ end = document.getLength();
+ type = getContentType(null, IDocument.DEFAULT_CONTENT_TYPE);
+ } else {
+ int outerOffset = outerDocument.getLocalOffset(offset);
+ // axelcl start
+ if (outerOffset < 0) {
+ start = 0;
+ end = document.getLength();
+ type = getContentType(null, IDocument.DEFAULT_CONTENT_TYPE);
+ } else {
+ // axelcl end
+ ITypedRegion region = outerDocument
+ .getPartition(outerOffset);
+
+ start = region.getOffset();
+ end = start + region.getLength();
+
+ // convert to parent offset
+ start = outerDocument.getParentOffset(start);
+ end = outerDocument.getParentOffset(end);
+
+ type = getContentType(null, region.getType());
+ }
+ }
+
+ if (prev != null) {
+ offset = prev.offset + prev.length;
+ if (start < offset) {
+ start = offset;
+ }
+ }
+
+ if (next != null) {
+ offset = next.offset;
+ if (offset < end) {
+ end = offset;
+ }
+ }
+
+ return new TypedRegion(start, end - start, type);
+ } catch (BadLocationException x) {
+ x.printStackTrace();
+ throw new IllegalArgumentException();
+ }
+ }
+
+ protected ITypedRegion getInnerPartition(int offset, FlatNode position) {
+ if (position instanceof ViewNode) {
+ // TODO: revisit condition
+ InnerDocumentView innerDocument = ((ViewNode) position).view;
+
+ if (innerDocument != null) {
+ // multiplexing to inner view
+ try {
+ // convert to inner offset
+ ITypedRegion region = innerDocument
+ .getPartition(innerDocument.getLocalOffset(offset));
+
+ // convert to parent offset
+ offset = innerDocument.getParentOffset(region.getOffset());
+
+ return new TypedRegion(offset, region.getLength(),
+ getContentType(position.type, region.getType()));
+ } catch (BadLocationException x) {
+ }
+ }
+ }
+
+ // simple partition
+ return new TypedRegion(position.offset, position.length, position.type);
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/OuterDocumentView.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/OuterDocumentView.java
index d68b599..efb1284 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/OuterDocumentView.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/OuterDocumentView.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: OuterDocumentView.java,v 1.4 2004-11-12 20:15:58 axelcl Exp $
+ * $Id: OuterDocumentView.java,v 1.5 2006-10-21 23:13:53 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.text.rules;
@@ -149,52 +149,52 @@ public class OuterDocumentView extends AbstractDocument implements
setTextStore(new TextStore());
setLineTracker(new DefaultLineTracker());
int length = getLength();
- if (length<0) {
- length = 0;
+ if (length < 0) {
+ length = 0;
}
getTracker().set(getStore().get(0, length));
-
+
completeInitialization();
}
-// public void addRange(Position range) {
-// DocumentEvent event = new DocumentEvent(this,
-// getLocalOffset(range.offset), range.length, "");
-// fireDocumentAboutToBeChanged(event);
-// ranges.add(-getIndex(range) - 1, range);
-// fireDocumentChanged(event);
-// }
-//
-// public void removeRange(Position range) {
-// String text;
-// try {
-// text = parent.get(range.offset, range.length);
-// } catch (BadLocationException e) {
-// return;
-// }
-// DocumentEvent event = new DocumentEvent(this,
-// getLocalOffset(range.offset), 0, text);
-// fireDocumentAboutToBeChanged(event);
-// deleteRange(range);
-// fireDocumentChanged(event);
-// }
-//
-// public void deleteRange(Position range) {
-// ranges.remove(getIndex(range));
-// }
-//
-// private int getIndex(Position range) {
-// return Collections.binarySearch(ranges, range, new Comparator() {
-// public int compare(Object o1, Object o2) {
-// int offset1 = ((Position) o1).offset;
-// int offset2 = ((Position) o2).offset;
-//
-// if (offset1 < offset2) return -1;
-// if (offset1 > offset2) return 1;
-// return 0;
-// }
-// });
-// }
+ // public void addRange(Position range) {
+ // DocumentEvent event = new DocumentEvent(this,
+ // getLocalOffset(range.offset), range.length, "");
+ // fireDocumentAboutToBeChanged(event);
+ // ranges.add(-getIndex(range) - 1, range);
+ // fireDocumentChanged(event);
+ // }
+ //
+ // public void removeRange(Position range) {
+ // String text;
+ // try {
+ // text = parent.get(range.offset, range.length);
+ // } catch (BadLocationException e) {
+ // return;
+ // }
+ // DocumentEvent event = new DocumentEvent(this,
+ // getLocalOffset(range.offset), 0, text);
+ // fireDocumentAboutToBeChanged(event);
+ // deleteRange(range);
+ // fireDocumentChanged(event);
+ // }
+ //
+ // public void deleteRange(Position range) {
+ // ranges.remove(getIndex(range));
+ // }
+ //
+ // private int getIndex(Position range) {
+ // return Collections.binarySearch(ranges, range, new Comparator() {
+ // public int compare(Object o1, Object o2) {
+ // int offset1 = ((Position) o1).offset;
+ // int offset2 = ((Position) o2).offset;
+ //
+ // if (offset1 < offset2) return -1;
+ // if (offset1 > offset2) return 1;
+ // return 0;
+ // }
+ // });
+ // }
/*
* @see org.eclipse.jface.text.AbstractDocument#fireDocumentAboutToBeChanged(DocumentEvent)
@@ -212,7 +212,7 @@ public class OuterDocumentView extends AbstractDocument implements
getTracker().replace(event.getOffset(), event.getLength(),
event.getText());
} catch (IndexOutOfBoundsException x) {
-
+
} catch (BadLocationException x) {
}
@@ -250,7 +250,7 @@ public class OuterDocumentView extends AbstractDocument implements
* @see net.sf.wdte.text.rules.IDocumentView#getLocalOffset(int)
*/
public int getLocalOffset(int parentOffset) {
-// Assert.isTrue(parentOffset>=0);
+ // Assert.isTrue(parentOffset>=0);
int localOffset = parentOffset;
Iterator i = ranges.iterator();
@@ -269,12 +269,12 @@ public class OuterDocumentView extends AbstractDocument implements
localOffset -= range.length;
}
// TODO jsurfer change start - check this
- if (localOffset<0) {
- return 0;
- } else if (localOffset>getLength()) {
- return getLength();
- }
- // jsurfer change end
+ if (localOffset < 0) {
+ return 0;
+ } else if (localOffset > getLength()) {
+ return getLength();
+ }
+ // jsurfer change end
return localOffset;
}
}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/ViewNode.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/ViewNode.java
index 2b37763..ea79491 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/ViewNode.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/ViewNode.java
@@ -8,13 +8,13 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: ViewNode.java,v 1.2 2005-06-14 05:04:09 axelcl Exp $
+ * $Id: ViewNode.java,v 1.3 2006-10-21 23:13:53 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.text.rules;
/**
- * @author Igor Malinin
+ * @author Igor Malinin
*/
public class ViewNode extends FlatNode {
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/source/DefaultSourceViewerConfiguration.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/source/DefaultSourceViewerConfiguration.java
index 7e7309b..efbb61e 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/source/DefaultSourceViewerConfiguration.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/source/DefaultSourceViewerConfiguration.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: DefaultSourceViewerConfiguration.java,v 1.1 2004-09-02 18:26:32 jsurfer Exp $
+ * $Id: DefaultSourceViewerConfiguration.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.text.source;
@@ -23,12 +23,10 @@ import org.eclipse.jface.text.source.SourceViewerConfiguration;
public class DefaultSourceViewerConfiguration extends SourceViewerConfiguration {
/** Preference key used to look up display tab width. */
- public static final String PREFERENCE_TAB_WIDTH =
- "net.sourceforge.phpeclipse.ui.editor.tabWidth"; //$NON-NLS-1$
+ public static final String PREFERENCE_TAB_WIDTH = "net.sourceforge.phpeclipse.ui.editor.tabWidth"; //$NON-NLS-1$
/** Preference key for inserting spaces rather than tabs. */
- public static final String PREFERENCE_SPACES_FOR_TABS =
- "net.sourceforge.phpeclipse.ui.editor.spacesForTabs"; //$NON-NLS-1$
+ public static final String PREFERENCE_SPACES_FOR_TABS = "net.sourceforge.phpeclipse.ui.editor.spacesForTabs"; //$NON-NLS-1$
private IPreferenceStore store;
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/outline/ModelBasedOutlinePage.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/outline/ModelBasedOutlinePage.java
index 8f9fda4..4a4709e 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/outline/ModelBasedOutlinePage.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/outline/ModelBasedOutlinePage.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial implementation
*
- * $Id: ModelBasedOutlinePage.java,v 1.1 2004-09-02 18:26:28 jsurfer Exp $
+ * $Id: ModelBasedOutlinePage.java,v 1.2 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.views.outline;
@@ -40,8 +40,8 @@ import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
/**
*
*/
-public class ModelBasedOutlinePage extends ContentOutlinePage
- implements IUpdate {
+public class ModelBasedOutlinePage extends ContentOutlinePage implements
+ IUpdate {
// Inner Classes -----------------------------------------------------------
@@ -81,41 +81,42 @@ public class ModelBasedOutlinePage extends ContentOutlinePage
return model.getElements();
}
- /*
+ /*
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
}
/*
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer,
+ * Object, Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (oldInput != newInput) {
if (newInput instanceof ISourceModel) {
model = (ISourceModel) newInput;
- }
+ }
}
}
}
/**
- * This action toggles whether this outline page links its selection
- * to the active editor.
+ * This action toggles whether this outline page links its selection to the
+ * active editor.
*/
private class ToggleLinkingAction extends ResourceAction {
-
+
/**
* Constructs a new action.
*/
public ToggleLinkingAction() {
super(WebUIMessages.getResourceBundle(),
- "OutlinePage.linkWithEditor."); //$NON-NLS-1$
+ "OutlinePage.linkWithEditor."); //$NON-NLS-1$
if ((preferenceStore != null)
- && (linkWithEditorPreferenceKey != null)) {
- boolean checked = preferenceStore.getBoolean(
- linkWithEditorPreferenceKey);
+ && (linkWithEditorPreferenceKey != null)) {
+ boolean checked = preferenceStore
+ .getBoolean(linkWithEditorPreferenceKey);
valueChanged(checked, false);
} else {
setEnabled(false);
@@ -127,31 +128,32 @@ public class ModelBasedOutlinePage extends ContentOutlinePage
*/
public void run() {
if ((preferenceStore != null)
- && (linkWithEditorPreferenceKey != null)) {
+ && (linkWithEditorPreferenceKey != null)) {
valueChanged(isChecked(), true);
}
}
-
+
// Private Methods -----------------------------------------------------
/**
* Updates whether the outline page is linked to the active editor.
*
- * @param checked Whether linking is enabled
- * @param store Whether the new state should be written back as a
- * preference
+ * @param checked
+ * Whether linking is enabled
+ * @param store
+ * Whether the new state should be written back as a
+ * preference
*/
private void valueChanged(final boolean checked, boolean store) {
setChecked(checked);
BusyIndicator.showWhile(getTreeViewer().getControl().getDisplay(),
- new Runnable() {
- public void run() {
- editor.synchronizeOutlinePage();
- }
- });
+ new Runnable() {
+ public void run() {
+ editor.synchronizeOutlinePage();
+ }
+ });
if (store) {
- preferenceStore.setValue(
- linkWithEditorPreferenceKey, checked);
+ preferenceStore.setValue(linkWithEditorPreferenceKey, checked);
}
}
@@ -185,7 +187,8 @@ public class ModelBasedOutlinePage extends ContentOutlinePage
/**
* Constructor.
*
- * @param editor The associated structured text editor
+ * @param editor
+ * The associated structured text editor
*/
public ModelBasedOutlinePage(StructuredTextEditor editor) {
this.editor = editor;
@@ -214,10 +217,11 @@ public class ModelBasedOutlinePage extends ContentOutlinePage
}
/*
- * @see org.eclipse.ui.part.Page#makeContributions(IMenuManager, IToolBarManager, IStatusLineManager)
+ * @see org.eclipse.ui.part.Page#makeContributions(IMenuManager,
+ * IToolBarManager, IStatusLineManager)
*/
public void makeContributions(IMenuManager menuManager,
- IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
+ IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
if (toolBarManager != null) {
toolBarManager.add(new ToggleLinkingAction());
}
@@ -250,15 +254,15 @@ public class ModelBasedOutlinePage extends ContentOutlinePage
/**
* Selects a specific element in the outline page.
*
- * @param element the element to select
+ * @param element
+ * the element to select
*/
public void select(ISourceReference element) {
TreeViewer viewer = getTreeViewer();
if (viewer != null) {
ISelection selection = viewer.getSelection();
if (selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection =
- (IStructuredSelection) selection;
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
List elements = structuredSelection.toList();
if (!elements.contains(element)) {
if (element == null) {
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/outline/ProblemsLabelDecorator.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/outline/ProblemsLabelDecorator.java
index 60b2fd1..598ce41 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/outline/ProblemsLabelDecorator.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/outline/ProblemsLabelDecorator.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial implementation
*
- * $Id: ProblemsLabelDecorator.java,v 1.2 2005-03-06 21:09:52 axelcl Exp $
+ * $Id: ProblemsLabelDecorator.java,v 1.3 2006-10-21 23:13:54 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.views.outline;
@@ -35,140 +35,152 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.texteditor.ITextEditor;
/**
- * Label decorator for the outline page that adds error and warning overlay icons to elements in the outline. The information is
- * retrieved from the annotation model corresponding to the input of the associated text editor.
+ * Label decorator for the outline page that adds error and warning overlay
+ * icons to elements in the outline. The information is retrieved from the
+ * annotation model corresponding to the input of the associated text editor.
*/
-public class ProblemsLabelDecorator extends LabelProvider implements ILabelDecorator {
-
- // Constants ---------------------------------------------------------------
-
- private static final String ANNOTATION_TYPE_ERROR = "org.eclipse.ui.workbench.texteditor.error"; //$NON-NLS-1$
-
- private static final String ANNOTATION_TYPE_WARNING = "org.eclipse.ui.workbench.texteditor.warning"; //$NON-NLS-1$
-
- // Instance Variables ------------------------------------------------------
-
- /** The associated text editor if the decorator is used in the outline. */
- private ITextEditor editor;
-
- /** Registry of icons and overlay icons. */
- private ImageDescriptorRegistry registry = new ImageDescriptorRegistry();
-
- // Constructors ------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @param editor
- * the associated text editor
- */
- public ProblemsLabelDecorator(ITextEditor editor) {
- this.editor = editor;
- }
-
- // ILabelDecorator Implementation ------------------------------------------
-
- /*
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- super.dispose();
- registry.dispose();
- }
-
- /*
- * @see ILabelDecorator#decorateImage(Image, Object)
- */
- public Image decorateImage(Image image, Object element) {
- Annotation annotations[] = getAssociatedAnnotations((ISourceReference) element);
- ImageDescriptor overlay = null;
- for (int i = 0; i < annotations.length; i++) {
- if (isError(annotations[i])) {
- overlay = WebUI.getDefault().getImageRegistry().getDescriptor(WebUI.ICON_OVERLAY_ERROR);
- } else if (isWarning(annotations[i])) {
- overlay = WebUI.getDefault().getImageRegistry().getDescriptor(WebUI.ICON_OVERLAY_WARNING);
- }
- }
- if (overlay != null) {
- ImageDescriptor base = new ImageImageDescriptor(image);
- return registry.get(new OverlayImageDescriptor(base, new ImageDescriptor[][] { null, null, { overlay }, null }, null));
- } else {
- }
- return image;
- }
-
- /*
- * @see ILabelDecorator#decorateText(String, Object)
- */
- public String decorateText(String text, Object element) {
- return text;
- }
-
- // Private Methods ---------------------------------------------------------
-
- /**
- * Returns all annotations associated with the given model element.
- *
- * @param element
- * the model element for which annotations should be collected
- * @return an array containing all annotations for the given element, or an empty array if no annotations are found
- */
- private Annotation[] getAssociatedAnnotations(ISourceReference element) {
- List retVal = new ArrayList();
- if (editor != null) {
- IEditorInput input = editor.getEditorInput();
- IAnnotationModel model = editor.getDocumentProvider().getAnnotationModel(input);
- if (model != null) { // bug #1120670
- for (Iterator i = model.getAnnotationIterator(); i.hasNext();) {
- Annotation annotation = (Annotation) i.next();
- Position pos = model.getPosition(annotation);
- if (pos != null && isInside(pos.getOffset(), element)) {
- retVal.add(annotation);
- }
- }
- }
- }
- return (Annotation[]) retVal.toArray(new Annotation[retVal.size()]);
- }
-
- /**
- * Determines whether the given annotation is an error.
- *
- * @param annotation
- * the annotation to check
- * @return true if the annotation is to be displayed as an error, false otherwise
- */
- private boolean isError(Annotation annotation) {
- return ANNOTATION_TYPE_ERROR.equals(annotation.getType());
- }
-
- /**
- * Determines whether the given annotation is a warning.
- *
- * @param annotation
- * the annotation to check
- * @return true if the annotation is to be displayed as a warning, false otherwise
- */
- private boolean isWarning(Annotation annotation) {
- return ANNOTATION_TYPE_WARNING.equals(annotation.getType());
- }
-
- /**
- * Tests if the given position is inside the source region of a model element.
- *
- * @param pos
- * the position to be tested
- * @param element
- * the source element
- * @return boolean true if position is located inside the element, otherwise false
- */
- private boolean isInside(int pos, ISourceReference element) {
- IRegion region = element.getSourceRegion();
- if (region != null) {
- int offset = region.getOffset();
- return ((offset <= pos) && (offset + region.getLength() > pos));
- }
- return false;
- }
+public class ProblemsLabelDecorator extends LabelProvider implements
+ ILabelDecorator {
+
+ // Constants ---------------------------------------------------------------
+
+ private static final String ANNOTATION_TYPE_ERROR = "org.eclipse.ui.workbench.texteditor.error"; //$NON-NLS-1$
+
+ private static final String ANNOTATION_TYPE_WARNING = "org.eclipse.ui.workbench.texteditor.warning"; //$NON-NLS-1$
+
+ // Instance Variables ------------------------------------------------------
+
+ /** The associated text editor if the decorator is used in the outline. */
+ private ITextEditor editor;
+
+ /** Registry of icons and overlay icons. */
+ private ImageDescriptorRegistry registry = new ImageDescriptorRegistry();
+
+ // Constructors ------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param editor
+ * the associated text editor
+ */
+ public ProblemsLabelDecorator(ITextEditor editor) {
+ this.editor = editor;
+ }
+
+ // ILabelDecorator Implementation ------------------------------------------
+
+ /*
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ registry.dispose();
+ }
+
+ /*
+ * @see ILabelDecorator#decorateImage(Image, Object)
+ */
+ public Image decorateImage(Image image, Object element) {
+ Annotation annotations[] = getAssociatedAnnotations((ISourceReference) element);
+ ImageDescriptor overlay = null;
+ for (int i = 0; i < annotations.length; i++) {
+ if (isError(annotations[i])) {
+ overlay = WebUI.getDefault().getImageRegistry().getDescriptor(
+ WebUI.ICON_OVERLAY_ERROR);
+ } else if (isWarning(annotations[i])) {
+ overlay = WebUI.getDefault().getImageRegistry().getDescriptor(
+ WebUI.ICON_OVERLAY_WARNING);
+ }
+ }
+ if (overlay != null) {
+ ImageDescriptor base = new ImageImageDescriptor(image);
+ return registry.get(new OverlayImageDescriptor(base,
+ new ImageDescriptor[][] { null, null, { overlay }, null },
+ null));
+ } else {
+ }
+ return image;
+ }
+
+ /*
+ * @see ILabelDecorator#decorateText(String, Object)
+ */
+ public String decorateText(String text, Object element) {
+ return text;
+ }
+
+ // Private Methods ---------------------------------------------------------
+
+ /**
+ * Returns all annotations associated with the given model element.
+ *
+ * @param element
+ * the model element for which annotations should be collected
+ * @return an array containing all annotations for the given element, or an
+ * empty array if no annotations are found
+ */
+ private Annotation[] getAssociatedAnnotations(ISourceReference element) {
+ List retVal = new ArrayList();
+ if (editor != null) {
+ IEditorInput input = editor.getEditorInput();
+ IAnnotationModel model = editor.getDocumentProvider()
+ .getAnnotationModel(input);
+ if (model != null) { // bug #1120670
+ for (Iterator i = model.getAnnotationIterator(); i.hasNext();) {
+ Annotation annotation = (Annotation) i.next();
+ Position pos = model.getPosition(annotation);
+ if (pos != null && isInside(pos.getOffset(), element)) {
+ retVal.add(annotation);
+ }
+ }
+ }
+ }
+ return (Annotation[]) retVal.toArray(new Annotation[retVal.size()]);
+ }
+
+ /**
+ * Determines whether the given annotation is an error.
+ *
+ * @param annotation
+ * the annotation to check
+ * @return true if the annotation is to be displayed as an error,
+ * false otherwise
+ */
+ private boolean isError(Annotation annotation) {
+ return ANNOTATION_TYPE_ERROR.equals(annotation.getType());
+ }
+
+ /**
+ * Determines whether the given annotation is a warning.
+ *
+ * @param annotation
+ * the annotation to check
+ * @return true if the annotation is to be displayed as a
+ * warning, false otherwise
+ */
+ private boolean isWarning(Annotation annotation) {
+ return ANNOTATION_TYPE_WARNING.equals(annotation.getType());
+ }
+
+ /**
+ * Tests if the given position is inside the source region of a model
+ * element.
+ *
+ * @param pos
+ * the position to be tested
+ * @param element
+ * the source element
+ * @return boolean true if position is located inside the
+ * element, otherwise false
+ */
+ private boolean isInside(int pos, ISourceReference element) {
+ IRegion region = element.getSourceRegion();
+ if (region != null) {
+ int offset = region.getOffset();
+ return ((offset <= pos) && (offset + region.getLength() > pos));
+ }
+ return false;
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/ImageDescriptorRegistry.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/ImageDescriptorRegistry.java
index c3b15af..4b90d9a 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/ImageDescriptorRegistry.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/ImageDescriptorRegistry.java
@@ -9,7 +9,7 @@
* Christopher Lenz - initial implementation based on the internal Eclipse
* class of the same name, defined in multiple packages
*
- * $Id: ImageDescriptorRegistry.java,v 1.1 2004-09-02 18:26:28 jsurfer Exp $
+ * $Id: ImageDescriptorRegistry.java,v 1.2 2006-10-21 23:13:53 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.views.util;
@@ -41,30 +41,31 @@ public class ImageDescriptorRegistry {
* display, respectively.
*/
public ImageDescriptorRegistry() {
- this(Display.getCurrent() != null ?
- Display.getCurrent() : Display.getDefault());
+ this(Display.getCurrent() != null ? Display.getCurrent() : Display
+ .getDefault());
}
/**
* Creates a new image descriptor registry for the given display. All images
* managed by this registry will be disposed when the display gets disposed.
*
- * @param display the display the images managed by this registry are
- * allocated for
+ * @param display
+ * the display the images managed by this registry are allocated
+ * for
*/
public ImageDescriptorRegistry(Display display) {
display.disposeExec(new Runnable() {
public void run() {
dispose();
- }
+ }
});
}
-
+
/**
* Returns the image assiciated with the given image descriptor.
*
- * @param descriptor the image descriptor for which the registry manages an
- * image
+ * @param descriptor
+ * the image descriptor for which the registry manages an image
* @return the image associated with the image descriptor or null
* if the image descriptor can't create the requested image.
*/
@@ -84,12 +85,12 @@ public class ImageDescriptorRegistry {
/**
* Disposes all images managed by this registry.
- */
+ */
public void dispose() {
- for (Iterator i = registry.values().iterator(); i.hasNext(); ) {
+ for (Iterator i = registry.values().iterator(); i.hasNext();) {
((Image) i.next()).dispose();
}
registry.clear();
}
-
+
}
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/ImageImageDescriptor.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/ImageImageDescriptor.java
index e1af923..f10b11a 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/ImageImageDescriptor.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/ImageImageDescriptor.java
@@ -9,7 +9,7 @@
* Christopher Lenz - initial version based on the Eclipse class of the same
* name in org.eclipse.jdt.internal.ui.viewsupport
*
- * $Id: ImageImageDescriptor.java,v 1.1 2004-09-02 18:26:28 jsurfer Exp $
+ * $Id: ImageImageDescriptor.java,v 1.2 2006-10-21 23:13:53 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.views.util;
@@ -19,7 +19,8 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
/**
- * ImageDescriptor implementation that wraps an existing {@link Image}.
+ * ImageDescriptor implementation that wraps an existing
+ * {@link Image}.
*/
public class ImageImageDescriptor extends ImageDescriptor {
@@ -33,10 +34,11 @@ public class ImageImageDescriptor extends ImageDescriptor {
/**
* Constructor.
*
- * @param image the image to wrap
+ * @param image
+ * the image to wrap
*/
public ImageImageDescriptor(Image image) {
- this.image= image;
+ this.image = image;
}
// ImageDescriptor Implementation ------------------------------------------
diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/OverlayImageDescriptor.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/OverlayImageDescriptor.java
index e9e995a..fb1477d 100644
--- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/OverlayImageDescriptor.java
+++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/views/util/OverlayImageDescriptor.java
@@ -9,7 +9,7 @@
* Christopher Lenz - initial version based on the internal Eclipse class
* org.eclipse.ui.internal.ide.misc.OverlayIcon
*
- * $Id: OverlayImageDescriptor.java,v 1.1 2004-09-02 18:26:28 jsurfer Exp $
+ * $Id: OverlayImageDescriptor.java,v 1.2 2006-10-21 23:13:53 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.ui.views.util;
@@ -31,7 +31,7 @@ public class OverlayImageDescriptor extends CompositeImageDescriptor {
/** The base image. */
private ImageDescriptor base;
-
+
/** The overlay images. */
private ImageDescriptor overlays[][];
@@ -41,8 +41,10 @@ public class OverlayImageDescriptor extends CompositeImageDescriptor {
* Creates the image descriptor. The size of the resulting image will be the
* same as the size of the base image.
*
- * @param base the descriptor of the base image
- * @param overlays descriptors of the overlay images
+ * @param base
+ * the descriptor of the base image
+ * @param overlays
+ * descriptors of the overlay images
*/
public OverlayImageDescriptor(ImageDescriptor base,
ImageDescriptor[][] overlays) {
@@ -52,10 +54,13 @@ public class OverlayImageDescriptor extends CompositeImageDescriptor {
/**
* Creates the image descriptor.
*
- * @param base the descriptor of the base image
- * @param overlays descriptors of the overlay images
- * @param size the size of the composite image, or null to use the
- * size of the base image
+ * @param base
+ * the descriptor of the base image
+ * @param overlays
+ * descriptors of the overlay images
+ * @param size
+ * the size of the composite image, or null to use the
+ * size of the base image
*/
public OverlayImageDescriptor(ImageDescriptor base,
ImageDescriptor[][] overlays, Point size) {
@@ -63,14 +68,14 @@ public class OverlayImageDescriptor extends CompositeImageDescriptor {
this.overlays = overlays;
if (size == null) {
ImageData data = base.getImageData();
- size = new Point(data.width, data.height);
+ size = new Point(data.width, data.height);
}
this.size = size;
}
// CompositeImageDescriptor Implementation ---------------------------------
- /*
+ /*
* @see CompositeImageDescriptor#drawCompositeImage(int, int)
*/
protected void drawCompositeImage(int width, int height) {
@@ -95,7 +100,7 @@ public class OverlayImageDescriptor extends CompositeImageDescriptor {
}
}
- /*
+ /*
* @see CompositeImageDescriptor#getSize()
*/
protected Point getSize() {
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/ExtendedBrowser.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/ExtendedBrowser.java
index 349f98e..a1b23ba 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/ExtendedBrowser.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/ExtendedBrowser.java
@@ -1,10 +1,10 @@
/**
* Copyright (c) 2004 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
*/
@@ -14,12 +14,14 @@ import net.sourceforge.phpeclipse.webbrowser.internal.WebBrowser;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.Composite;
+
/**
- * Web browser widget. Extends the eclipse Browser widget by adding an
- * optional toolbar and statusbar.
+ * Web browser widget. Extends the eclipse Browser widget by adding an optional
+ * toolbar and statusbar.
*/
public class ExtendedBrowser extends WebBrowser {
- public ExtendedBrowser(Composite parent, final boolean showToolbar, final boolean showStatusbar) {
+ public ExtendedBrowser(Composite parent, final boolean showToolbar,
+ final boolean showStatusbar) {
super(parent, showToolbar, showStatusbar);
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IExternalWebBrowser.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IExternalWebBrowser.java
index e096266..18659dd 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IExternalWebBrowser.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IExternalWebBrowser.java
@@ -1,15 +1,16 @@
package net.sourceforge.phpeclipse.webbrowser;
+
/**
*
*/
public interface IExternalWebBrowser extends IWebBrowser {
public String getLocation();
-
+
public String getParameters();
-
+
public void delete();
-
+
public boolean isWorkingCopy();
-
+
public IExternalWebBrowserWorkingCopy getWorkingCopy();
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IExternalWebBrowserWorkingCopy.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IExternalWebBrowserWorkingCopy.java
index f33fff7..fb2a37a 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IExternalWebBrowserWorkingCopy.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IExternalWebBrowserWorkingCopy.java
@@ -1,4 +1,5 @@
package net.sourceforge.phpeclipse.webbrowser;
+
/**
*
*/
@@ -6,8 +7,8 @@ public interface IExternalWebBrowserWorkingCopy extends IExternalWebBrowser {
public void setName(String name);
public void setLocation(String location);
-
+
public void setParameters(String params);
-
+
public IExternalWebBrowser save();
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IInternalWebBrowser.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IInternalWebBrowser.java
index 9c996d2..0ca2336 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IInternalWebBrowser.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IInternalWebBrowser.java
@@ -1,13 +1,14 @@
package net.sourceforge.phpeclipse.webbrowser;
+
/**
*
*/
public interface IInternalWebBrowser extends IWebBrowser {
public boolean getUseNewPage();
-
+
public boolean getClearHistoryOnExit();
-
+
public boolean isWorkingCopy();
-
+
public IInternalWebBrowserWorkingCopy getWorkingCopy();
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IInternalWebBrowserWorkingCopy.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IInternalWebBrowserWorkingCopy.java
index 83ed611..18d2f2b 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IInternalWebBrowserWorkingCopy.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IInternalWebBrowserWorkingCopy.java
@@ -1,11 +1,12 @@
package net.sourceforge.phpeclipse.webbrowser;
+
/**
*
*/
public interface IInternalWebBrowserWorkingCopy extends IInternalWebBrowser {
public void setUseNewPage(boolean b);
-
+
public void setClearHistoryOnExit(boolean b);
-
+
public IInternalWebBrowser save();
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IURLMap.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IURLMap.java
index 3b18121..c58bc86 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IURLMap.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IURLMap.java
@@ -4,11 +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.phpeclipse.webbrowser;
+
/**
* Interface for mapping special URLs to other locations.
*/
@@ -16,7 +17,8 @@ public interface IURLMap {
/**
* Returns a mapped URL
*
- * @param url java.lang.String
+ * @param url
+ * java.lang.String
* @return java.lang.String
*/
public String getMappedURL(String url);
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IWebBrowser.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IWebBrowser.java
index 012458b..7d4ff17 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IWebBrowser.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IWebBrowser.java
@@ -1,6 +1,7 @@
package net.sourceforge.phpeclipse.webbrowser;
import java.net.URL;
+
/**
*
*/
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IWebBrowserEditorInput.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IWebBrowserEditorInput.java
index 58af19f..2663f7a 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IWebBrowserEditorInput.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/IWebBrowserEditorInput.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
*/
@@ -13,42 +13,41 @@ package net.sourceforge.phpeclipse.webbrowser;
import java.net.URL;
import org.eclipse.ui.IEditorInput;
+
/**
- * The editor input for the Web browser editor. If the
- * integrated Web browser exists for this platform, (and
- * the user has chosen to use it) this information will
- * be used to populate the Web browser. If not, this
- * information will be used to launch an external Web
- * browser.
+ * The editor input for the Web browser editor. If the integrated Web browser
+ * exists for this platform, (and the user has chosen to use it) this
+ * information will be used to populate the Web browser. If not, this
+ * information will be used to launch an external Web browser.
*/
public interface IWebBrowserEditorInput extends IEditorInput {
/**
- * Returns true if this page can reuse the browser that the
- * given input is being displayed in, or false if it should
- * open up in a new page.
- *
- * @param input net.sourceforge.phpeclipse.webbrowser.IWebBrowserEditorInput
+ * Returns true if this page can reuse the browser that the given input is
+ * being displayed in, or false if it should open up in a new page.
+ *
+ * @param input
+ * net.sourceforge.phpeclipse.webbrowser.IWebBrowserEditorInput
* @return boolean
*/
public boolean canReplaceInput(IWebBrowserEditorInput input);
/**
* Returns the url that should be displayed in the browser.
- *
+ *
* @return java.net.URL
*/
public URL getURL();
/**
* Returns true if the Web statusbar should be shown.
- *
+ *
* @return boolean
*/
public boolean isStatusbarVisible();
/**
* Returns true if the Web toolbar should be shown.
- *
+ *
* @return boolean
*/
public boolean isToolbarVisible();
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/OpenBrowserAction.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/OpenBrowserAction.java
index 67bc2c7..866b55a 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/OpenBrowserAction.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/OpenBrowserAction.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.phpeclipse.webbrowser;
import org.eclipse.jface.action.Action;
+
/**
* Action to open the Web browser.
*/
@@ -26,6 +27,8 @@ public class OpenBrowserAction extends Action {
* Implementation of method defined on IAction.
*/
public void run() {
- WebBrowser.openURL(new WebBrowserEditorInput(null, WebBrowserEditorInput.SHOW_ALL | WebBrowserEditorInput.FORCE_NEW_PAGE));
+ WebBrowser.openURL(new WebBrowserEditorInput(null,
+ WebBrowserEditorInput.SHOW_ALL
+ | WebBrowserEditorInput.FORCE_NEW_PAGE));
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/OpenBrowserWorkbenchAction.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/OpenBrowserWorkbenchAction.java
index 966d2e3..6991e19 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/OpenBrowserWorkbenchAction.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/OpenBrowserWorkbenchAction.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
*/
@@ -14,10 +14,12 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
/**
* Action to open the Web broswer.
*/
-public class OpenBrowserWorkbenchAction implements IWorkbenchWindowActionDelegate {
+public class OpenBrowserWorkbenchAction implements
+ IWorkbenchWindowActionDelegate {
/**
* OpenBrowserWorkbenchAction constructor comment.
*/
@@ -26,17 +28,21 @@ public class OpenBrowserWorkbenchAction implements IWorkbenchWindowActionDelegat
}
/**
- * Disposes this action delegate. The implementor should unhook any references
- * to itself so that garbage collection can occur.
+ * Disposes this action delegate. The implementor should unhook any
+ * references to itself so that garbage collection can occur.
*/
- public void dispose() { }
+ public void dispose() {
+ }
/**
- * Initializes this action delegate with the workbench window it will work in.
- *
- * @param window the window that provides the context for this delegate
+ * Initializes this action delegate with the workbench window it will work
+ * in.
+ *
+ * @param window
+ * the window that provides the context for this delegate
*/
- public void init(IWorkbenchWindow window) { }
+ public void init(IWorkbenchWindow window) {
+ }
/**
* Performs this action.
@@ -44,23 +50,31 @@ public class OpenBrowserWorkbenchAction implements IWorkbenchWindowActionDelegat
* This method is called when the delegating action has been triggered.
* Implement this method to do the actual work.
*
- *
- * @param action the action proxy that handles the presentation portion of the
- * action
+ *
+ * @param action
+ * the action proxy that handles the presentation portion of the
+ * action
*/
public void run(IAction action) {
- WebBrowser.openURL(new WebBrowserEditorInput(null, WebBrowserEditorInput.SHOW_ALL | WebBrowserEditorInput.FORCE_NEW_PAGE));
+ WebBrowser.openURL(new WebBrowserEditorInput(null,
+ WebBrowserEditorInput.SHOW_ALL
+ | WebBrowserEditorInput.FORCE_NEW_PAGE));
}
/**
- * Notifies this action delegate that the selection in the workbench has changed.
+ * Notifies this action delegate that the selection in the workbench has
+ * changed.
*
* Implementers can use this opportunity to change the availability of the
* action or to modify other presentation properties.
*
- *
- * @param action the action proxy that handles presentation portion of the action
- * @param selection the current selection in the workbench
+ *
+ * @param action
+ * the action proxy that handles presentation portion of the
+ * action
+ * @param selection
+ * the current selection in the workbench
*/
- public void selectionChanged(IAction action, ISelection selection) { }
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/WebBrowser.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/WebBrowser.java
index 9016046..69c82a7 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/WebBrowser.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/WebBrowser.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
*/
@@ -21,10 +21,10 @@ import net.sourceforge.phpeclipse.webbrowser.internal.WebBrowserUIPlugin;
import net.sourceforge.phpeclipse.webbrowser.internal.WebBrowserUtil;
import org.eclipse.swt.widgets.Display;
+
/**
- * The main interface to the internal Web browser. If allows
- * you to query the file types supported by the Web browser
- * and open a URL.
+ * The main interface to the internal Web browser. If allows you to query the
+ * file types supported by the Web browser and open a URL.
*/
public class WebBrowser {
/**
@@ -35,9 +35,9 @@ public class WebBrowser {
}
/**
- * Returns true if the internal Web browser is supported on this
- * platform and the user has chosen to use it.
- *
+ * Returns true if the internal Web browser is supported on this platform
+ * and the user has chosen to use it.
+ *
* @return boolean
*/
public static boolean isUsingInternalBrowser() {
@@ -45,22 +45,22 @@ public class WebBrowser {
}
/**
- * Display the given URL in a Web browser. If the user has chosen not
- * to use the internal browser, an external browser will be used. If
- * not, a browser in the current page will be reused if forceNewPage
- * is not true and the user preference is not set. Finally, showToolbar
- * will decide when the toolbar should be shown in the internal browser.
- *
+ * Display the given URL in a Web browser. If the user has chosen not to use
+ * the internal browser, an external browser will be used. If not, a browser
+ * in the current page will be reused if forceNewPage is not true and the
+ * user preference is not set. Finally, showToolbar will decide when the
+ * toolbar should be shown in the internal browser.
+ *
* @param input
*/
public static void openURL(final IWebBrowserEditorInput input) {
Trace.trace(Trace.FINEST, "openURL() " + input);
if (input == null)
return;
-
+
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- if (!isUsingInternalBrowser()){
+ if (!isUsingInternalBrowser()) {
IWebBrowser browser = getCurrentWebBrowser();
browser.openURL(input.getURL());
} else
@@ -107,8 +107,9 @@ public class WebBrowser {
/**
* Display the given URL in a Web browser.
- *
- * @param url java.net.URL
+ *
+ * @param url
+ * java.net.URL
*/
public static void openURL(URL url) {
IWebBrowser browser = getCurrentWebBrowser();
@@ -117,7 +118,8 @@ public class WebBrowser {
else {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- WebBrowserUtil.openError(WebBrowserUIPlugin.getResource("%errorNoBrowser"));
+ WebBrowserUtil.openError(WebBrowserUIPlugin
+ .getResource("%errorNoBrowser"));
}
});
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/WebBrowserEditorInput.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/WebBrowserEditorInput.java
index aeec7e4..1f4681f 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/WebBrowserEditorInput.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/WebBrowserEditorInput.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
*/
@@ -22,10 +22,12 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IElementFactory;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
+
/**
* The editor input for the integrated web browser.
*/
-public class WebBrowserEditorInput implements IWebBrowserEditorInput, IPersistableElement, IElementFactory {
+public class WebBrowserEditorInput implements IWebBrowserEditorInput,
+ IPersistableElement, IElementFactory {
// --- constants to pass into constructor ---
// if used, the toolbar will be available
@@ -42,7 +44,7 @@ public class WebBrowserEditorInput implements IWebBrowserEditorInput, IPersistab
// the page can reopen to the same URL after
// shutting down
public static final int SAVE_URL = 1 << 5;
-
+
// if used, the browser will be transient and will not appear
// in the most recently used file list, nor will it reopen after
// restarting Eclipse
@@ -51,12 +53,17 @@ public class WebBrowserEditorInput implements IWebBrowserEditorInput, IPersistab
public static final int SHOW_ALL = SHOW_TOOLBAR | SHOW_STATUSBAR;
private static final String ELEMENT_FACTORY_ID = "net.sourceforge.phpeclipse.webbrowser.elementFactory";
+
private static final String MEMENTO_URL = "url";
+
private static final String MEMENTO_STYLE = "style";
+
private static final String MEMENTO_ID = "id";
private URL url;
+
private int style;
+
private String id = null;
/**
@@ -98,13 +105,13 @@ public class WebBrowserEditorInput implements IWebBrowserEditorInput, IPersistab
public WebBrowserEditorInput(URL url, boolean b) {
this(url);
}
-
+
/**
- * Returns true if this page can reuse the browser that the
- * given input is being displayed in, or false if it should
- * open up in a new page.
- *
- * @param input net.sourceforge.phpeclipse.webbrowser.IWebBrowserEditorInput
+ * Returns true if this page can reuse the browser that the given input is
+ * being displayed in, or false if it should open up in a new page.
+ *
+ * @param input
+ * net.sourceforge.phpeclipse.webbrowser.IWebBrowserEditorInput
* @return boolean
*/
public boolean canReplaceInput(IWebBrowserEditorInput input) {
@@ -123,13 +130,15 @@ public class WebBrowserEditorInput implements IWebBrowserEditorInput, IPersistab
} else
return false;
}
-
+
/**
- * Creates an IElement from the state captured within
- * an IMemento.
- *
- * @param memento a memento containing the state for an element
- * @return an element, or null if the element could not be created
+ * Creates an IElement from the state captured within an
+ * IMemento.
+ *
+ * @param memento
+ * a memento containing the state for an element
+ * @return an element, or null if the element could not be
+ * created
*/
public IAdaptable createElement(IMemento memento) {
URL url2 = null;
@@ -142,26 +151,27 @@ public class WebBrowserEditorInput implements IWebBrowserEditorInput, IPersistab
int newStyle = SHOW_TOOLBAR | SHOW_STATUSBAR;
try {
newStyle = memento.getInteger(MEMENTO_STYLE).intValue();
-
+
if ((newStyle & SAVE_URL) != 0)
url = new URL(memento.getString(MEMENTO_URL));
} catch (Exception e) {
// could not determine the style
}
-
+
String id2 = null;
try {
id2 = memento.getString(MEMENTO_ID);
if (id2 != null && id2.length() < 1)
id2 = null;
- } catch (Exception e) { }
-
+ } catch (Exception e) {
+ }
+
return new WebBrowserEditorInput(url2, newStyle, id2);
}
-
+
/**
- * Indicates whether some other object is "equal to" this one.
- * In this case it means that the underlying IFolders are equal.
+ * Indicates whether some other object is "equal to" this one. In this case
+ * it means that the underlying IFolders are equal.
*/
public boolean equals(Object obj) {
if (this == obj)
@@ -169,23 +179,23 @@ public class WebBrowserEditorInput implements IWebBrowserEditorInput, IPersistab
if (!(obj instanceof WebBrowserEditorInput))
return false;
WebBrowserEditorInput other = (WebBrowserEditorInput) obj;
-
+
if (url != null && !url.equals(obj))
return false;
-
+
return canReplaceInput(other);
}
-
+
/**
- * Returns whether the editor input exists.
+ * Returns whether the editor input exists.
*
- * This method is primarily used to determine if an editor input should
- * appear in the "File Most Recently Used" menu. An editor input will appear
- * in the list until the return value of exists becomes
+ * This method is primarily used to determine if an editor input should
+ * appear in the "File Most Recently Used" menu. An editor input will appear
+ * in the list until the return value of exists becomes
* false or it drops off the bottom of the list.
- *
- * @return true if the editor input exists; false
- * otherwise
+ *
+ * @return true if the editor input exists;
+ * false otherwise
*/
public boolean exists() {
if ((style & TRANSIENT) != 0)
@@ -193,54 +203,55 @@ public class WebBrowserEditorInput implements IWebBrowserEditorInput, IPersistab
else
return true;
}
-
+
/**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns null if
- * no such object can be found.
- *
- * @param adapter the adapter class to look up
- * @return a object castable to the given class,
- * or null if this object does not
- * have an adapter for the given class
+ * Returns an object which is an instance of the given class associated with
+ * this object. Returns null if no such object can be found.
+ *
+ * @param adapter
+ * the adapter class to look up
+ * @return a object castable to the given class, or null if
+ * this object does not have an adapter for the given class
*/
public Object getAdapter(Class adapter) {
return null;
}
-
+
/**
- * Returns the ID of an element factory which can be used to recreate
- * this object. An element factory extension with this ID must exist
- * within the workbench registry.
+ * Returns the ID of an element factory which can be used to recreate this
+ * object. An element factory extension with this ID must exist within the
+ * workbench registry.
*
* @return the element factory ID
*/
public String getFactoryId() {
return ELEMENT_FACTORY_ID;
}
-
+
public ImageDescriptor getImageDescriptor() {
- return ImageResource.getImageDescriptor(ImageResource.IMG_INTERNAL_BROWSER);
+ return ImageResource
+ .getImageDescriptor(ImageResource.IMG_INTERNAL_BROWSER);
}
-
+
/**
* Returns the name of this editor input for display purposes.
*
* For instance, if the fully qualified input name is
* "a\b\MyFile.gif", the return value would be just
* "MyFile.gif".
- *
+ *
* @return the file name string
*/
public String getName() {
return WebBrowserUIPlugin.getResource("%viewWebBrowserTitle");
}
-
+
/*
- * Returns an object that can be used to save the state of this editor input.
- *
- * @return the persistable element, or null if this editor input
- * cannot be persisted
+ * Returns an object that can be used to save the state of this editor
+ * input.
+ *
+ * @return the persistable element, or null if this editor
+ * input cannot be persisted
*/
public IPersistableElement getPersistable() {
if ((style & TRANSIENT) != 0)
@@ -248,23 +259,23 @@ public class WebBrowserEditorInput implements IWebBrowserEditorInput, IPersistab
else
return this;
}
-
+
public String getToolTipText() {
if (url != null)
return url.toExternalForm();
else
return WebBrowserUIPlugin.getResource("%viewWebBrowserTitle");
}
-
+
/**
* Returns the url.
- *
+ *
* @return java.net.URL
*/
public URL getURL() {
return url;
}
-
+
/**
* Returns the browser id. Browsers with a set id will always & only be
* replaced by browsers with the same id.
@@ -274,43 +285,44 @@ public class WebBrowserEditorInput implements IWebBrowserEditorInput, IPersistab
public String getBrowserId() {
return id;
}
-
+
/**
* Returns true if the status bar should be shown.
- *
+ *
* @return boolean
*/
public boolean isStatusbarVisible() {
return (style & SHOW_STATUSBAR) != 0;
}
-
+
/**
* Returns true if the toolbar should be shown.
- *
+ *
* @return boolean
*/
public boolean isToolbarVisible() {
return (style & SHOW_TOOLBAR) != 0;
}
-
+
/**
* Saves the state of an element within a memento.
- *
- * @param memento the storage area for element state
+ *
+ * @param memento
+ * the storage area for element state
*/
public void saveState(IMemento memento) {
if ((style & SAVE_URL) != 0 && url != null)
memento.putString(MEMENTO_URL, url.toExternalForm());
memento.putInteger(MEMENTO_STYLE, style);
-
+
if (id != null)
memento.putString(MEMENTO_ID, id);
}
/**
* Converts this object to a string.
- *
+ *
* @return java.lang.String
*/
public String toString() {
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserContentProvider.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserContentProvider.java
index fd2696f..da3842f 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserContentProvider.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserContentProvider.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
**********************************************************************/
@@ -31,45 +31,51 @@ public class BrowserContentProvider 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() { }
+ 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.
- *
- * @param inputElement the input element
+ * 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
* @return the array of elements to display in the viewer
*/
public Object[] getElements(Object inputElement) {
List list = new ArrayList();
- Iterator iterator = BrowserManager.getInstance().getWebBrowsers().iterator();
+ Iterator iterator = BrowserManager.getInstance().getWebBrowsers()
+ .iterator();
while (iterator.hasNext()) {
IWebBrowser browser = (IWebBrowser) iterator.next();
list.add(browser);
}
return list.toArray();
- }
+ }
/**
- * Notifies this content provider that the given viewer's input
- * has been switched to a different element.
+ * Notifies this content provider that the given viewer's input has been
+ * switched to a different element.
*
- * A typical use for this method is registering the content provider as a listener
- * to changes on the new input (using model-specific means), and deregistering the viewer
- * from the old input. In response to these change notifications, the content provider
- * propagates the changes to the viewer.
+ * A typical use for this method is registering the content provider as a
+ * listener to changes on the new input (using model-specific means), and
+ * 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
- * @param oldInput 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
+ *
+ * @param viewer
+ * the viewer
+ * @param oldInput
+ * 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
*/
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserManager.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserManager.java
index d5dea45..cd2b875 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserManager.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserManager.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
**********************************************************************/
@@ -30,262 +30,273 @@ import org.eclipse.ui.IMemento;
import org.eclipse.ui.XMLMemento;
/**
- *
+ *
*/
public class BrowserManager {
- private static final int ADD = 0;
-
- private static final int CHANGE = 1;
-
- private static final int REMOVE = 2;
-
- protected List browsers;
-
- protected IWebBrowser currentBrowser;
-
- protected List browserListeners = new ArrayList();
-
- private Preferences.IPropertyChangeListener pcl;
-
- protected boolean ignorePreferenceChanges = false;
-
- protected static BrowserManager instance;
-
- public static BrowserManager getInstance() {
- if (instance == null)
- instance = new BrowserManager();
- return instance;
- }
-
- private BrowserManager() {
- pcl = new Preferences.IPropertyChangeListener() {
- public void propertyChange(Preferences.PropertyChangeEvent event) {
- if (ignorePreferenceChanges)
- return;
- String property = event.getProperty();
- if (property.equals("browsers")) {
- loadBrowsers();
- }
- }
- };
-
- WebBrowserUIPlugin.getInstance().getPluginPreferences().addPropertyChangeListener(pcl);
- }
-
- protected void dispose() {
- WebBrowserUIPlugin.getInstance().getPluginPreferences().removePropertyChangeListener(pcl);
-
- // clear the cache
- if (browsers != null) {
- Iterator iterator = browsers.iterator();
- while (iterator.hasNext()) {
- Object obj = iterator.next();
- if (obj instanceof IInternalWebBrowser) {
- IInternalWebBrowser wb = (IInternalWebBrowser) obj;
- if (wb.getClearHistoryOnExit())
- WebBrowserPreference.setInternalWebBrowserHistory(null);
- }
- }
- }
- }
-
- public IExternalWebBrowserWorkingCopy createExternalWebBrowser() {
- return new ExternalWebBrowserWorkingCopy();
- }
-
- public List getWebBrowsers() {
- if (browsers == null)
- loadBrowsers();
- return new ArrayList(browsers);
- }
-
- protected void loadBrowsers() {
- Trace.trace(Trace.FINEST, "Loading web browsers");
-
- Preferences prefs = WebBrowserUIPlugin.getInstance().getPluginPreferences();
- String xmlString = prefs.getString("browsers");
- if (xmlString != null && xmlString.length() > 0) {
- browsers = new ArrayList();
-
- try {
- ByteArrayInputStream in = new ByteArrayInputStream(xmlString.getBytes());
- Reader reader = new InputStreamReader(in);
- IMemento memento = XMLMemento.createReadRoot(reader);
-
- IMemento child = memento.getChild("internal");
- if (child != null) {
- InternalWebBrowser browser = new InternalWebBrowser();
- browser.load(child);
- browsers.add(browser);
- }
-
- IMemento[] children = memento.getChildren("external");
- int size = children.length;
- for (int i = 0; i < size; i++) {
- ExternalWebBrowser browser = new ExternalWebBrowser();
- browser.load(children[i]);
- browsers.add(browser);
- }
-
- Integer current = memento.getInteger("current");
- if (current != null) {
- currentBrowser = (IWebBrowser) browsers.get(current.intValue());
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not load browsers: " + e.getMessage());
- }
- addInternalBrowser(browsers);
- if (currentBrowser == null && browsers.size() > 0)
- currentBrowser = (IWebBrowser) browsers.get(0);
- } else {
- setupDefaultBrowsers();
- saveBrowsers();
- return;
- }
- }
-
- protected void saveBrowsers() {
- try {
- ignorePreferenceChanges = true;
- XMLMemento memento = XMLMemento.createWriteRoot("web-browsers");
-
- Iterator iterator = browsers.iterator();
- while (iterator.hasNext()) {
- Object obj = iterator.next();
- if (obj instanceof InternalWebBrowser) {
- InternalWebBrowser browser = (InternalWebBrowser) obj;
- IMemento child = memento.createChild("internal");
- browser.save(child);
- } else if (obj instanceof ExternalWebBrowser) {
- ExternalWebBrowser browser = (ExternalWebBrowser) obj;
- IMemento child = memento.createChild("external");
- browser.save(child);
- }
- }
-
- memento.putInteger("current", browsers.indexOf(currentBrowser));
-
- StringWriter writer = new StringWriter();
- memento.save(writer);
- String xmlString = writer.getBuffer().toString();
- Preferences prefs = WebBrowserUIPlugin.getInstance().getPluginPreferences();
- prefs.setValue("browsers", xmlString);
- WebBrowserUIPlugin.getInstance().savePluginPreferences();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save browsers", e);
- }
- ignorePreferenceChanges = false;
- }
-
- protected void addInternalBrowser(List browserList) {
- if (browserList == null)
- return;
-
- Iterator iterator = browserList.iterator();
- while (iterator.hasNext()) {
- IWebBrowser browser = (IWebBrowser) iterator.next();
- if (browser instanceof IInternalWebBrowser)
- return;
- }
-
- // add the internal browser if we can
-// WebBrowserUIPlugin.getInstance().getLog().log(
-// new Status(IStatus.INFO, WebBrowserUIPlugin.PLUGIN_ID, 0, WebBrowserUtil.canUseInternalWebBrowser() + "/"
-// + WebBrowserUtil.isInternalBrowserOperational(), null));
-// if (!WebBrowserUtil.canUseInternalWebBrowser() || !WebBrowserUtil.isInternalBrowserOperational())
-// return;
- WebBrowserUIPlugin.getInstance().getLog().log(
- new Status(IStatus.INFO, WebBrowserUIPlugin.PLUGIN_ID, 0,
- "-"+WebBrowserUtil.isInternalBrowserOperational(), null));
- if (!WebBrowserUtil.isInternalBrowserOperational())
- return;
- browserList.add(0, new InternalWebBrowser());
- }
-
- private void setupDefaultBrowsers() {
- browsers = new ArrayList();
-
- addInternalBrowser(browsers);
-
- // handle all the EXTERNAL browsers by criteria and add those too at startup
- WebBrowserUtil.addFoundBrowsers(browsers);
-
- // by default, if internal is there, that is current, else set the first external one
- if (!browsers.isEmpty())
- currentBrowser = (IWebBrowser) browsers.get(0);
- }
-
- protected void addBrowser(IExternalWebBrowser browser) {
- if (browsers == null)
- loadBrowsers();
- if (!browsers.contains(browser))
- browsers.add(browser);
- fireWebBrowserEvent(browser, ADD);
- saveBrowsers();
- }
-
- protected void removeWebBrowser(IExternalWebBrowser browser) {
- if (browsers == null)
- loadBrowsers();
- browsers.remove(browser);
- fireWebBrowserEvent(browser, REMOVE);
- }
-
- // Internal Web browser CAN be "edited", just not created or removed
- protected void browserChanged(IWebBrowser browser) {
- fireWebBrowserEvent(browser, CHANGE);
- saveBrowsers();
- }
-
- /**
- * Add Web browser listener.
- *
- * @param listener
- */
- public void addWebBrowserListener(IWebBrowserListener listener) {
- browserListeners.add(listener);
- }
-
- /**
- * Remove Web browser listener.
- *
- * @param listener
- */
- public void removeWebBrowserListener(IWebBrowserListener listener) {
- browserListeners.remove(listener);
- }
-
- /**
- * Fire a Web browser event.
- *
- * @param browser
- * @param type
- */
- protected void fireWebBrowserEvent(IWebBrowser browser, int type) {
- Object[] obj = browserListeners.toArray();
-
- int size = obj.length;
- for (int i = 0; i < size; i++) {
- IWebBrowserListener listener = (IWebBrowserListener) obj[i];
- if (type == ADD)
- listener.browserAdded(browser);
- else if (type == CHANGE)
- listener.browserChanged(browser);
- else if (type == REMOVE)
- listener.browserRemoved(browser);
- }
- }
-
- public IWebBrowser getCurrentWebBrowser() {
- if (browsers == null)
- loadBrowsers();
-
- return currentBrowser;
- }
-
- public void setCurrentWebBrowser(IWebBrowser wb) {
- if (browsers.contains(wb))
- currentBrowser = wb;
- saveBrowsers();
- }
+ private static final int ADD = 0;
+
+ private static final int CHANGE = 1;
+
+ private static final int REMOVE = 2;
+
+ protected List browsers;
+
+ protected IWebBrowser currentBrowser;
+
+ protected List browserListeners = new ArrayList();
+
+ private Preferences.IPropertyChangeListener pcl;
+
+ protected boolean ignorePreferenceChanges = false;
+
+ protected static BrowserManager instance;
+
+ public static BrowserManager getInstance() {
+ if (instance == null)
+ instance = new BrowserManager();
+ return instance;
+ }
+
+ private BrowserManager() {
+ pcl = new Preferences.IPropertyChangeListener() {
+ public void propertyChange(Preferences.PropertyChangeEvent event) {
+ if (ignorePreferenceChanges)
+ return;
+ String property = event.getProperty();
+ if (property.equals("browsers")) {
+ loadBrowsers();
+ }
+ }
+ };
+
+ WebBrowserUIPlugin.getInstance().getPluginPreferences()
+ .addPropertyChangeListener(pcl);
+ }
+
+ protected void dispose() {
+ WebBrowserUIPlugin.getInstance().getPluginPreferences()
+ .removePropertyChangeListener(pcl);
+
+ // clear the cache
+ if (browsers != null) {
+ Iterator iterator = browsers.iterator();
+ while (iterator.hasNext()) {
+ Object obj = iterator.next();
+ if (obj instanceof IInternalWebBrowser) {
+ IInternalWebBrowser wb = (IInternalWebBrowser) obj;
+ if (wb.getClearHistoryOnExit())
+ WebBrowserPreference.setInternalWebBrowserHistory(null);
+ }
+ }
+ }
+ }
+
+ public IExternalWebBrowserWorkingCopy createExternalWebBrowser() {
+ return new ExternalWebBrowserWorkingCopy();
+ }
+
+ public List getWebBrowsers() {
+ if (browsers == null)
+ loadBrowsers();
+ return new ArrayList(browsers);
+ }
+
+ protected void loadBrowsers() {
+ Trace.trace(Trace.FINEST, "Loading web browsers");
+
+ Preferences prefs = WebBrowserUIPlugin.getInstance()
+ .getPluginPreferences();
+ String xmlString = prefs.getString("browsers");
+ if (xmlString != null && xmlString.length() > 0) {
+ browsers = new ArrayList();
+
+ try {
+ ByteArrayInputStream in = new ByteArrayInputStream(xmlString
+ .getBytes());
+ Reader reader = new InputStreamReader(in);
+ IMemento memento = XMLMemento.createReadRoot(reader);
+
+ IMemento child = memento.getChild("internal");
+ if (child != null) {
+ InternalWebBrowser browser = new InternalWebBrowser();
+ browser.load(child);
+ browsers.add(browser);
+ }
+
+ IMemento[] children = memento.getChildren("external");
+ int size = children.length;
+ for (int i = 0; i < size; i++) {
+ ExternalWebBrowser browser = new ExternalWebBrowser();
+ browser.load(children[i]);
+ browsers.add(browser);
+ }
+
+ Integer current = memento.getInteger("current");
+ if (current != null) {
+ currentBrowser = (IWebBrowser) browsers.get(current
+ .intValue());
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.WARNING, "Could not load browsers: "
+ + e.getMessage());
+ }
+ addInternalBrowser(browsers);
+ if (currentBrowser == null && browsers.size() > 0)
+ currentBrowser = (IWebBrowser) browsers.get(0);
+ } else {
+ setupDefaultBrowsers();
+ saveBrowsers();
+ return;
+ }
+ }
+
+ protected void saveBrowsers() {
+ try {
+ ignorePreferenceChanges = true;
+ XMLMemento memento = XMLMemento.createWriteRoot("web-browsers");
+
+ Iterator iterator = browsers.iterator();
+ while (iterator.hasNext()) {
+ Object obj = iterator.next();
+ if (obj instanceof InternalWebBrowser) {
+ InternalWebBrowser browser = (InternalWebBrowser) obj;
+ IMemento child = memento.createChild("internal");
+ browser.save(child);
+ } else if (obj instanceof ExternalWebBrowser) {
+ ExternalWebBrowser browser = (ExternalWebBrowser) obj;
+ IMemento child = memento.createChild("external");
+ browser.save(child);
+ }
+ }
+
+ memento.putInteger("current", browsers.indexOf(currentBrowser));
+
+ StringWriter writer = new StringWriter();
+ memento.save(writer);
+ String xmlString = writer.getBuffer().toString();
+ Preferences prefs = WebBrowserUIPlugin.getInstance()
+ .getPluginPreferences();
+ prefs.setValue("browsers", xmlString);
+ WebBrowserUIPlugin.getInstance().savePluginPreferences();
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Could not save browsers", e);
+ }
+ ignorePreferenceChanges = false;
+ }
+
+ protected void addInternalBrowser(List browserList) {
+ if (browserList == null)
+ return;
+
+ Iterator iterator = browserList.iterator();
+ while (iterator.hasNext()) {
+ IWebBrowser browser = (IWebBrowser) iterator.next();
+ if (browser instanceof IInternalWebBrowser)
+ return;
+ }
+
+ // add the internal browser if we can
+ // WebBrowserUIPlugin.getInstance().getLog().log(
+ // new Status(IStatus.INFO, WebBrowserUIPlugin.PLUGIN_ID, 0,
+ // WebBrowserUtil.canUseInternalWebBrowser() + "/"
+ // + WebBrowserUtil.isInternalBrowserOperational(), null));
+ // if (!WebBrowserUtil.canUseInternalWebBrowser() ||
+ // !WebBrowserUtil.isInternalBrowserOperational())
+ // return;
+ WebBrowserUIPlugin.getInstance().getLog().log(
+ new Status(IStatus.INFO, WebBrowserUIPlugin.PLUGIN_ID, 0, "-"
+ + WebBrowserUtil.isInternalBrowserOperational(), null));
+ if (!WebBrowserUtil.isInternalBrowserOperational())
+ return;
+ browserList.add(0, new InternalWebBrowser());
+ }
+
+ private void setupDefaultBrowsers() {
+ browsers = new ArrayList();
+
+ addInternalBrowser(browsers);
+
+ // handle all the EXTERNAL browsers by criteria and add those too at
+ // startup
+ WebBrowserUtil.addFoundBrowsers(browsers);
+
+ // by default, if internal is there, that is current, else set the first
+ // external one
+ if (!browsers.isEmpty())
+ currentBrowser = (IWebBrowser) browsers.get(0);
+ }
+
+ protected void addBrowser(IExternalWebBrowser browser) {
+ if (browsers == null)
+ loadBrowsers();
+ if (!browsers.contains(browser))
+ browsers.add(browser);
+ fireWebBrowserEvent(browser, ADD);
+ saveBrowsers();
+ }
+
+ protected void removeWebBrowser(IExternalWebBrowser browser) {
+ if (browsers == null)
+ loadBrowsers();
+ browsers.remove(browser);
+ fireWebBrowserEvent(browser, REMOVE);
+ }
+
+ // Internal Web browser CAN be "edited", just not created or removed
+ protected void browserChanged(IWebBrowser browser) {
+ fireWebBrowserEvent(browser, CHANGE);
+ saveBrowsers();
+ }
+
+ /**
+ * Add Web browser listener.
+ *
+ * @param listener
+ */
+ public void addWebBrowserListener(IWebBrowserListener listener) {
+ browserListeners.add(listener);
+ }
+
+ /**
+ * Remove Web browser listener.
+ *
+ * @param listener
+ */
+ public void removeWebBrowserListener(IWebBrowserListener listener) {
+ browserListeners.remove(listener);
+ }
+
+ /**
+ * Fire a Web browser event.
+ *
+ * @param browser
+ * @param type
+ */
+ protected void fireWebBrowserEvent(IWebBrowser browser, int type) {
+ Object[] obj = browserListeners.toArray();
+
+ int size = obj.length;
+ for (int i = 0; i < size; i++) {
+ IWebBrowserListener listener = (IWebBrowserListener) obj[i];
+ if (type == ADD)
+ listener.browserAdded(browser);
+ else if (type == CHANGE)
+ listener.browserChanged(browser);
+ else if (type == REMOVE)
+ listener.browserRemoved(browser);
+ }
+ }
+
+ public IWebBrowser getCurrentWebBrowser() {
+ if (browsers == null)
+ loadBrowsers();
+
+ return currentBrowser;
+ }
+
+ public void setCurrentWebBrowser(IWebBrowser wb) {
+ if (browsers.contains(wb))
+ currentBrowser = wb;
+ saveBrowsers();
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserSearcher.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserSearcher.java
index 7884159..6e6d30b 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserSearcher.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserSearcher.java
@@ -1,11 +1,12 @@
package net.sourceforge.phpeclipse.webbrowser.internal;
+
/**********************************************************************
* Copyright (c) 2003 IBM Corporation 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 - Initial API and implementation
**********************************************************************/
@@ -23,11 +24,13 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Shell;
+
/**
*
*/
public class BrowserSearcher {
private static boolean cancelled;
+
private BrowserSearcher() {
super();
}
@@ -47,17 +50,17 @@ public class BrowserSearcher {
String path = dialog.open();
if (path == null)
return null;
-
+
cancelled = false;
-
+
final File rootDir = new File(path);
ProgressMonitorDialog pm = new ProgressMonitorDialog(shell);
IRunnableWithProgress r = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
- monitor.beginTask(
- WebBrowserUIPlugin.getResource("%searchingTaskName"),
- IProgressMonitor.UNKNOWN);
+ monitor.beginTask(WebBrowserUIPlugin
+ .getResource("%searchingTaskName"),
+ IProgressMonitor.UNKNOWN);
search(rootDir, existingPaths, foundBrowsers, monitor);
monitor.done();
if (monitor.isCanceled())
@@ -68,23 +71,26 @@ public class BrowserSearcher {
try {
pm.run(true, true, r);
} catch (InvocationTargetException e) {
- Trace.trace(Trace.SEVERE, "Invocation Exception occured running monitor: " + e);
+ Trace.trace(Trace.SEVERE,
+ "Invocation Exception occured running monitor: " + e);
} catch (InterruptedException e) {
- Trace.trace(Trace.SEVERE, "Interrupted exception occured running monitor: " + e);
+ Trace.trace(Trace.SEVERE,
+ "Interrupted exception occured running monitor: " + e);
return null;
}
-
+
if (cancelled)
return null;
return foundBrowsers;
}
-
+
protected static void setCancelled(boolean b) {
cancelled = b;
}
- protected static void search(File directory, List existingPaths, List foundBrowsers, IProgressMonitor monitor) {
+ protected static void search(File directory, List existingPaths,
+ List foundBrowsers, IProgressMonitor monitor) {
if (monitor.isCanceled())
return;
@@ -96,18 +102,20 @@ public class BrowserSearcher {
return;
File file = new File(directory, names[i]);
-
+
if (existingPaths.contains(file.getAbsolutePath().toLowerCase()))
continue;
- IExternalWebBrowserWorkingCopy wc = WebBrowserUtil.createExternalBrowser(file);
+ IExternalWebBrowserWorkingCopy wc = WebBrowserUtil
+ .createExternalBrowser(file);
if (wc != null)
foundBrowsers.add(wc);
try {
- monitor.subTask(
- MessageFormat.format(WebBrowserUIPlugin.getResource("%searching"),
- new String[] { Integer.toString(foundBrowsers.size()), file.getCanonicalPath()}));
+ monitor.subTask(MessageFormat.format(WebBrowserUIPlugin
+ .getResource("%searching"), new String[] {
+ Integer.toString(foundBrowsers.size()),
+ file.getCanonicalPath() }));
} catch (IOException ioe) {
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableComposite.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableComposite.java
index c8aeec5..6bab84a 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableComposite.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableComposite.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
**********************************************************************/
@@ -40,18 +40,25 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.PlatformUI;
+
/**
- *
+ *
*/
public class BrowserTableComposite extends Composite {
protected Table table;
+
protected CheckboxTableViewer tableViewer;
+
protected Button edit;
+
protected Button remove;
+
protected Button search;
+
protected IWebBrowser selection;
protected Label location;
+
protected Label parameters;
public BrowserTableComposite(Composite parent, int style) {
@@ -73,12 +80,15 @@ public class BrowserTableComposite extends Composite {
Label label = new Label(this, SWT.NONE);
label.setText(WebBrowserUIPlugin.getResource("%browserList"));
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
+ data = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_CENTER);
data.horizontalSpan = 2;
label.setLayoutData(data);
- table = new Table(this, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
+ table = new Table(this, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL
+ | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
+ data = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL);
data.widthHint = 300;
table.setLayoutData(data);
table.setHeaderVisible(false);
@@ -98,27 +108,35 @@ public class BrowserTableComposite extends Composite {
tableViewer.setInput("root");
- // uncheck any other elements that might be checked and leave only the element checked to
- // remain checked since one can only chose one brower at a time to be current.
+ // uncheck any other elements that might be checked and leave only the
+ // element checked to
+ // remain checked since one can only chose one brower at a time to be
+ // current.
tableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent e) {
checkNewDefaultBrowser(e.getElement());
IWebBrowser browser = (IWebBrowser) e.getElement();
BrowserManager.getInstance().setCurrentWebBrowser(browser);
- // if no other browsers are checked, don't allow the single one currently
- // checked to become unchecked, and lose a current browser. That is, don't
- // permit unchecking if no other item is checked which is supposed to be the case.
+ // if no other browsers are checked, don't allow the single one
+ // currently
+ // checked to become unchecked, and lose a current browser. That
+ // is, don't
+ // permit unchecking if no other item is checked which is
+ // supposed to be the case.
Object[] obj = tableViewer.getCheckedElements();
- if (obj.length == 0)
- tableViewer.setChecked(e.getElement(), true);
+ if (obj.length == 0)
+ tableViewer.setChecked(e.getElement(), true);
}
});
- // set a default, checked browser based on the current browser. If there is not a
+ // set a default, checked browser based on the current browser. If there
+ // is not a
// current browser, but the first item exists, use that instead.
- // This will work currently until workbench shutdown, because current browser is not yet persisted.
- IWebBrowser browser = BrowserManager.getInstance().getCurrentWebBrowser();
+ // This will work currently until workbench shutdown, because current
+ // browser is not yet persisted.
+ IWebBrowser browser = BrowserManager.getInstance()
+ .getCurrentWebBrowser();
if (browser != null)
tableViewer.setChecked(browser, true);
else {
@@ -127,27 +145,28 @@ public class BrowserTableComposite extends Composite {
tableViewer.setChecked(obj, true);
}
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- Object obj = getSelection(event.getSelection());
-
- if (obj instanceof IInternalWebBrowser) {
- selection = (IInternalWebBrowser) obj;
- remove.setEnabled(false);
- edit.setEnabled(true);
- } else if (obj instanceof IExternalWebBrowser) {
- selection = (IExternalWebBrowser) obj;
- remove.setEnabled(true);
- edit.setEnabled(true);
- } else
- selection = null;
-
- if (selection == null) {
- edit.setEnabled(false);
- remove.setEnabled(false);
- }
- }
- });
+ tableViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ Object obj = getSelection(event.getSelection());
+
+ if (obj instanceof IInternalWebBrowser) {
+ selection = (IInternalWebBrowser) obj;
+ remove.setEnabled(false);
+ edit.setEnabled(true);
+ } else if (obj instanceof IExternalWebBrowser) {
+ selection = (IExternalWebBrowser) obj;
+ remove.setEnabled(true);
+ edit.setEnabled(true);
+ } else
+ selection = null;
+
+ if (selection == null) {
+ edit.setEnabled(false);
+ remove.setEnabled(false);
+ }
+ }
+ });
Composite buttonComp = new Composite(this, SWT.NONE);
layout = new GridLayout();
@@ -157,99 +176,120 @@ public class BrowserTableComposite 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, WebBrowserUIPlugin.getResource("%add"));
+ Button add = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin
+ .getResource("%add"));
add.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- ExternalBrowserDialog dialog = new ExternalBrowserDialog(getShell());
+ ExternalBrowserDialog dialog = new ExternalBrowserDialog(
+ getShell());
if (dialog.open() == Window.CANCEL)
return;
tableViewer.refresh();
}
});
- edit = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%edit"));
+ edit = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin
+ .getResource("%edit"));
edit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IWebBrowser browser2 = getSelectedWebBrowser();
if (browser2 instanceof IInternalWebBrowser) {
- IInternalWebBrowserWorkingCopy wc = ((IInternalWebBrowser) browser2).getWorkingCopy();
- InternalBrowserDialog dialog = new InternalBrowserDialog(getShell(), wc);
+ IInternalWebBrowserWorkingCopy wc = ((IInternalWebBrowser) browser2)
+ .getWorkingCopy();
+ InternalBrowserDialog dialog = new InternalBrowserDialog(
+ getShell(), wc);
if (dialog.open() != Window.CANCEL) {
try {
tableViewer.refresh(wc.save());
- } catch (Exception ex) { }
+ } catch (Exception ex) {
+ }
}
- }
- else if(browser2 instanceof IExternalWebBrowser) {
- IExternalWebBrowserWorkingCopy wc = ((IExternalWebBrowser) browser2).getWorkingCopy();
- ExternalBrowserDialog dialog = new ExternalBrowserDialog(getShell(), wc);
+ } else if (browser2 instanceof IExternalWebBrowser) {
+ IExternalWebBrowserWorkingCopy wc = ((IExternalWebBrowser) browser2)
+ .getWorkingCopy();
+ ExternalBrowserDialog dialog = new ExternalBrowserDialog(
+ 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, WebBrowserUIPlugin.getResource("%remove"));
+ remove = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin
+ .getResource("%remove"));
remove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IWebBrowser browser2 = getSelectedWebBrowser();
try {
- if (browser2 instanceof IInternalWebBrowser){
+ if (browser2 instanceof IInternalWebBrowser) {
remove.setEnabled(false);
return; // nothing else possible to do
- }
- else if(browser2 instanceof IExternalWebBrowser) {
+ } else if (browser2 instanceof IExternalWebBrowser) {
remove.setEnabled(true);
- ((IExternalWebBrowser) browser2).delete();
+ ((IExternalWebBrowser) browser2).delete();
tableViewer.remove(browser2);
- // need here to ensure that if the item deleted was checked, ie, was
- // the current browser, that the new current browser will be the first in the
- // list, typically, the internal browser, which cannot be deleted, and be current.
- if(((IExternalWebBrowser) browser2) == BrowserManager.getInstance().getCurrentWebBrowser()){
+ // need here to ensure that if the item deleted was
+ // checked, ie, was
+ // the current browser, that the new current browser
+ // will be the first in the
+ // list, typically, the internal browser, which cannot
+ // be deleted, and be current.
+ if (((IExternalWebBrowser) browser2) == BrowserManager
+ .getInstance().getCurrentWebBrowser()) {
Object obj = tableViewer.getElementAt(0);
- if(obj != null){
- BrowserManager.getInstance().setCurrentWebBrowser((InternalWebBrowser)obj);
- tableViewer.setChecked(obj, true);
- }
+ if (obj != null) {
+ BrowserManager.getInstance()
+ .setCurrentWebBrowser(
+ (InternalWebBrowser) obj);
+ tableViewer.setChecked(obj, true);
+ }
}
}
- } catch (Exception ex) { }
+ } catch (Exception ex) {
+ }
}
});
remove.setEnabled(false);
- search = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin.getResource("%search"));
+ search = SWTUtil.createButton(buttonComp, WebBrowserUIPlugin
+ .getResource("%search"));
search.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- java.util.List browsersToCreate = BrowserSearcher.search(getShell());
+ java.util.List browsersToCreate = BrowserSearcher
+ .search(getShell());
if (browsersToCreate == null) // cancelled
return;
if (browsersToCreate.isEmpty()) { // no browsers found
- WebBrowserUtil.openMessage(WebBrowserUIPlugin.getResource("%searchingNoneFound"));
+ WebBrowserUtil.openMessage(WebBrowserUIPlugin
+ .getResource("%searchingNoneFound"));
return;
}
Iterator iterator = browsersToCreate.iterator();
while (iterator.hasNext()) {
- IExternalWebBrowserWorkingCopy browser2 = (IExternalWebBrowserWorkingCopy) iterator.next();
+ IExternalWebBrowserWorkingCopy browser2 = (IExternalWebBrowserWorkingCopy) iterator
+ .next();
browser2.save();
}
tableViewer.refresh();
}
});
- PlatformUI.getWorkbench().getHelpSystem().setHelp(search, ContextIds.PREF_BROWSER_EXTERNAL_SEARCH);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(search,
+ ContextIds.PREF_BROWSER_EXTERNAL_SEARCH);
tableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent e) {
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableLabelProvider.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableLabelProvider.java
index bdbc77c..05904ad 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableLabelProvider.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BrowserTableLabelProvider.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
**********************************************************************/
@@ -17,6 +17,7 @@ import net.sourceforge.phpeclipse.webbrowser.IWebBrowser;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Image;
+
/**
* Web browser table label provider.
*/
@@ -31,12 +32,14 @@ public class BrowserTableLabelProvider implements ITableLabelProvider {
/**
*
*/
- public void addListener(ILabelProviderListener listener) { }
+ public void addListener(ILabelProviderListener listener) {
+ }
/**
*
*/
- public void dispose() { }
+ public void dispose() {
+ }
/**
*
@@ -44,37 +47,40 @@ public class BrowserTableLabelProvider implements ITableLabelProvider {
public Image getColumnImage(Object element, int columnIndex) {
if (columnIndex == 0) {
if (element instanceof IInternalWebBrowser)
- return ImageResource.getImage(ImageResource.IMG_INTERNAL_BROWSER);
+ return ImageResource
+ .getImage(ImageResource.IMG_INTERNAL_BROWSER);
else
- return ImageResource.getImage(ImageResource.IMG_EXTERNAL_BROWSER);
+ return ImageResource
+ .getImage(ImageResource.IMG_EXTERNAL_BROWSER);
}
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
+ *
+ * @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) {
- IWebBrowser browser = (IWebBrowser)element;
+ IWebBrowser browser = (IWebBrowser) element;
if (browser instanceof IExternalWebBrowser) {
if (columnIndex == 0)
- return notNull(((IExternalWebBrowser)browser).getName());
+ return notNull(((IExternalWebBrowser) browser).getName());
else if (columnIndex == 1)
- return notNull(((IExternalWebBrowser)browser).getLocation());
+ return notNull(((IExternalWebBrowser) browser).getLocation());
else if (columnIndex == 2)
- return notNull(((IExternalWebBrowser)browser).getParameters());
- } else if(browser instanceof IInternalWebBrowser) {
+ return notNull(((IExternalWebBrowser) browser).getParameters());
+ } else if (browser instanceof IInternalWebBrowser) {
if (columnIndex == 0)
- return notNull(((IInternalWebBrowser)browser).getName());
+ return notNull(((IInternalWebBrowser) browser).getName());
}
return "";
}
-
+
protected String notNull(String s) {
if (s != null)
return s;
@@ -92,5 +98,6 @@ public class BrowserTableLabelProvider implements ITableLabelProvider {
/**
*
*/
- public void removeListener(ILabelProviderListener listener) { }
+ public void removeListener(ILabelProviderListener listener) {
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BusyIndicator.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BusyIndicator.java
index 1b4caa2..958eba1 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BusyIndicator.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/BusyIndicator.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
*/
@@ -19,49 +19,56 @@ import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+
/**
* An animated image to show busy status of the Web browser.
*/
public class BusyIndicator extends Canvas {
protected Image[] images;
+
protected Image image;
protected Thread busyThread;
+
protected boolean stop;
/**
* BusyWidget constructor comment.
- * @param parent org.eclipse.swt.widgets.Composite
- * @param style int
+ *
+ * @param parent
+ * org.eclipse.swt.widgets.Composite
+ * @param style
+ * int
*/
public BusyIndicator(Composite parent, int style) {
super(parent, style);
-
+
images = ImageResource.getBusyImages();
-
+
addPaintListener(new PaintListener() {
public void paintControl(PaintEvent event) {
onPaint(event);
}
});
-
+
image = images[0];
}
-
+
public Point computeSize(int wHint, int hHint, boolean changed) {
return new Point(25, 25);
}
-
+
/**
* Creates a thread to animate the image.
*/
protected synchronized void createBusyThread() {
if (busyThread != null)
return;
-
+
stop = false;
busyThread = new Thread() {
protected int count;
+
public void run() {
try {
count = 1;
@@ -79,7 +86,8 @@ public class BusyIndicator extends Canvas {
});
try {
sleep(125);
- } catch (Exception e) { }
+ } catch (Exception e) {
+ }
}
if (busyThread == null)
Display.getDefault().syncExec(new Thread() {
@@ -92,18 +100,18 @@ public class BusyIndicator extends Canvas {
}
}
};
-
+
busyThread.setPriority(Thread.NORM_PRIORITY + 2);
busyThread.setDaemon(true);
busyThread.start();
}
-
+
public void dispose() {
stop = true;
busyThread = null;
super.dispose();
}
-
+
/**
* Return the image or null.
*/
@@ -113,21 +121,21 @@ public class BusyIndicator extends Canvas {
/**
* Returns true if it is currently busy.
- *
+ *
* @return boolean
*/
public boolean isBusy() {
return (busyThread != null);
}
- /*
+ /*
* Process the paint event
*/
protected void onPaint(PaintEvent event) {
Rectangle rect = getClientArea();
if (rect.width == 0 || rect.height == 0)
return;
-
+
GC gc = event.gc;
if (image != null)
gc.drawImage(image, 2, 2);
@@ -135,8 +143,9 @@ public class BusyIndicator extends Canvas {
/**
* Sets the indicators busy count up (true) or down (false) one.
- *
- * @param busy boolean
+ *
+ * @param busy
+ * boolean
*/
public synchronized void setBusy(boolean busy) {
if (busy) {
@@ -151,8 +160,7 @@ public class BusyIndicator extends Canvas {
}
/**
- * Set the image.
- * The value null clears it.
+ * Set the image. The value null clears it.
*/
public void setImage(Image image) {
if (image != this.image && !isDisposed()) {
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ContextIds.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ContextIds.java
index dbfb19e..613ede8 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ContextIds.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ContextIds.java
@@ -1,25 +1,40 @@
/**
* 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
*/
package net.sourceforge.phpeclipse.webbrowser.internal;
+
/**
* Context help id constants.
*/
public interface ContextIds {
- public static final String PREF_BROWSER = WebBrowserUIPlugin.PLUGIN_ID + ".wbpr0000";
- public static final String PREF_BROWSER_INTERNAL = WebBrowserUIPlugin.PLUGIN_ID + ".wbpr0002";
- public static final String PREF_BROWSER_EXTERNAL_ADD = WebBrowserUIPlugin.PLUGIN_ID + ".wbpr0004";
- public static final String PREF_BROWSER_EXTERNAL_EDIT = WebBrowserUIPlugin.PLUGIN_ID + ".wbpr0005";
- public static final String PREF_BROWSER_EXTERNAL_SEARCH = WebBrowserUIPlugin.PLUGIN_ID + ".wbpr0006";
-
- public static final String WEB_BROWSER = WebBrowserUIPlugin.PLUGIN_ID + ".sewb0000";
- public static final String WEB_BROWSER_URL = WebBrowserUIPlugin.PLUGIN_ID + ".sewb0002";
- public static final String WEB_BROWSER_WEB = WebBrowserUIPlugin.PLUGIN_ID + ".sewb0004";
+ public static final String PREF_BROWSER = WebBrowserUIPlugin.PLUGIN_ID
+ + ".wbpr0000";
+
+ public static final String PREF_BROWSER_INTERNAL = WebBrowserUIPlugin.PLUGIN_ID
+ + ".wbpr0002";
+
+ public static final String PREF_BROWSER_EXTERNAL_ADD = WebBrowserUIPlugin.PLUGIN_ID
+ + ".wbpr0004";
+
+ public static final String PREF_BROWSER_EXTERNAL_EDIT = WebBrowserUIPlugin.PLUGIN_ID
+ + ".wbpr0005";
+
+ public static final String PREF_BROWSER_EXTERNAL_SEARCH = WebBrowserUIPlugin.PLUGIN_ID
+ + ".wbpr0006";
+
+ public static final String WEB_BROWSER = WebBrowserUIPlugin.PLUGIN_ID
+ + ".sewb0000";
+
+ public static final String WEB_BROWSER_URL = WebBrowserUIPlugin.PLUGIN_ID
+ + ".sewb0002";
+
+ public static final String WEB_BROWSER_WEB = WebBrowserUIPlugin.PLUGIN_ID
+ + ".sewb0004";
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalBrowserDialog.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalBrowserDialog.java
index 4b3b9c9..2c42ad3 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalBrowserDialog.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalBrowserDialog.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
**********************************************************************/
@@ -31,18 +31,27 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
+
/**
- *
+ *
*/
public class ExternalBrowserDialog extends Dialog {
protected IExternalWebBrowserWorkingCopy browser;
+
protected boolean isEdit;
+
protected Button newPageCheckbox;
+
protected Button clearHistoryCheckbox;
+
protected Button browseButton;
+
protected Text browserNameTextfield;
+
protected Text browserLocationTextfield;
+
protected Text browserParametersTextfield;
+
private Button okButton;
interface StringModifyListener {
@@ -52,7 +61,8 @@ public class ExternalBrowserDialog extends Dialog {
/**
* @param parentShell
*/
- public ExternalBrowserDialog(Shell parentShell, IExternalWebBrowserWorkingCopy browser) {
+ public ExternalBrowserDialog(Shell parentShell,
+ IExternalWebBrowserWorkingCopy browser) {
super(parentShell);
this.browser = browser;
isEdit = true;
@@ -68,16 +78,19 @@ public class ExternalBrowserDialog extends Dialog {
super.configureShell(shell);
if (isEdit)
- shell.setText(WebBrowserUIPlugin.getResource("%editExternalBrowser"));
+ shell.setText(WebBrowserUIPlugin
+ .getResource("%editExternalBrowser"));
else
shell.setText(WebBrowserUIPlugin.getResource("%createBrowser"));
}
- 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.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING);
data.widthHint = 250;
text.setLayoutData(data);
if (listener != null)
@@ -89,41 +102,51 @@ public class ExternalBrowserDialog extends Dialog {
return text;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
- ((GridLayout)composite.getLayout()).numColumns = 3;
+ ((GridLayout) composite.getLayout()).numColumns = 3;
if (isEdit)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER_EXTERNAL_EDIT);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
+ ContextIds.PREF_BROWSER_EXTERNAL_EDIT);
else
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER_EXTERNAL_ADD);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
+ ContextIds.PREF_BROWSER_EXTERNAL_ADD);
SWTUtil.createLabel(composite, WebBrowserUIPlugin.getResource("%name"));
- browserNameTextfield = createText(composite, browser.getName(), new StringModifyListener() {
- public void valueChanged(String s) {
- browser.setName(s);
- validateFields();
- }
- });
+ browserNameTextfield = createText(composite, browser.getName(),
+ new StringModifyListener() {
+ public void valueChanged(String s) {
+ browser.setName(s);
+ validateFields();
+ }
+ });
new Label(composite, SWT.NONE);
- SWTUtil.createLabel(composite, WebBrowserUIPlugin.getResource("%location"));
- browserLocationTextfield = createText(composite, browser.getLocation(), new StringModifyListener() {
- public void valueChanged(String s) {
- browser.setLocation(s);
- validateFields();
- }
- });
-
- browseButton = SWTUtil.createButton(composite, WebBrowserUIPlugin.getResource("%browse"));
+ SWTUtil.createLabel(composite, WebBrowserUIPlugin
+ .getResource("%location"));
+ browserLocationTextfield = createText(composite, browser.getLocation(),
+ new StringModifyListener() {
+ public void valueChanged(String s) {
+ browser.setLocation(s);
+ validateFields();
+ }
+ });
+
+ browseButton = SWTUtil.createButton(composite, WebBrowserUIPlugin
+ .getResource("%browse"));
browseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
- dialog.setText(WebBrowserUIPlugin.getResource("%browseMessage"));
+ dialog
+ .setText(WebBrowserUIPlugin
+ .getResource("%browseMessage"));
String fname = browserLocationTextfield.getText();
@@ -135,8 +158,10 @@ public class ExternalBrowserDialog extends Dialog {
}
});
- SWTUtil.createLabel(composite, WebBrowserUIPlugin.getResource("%parameters"));
- browserParametersTextfield = createText(composite, browser.getParameters(), new StringModifyListener() {
+ SWTUtil.createLabel(composite, WebBrowserUIPlugin
+ .getResource("%parameters"));
+ browserParametersTextfield = createText(composite, browser
+ .getParameters(), new StringModifyListener() {
public void valueChanged(String s) {
browser.setParameters(s);
}
@@ -146,26 +171,30 @@ public class ExternalBrowserDialog extends Dialog {
new Label(composite, SWT.NONE);
Label urlLabel = new Label(composite, SWT.NONE);
- urlLabel.setText(WebBrowserUIPlugin.getResource("%parametersMessage", WebBrowserPreference.URL_PARAMETER));
-
+ urlLabel.setText(WebBrowserUIPlugin.getResource("%parametersMessage",
+ WebBrowserPreference.URL_PARAMETER));
return composite;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
protected void okPressed() {
- // do simple field validation to at least ensure target directory entered is valid pathname
+ // do simple field validation to at least ensure target directory
+ // entered is valid pathname
try {
- File file = new File(browser.getLocation());
- if(!file.isFile()){
- WebBrowserUtil.openError(WebBrowserUIPlugin.getResource("%locationInvalid"));
+ File file = new File(browser.getLocation());
+ if (!file.isFile()) {
+ WebBrowserUtil.openError(WebBrowserUIPlugin
+ .getResource("%locationInvalid"));
return;
}
- }
- catch(Exception e){
- WebBrowserUtil.openError(WebBrowserUIPlugin.getResource("%locationInvalid"));
+ } catch (Exception e) {
+ WebBrowserUtil.openError(WebBrowserUIPlugin
+ .getResource("%locationInvalid"));
return;
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalWebBrowser.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalWebBrowser.java
index 10e5086..879aea1 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalWebBrowser.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalWebBrowser.java
@@ -7,39 +7,50 @@ import net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy;
import org.eclipse.swt.program.Program;
import org.eclipse.ui.IMemento;
+
/**
*
*/
public class ExternalWebBrowser implements IExternalWebBrowser {
private static final String MEMENTO_NAME = "name";
+
private static final String MEMENTO_LOCATION = "location";
+
private static final String MEMENTO_PARAMETERS = "parameters";
protected String name;
+
protected String location;
+
protected String parameters;
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IWebBrowser#getName()
*/
public String getName() {
return name;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowser#getLocation()
*/
public String getLocation() {
return location;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowser#getParameters()
*/
public String getParameters() {
return parameters;
}
-
+
public void delete() {
BrowserManager.getInstance().removeWebBrowser(this);
}
@@ -58,12 +69,14 @@ public class ExternalWebBrowser implements IExternalWebBrowser {
parameters = browser.getParameters();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IWebBrowser#openURL(java.net.URL)
*/
public void openURL(URL url) {
String urlText = WebBrowserPreference.getHomePageURL();
-
+
if (url != null)
urlText = url.toExternalForm();
else if (urlText.startsWith("file:") & urlText.length() > 6) {
@@ -75,12 +88,14 @@ public class ExternalWebBrowser implements IExternalWebBrowser {
if (!WebBrowserUtil.isWindows()) {
int index = urlText.indexOf(" ");
while (index >= 0) {
- urlText = urlText.substring(0, index) + "%20" + urlText.substring(index + 1);
+ urlText = urlText.substring(0, index) + "%20"
+ + urlText.substring(index + 1);
index = urlText.indexOf(" ");
}
}
- Trace.trace(Trace.FINEST, "Launching external Web browser: " + location + " - " + parameters + " - " + urlText);
+ Trace.trace(Trace.FINEST, "Launching external Web browser: " + location
+ + " - " + parameters + " - " + urlText);
if (location == null || location.length() == 0) {
try {
String extension = null;
@@ -94,31 +109,39 @@ public class ExternalWebBrowser implements IExternalWebBrowser {
Program program = Program.findProgram(extension);
program.execute(urlText);
} catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error launching default external browser", e);
- WebBrowserUtil.openError(WebBrowserUIPlugin.getResource("%errorCouldNotLaunchWebBrowser", urlText));
+ Trace.trace(Trace.SEVERE,
+ "Error launching default external browser", e);
+ WebBrowserUtil.openError(WebBrowserUIPlugin.getResource(
+ "%errorCouldNotLaunchWebBrowser", urlText));
}
return;
}
-
+
String params = parameters;
if (params == null)
params = "";
-
+
int urlIndex = params.indexOf(WebBrowserPreference.URL_PARAMETER);
if (urlIndex >= 0)
- params = params.substring(0, urlIndex) + " " + urlText + " " + params.substring(urlIndex + WebBrowserPreference.URL_PARAMETER.length());
+ params = params.substring(0, urlIndex)
+ + " "
+ + urlText
+ + " "
+ + params.substring(urlIndex
+ + WebBrowserPreference.URL_PARAMETER.length());
else {
if (!params.endsWith(" "))
params += " ";
params += urlText;
}
-
+
try {
Trace.trace(Trace.FINEST, "Launching " + location + " " + params);
Runtime.getRuntime().exec(location + " " + params);
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Could not launch external browser", e);
- WebBrowserUtil.openError(WebBrowserUIPlugin.getResource("%errorCouldNotLaunchWebBrowser", urlText));
+ WebBrowserUtil.openError(WebBrowserUIPlugin.getResource(
+ "%errorCouldNotLaunchWebBrowser", urlText));
}
}
@@ -135,6 +158,7 @@ public class ExternalWebBrowser implements IExternalWebBrowser {
}
public String toString() {
- return "External Web browser: " + getName() + " / " + getLocation() + " / " + getParameters();
+ return "External Web browser: " + getName() + " / " + getLocation()
+ + " / " + getParameters();
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalWebBrowserWorkingCopy.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalWebBrowserWorkingCopy.java
index c3ef3c7..6f4c213 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalWebBrowserWorkingCopy.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ExternalWebBrowserWorkingCopy.java
@@ -2,14 +2,17 @@ package net.sourceforge.phpeclipse.webbrowser.internal;
import net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowser;
import net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy;
+
/**
*
*/
-public class ExternalWebBrowserWorkingCopy extends ExternalWebBrowser implements IExternalWebBrowserWorkingCopy {
+public class ExternalWebBrowserWorkingCopy extends ExternalWebBrowser implements
+ IExternalWebBrowserWorkingCopy {
protected ExternalWebBrowser browser;
// creation
- public ExternalWebBrowserWorkingCopy() { }
+ public ExternalWebBrowserWorkingCopy() {
+ }
// working copy
public ExternalWebBrowserWorkingCopy(ExternalWebBrowser browser) {
@@ -17,21 +20,27 @@ public class ExternalWebBrowserWorkingCopy extends ExternalWebBrowser implements
setInternal(browser);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy#setName(java.lang.String)
*/
public void setName(String name) {
this.name = name;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy#setLocation(java.lang.String)
*/
public void setLocation(String location) {
this.location = location;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy#setParameters(java.lang.String)
*/
public void setParameters(String params) {
@@ -41,12 +50,14 @@ public class ExternalWebBrowserWorkingCopy extends ExternalWebBrowser implements
public boolean isWorkingCopy() {
return true;
}
-
+
public IExternalWebBrowserWorkingCopy getWorkingCopy() {
return this;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy#save()
*/
public IExternalWebBrowser save() {
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/Favorite.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/Favorite.java
index 1009eff..41aface 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/Favorite.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/Favorite.java
@@ -1,23 +1,26 @@
/**
* 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
*/
package net.sourceforge.phpeclipse.webbrowser.internal;
+
/**
*
*/
public class Favorite {
protected String url;
+
protected String name;
- public Favorite() { }
-
+ public Favorite() {
+ }
+
public Favorite(String name, String url) {
if (name == null)
name = "";
@@ -42,15 +45,15 @@ public class Favorite {
public void setURL(String url) {
this.url = url;
}
-
+
public boolean equals(Object obj) {
if (!(obj instanceof Favorite))
return false;
-
+
Favorite f = (Favorite) obj;
return (name.equals(f.name) && url.equals(f.url));
}
-
+
public String toString() {
return "(" + name + "/" + url + ")";
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/IWebBrowserListener.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/IWebBrowserListener.java
index 97e20dc..5f3cf12 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/IWebBrowserListener.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/IWebBrowserListener.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
**********************************************************************/
@@ -17,8 +17,8 @@ import net.sourceforge.phpeclipse.webbrowser.IWebBrowser;
*/
public interface IWebBrowserListener {
public void browserAdded(IWebBrowser browser);
-
+
public void browserChanged(IWebBrowser browser);
-
+
public void browserRemoved(IWebBrowser browser);
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ImageResource.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ImageResource.java
index 5548430..259085d 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ImageResource.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/ImageResource.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
*/
@@ -17,6 +17,7 @@ import java.util.Map;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
+
/**
* Utility class to handle image resources.
*/
@@ -34,7 +35,8 @@ public class ImageResource {
static {
try {
String pathSuffix = "icons/";
- ICON_BASE_URL = WebBrowserUIPlugin.getInstance().getBundle().getEntry(pathSuffix);
+ ICON_BASE_URL = WebBrowserUIPlugin.getInstance().getBundle()
+ .getEntry(pathSuffix);
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Could not set icon base URL", e);
}
@@ -43,7 +45,9 @@ public class ImageResource {
private static Image[] busyImages;
private static final String URL_CLCL = "clcl16/";
+
private static final String URL_ELCL = "elcl16/";
+
private static final String URL_DLCL = "dlcl16/";
private static final String URL_OBJ = "obj16/";
@@ -51,45 +55,69 @@ public class ImageResource {
// --- constants for images ---
// toolbar images
public static final String IMG_CLCL_NAV_BACKWARD = "IMG_CLCL_NAV_BACKWARD";
+
public static final String IMG_CLCL_NAV_FORWARD = "IMG_CLCL_NAV_FORWARD";
+
public static final String IMG_CLCL_NAV_STOP = "IMG_CLCL_NAV_STOP";
+
public static final String IMG_CLCL_NAV_REFRESH = "IMG_CLCL_NAV_REFRESH";
+
public static final String IMG_CLCL_NAV_GO = "IMG_CLCL_NAV_GO";
+
public static final String IMG_CLCL_NAV_FAVORITES = "cfavorites";
+
public static final String IMG_CLCL_NAV_HOME = "IMG_CLCL_NAV_HOME";
+
public static final String IMG_CLCL_NAV_PRINT = "IMG_CLCL_NAV_PRINT";
public static final String IMG_ELCL_NAV_BACKWARD = "IMG_ELCL_NAV_BACKWARD";
+
public static final String IMG_ELCL_NAV_FORWARD = "IMG_ELCL_NAV_FORWARD";
+
public static final String IMG_ELCL_NAV_STOP = "IMG_ELCL_NAV_STOP";
+
public static final String IMG_ELCL_NAV_REFRESH = "IMG_ELCL_NAV_REFRESH";
+
public static final String IMG_ELCL_NAV_GO = "IMG_ELCL_NAV_GO";
+
public static final String IMG_ELCL_NAV_FAVORITES = "efavorites";
+
public static final String IMG_ELCL_NAV_HOME = "IMG_ELCL_NAV_HOME";
+
public static final String IMG_ELCL_NAV_PRINT = "IMG_ELCL_NAV_PRINT";
public static final String IMG_DLCL_NAV_BACKWARD = "IMG_DLCL_NAV_BACKWARD";
+
public static final String IMG_DLCL_NAV_FORWARD = "IMG_DLCL_NAV_FORWARD";
+
public static final String IMG_DLCL_NAV_STOP = "IMG_DLCL_NAV_STOP";
+
public static final String IMG_DLCL_NAV_REFRESH = "IMG_DLCL_NAV_REFRESH";
+
public static final String IMG_DLCL_NAV_GO = "IMG_DLCL_NAV_GO";
+
public static final String IMG_DLCL_NAV_FAVORITES = "dfavorites";
+
public static final String IMG_DLCL_NAV_HOME = "IMG_DLCL_NAV_HOME";
+
public static final String IMG_DLCL_NAV_PRINT = "IMG_DLCL_NAV_PRINT";
// general object images
public static final String IMG_INTERNAL_BROWSER = "internalBrowser";
+
public static final String IMG_EXTERNAL_BROWSER = "externalBrowser";
+
public static final String IMG_FAVORITE = "favorite";
/**
* Cannot construct an ImageResource. Use static methods only.
*/
- private ImageResource() { }
+ private ImageResource() {
+ }
/**
* Returns the busy images for the Web browser.
- *
+ *
* @return org.eclipse.swt.graphics.Image[]
*/
public static Image[] getBusyImages() {
@@ -98,8 +126,9 @@ public class ImageResource {
/**
* Return the image with the given key.
- *
- * @param key java.lang.String
+ *
+ * @param key
+ * java.lang.String
* @return org.eclipse.swt.graphics.Image
*/
public static Image getImage(String key) {
@@ -110,8 +139,9 @@ public class ImageResource {
/**
* Return the image descriptor with the given key.
- *
- * @param key java.lang.String
+ *
+ * @param key
+ * java.lang.String
* @return org.eclipse.jface.resource.ImageDescriptor
*/
public static ImageDescriptor getImageDescriptor(String key) {
@@ -126,7 +156,7 @@ public class ImageResource {
protected static void initializeImageRegistry() {
imageRegistry = new ImageRegistry();
imageDescriptors = new HashMap();
-
+
// load Web browser images
registerImage(IMG_ELCL_NAV_BACKWARD, URL_ELCL + "nav_backward.gif");
registerImage(IMG_ELCL_NAV_FORWARD, URL_ELCL + "nav_forward.gif");
@@ -136,7 +166,7 @@ public class ImageResource {
registerImage(IMG_ELCL_NAV_FAVORITES, URL_ELCL + "add_favorite.gif");
registerImage(IMG_ELCL_NAV_HOME, URL_ELCL + "nav_home.gif");
registerImage(IMG_ELCL_NAV_PRINT, URL_ELCL + "nav_print.gif");
-
+
registerImage(IMG_CLCL_NAV_BACKWARD, URL_CLCL + "nav_backward.gif");
registerImage(IMG_CLCL_NAV_FORWARD, URL_CLCL + "nav_forward.gif");
registerImage(IMG_CLCL_NAV_STOP, URL_CLCL + "nav_stop.gif");
@@ -145,7 +175,7 @@ public class ImageResource {
registerImage(IMG_CLCL_NAV_FAVORITES, URL_CLCL + "add_favorite.gif");
registerImage(IMG_CLCL_NAV_HOME, URL_CLCL + "nav_home.gif");
registerImage(IMG_CLCL_NAV_PRINT, URL_CLCL + "nav_print.gif");
-
+
registerImage(IMG_DLCL_NAV_BACKWARD, URL_DLCL + "nav_backward.gif");
registerImage(IMG_DLCL_NAV_FORWARD, URL_DLCL + "nav_forward.gif");
registerImage(IMG_DLCL_NAV_STOP, URL_DLCL + "nav_stop.gif");
@@ -154,33 +184,38 @@ public class ImageResource {
registerImage(IMG_DLCL_NAV_FAVORITES, URL_DLCL + "add_favorite.gif");
registerImage(IMG_DLCL_NAV_HOME, URL_DLCL + "nav_home.gif");
registerImage(IMG_DLCL_NAV_PRINT, URL_DLCL + "nav_print.gif");
-
+
registerImage(IMG_INTERNAL_BROWSER, URL_OBJ + "internal_browser.gif");
registerImage(IMG_EXTERNAL_BROWSER, URL_OBJ + "external_browser.gif");
-
+
registerImage(IMG_FAVORITE, URL_OBJ + "favorite.gif");
-
+
// busy images
busyImages = new Image[13];
for (int i = 0; i < 13; i++) {
- registerImage("busy" + i, URL_OBJ + "frames" + java.io.File.separator + "frame" + (i+1) + ".gif");
+ registerImage("busy" + i, URL_OBJ + "frames"
+ + java.io.File.separator + "frame" + (i + 1) + ".gif");
busyImages[i] = getImage("busy" + i);
}
}
/**
* Register an image with the registry.
- *
- * @param key java.lang.String
- * @param partialURL java.lang.String
+ *
+ * @param key
+ * java.lang.String
+ * @param partialURL
+ * java.lang.String
*/
private static void registerImage(String key, String partialURL) {
try {
- ImageDescriptor id = ImageDescriptor.createFromURL(new URL(ICON_BASE_URL, partialURL));
+ ImageDescriptor id = ImageDescriptor.createFromURL(new URL(
+ ICON_BASE_URL, partialURL));
imageRegistry.put(key, id);
imageDescriptors.put(key, id);
} catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error registering image " + key + " from " + partialURL, e);
+ Trace.trace(Trace.WARNING, "Error registering image " + key
+ + " from " + partialURL, e);
}
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalBrowserDialog.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalBrowserDialog.java
index e0261e8..75f74e3 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalBrowserDialog.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalBrowserDialog.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
**********************************************************************/
@@ -21,19 +21,24 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
+
/**
- *
+ *
*/
public class InternalBrowserDialog extends Dialog {
protected IInternalWebBrowserWorkingCopy browser;
+
protected boolean isEdit;
+
protected Button newPageCheckbox;
+
protected Button clearURLHistoryCheckbox;
/**
* @param parentShell
*/
- public InternalBrowserDialog(Shell parentShell, IInternalWebBrowserWorkingCopy browser) {
+ public InternalBrowserDialog(Shell parentShell,
+ IInternalWebBrowserWorkingCopy browser) {
super(parentShell);
this.browser = browser;
isEdit = true;
@@ -43,15 +48,18 @@ public class InternalBrowserDialog extends Dialog {
super.configureShell(shell);
if (isEdit)
- shell.setText(WebBrowserUIPlugin.getResource("%editInternalBrowser"));
+ shell.setText(WebBrowserUIPlugin
+ .getResource("%editInternalBrowser"));
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
- ((GridLayout)composite.getLayout()).numColumns = 1;
+ ((GridLayout) composite.getLayout()).numColumns = 1;
Composite comp = new Composite(composite, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
@@ -59,10 +67,13 @@ public class InternalBrowserDialog extends Dialog {
layout.marginWidth = 10;
comp.setLayout(layout);
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER_INTERNAL);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
+ ContextIds.PREF_BROWSER_INTERNAL);
- newPageCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin.getResource("%prefBrowserNewPage"), false);
- clearURLHistoryCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin.getResource("%clearURLHistory"), true);
+ newPageCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin
+ .getResource("%prefBrowserNewPage"), false);
+ clearURLHistoryCheckbox = SWTUtil.createCheckbox(comp,
+ WebBrowserUIPlugin.getResource("%clearURLHistory"), true);
newPageCheckbox.setSelection(browser.getUseNewPage());
clearURLHistoryCheckbox.setSelection(browser.getClearHistoryOnExit());
@@ -70,7 +81,9 @@ public class InternalBrowserDialog extends Dialog {
return composite;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
protected void okPressed() {
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalWebBrowser.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalWebBrowser.java
index 05a02ac..de5958b 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalWebBrowser.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalWebBrowser.java
@@ -7,31 +7,36 @@ import net.sourceforge.phpeclipse.webbrowser.IInternalWebBrowserWorkingCopy;
import net.sourceforge.phpeclipse.webbrowser.WebBrowserEditorInput;
import org.eclipse.ui.IMemento;
+
/**
*
*/
public class InternalWebBrowser implements IInternalWebBrowser {
private static final String MEMENTO_NEW_PAGE = "new_page";
+
private static final String MEMENTO_CLEAR_HISTORY_ON_EXIT = "clear_history";
protected boolean useNewPage;
+
protected boolean clearHistory;
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IWebBrowser#getName()
*/
public String getName() {
return WebBrowserUIPlugin.getResource("%internalWebBrowserName");
}
-
+
public boolean getUseNewPage() {
return useNewPage;
}
-
+
public boolean getClearHistoryOnExit() {
return clearHistory;
}
-
+
public boolean isWorkingCopy() {
return false;
}
@@ -39,22 +44,25 @@ public class InternalWebBrowser implements IInternalWebBrowser {
public IInternalWebBrowserWorkingCopy getWorkingCopy() {
return new InternalWebBrowserWorkingCopy(this);
}
-
+
protected void setInternal(IInternalWebBrowser browser) {
useNewPage = browser.getUseNewPage();
clearHistory = browser.getClearHistoryOnExit();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IWebBrowser#openURL(java.net.URL)
*/
public void openURL(URL url) {
WebBrowserEditor.open(new WebBrowserEditorInput(url));
}
-
+
protected void save(IMemento memento) {
memento.putString(MEMENTO_NEW_PAGE, useNewPage ? "true" : "false");
- memento.putString(MEMENTO_CLEAR_HISTORY_ON_EXIT, clearHistory ? "true" : "false");
+ memento.putString(MEMENTO_CLEAR_HISTORY_ON_EXIT, clearHistory ? "true"
+ : "false");
}
protected void load(IMemento memento) {
@@ -63,14 +71,14 @@ public class InternalWebBrowser implements IInternalWebBrowser {
useNewPage = true;
else
useNewPage = false;
-
+
s = memento.getString(MEMENTO_CLEAR_HISTORY_ON_EXIT);
if ("true".equals(s))
clearHistory = true;
else
clearHistory = false;
}
-
+
public String toString() {
return "Internal Web browser";
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalWebBrowserWorkingCopy.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalWebBrowserWorkingCopy.java
index 671f74b..b333362 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalWebBrowserWorkingCopy.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternalWebBrowserWorkingCopy.java
@@ -2,10 +2,12 @@ package net.sourceforge.phpeclipse.webbrowser.internal;
import net.sourceforge.phpeclipse.webbrowser.IInternalWebBrowser;
import net.sourceforge.phpeclipse.webbrowser.IInternalWebBrowserWorkingCopy;
+
/**
*
*/
-public class InternalWebBrowserWorkingCopy extends InternalWebBrowser implements IInternalWebBrowserWorkingCopy {
+public class InternalWebBrowserWorkingCopy extends InternalWebBrowser implements
+ IInternalWebBrowserWorkingCopy {
protected InternalWebBrowser browser;
// working copy
@@ -17,7 +19,7 @@ public class InternalWebBrowserWorkingCopy extends InternalWebBrowser implements
public void setUseNewPage(boolean b) {
useNewPage = b;
}
-
+
public void setClearHistoryOnExit(boolean b) {
clearHistory = b;
}
@@ -25,12 +27,14 @@ public class InternalWebBrowserWorkingCopy extends InternalWebBrowser implements
public boolean isWorkingCopy() {
return true;
}
-
+
public IInternalWebBrowserWorkingCopy getWorkingCopy() {
return this;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see net.sourceforge.phpeclipse.webbrowser.IExternalWebBrowserWorkingCopy#save()
*/
public IInternalWebBrowser save() {
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternetPreferencePage.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternetPreferencePage.java
index 0b5c512..e88ffbd 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternetPreferencePage.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/InternetPreferencePage.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
*/
@@ -21,10 +21,12 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
+
/**
* A preference page that holds internet preferences.
*/
-public class InternetPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+public class InternetPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
/**
* InternetPreferencePage constructor comment.
*/
@@ -35,8 +37,9 @@ public class InternetPreferencePage extends PreferencePage implements IWorkbench
/**
* 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) {
@@ -50,12 +53,15 @@ public class InternetPreferencePage extends PreferencePage implements IWorkbench
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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
+ ContextIds.PREF_BROWSER);
Label label = new Label(composite, SWT.WRAP);
- label.setText(WebBrowserUIPlugin.getResource("%preferenceInternetDescription"));
+ label.setText(WebBrowserUIPlugin
+ .getResource("%preferenceInternetDescription"));
data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
label.setLayoutData(data);
@@ -66,8 +72,10 @@ public class InternetPreferencePage extends PreferencePage implements IWorkbench
/**
* Initializes this preference page using the passed desktop.
- *
- * @param desktop the current desktop
+ *
+ * @param desktop
+ * the current desktop
*/
- public void init(IWorkbench workbench) { }
+ public void init(IWorkbench workbench) {
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/OpenWithBrowserActionDelegate.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/OpenWithBrowserActionDelegate.java
index 7445daf..18cdc65 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/OpenWithBrowserActionDelegate.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/OpenWithBrowserActionDelegate.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
*/
@@ -21,6 +21,7 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IActionDelegate;
+
/**
* Action to open the Web broswer on a resource.
*/
@@ -40,49 +41,57 @@ public class OpenWithBrowserActionDelegate implements IActionDelegate {
* This method is called when the delegating action has been triggered.
* Implement this method to do the actual work.
*
- *
- * @param action the action proxy that handles the presentation portion of the
- * action
+ *
+ * @param action
+ * the action proxy that handles the presentation portion of the
+ * action
*/
public void run(IAction action) {
URL url = null;
try {
url = new URL("file://" + resource.getLocation());
- WebBrowser.openURL(new WebBrowserEditorInput(url, WebBrowserEditorInput.SHOW_ALL | WebBrowserEditorInput.FORCE_NEW_PAGE));
+ WebBrowser.openURL(new WebBrowserEditorInput(url,
+ WebBrowserEditorInput.SHOW_ALL
+ | WebBrowserEditorInput.FORCE_NEW_PAGE));
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Error opening browser on file", e);
}
}
/**
- * Notifies this action delegate that the selection in the workbench has changed.
+ * Notifies this action delegate that the selection in the workbench has
+ * changed.
*
* Implementers can use this opportunity to change the availability of the
* action or to modify other presentation properties.
*
- *
- * @param action the action proxy that handles presentation portion of the action
- * @param selection the current selection in the workbench
+ *
+ * @param action
+ * the action proxy that handles presentation portion of the
+ * action
+ * @param selection
+ * the current selection in the workbench
*/
public void selectionChanged(IAction action, ISelection sel) {
if (sel.isEmpty() || !(sel instanceof IStructuredSelection)) {
action.setEnabled(false);
return;
}
-
+
IStructuredSelection select = (IStructuredSelection) sel;
Iterator iterator = select.iterator();
Object selection = iterator.next();
- if (iterator.hasNext()) { // more than one selection (should never happen)
+ if (iterator.hasNext()) { // more than one selection (should never
+ // happen)
action.setEnabled(false);
return;
}
-
+
if (!(selection instanceof IResource)) {
action.setEnabled(false);
return;
}
-
+
resource = (IResource) selection;
action.setEnabled(true);
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/OrganizeFavoritesDialog.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/OrganizeFavoritesDialog.java
index 3c74e02..fd9f89f 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/OrganizeFavoritesDialog.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/OrganizeFavoritesDialog.java
@@ -1,11 +1,12 @@
package net.sourceforge.phpeclipse.webbrowser.internal;
+
/**********************************************************************
* 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
**********************************************************************/
@@ -39,34 +40,40 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
+
/**
* Dialog to manage the favorites list.
*/
public class OrganizeFavoritesDialog extends Dialog {
- protected List favorites = WebBrowserPreference.getInternalWebBrowserFavorites();
-
+ protected List favorites = WebBrowserPreference
+ .getInternalWebBrowserFavorites();
+
public class FavoriteContentProvider implements IStructuredContentProvider {
public FavoriteContentProvider() {
super();
}
- public void dispose() { }
+ public void dispose() {
+ }
public Object[] getElements(Object inputElement) {
return favorites.toArray();
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
}
-
+
public class FavoriteLabelProvider implements ITableLabelProvider {
public FavoriteLabelProvider() {
super();
}
- public void addListener(ILabelProviderListener listener) { }
+ public void addListener(ILabelProviderListener listener) {
+ }
- public void dispose() { }
+ public void dispose() {
+ }
public Image getColumnImage(Object element, int columnIndex) {
if (columnIndex == 0)
@@ -86,13 +93,15 @@ public class OrganizeFavoritesDialog extends Dialog {
return false;
}
- public void removeListener(ILabelProviderListener listener) { }
+ public void removeListener(ILabelProviderListener listener) {
+ }
}
/**
* ManageFavoritesDialog constructor comment.
- * @param parentShell org.eclipse.swt.widgets.Shell
- * @
+ *
+ * @param parentShell
+ * org.eclipse.swt.widgets.Shell @
*/
public OrganizeFavoritesDialog(Shell parentShell) {
super(parentShell);
@@ -101,11 +110,12 @@ public class OrganizeFavoritesDialog extends Dialog {
}
/**
- *
+ *
*/
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
- newShell.setText(WebBrowserUIPlugin.getResource("%dialogOrganizeFavoritesTitle"));
+ newShell.setText(WebBrowserUIPlugin
+ .getResource("%dialogOrganizeFavoritesTitle"));
}
/**
@@ -122,42 +132,47 @@ public class OrganizeFavoritesDialog extends Dialog {
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
composite.setFont(parent.getFont());
- //WorkbenchHelp.setHelp(composite, ContextIds.TERMINATE_SERVER_DIALOG);
-
+ // WorkbenchHelp.setHelp(composite, ContextIds.TERMINATE_SERVER_DIALOG);
+
Label label = new Label(composite, SWT.NONE);
- label.setText(WebBrowserUIPlugin.getResource("%dialogOrganizeFavoritesMessage"));
+ label.setText(WebBrowserUIPlugin
+ .getResource("%dialogOrganizeFavoritesMessage"));
GridData data = new GridData();
data.horizontalSpan = 2;
label.setLayoutData(data);
-
- final Table table = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
+
+ final Table table = new Table(composite, SWT.BORDER
+ | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
data.widthHint = 300;
data.heightHint = 150;
table.setLayoutData(data);
table.setLinesVisible(true);
-
+
TableLayout tableLayout = new TableLayout();
table.setLayout(tableLayout);
table.setHeaderVisible(true);
-
+
tableLayout.addColumnData(new ColumnWeightData(5, 50, true));
TableColumn col = new TableColumn(table, SWT.NONE);
- col.setText(WebBrowserUIPlugin.getResource("%dialogOrganizeFavoritesName"));
-
+ col.setText(WebBrowserUIPlugin
+ .getResource("%dialogOrganizeFavoritesName"));
+
tableLayout.addColumnData(new ColumnWeightData(6, 60, true));
col = new TableColumn(table, SWT.NONE);
- col.setText(WebBrowserUIPlugin.getResource("%dialogOrganizeFavoritesURL"));
+ col.setText(WebBrowserUIPlugin
+ .getResource("%dialogOrganizeFavoritesURL"));
table.setLayout(tableLayout);
-
- final TableViewer tableViewer = new TableViewer(table);
+
+ final TableViewer tableViewer = new TableViewer(table);
tableViewer.setContentProvider(new FavoriteContentProvider());
tableViewer.setLabelProvider(new FavoriteLabelProvider());
tableViewer.setInput("root");
- tableViewer.setColumnProperties(new String[] {"name", "url"});
-
- tableViewer.setCellEditors(new CellEditor[] {new TextCellEditor(table), new TextCellEditor(table)});
-
+ tableViewer.setColumnProperties(new String[] { "name", "url" });
+
+ tableViewer.setCellEditors(new CellEditor[] {
+ new TextCellEditor(table), new TextCellEditor(table) });
+
ICellModifier cellModifier = new ICellModifier() {
public Object getValue(Object element, String property) {
Favorite f = (Favorite) element;
@@ -166,11 +181,11 @@ public class OrganizeFavoritesDialog extends Dialog {
else
return f.getURL();
}
-
+
public boolean canModify(Object element, String property) {
return true;
}
-
+
public void modify(Object element, String property, Object value) {
if (element instanceof Item)
element = ((Item) element).getData();
@@ -189,29 +204,31 @@ public class OrganizeFavoritesDialog extends Dialog {
}
};
tableViewer.setCellModifier(cellModifier);
-
- final Button remove = SWTUtil.createButton(composite, WebBrowserUIPlugin.getResource("%remove"));
+
+ final Button remove = SWTUtil.createButton(composite,
+ WebBrowserUIPlugin.getResource("%remove"));
remove.setEnabled(false);
-
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- remove.setEnabled(!event.getSelection().isEmpty());
- }
- });
-
+
+ tableViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ remove.setEnabled(!event.getSelection().isEmpty());
+ }
+ });
+
remove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int index = table.getSelectionIndex();
if (index < 0 || index >= favorites.size())
return;
-
+
tableViewer.remove(favorites.get(index));
favorites.remove(index);
}
});
-
+
Dialog.applyDialogFont(composite);
-
+
return composite;
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SWTUtil.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SWTUtil.java
index 4381e6c..9598768 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SWTUtil.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/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.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/StandardURLMap.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/StandardURLMap.java
index 95ba794..1cc4d58 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/StandardURLMap.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/StandardURLMap.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.phpeclipse.webbrowser.internal;
import net.sourceforge.phpeclipse.webbrowser.IURLMap;
+
/**
* Standard URL mappings.
*/
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SwitchBrowserWorkbenchAction.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SwitchBrowserWorkbenchAction.java
index 829bf49..33e1e68 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SwitchBrowserWorkbenchAction.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SwitchBrowserWorkbenchAction.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
*/
@@ -24,15 +24,17 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
+
/**
* Action to open the Web broswer.
*/
-public class SwitchBrowserWorkbenchAction implements IWorkbenchWindowPulldownDelegate2 {
+public class SwitchBrowserWorkbenchAction implements
+ IWorkbenchWindowPulldownDelegate2 {
/**
* The menu created by this action
*/
private Menu fMenu;
-
+
protected boolean recreateMenu = false;
/**
@@ -45,11 +47,12 @@ public class SwitchBrowserWorkbenchAction implements IWorkbenchWindowPulldownDel
public void dispose() {
setMenu(null);
}
-
+
/**
* Sets this action's drop-down menu, disposing the previous menu.
*
- * @param menu the new menu
+ * @param menu
+ * the new menu
*/
private void setMenu(Menu menu) {
if (fMenu != null) {
@@ -58,43 +61,51 @@ public class SwitchBrowserWorkbenchAction implements IWorkbenchWindowPulldownDel
fMenu = menu;
}
- public void init(IWorkbenchWindow window) { }
-
+ public void init(IWorkbenchWindow window) {
+ }
+
/**
* Adds the given action to the specified menu with an accelerator specified
* by the given number.
*
- * @param menu the menu to add the action to
- * @param action the action to add
- * @param accelerator the number that should appear as an accelerator
+ * @param menu
+ * the menu to add the action to
+ * @param action
+ * the action to add
+ * @param accelerator
+ * the number that should appear as an accelerator
*/
protected void addToMenu(Menu menu, IAction action, int accelerator) {
- StringBuffer label= new StringBuffer();
+ StringBuffer label = new StringBuffer();
if (accelerator >= 0 && accelerator < 10) {
- //add the numerical accelerator
+ // add the numerical accelerator
label.append('&');
label.append(accelerator);
label.append(' ');
}
label.append(action.getText());
action.setText(label.toString());
- ActionContributionItem item= new ActionContributionItem(action);
+ ActionContributionItem item = new ActionContributionItem(action);
item.fill(menu, -1);
}
-
+
/**
- * Fills the drop-down menu with favorites and launch history,
- * launch shortcuts, and an action to open the launch configuration dialog.
- *
- * @param menu the menu to fill
+ * Fills the drop-down menu with favorites and launch history, launch
+ * shortcuts, and an action to open the launch configuration dialog.
+ *
+ * @param menu
+ * the menu to fill
*/
protected void fillMenu(Menu menu) {
- IWebBrowser current = BrowserManager.getInstance().getCurrentWebBrowser();
- Iterator iterator = BrowserManager.getInstance().getWebBrowsers().iterator();
+ IWebBrowser current = BrowserManager.getInstance()
+ .getCurrentWebBrowser();
+ Iterator iterator = BrowserManager.getInstance().getWebBrowsers()
+ .iterator();
int i = 0;
while (iterator.hasNext()) {
IWebBrowser browser = (IWebBrowser) iterator.next();
- addToMenu(menu, new SwitchDefaultBrowserAction(browser, browser.equals(current)), i++);
+ addToMenu(menu, new SwitchDefaultBrowserAction(browser, browser
+ .equals(current)), i++);
}
}
@@ -106,33 +117,35 @@ public class SwitchBrowserWorkbenchAction implements IWorkbenchWindowPulldownDel
// it is shown because of dynamic history list
fMenu.addMenuListener(new MenuAdapter() {
public void menuShown(MenuEvent e) {
- //if (recreateMenu) {
- Menu m = (Menu) e.widget;
- MenuItem[] items = m.getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].dispose();
- }
- fillMenu(m);
- recreateMenu = false;
- //}
+ // if (recreateMenu) {
+ Menu m = (Menu) e.widget;
+ MenuItem[] items = m.getItems();
+ for (int i = 0; i < items.length; i++) {
+ items[i].dispose();
+ }
+ fillMenu(m);
+ recreateMenu = false;
+ // }
}
});
}
- public void selectionChanged(IAction action, ISelection selection) { }
-
- public void run(IAction action) { }
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ public void run(IAction action) {
+ }
public Menu getMenu(Menu parent) {
setMenu(new Menu(parent));
- //fillMenu(fMenu);
+ // fillMenu(fMenu);
initMenu();
return fMenu;
}
public Menu getMenu(Control parent) {
setMenu(new Menu(parent));
- //fillMenu(fMenu);
+ // fillMenu(fMenu);
initMenu();
return fMenu;
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SwitchDefaultBrowserAction.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SwitchDefaultBrowserAction.java
index a2bab5b..22d54c5 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SwitchDefaultBrowserAction.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/SwitchDefaultBrowserAction.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
*/
@@ -14,6 +14,7 @@ import net.sourceforge.phpeclipse.webbrowser.IInternalWebBrowser;
import net.sourceforge.phpeclipse.webbrowser.IWebBrowser;
import org.eclipse.jface.action.Action;
+
/**
* Action to open the Web browser.
*/
@@ -25,14 +26,16 @@ public class SwitchDefaultBrowserAction extends Action {
*/
public SwitchDefaultBrowserAction(IWebBrowser webbrowser, boolean current) {
super();
-
+
this.webbrowser = webbrowser;
setText(webbrowser.getName());
if (webbrowser instanceof IInternalWebBrowser)
- setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_INTERNAL_BROWSER));
+ setImageDescriptor(ImageResource
+ .getImageDescriptor(ImageResource.IMG_INTERNAL_BROWSER));
else
- setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_EXTERNAL_BROWSER));
-
+ setImageDescriptor(ImageResource
+ .getImageDescriptor(ImageResource.IMG_EXTERNAL_BROWSER));
+
if (current)
setChecked(true);
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/TextAction.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/TextAction.java
index 54cf481..1d7206d 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/TextAction.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/TextAction.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
*/
@@ -16,17 +16,21 @@ import org.eclipse.swt.SWTException;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.graphics.Point;
+
/**
* Text actions (cut, copy, paste) for the Web browser.
*/
public class TextAction extends Action {
protected WebBrowser browser;
+
protected byte type;
public static final byte CUT = 0;
+
public static final byte COPY = 1;
+
public static final byte PASTE = 2;
-
+
/**
* TextAction constructor comment.
*/
@@ -35,97 +39,108 @@ public class TextAction extends Action {
this.browser = browser;
this.type = type;
}
-
+
/**
- * Copies the selected text to the clipboard. The text will be put in the
+ * Copies the selected text to the clipboard. The text will be put in the
* clipboard in plain text format.
*
- *
- * @exception SWTException
- *
ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- *
ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
+ *
+ * @exception SWTException
+ *
+ *
ERROR_WIDGET_DISPOSED - if the receiver has been
+ * disposed
+ *
ERROR_THREAD_INVALID_ACCESS - if not called from the
+ * thread that created the receiver
+ *
*/
public void copy() {
Point selection = browser.combo.getSelection();
-
+
int length = selection.y - selection.x;
if (length > 0) {
TextTransfer plainTextTransfer = TextTransfer.getInstance();
try {
- browser.clipboard.setContents(
- new String[] { browser.combo.getText().substring(selection.x, selection.y) },
- new Transfer[] { plainTextTransfer });
+ browser.clipboard.setContents(new String[] { browser.combo
+ .getText().substring(selection.x, selection.y) },
+ new Transfer[] { plainTextTransfer });
} catch (SWTError error) {
- // Copy to clipboard failed. This happens when another application
+ // Copy to clipboard failed. This happens when another
+ // application
// is accessing the clipboard while we copy. Ignore the error.
// Fixes 1GDQAVN
}
}
}
-
+
/**
- * Moves the selected text to the clipboard. The text will be put in the
+ * Moves the selected text to the clipboard. The text will be put in the
* clipboard in plain text format and RTF format.
*
- *
- * @exception SWTException
- *
ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- *
ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
+ *
+ * @exception SWTException
+ *
+ *
ERROR_WIDGET_DISPOSED - if the receiver has been
+ * disposed
+ *
ERROR_THREAD_INVALID_ACCESS - if not called from the
+ * thread that created the receiver
+ *
*/
- public void cut(){
+ public void cut() {
Point selection = browser.combo.getSelection();
-
+
if (selection.y > selection.x) {
copy();
delete();
}
}
-
+
/**
- * Deletes the character to the right of the caret. Delete the selected text if any.
+ * Deletes the character to the right of the caret. Delete the selected text
+ * if any.
*/
public void delete() {
Point selection = browser.combo.getSelection();
String text = browser.combo.getText();
-
+
if (selection.x != selection.y) {
text = text.substring(0, selection.x) + text.substring(selection.y);
browser.combo.setText(text);
browser.combo.setSelection(new Point(selection.x, selection.x));
}
}
-
- /**
- * Replaces the selection with the clipboard text or insert the text at
- * the current caret offset if there is no selection.
- * If the widget has the SWT.SINGLE style and the clipboard text contains
- * more than one line, only the first line without line delimiters is
- * inserted in the widget.
+
+ /**
+ * Replaces the selection with the clipboard text or insert the text at the
+ * current caret offset if there is no selection. If the widget has the
+ * SWT.SINGLE style and the clipboard text contains more than one line, only
+ * the first line without line delimiters is inserted in the widget.
*
- *
- * @exception SWTException
- *
ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- *
ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- *
+ *
+ * @exception SWTException
+ *
+ *
ERROR_WIDGET_DISPOSED - if the receiver has been
+ * disposed
+ *
ERROR_THREAD_INVALID_ACCESS - if not called from the
+ * thread that created the receiver
+ *
*/
public void paste() {
TextTransfer transfer = TextTransfer.getInstance();
Point selection = browser.combo.getSelection();
String text = browser.combo.getText();
-
+
String newText = (String) browser.clipboard.getContents(transfer);
if (newText != null && newText.length() > 0) {
- text = text.substring(0, selection.x) + newText + text.substring(selection.y);
+ text = text.substring(0, selection.x) + newText
+ + text.substring(selection.y);
browser.combo.setText(text);
-
+
// set the selection to the end of the paste
int x = selection.x + newText.length();
browser.combo.setSelection(new Point(x, x));
}
}
-
+
/**
* Implementation of method defined on IAction.
*/
@@ -139,9 +154,10 @@ public class TextAction extends Action {
else if (type == PASTE)
paste();
}
-
+
/**
*
*/
- protected void update() { }
+ protected void update() {
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/Trace.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/Trace.java
index 550cd7d..db21a7c 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/Trace.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/Trace.java
@@ -1,22 +1,27 @@
/**
* 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
*/
package net.sourceforge.phpeclipse.webbrowser.internal;
+
/**
* Helper class to route trace output.
*/
public class Trace {
public static int CONFIG = 0;
+
public static int WARNING = 2;
+
public static int SEVERE = 3;
+
public static int FINER = 4;
+
public static int FINEST = 5;
/**
@@ -28,8 +33,9 @@ public class Trace {
/**
* Trace the given text.
- *
- * @param s java.lang.String
+ *
+ * @param s
+ * java.lang.String
*/
public static void trace(int level, String s) {
Trace.trace(level, s, null);
@@ -37,9 +43,11 @@ public class Trace {
/**
* Trace the given message and exception.
- *
- * @param s java.lang.String
- * @param t java.lang.Throwable
+ *
+ * @param s
+ * java.lang.String
+ * @param t
+ * java.lang.Throwable
*/
public static void trace(int level, String s, Throwable t) {
if (!WebBrowserUIPlugin.getInstance().isDebugging())
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowser.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowser.java
index 24cfb5d..4c4f9ee 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowser.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowser.java
@@ -1,11 +1,13 @@
/**
- * Copyright (c) 2003 IBM Corporation 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 - Initial API and implementation
+ * Copyright (c) 2003 IBM Corporation 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 -
+ * Initial API and implementation
*/
-//TODO 1. Handle the sizing of a popup running in shelled out secondary window.
-//TODO 2. Support printing: waiting on eclipse bug 47937/44823.
+// TODO 1. Handle the sizing of a popup running in shelled out secondary window.
+// TODO 2. Support printing: waiting on eclipse bug 47937/44823.
package net.sourceforge.phpeclipse.webbrowser.internal;
import java.util.Iterator;
@@ -48,590 +50,644 @@ import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.PlatformUI;
public class WebBrowser extends Composite {
- protected Composite toolbarComp;
+ protected Composite toolbarComp;
- protected Composite statusComp;
+ protected Composite statusComp;
- protected Combo combo;
+ protected Combo combo;
- protected Clipboard clipboard;
+ protected Clipboard clipboard;
- protected boolean showToolbar;
+ protected boolean showToolbar;
- protected ToolItem back;
+ protected ToolItem back;
- protected ToolItem forward;
+ protected ToolItem forward;
- protected ToolItem stop;
+ protected ToolItem stop;
- protected ToolItem favorites;
+ protected ToolItem favorites;
- protected ToolItem refresh;
+ protected ToolItem refresh;
- protected BusyIndicator busy;
+ protected BusyIndicator busy;
- protected boolean showStatusbar;
+ protected boolean showStatusbar;
- protected ProgressBar progress;
+ protected ProgressBar progress;
- protected Label status;
+ protected Label status;
- private static int MAX_HISTORY = 50;
+ private static int MAX_HISTORY = 50;
- protected static java.util.List history;
+ protected static java.util.List history;
- protected Browser browser;
+ protected Browser browser;
- protected Shell shell;
+ protected Shell shell;
+
+ protected WebBrowserEditor editor;
+
+ protected String title;
+
+ public WebBrowser(Composite parent, final boolean showToolbar,
+ final boolean showStatusbar) {
+ super(parent, SWT.NONE);
+
+ this.showToolbar = showToolbar;
+ this.showStatusbar = showStatusbar;
- protected WebBrowserEditor editor;
-
- protected String title;
-
- public WebBrowser(Composite parent, final boolean showToolbar, final boolean showStatusbar) {
- super(parent, SWT.NONE);
-
- this.showToolbar = showToolbar;
- this.showStatusbar = showStatusbar;
-
- GridLayout layout = new GridLayout();
- layout.marginHeight = 3;
- layout.marginWidth = 3;
- layout.horizontalSpacing = 3;
- layout.verticalSpacing = 3;
- layout.numColumns = 1;
- setLayout(layout);
- setLayoutData(new GridData(GridData.FILL_BOTH));
- clipboard = new Clipboard(parent.getDisplay());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ContextIds.WEB_BROWSER);
-
- if (showToolbar) {
- toolbarComp = new Composite(this, SWT.NONE);
- GridLayout outerLayout = new GridLayout();
- outerLayout.numColumns = 2;
- outerLayout.marginWidth = 0;
- outerLayout.marginHeight = 0;
- toolbarComp.setLayout(outerLayout);
- toolbarComp.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL));
-
- // create the top line, with a combo box for history and a "go" button
- Composite top = new Composite(toolbarComp, SWT.NONE);
- GridLayout topLayout = new GridLayout();
- topLayout.numColumns = 2;
- topLayout.marginWidth = 0;
- topLayout.marginHeight = 0;
- top.setLayout(topLayout);
- top.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL));
-
- combo = new Combo(top, SWT.DROP_DOWN);
-
- updateHistory();
-
- combo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent we) {
- try {
- if (combo.getSelectionIndex() != -1)
- setURL(combo.getItem(combo.getSelectionIndex()));
- } catch (Exception e) {
- }
- }
- });
- combo.addListener(SWT.DefaultSelection, new Listener() {
- public void handleEvent(Event e) {
- setURL(combo.getText());
- }
- });
- combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, ContextIds.WEB_BROWSER_URL);
-
- ToolBar toolbar = new ToolBar(top, SWT.FLAT);
- fillToolBar(toolbar);
-
- new ToolItem(toolbar, SWT.SEPARATOR);
-
- busy = new BusyIndicator(toolbarComp, SWT.NONE);
- busy.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- }
-
- // create a new SWT Web browser widget, checking once again to make sure we can use it in this environment
-// if (WebBrowserUtil.canUseInternalWebBrowser() & WebBrowserUtil.isInternalBrowserOperational())
- if (WebBrowserUtil.isInternalBrowserOperational())
- this.browser = new Browser(this, SWT.NONE);
- else {
- WebBrowserUtil.openError(WebBrowserUIPlugin.getResource("%errorCouldNotLaunchInternalWebBrowser"));
- return;
- }
-
- if (showToolbar) {
- back.setEnabled(browser.isBackEnabled());
- forward.setEnabled(browser.isForwardEnabled());
- }
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(browser, ContextIds.WEB_BROWSER_WEB);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- data.horizontalSpan = 3;
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- browser.setLayoutData(data);
-
- if (showStatusbar)
- createStatusArea(this);
-
- addBrowserListeners();
- }
-
- /**
- *
- */
- protected void addBrowserListeners() {
- if (showStatusbar) {
- // respond to Browser StatusTextEvents events by updating the status Text label
- browser.addStatusTextListener(new StatusTextListener() {
- public void changed(StatusTextEvent event) {
- status.setText(event.text);
- }
- });
- }
-
- /**
- * Add listener for new window creation so that we can instead of opening a separate new window in which the session is lost, we
- * can instead open a new window in a new shell within the browser area thereby maintaining the session.
- */
- browser.addOpenWindowListener(new OpenWindowListener() {
- public void open(WindowEvent event) {
- Shell shell2 = new Shell(getDisplay());
- shell2.setLayout(new FillLayout());
- shell2.setText(WebBrowserUIPlugin.getResource("%viewWebBrowserTitle"));
- shell2.setImage(getShell().getImage());
- WebBrowser browser2 = new WebBrowser(shell2, showToolbar, showStatusbar);
- browser2.shell = shell2;
- event.browser = browser2.browser;
- shell2.open();
- }
- });
-
- browser.addCloseWindowListener(new CloseWindowListener() {
- public void close(WindowEvent event) {
- // if shell is not null, it must be a secondary popup window, else its an editor window
- if (shell != null)
- shell.dispose();
- else
- editor.closeEditor();
- }
- });
-
- browser.addProgressListener(new ProgressListener() {
- public void changed(ProgressEvent event) {
- if (event.total == 0)
- return;
-
- boolean done = (event.current == event.total);
-
- int percentProgress = event.current * 100 / event.total;
- if (showStatusbar) {
- if (done)
- progress.setSelection(0);
- else
- progress.setSelection(percentProgress);
- }
-
- if (showToolbar) {
- if (!busy.isBusy() && (percentProgress > 0 && percentProgress < 100)) {
- busy.setBusy(true);
- }
- // Once the progress hits 100 percent, done, set busy to false
- else if (busy.isBusy() && done) {
- busy.setBusy(false);
- }
- }
- }
-
- public void completed(ProgressEvent event) {
- if (showStatusbar)
- progress.setSelection(0);
- if (showToolbar) {
- busy.setBusy(false);
- back.setEnabled(browser.isBackEnabled());
- forward.setEnabled(browser.isForwardEnabled());
- }
- }
- });
-
- if (showToolbar) {
- browser.addLocationListener(new LocationListener() {
- public void changed(LocationEvent event) {
- if (!event.top)
- return;
- if (!isHome()) {
- combo.setText(event.location);
- addToHistory(event.location);
- updateHistory();
- } else
- combo.setText("");
- }
-
- public void changing(LocationEvent event) {
- }
- });
- }
-
- browser.addTitleListener(new TitleListener() {
- public void changed(TitleEvent event) {
- title = event.title;
- }
- });
- }
-
- /**
- * Return the underlying browser control.
- *
- * @return org.eclipse.swt.browser.Browser
- */
- public Browser getBrowser() {
- return browser;
- }
-
- /**
- *
- */
- protected void forward() {
- browser.forward();
- }
-
- /**
- *
- */
- protected void back() {
- browser.back();
- }
-
- /**
- *
- */
- protected void stop() {
- browser.stop();
- }
-
- /**
- *
- */
- protected void navigate(String url) {
- Trace.trace(Trace.FINER, "Navigate: " + url);
- if (url != null && url.equals(getURL())) {
- refresh();
- return;
- }
- browser.setUrl(url);
- }
-
- /**
- * Refresh the currently viewed page.
- */
- public void refresh() {
- browser.refresh();
- }
-
- protected void setURL(String url, boolean browse) {
- Trace.trace(Trace.FINEST, "setURL: " + url + " " + browse);
- if (url == null) {
- home();
- return;
- }
-
- if (url.endsWith(WebBrowserPreference.getHomePageURL().substring(9)))
- return;
-
- // check URL maps
- Iterator iterator = WebBrowserUtil.getURLMaps().iterator();
- String newURL = null;
- while (iterator.hasNext() && newURL == null) {
- try {
- IURLMap map = (IURLMap) iterator.next();
- newURL = map.getMappedURL(url);
- } catch (Exception e) {
- }
- }
- if (newURL != null)
- url = newURL;
-
- if (browse)
- navigate(url);
-
- addToHistory(url);
- updateHistory();
- }
-
- protected void addToHistory(String url) {
- if (history == null)
- history = WebBrowserPreference.getInternalWebBrowserHistory();
- int found = -1;
- int size = history.size();
- for (int i = 0; i < size; i++) {
- String s = (String) history.get(i);
- if (s.equals(url)) {
- found = i;
- break;
- }
- }
-
- if (found == -1) {
- if (size >= MAX_HISTORY)
- history.remove(size - 1);
- history.add(0, url);
- WebBrowserPreference.setInternalWebBrowserHistory(history);
- } else if (found != 0) {
- history.remove(found);
- history.add(0, url);
- WebBrowserPreference.setInternalWebBrowserHistory(history);
- }
- }
-
- public void setURL(String url) {
- setURL(url, true);
- }
-
- /**
- * Creates the Web browser status area.
- */
- private void createStatusArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.horizontalSpacing = 4;
- layout.verticalSpacing = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Add a label for displaying status messages as they are received from the control
- status = new Label(composite, SWT.SINGLE | SWT.READ_ONLY);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalIndent = 2;
- status.setLayoutData(gridData);
-
- // Add a progress bar to display downloading progress information
- progress = new ProgressBar(composite, SWT.BORDER);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_FILL);
- gridData.widthHint = 100;
- gridData.heightHint = 10;
- progress.setLayoutData(gridData);
- }
-
- /**
- *
- */
- public void dispose() {
- super.dispose();
-
- showStatusbar = false;
- showToolbar = false;
-
- if (busy != null)
- busy.dispose();
- busy = null;
-
- browser = null;
- }
-
- /**
- * Populate the toolbar.
- *
- * @param toolbar
- * org.eclipse.swt.widgets.ToolBar
- */
- private void fillToolBar(final ToolBar toolbar) {
- ToolItem go = new ToolItem(toolbar, SWT.NONE);
- go.setImage(ImageResource.getImage(ImageResource.IMG_ELCL_NAV_GO));
- go.setHotImage(ImageResource.getImage(ImageResource.IMG_CLCL_NAV_GO));
- go.setDisabledImage(ImageResource.getImage(ImageResource.IMG_DLCL_NAV_GO));
- go.setToolTipText(WebBrowserUIPlugin.getResource("%actionWebBrowserGo"));
- go.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setURL(combo.getText());
- }
- });
-
- new ToolItem(toolbar, SWT.SEPARATOR);
-
- favorites = new ToolItem(toolbar, SWT.DROP_DOWN);
- favorites.setImage(ImageResource.getImage(ImageResource.IMG_ELCL_NAV_FAVORITES));
- favorites.setHotImage(ImageResource.getImage(ImageResource.IMG_CLCL_NAV_FAVORITES));
- favorites.setDisabledImage(ImageResource.getImage(ImageResource.IMG_DLCL_NAV_FAVORITES));
- favorites.setToolTipText(WebBrowserUIPlugin.getResource("%actionWebBrowserFavorites"));
-
- favorites.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- if (event.detail == SWT.ARROW) {
- Rectangle r = favorites.getBounds();
- showFavorites(toolbar, toolbar.toDisplay(r.x, r.y + r.height));
- } else
- addFavorite();
- }
- });
-
- // create back and forward actions
- back = new ToolItem(toolbar, SWT.NONE);
- back.setImage(ImageResource.getImage(ImageResource.IMG_ELCL_NAV_BACKWARD));
- back.setHotImage(ImageResource.getImage(ImageResource.IMG_CLCL_NAV_BACKWARD));
- back.setDisabledImage(ImageResource.getImage(ImageResource.IMG_DLCL_NAV_BACKWARD));
- back.setToolTipText(WebBrowserUIPlugin.getResource("%actionWebBrowserBack"));
- back.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- back();
- }
- });
-
- forward = new ToolItem(toolbar, SWT.NONE);
- forward.setImage(ImageResource.getImage(ImageResource.IMG_ELCL_NAV_FORWARD));
- forward.setHotImage(ImageResource.getImage(ImageResource.IMG_CLCL_NAV_FORWARD));
- forward.setDisabledImage(ImageResource.getImage(ImageResource.IMG_DLCL_NAV_FORWARD));
- forward.setToolTipText(WebBrowserUIPlugin.getResource("%actionWebBrowserForward"));
- forward.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- forward();
- }
- });
-
- // create refresh, stop, and print actions
- stop = new ToolItem(toolbar, SWT.NONE);
- stop.setImage(ImageResource.getImage(ImageResource.IMG_ELCL_NAV_STOP));
- stop.setHotImage(ImageResource.getImage(ImageResource.IMG_CLCL_NAV_STOP));
- stop.setDisabledImage(ImageResource.getImage(ImageResource.IMG_DLCL_NAV_STOP));
- stop.setToolTipText(WebBrowserUIPlugin.getResource("%actionWebBrowserStop"));
- stop.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- stop();
- }
- });
-
- refresh = new ToolItem(toolbar, SWT.NONE);
- refresh.setImage(ImageResource.getImage(ImageResource.IMG_ELCL_NAV_REFRESH));
- refresh.setHotImage(ImageResource.getImage(ImageResource.IMG_CLCL_NAV_REFRESH));
- refresh.setDisabledImage(ImageResource.getImage(ImageResource.IMG_DLCL_NAV_REFRESH));
- refresh.setToolTipText(WebBrowserUIPlugin.getResource("%actionWebBrowserRefresh"));
- refresh.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- refresh();
- }
- });
- }
-
- protected void addFavorite() {
- java.util.List list = WebBrowserPreference.getInternalWebBrowserFavorites();
- Favorite f = new Favorite(title, browser.getUrl());
- if (!list.contains(f)) {
- list.add(f);
- WebBrowserPreference.setInternalWebBrowserFavorites(list);
- }
- }
-
- protected void showFavorites(Control parent, Point p) {
- Menu perspectiveBarMenu = null;
- if (perspectiveBarMenu == null) {
- Menu menu = new Menu(parent);
-
- // locked favorites
- Iterator iterator = WebBrowserUtil.getLockedFavorites().iterator();
- if (iterator.hasNext()) {
- while (iterator.hasNext()) {
- final Favorite f = (Favorite) iterator.next();
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setText(f.getName());
- item.setImage(ImageResource.getImage(ImageResource.IMG_FAVORITE));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setURL(f.getURL());
- }
- });
- }
-
- new MenuItem(menu, SWT.SEPARATOR);
- }
-
- iterator = WebBrowserPreference.getInternalWebBrowserFavorites().iterator();
- if (!iterator.hasNext()) {
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setText(WebBrowserUIPlugin.getResource("%actionWebBrowserNoFavorites"));
- }
- while (iterator.hasNext()) {
- final Favorite f = (Favorite) iterator.next();
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setText(f.getName());
- item.setImage(ImageResource.getImage(ImageResource.IMG_FAVORITE));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setURL(f.getURL());
- }
- });
- }
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setText(WebBrowserUIPlugin.getResource("%actionWebBrowserOrganizeFavorites"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- OrganizeFavoritesDialog dialog = new OrganizeFavoritesDialog(shell);
- dialog.open();
- }
- });
-
- perspectiveBarMenu = menu;
- }
-
- if (perspectiveBarMenu != null) {
- perspectiveBarMenu.setLocation(p.x, p.y);
- perspectiveBarMenu.setVisible(true);
- }
- }
-
- public void home() {
- navigate(WebBrowserPreference.getHomePageURL());
- }
-
- /**
- * Returns true if the homepage is currently being displayed.
- *
- * @return boolean
- */
- protected boolean isHome() {
- return getURL() != null && getURL().endsWith(WebBrowserPreference.getHomePageURL().substring(9));
- }
-
- protected String getURL() {
- return browser.getUrl();
- }
-
- /**
- * Update the history list to the global copy.
- */
- protected void updateHistory() {
- if (combo == null)
- return;
-
- String temp = combo.getText();
- if (history == null)
- history = WebBrowserPreference.getInternalWebBrowserHistory();
-
- String[] historyList = new String[history.size()];
- history.toArray(historyList);
- combo.setItems(historyList);
-
- combo.setText(temp);
- }
-
- public void addProgressListener(ProgressListener listener) {
- browser.addProgressListener(listener);
- }
-
- public void addStatusTextListener(StatusTextListener listener) {
- browser.addStatusTextListener(listener);
- }
-
- public void addTitleListener(TitleListener listener) {
- browser.addTitleListener(listener);
- }
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 3;
+ layout.marginWidth = 3;
+ layout.horizontalSpacing = 3;
+ layout.verticalSpacing = 3;
+ layout.numColumns = 1;
+ setLayout(layout);
+ setLayoutData(new GridData(GridData.FILL_BOTH));
+ clipboard = new Clipboard(parent.getDisplay());
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+ ContextIds.WEB_BROWSER);
+
+ if (showToolbar) {
+ toolbarComp = new Composite(this, SWT.NONE);
+ GridLayout outerLayout = new GridLayout();
+ outerLayout.numColumns = 2;
+ outerLayout.marginWidth = 0;
+ outerLayout.marginHeight = 0;
+ toolbarComp.setLayout(outerLayout);
+ toolbarComp.setLayoutData(new GridData(
+ GridData.VERTICAL_ALIGN_BEGINNING
+ | GridData.FILL_HORIZONTAL));
+
+ // create the top line, with a combo box for history and a "go"
+ // button
+ Composite top = new Composite(toolbarComp, SWT.NONE);
+ GridLayout topLayout = new GridLayout();
+ topLayout.numColumns = 2;
+ topLayout.marginWidth = 0;
+ topLayout.marginHeight = 0;
+ top.setLayout(topLayout);
+ top.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER
+ | GridData.FILL_HORIZONTAL));
+
+ combo = new Combo(top, SWT.DROP_DOWN);
+
+ updateHistory();
+
+ combo.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent we) {
+ try {
+ if (combo.getSelectionIndex() != -1)
+ setURL(combo.getItem(combo.getSelectionIndex()));
+ } catch (Exception e) {
+ }
+ }
+ });
+ combo.addListener(SWT.DefaultSelection, new Listener() {
+ public void handleEvent(Event e) {
+ setURL(combo.getText());
+ }
+ });
+ combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(combo,
+ ContextIds.WEB_BROWSER_URL);
+
+ ToolBar toolbar = new ToolBar(top, SWT.FLAT);
+ fillToolBar(toolbar);
+
+ new ToolItem(toolbar, SWT.SEPARATOR);
+
+ busy = new BusyIndicator(toolbarComp, SWT.NONE);
+ busy.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+ }
+
+ // create a new SWT Web browser widget, checking once again to make sure
+ // we can use it in this environment
+ // if (WebBrowserUtil.canUseInternalWebBrowser() &
+ // WebBrowserUtil.isInternalBrowserOperational())
+ if (WebBrowserUtil.isInternalBrowserOperational())
+ this.browser = new Browser(this, SWT.NONE);
+ else {
+ WebBrowserUtil.openError(WebBrowserUIPlugin
+ .getResource("%errorCouldNotLaunchInternalWebBrowser"));
+ return;
+ }
+
+ if (showToolbar) {
+ back.setEnabled(browser.isBackEnabled());
+ forward.setEnabled(browser.isForwardEnabled());
+ }
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(browser,
+ ContextIds.WEB_BROWSER_WEB);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalSpan = 3;
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+ browser.setLayoutData(data);
+
+ if (showStatusbar)
+ createStatusArea(this);
+
+ addBrowserListeners();
+ }
+
+ /**
+ *
+ */
+ protected void addBrowserListeners() {
+ if (showStatusbar) {
+ // respond to Browser StatusTextEvents events by updating the status
+ // Text label
+ browser.addStatusTextListener(new StatusTextListener() {
+ public void changed(StatusTextEvent event) {
+ status.setText(event.text);
+ }
+ });
+ }
+
+ /**
+ * Add listener for new window creation so that we can instead of
+ * opening a separate new window in which the session is lost, we can
+ * instead open a new window in a new shell within the browser area
+ * thereby maintaining the session.
+ */
+ browser.addOpenWindowListener(new OpenWindowListener() {
+ public void open(WindowEvent event) {
+ Shell shell2 = new Shell(getDisplay());
+ shell2.setLayout(new FillLayout());
+ shell2.setText(WebBrowserUIPlugin
+ .getResource("%viewWebBrowserTitle"));
+ shell2.setImage(getShell().getImage());
+ WebBrowser browser2 = new WebBrowser(shell2, showToolbar,
+ showStatusbar);
+ browser2.shell = shell2;
+ event.browser = browser2.browser;
+ shell2.open();
+ }
+ });
+
+ browser.addCloseWindowListener(new CloseWindowListener() {
+ public void close(WindowEvent event) {
+ // if shell is not null, it must be a secondary popup window,
+ // else its an editor window
+ if (shell != null)
+ shell.dispose();
+ else
+ editor.closeEditor();
+ }
+ });
+
+ browser.addProgressListener(new ProgressListener() {
+ public void changed(ProgressEvent event) {
+ if (event.total == 0)
+ return;
+
+ boolean done = (event.current == event.total);
+
+ int percentProgress = event.current * 100 / event.total;
+ if (showStatusbar) {
+ if (done)
+ progress.setSelection(0);
+ else
+ progress.setSelection(percentProgress);
+ }
+
+ if (showToolbar) {
+ if (!busy.isBusy()
+ && (percentProgress > 0 && percentProgress < 100)) {
+ busy.setBusy(true);
+ }
+ // Once the progress hits 100 percent, done, set busy to
+ // false
+ else if (busy.isBusy() && done) {
+ busy.setBusy(false);
+ }
+ }
+ }
+
+ public void completed(ProgressEvent event) {
+ if (showStatusbar)
+ progress.setSelection(0);
+ if (showToolbar) {
+ busy.setBusy(false);
+ back.setEnabled(browser.isBackEnabled());
+ forward.setEnabled(browser.isForwardEnabled());
+ }
+ }
+ });
+
+ if (showToolbar) {
+ browser.addLocationListener(new LocationListener() {
+ public void changed(LocationEvent event) {
+ if (!event.top)
+ return;
+ if (!isHome()) {
+ combo.setText(event.location);
+ addToHistory(event.location);
+ updateHistory();
+ } else
+ combo.setText("");
+ }
+
+ public void changing(LocationEvent event) {
+ }
+ });
+ }
+
+ browser.addTitleListener(new TitleListener() {
+ public void changed(TitleEvent event) {
+ title = event.title;
+ }
+ });
+ }
+
+ /**
+ * Return the underlying browser control.
+ *
+ * @return org.eclipse.swt.browser.Browser
+ */
+ public Browser getBrowser() {
+ return browser;
+ }
+
+ /**
+ *
+ */
+ protected void forward() {
+ browser.forward();
+ }
+
+ /**
+ *
+ */
+ protected void back() {
+ browser.back();
+ }
+
+ /**
+ *
+ */
+ protected void stop() {
+ browser.stop();
+ }
+
+ /**
+ *
+ */
+ protected void navigate(String url) {
+ Trace.trace(Trace.FINER, "Navigate: " + url);
+ if (url != null && url.equals(getURL())) {
+ refresh();
+ return;
+ }
+ browser.setUrl(url);
+ }
+
+ /**
+ * Refresh the currently viewed page.
+ */
+ public void refresh() {
+ browser.refresh();
+ }
+
+ protected void setURL(String url, boolean browse) {
+ Trace.trace(Trace.FINEST, "setURL: " + url + " " + browse);
+ if (url == null) {
+ home();
+ return;
+ }
+
+ if (url.endsWith(WebBrowserPreference.getHomePageURL().substring(9)))
+ return;
+
+ // check URL maps
+ Iterator iterator = WebBrowserUtil.getURLMaps().iterator();
+ String newURL = null;
+ while (iterator.hasNext() && newURL == null) {
+ try {
+ IURLMap map = (IURLMap) iterator.next();
+ newURL = map.getMappedURL(url);
+ } catch (Exception e) {
+ }
+ }
+ if (newURL != null)
+ url = newURL;
+
+ if (browse)
+ navigate(url);
+
+ addToHistory(url);
+ updateHistory();
+ }
+
+ protected void addToHistory(String url) {
+ if (history == null)
+ history = WebBrowserPreference.getInternalWebBrowserHistory();
+ int found = -1;
+ int size = history.size();
+ for (int i = 0; i < size; i++) {
+ String s = (String) history.get(i);
+ if (s.equals(url)) {
+ found = i;
+ break;
+ }
+ }
+
+ if (found == -1) {
+ if (size >= MAX_HISTORY)
+ history.remove(size - 1);
+ history.add(0, url);
+ WebBrowserPreference.setInternalWebBrowserHistory(history);
+ } else if (found != 0) {
+ history.remove(found);
+ history.add(0, url);
+ WebBrowserPreference.setInternalWebBrowserHistory(history);
+ }
+ }
+
+ public void setURL(String url) {
+ setURL(url, true);
+ }
+
+ /**
+ * Creates the Web browser status area.
+ */
+ private void createStatusArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.horizontalSpacing = 4;
+ layout.verticalSpacing = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Add a label for displaying status messages as they are received from
+ // the control
+ status = new Label(composite, SWT.SINGLE | SWT.READ_ONLY);
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL);
+ gridData.horizontalIndent = 2;
+ status.setLayoutData(gridData);
+
+ // Add a progress bar to display downloading progress information
+ progress = new ProgressBar(composite, SWT.BORDER);
+ gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
+ | GridData.VERTICAL_ALIGN_FILL);
+ gridData.widthHint = 100;
+ gridData.heightHint = 10;
+ progress.setLayoutData(gridData);
+ }
+
+ /**
+ *
+ */
+ public void dispose() {
+ super.dispose();
+
+ showStatusbar = false;
+ showToolbar = false;
+
+ if (busy != null)
+ busy.dispose();
+ busy = null;
+
+ browser = null;
+ }
+
+ /**
+ * Populate the toolbar.
+ *
+ * @param toolbar
+ * org.eclipse.swt.widgets.ToolBar
+ */
+ private void fillToolBar(final ToolBar toolbar) {
+ ToolItem go = new ToolItem(toolbar, SWT.NONE);
+ go.setImage(ImageResource.getImage(ImageResource.IMG_ELCL_NAV_GO));
+ go.setHotImage(ImageResource.getImage(ImageResource.IMG_CLCL_NAV_GO));
+ go.setDisabledImage(ImageResource
+ .getImage(ImageResource.IMG_DLCL_NAV_GO));
+ go
+ .setToolTipText(WebBrowserUIPlugin
+ .getResource("%actionWebBrowserGo"));
+ go.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ setURL(combo.getText());
+ }
+ });
+
+ new ToolItem(toolbar, SWT.SEPARATOR);
+
+ favorites = new ToolItem(toolbar, SWT.DROP_DOWN);
+ favorites.setImage(ImageResource
+ .getImage(ImageResource.IMG_ELCL_NAV_FAVORITES));
+ favorites.setHotImage(ImageResource
+ .getImage(ImageResource.IMG_CLCL_NAV_FAVORITES));
+ favorites.setDisabledImage(ImageResource
+ .getImage(ImageResource.IMG_DLCL_NAV_FAVORITES));
+ favorites.setToolTipText(WebBrowserUIPlugin
+ .getResource("%actionWebBrowserFavorites"));
+
+ favorites.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ if (event.detail == SWT.ARROW) {
+ Rectangle r = favorites.getBounds();
+ showFavorites(toolbar, toolbar.toDisplay(r.x, r.y
+ + r.height));
+ } else
+ addFavorite();
+ }
+ });
+
+ // create back and forward actions
+ back = new ToolItem(toolbar, SWT.NONE);
+ back.setImage(ImageResource
+ .getImage(ImageResource.IMG_ELCL_NAV_BACKWARD));
+ back.setHotImage(ImageResource
+ .getImage(ImageResource.IMG_CLCL_NAV_BACKWARD));
+ back.setDisabledImage(ImageResource
+ .getImage(ImageResource.IMG_DLCL_NAV_BACKWARD));
+ back.setToolTipText(WebBrowserUIPlugin
+ .getResource("%actionWebBrowserBack"));
+ back.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ back();
+ }
+ });
+
+ forward = new ToolItem(toolbar, SWT.NONE);
+ forward.setImage(ImageResource
+ .getImage(ImageResource.IMG_ELCL_NAV_FORWARD));
+ forward.setHotImage(ImageResource
+ .getImage(ImageResource.IMG_CLCL_NAV_FORWARD));
+ forward.setDisabledImage(ImageResource
+ .getImage(ImageResource.IMG_DLCL_NAV_FORWARD));
+ forward.setToolTipText(WebBrowserUIPlugin
+ .getResource("%actionWebBrowserForward"));
+ forward.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ forward();
+ }
+ });
+
+ // create refresh, stop, and print actions
+ stop = new ToolItem(toolbar, SWT.NONE);
+ stop.setImage(ImageResource.getImage(ImageResource.IMG_ELCL_NAV_STOP));
+ stop.setHotImage(ImageResource
+ .getImage(ImageResource.IMG_CLCL_NAV_STOP));
+ stop.setDisabledImage(ImageResource
+ .getImage(ImageResource.IMG_DLCL_NAV_STOP));
+ stop.setToolTipText(WebBrowserUIPlugin
+ .getResource("%actionWebBrowserStop"));
+ stop.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ stop();
+ }
+ });
+
+ refresh = new ToolItem(toolbar, SWT.NONE);
+ refresh.setImage(ImageResource
+ .getImage(ImageResource.IMG_ELCL_NAV_REFRESH));
+ refresh.setHotImage(ImageResource
+ .getImage(ImageResource.IMG_CLCL_NAV_REFRESH));
+ refresh.setDisabledImage(ImageResource
+ .getImage(ImageResource.IMG_DLCL_NAV_REFRESH));
+ refresh.setToolTipText(WebBrowserUIPlugin
+ .getResource("%actionWebBrowserRefresh"));
+ refresh.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ refresh();
+ }
+ });
+ }
+
+ protected void addFavorite() {
+ java.util.List list = WebBrowserPreference
+ .getInternalWebBrowserFavorites();
+ Favorite f = new Favorite(title, browser.getUrl());
+ if (!list.contains(f)) {
+ list.add(f);
+ WebBrowserPreference.setInternalWebBrowserFavorites(list);
+ }
+ }
+
+ protected void showFavorites(Control parent, Point p) {
+ Menu perspectiveBarMenu = null;
+ if (perspectiveBarMenu == null) {
+ Menu menu = new Menu(parent);
+
+ // locked favorites
+ Iterator iterator = WebBrowserUtil.getLockedFavorites().iterator();
+ if (iterator.hasNext()) {
+ while (iterator.hasNext()) {
+ final Favorite f = (Favorite) iterator.next();
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setText(f.getName());
+ item.setImage(ImageResource
+ .getImage(ImageResource.IMG_FAVORITE));
+ item.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ setURL(f.getURL());
+ }
+ });
+ }
+
+ new MenuItem(menu, SWT.SEPARATOR);
+ }
+
+ iterator = WebBrowserPreference.getInternalWebBrowserFavorites()
+ .iterator();
+ if (!iterator.hasNext()) {
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setText(WebBrowserUIPlugin
+ .getResource("%actionWebBrowserNoFavorites"));
+ }
+ while (iterator.hasNext()) {
+ final Favorite f = (Favorite) iterator.next();
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setText(f.getName());
+ item.setImage(ImageResource
+ .getImage(ImageResource.IMG_FAVORITE));
+ item.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ setURL(f.getURL());
+ }
+ });
+ }
+
+ new MenuItem(menu, SWT.SEPARATOR);
+
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setText(WebBrowserUIPlugin
+ .getResource("%actionWebBrowserOrganizeFavorites"));
+ item.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ OrganizeFavoritesDialog dialog = new OrganizeFavoritesDialog(
+ shell);
+ dialog.open();
+ }
+ });
+
+ perspectiveBarMenu = menu;
+ }
+
+ if (perspectiveBarMenu != null) {
+ perspectiveBarMenu.setLocation(p.x, p.y);
+ perspectiveBarMenu.setVisible(true);
+ }
+ }
+
+ public void home() {
+ navigate(WebBrowserPreference.getHomePageURL());
+ }
+
+ /**
+ * Returns true if the homepage is currently being displayed.
+ *
+ * @return boolean
+ */
+ protected boolean isHome() {
+ return getURL() != null
+ && getURL().endsWith(
+ WebBrowserPreference.getHomePageURL().substring(9));
+ }
+
+ protected String getURL() {
+ return browser.getUrl();
+ }
+
+ /**
+ * Update the history list to the global copy.
+ */
+ protected void updateHistory() {
+ if (combo == null)
+ return;
+
+ String temp = combo.getText();
+ if (history == null)
+ history = WebBrowserPreference.getInternalWebBrowserHistory();
+
+ String[] historyList = new String[history.size()];
+ history.toArray(historyList);
+ combo.setItems(historyList);
+
+ combo.setText(temp);
+ }
+
+ public void addProgressListener(ProgressListener listener) {
+ browser.addProgressListener(listener);
+ }
+
+ public void addStatusTextListener(StatusTextListener listener) {
+ browser.addStatusTextListener(listener);
+ }
+
+ public void addTitleListener(TitleListener listener) {
+ browser.addTitleListener(listener);
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserEditor.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserEditor.java
index c55f9d4..f266e11 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserEditor.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserEditor.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
*/
@@ -39,20 +39,26 @@ import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.part.EditorPart;
+
/**
- * An integrated Web browser, defined as an editor to make
- * better use of the desktop.
+ * An integrated Web browser, defined as an editor to make better use of the
+ * desktop.
*/
public class WebBrowserEditor extends EditorPart {
public static final String WEB_BROWSER_EDITOR_ID = "net.sourceforge.phpeclipse.webbrowser";
+
protected WebBrowser webBrowser;
+
protected String initialURL;
+
protected Image image;
protected TextAction cutAction;
+
protected TextAction copyAction;
+
protected TextAction pasteAction;
-
+
protected IResourceChangeListener resourceListener;
/**
@@ -61,7 +67,7 @@ public class WebBrowserEditor extends EditorPart {
public WebBrowserEditor() {
super();
}
-
+
/**
* Creates the SWT controls for this workbench part.
*
@@ -71,95 +77,97 @@ public class WebBrowserEditor extends EditorPart {
*
* For implementors this is a multi-step process:
*
- *
Create one or more controls within the parent.
- *
Set the parent layout as needed.
- *
Register any global actions with the IActionService.
- *
Register any popup menus with the IActionService.
- *
Register a selection provider with the ISelectionService
- * (optional).
+ *
Create one or more controls within the parent.
+ *
Set the parent layout as needed.
+ *
Register any global actions with the IActionService.
+ *
Register any popup menus with the IActionService.
+ *
Register a selection provider with the
+ * ISelectionService (optional).
*
*
- *
- * @param parent the parent control
+ *
+ * @param parent
+ * the parent control
*/
public void createPartControl(Composite parent) {
IWebBrowserEditorInput input = getWebBrowserEditorInput();
-
-
+
if (input == null || input.isToolbarVisible() == false)
- webBrowser = new WebBrowser(parent, false, input.isStatusbarVisible());
+ webBrowser = new WebBrowser(parent, false, input
+ .isStatusbarVisible());
else {
- webBrowser = new WebBrowser(parent, true, input.isStatusbarVisible());
+ webBrowser = new WebBrowser(parent, true, input
+ .isStatusbarVisible());
cutAction = new TextAction(webBrowser, TextAction.CUT);
copyAction = new TextAction(webBrowser, TextAction.COPY);
pasteAction = new TextAction(webBrowser, TextAction.PASTE);
}
-
+
webBrowser.setURL(initialURL);
webBrowser.editor = this;
}
-
+
public void dispose() {
if (image != null && !image.isDisposed())
image.dispose();
image = null;
if (resourceListener != null)
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceListener);
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(
+ resourceListener);
}
-
- /* (non-Javadoc)
- * Saves the contents of this editor.
- *
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see IEditorPart
- *
- *
+
+ /*
+ * (non-Javadoc) Saves the contents of this editor.
Subclasses must
+ * override this method to implement the open-save-close lifecycle for an
+ * editor. For greater details, see IEditorPart
+ *
* @see IEditorPart
*/
- public void doSave(IProgressMonitor monitor) { }
+ public void doSave(IProgressMonitor monitor) {
+ }
- /* (non-Javadoc)
- * Saves the contents of this editor to another object.
- *
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see IEditorPart
+ /*
+ * (non-Javadoc) Saves the contents of this editor to another object.
+ * Subclasses must override this method to implement the open-save-close
+ * lifecycle for an editor. For greater details, see IEditorPart
*
- *
+ *
* @see IEditorPart
*/
- public void doSaveAs() { }
-
+ public void doSaveAs() {
+ }
+
/**
* Returns the copy action.
- *
+ *
* @return org.eclipse.jface.action.IAction
*/
public IAction getCopyAction() {
return copyAction;
}
-
+
/**
* Returns the cut action.
- *
+ *
* @return org.eclipse.jface.action.IAction
*/
public IAction getCutAction() {
return cutAction;
}
-
+
/**
* Returns the paste action.
- *
+ *
* @return org.eclipse.jface.action.IAction
*/
public IAction getPasteAction() {
return pasteAction;
}
-
+
/**
* Returns the web editor input, if available.
- *
+ *
* @return net.sourceforge.phpeclipse.webbrowser.IWebBrowserEditorInput
*/
protected IWebBrowserEditorInput getWebBrowserEditorInput() {
@@ -168,31 +176,25 @@ public class WebBrowserEditor extends EditorPart {
return (IWebBrowserEditorInput) input;
return null;
}
-
- /* (non-Javadoc)
- * Sets the cursor and selection state for this editor to the passage defined
- * by the given marker.
- *
- * Subclasses may override. For greater details, see IEditorPart
- *
- *
+
+ /*
+ * (non-Javadoc) Sets the cursor and selection state for this editor to the
+ * passage defined by the given marker.
Subclasses may override. For
+ * greater details, see IEditorPart
+ *
* @see IEditorPart
*/
- public void gotoMarker(IMarker marker) { }
-
- /* (non-Javadoc)
- * Initializes the editor part with a site and input.
- *
- * Subclasses of EditorPart must implement this method. Within
- * the implementation subclasses should verify that the input type is acceptable
- * and then save the site and input. Here is sample code:
- *
- *
- * if (!(input instanceof IFileEditorInput))
- * throw new PartInitException("Invalid Input: Must be IFileEditorInput");
- * setSite(site);
- * setInput(editorInput);
- *
+ public void gotoMarker(IMarker marker) {
+ }
+
+ /*
+ * (non-Javadoc) Initializes the editor part with a site and input.
+ * Subclasses of EditorPart must implement this method.
+ * Within the implementation subclasses should verify that the input type is
+ * acceptable and then save the site and input. Here is sample code:
+ *
if (!(input instanceof IFileEditorInput)) throw new
+ * PartInitException("Invalid Input: Must be IFileEditorInput");
+ * setSite(site); setInput(editorInput);
*/
public void init(IEditorSite site, IEditorInput input) {
Trace.trace(Trace.FINEST, "Opening browser: " + input);
@@ -207,7 +209,9 @@ public class WebBrowserEditor extends EditorPart {
Trace.trace(Trace.SEVERE, "Error getting URL to file");
}
addResourceListener(file);
- input = new WebBrowserEditorInput(url, WebBrowserEditorInput.SHOW_ALL | WebBrowserEditorInput.SAVE_URL);
+ input = new WebBrowserEditorInput(url,
+ WebBrowserEditorInput.SHOW_ALL
+ | WebBrowserEditorInput.SAVE_URL);
}
if (input instanceof IWebBrowserEditorInput) {
IWebBrowserEditorInput wbei = (IWebBrowserEditorInput) input;
@@ -218,7 +222,7 @@ public class WebBrowserEditor extends EditorPart {
webBrowser.setURL(initialURL);
site.getWorkbenchWindow().getActivePage().bringToTop(this);
}
-
+
setPartName(wbei.getName());
setTitleToolTip(wbei.getToolTipText());
@@ -233,37 +237,34 @@ public class WebBrowserEditor extends EditorPart {
setSite(site);
setInput(input);
}
-
- /* (non-Javadoc)
- * Returns whether the contents of this editor have changed since the last save
- * operation.
- *
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see IEditorPart
- *
- *
+
+ /*
+ * (non-Javadoc) Returns whether the contents of this editor have changed
+ * since the last save operation.
Subclasses must override this method
+ * to implement the open-save-close lifecycle for an editor. For greater
+ * details, see IEditorPart
+ *
* @see IEditorPart
*/
public boolean isDirty() {
return false;
}
-
- /* (non-Javadoc)
- * Returns whether the "save as" operation is supported by this editor.
- *
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see IEditorPart
+
+ /*
+ * (non-Javadoc) Returns whether the "save as" operation is supported by
+ * this editor.
Subclasses must override this method to implement the
+ * open-save-close lifecycle for an editor. For greater details, see IEditorPart
*
- *
+ *
* @see IEditorPart
*/
public boolean isSaveAsAllowed() {
return false;
}
-
+
/**
* Returns true if this editor has a toolbar.
- *
+ *
* @return boolean
*/
public boolean isToolbarVisible() {
@@ -273,12 +274,13 @@ public class WebBrowserEditor extends EditorPart {
else
return false;
}
-
+
/**
* Open the input in the internal Web browser.
*/
public static void open(IWebBrowserEditorInput input) {
- IWorkbenchWindow workbenchWindow = WebBrowserUIPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWindow workbenchWindow = WebBrowserUIPlugin.getInstance()
+ .getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = workbenchWindow.getActivePage();
try {
@@ -289,20 +291,21 @@ public class WebBrowserEditor extends EditorPart {
IEditorPart editor = editors[i].getEditor(true);
if (editor != null && editor instanceof WebBrowserEditor) {
WebBrowserEditor webEditor = (WebBrowserEditor) editor;
- if (input.canReplaceInput(webEditor.getWebBrowserEditorInput())) {
+ if (input.canReplaceInput(webEditor
+ .getWebBrowserEditorInput())) {
editor.init(editor.getEditorSite(), input);
return;
}
}
}
}
-
+
page.openEditor(input, WebBrowserEditor.WEB_BROWSER_EDITOR_ID);
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Error opening Web browser", e);
}
}
-
+
/**
* Asks this part to take focus within the workbench.
*
@@ -319,7 +322,7 @@ public class WebBrowserEditor extends EditorPart {
webBrowser.updateHistory();
}
}
-
+
/**
* Update the actions.
*/
@@ -338,37 +341,49 @@ public class WebBrowserEditor extends EditorPart {
protected void closeEditor() {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- getEditorSite().getPage().closeEditor(WebBrowserEditor.this, false);
+ getEditorSite().getPage().closeEditor(WebBrowserEditor.this,
+ false);
}
});
}
-
+
/**
* Adds a resource change listener to see if the file is deleted.
*/
protected void addResourceListener(final IResource resource) {
if (resource == null)
return;
-
+
resourceListener = new IResourceChangeListener() {
public void resourceChanged(IResourceChangeEvent event) {
try {
event.getDelta().accept(new IResourceDeltaVisitor() {
public boolean visit(IResourceDelta delta) {
IResource res = delta.getResource();
-
+
if (res == null || !res.equals(resource))
return true;
if (delta.getKind() != IResourceDelta.REMOVED)
return true;
-
+
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- String title = WebBrowserUIPlugin.getResource("%dialogResourceDeletedTitle");
- String message = WebBrowserUIPlugin.getResource("%dialogResourceDeletedMessage", resource.getName());
- String[] labels = new String[] {WebBrowserUIPlugin.getResource("%dialogResourceDeletedIgnore"), IDialogConstants.CLOSE_LABEL};
- MessageDialog dialog = new MessageDialog(getEditorSite().getShell(), title, null, message, MessageDialog.INFORMATION, labels, 0);
+ String title = WebBrowserUIPlugin
+ .getResource("%dialogResourceDeletedTitle");
+ String message = WebBrowserUIPlugin
+ .getResource(
+ "%dialogResourceDeletedMessage",
+ resource.getName());
+ String[] labels = new String[] {
+ WebBrowserUIPlugin
+ .getResource("%dialogResourceDeletedIgnore"),
+ IDialogConstants.CLOSE_LABEL };
+ MessageDialog dialog = new MessageDialog(
+ getEditorSite().getShell(), title,
+ null, message,
+ MessageDialog.INFORMATION, labels,
+ 0);
if (dialog.open() != 0)
closeEditor();
@@ -378,10 +393,12 @@ public class WebBrowserEditor extends EditorPart {
}
});
} catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error listening for resource deletion", e);
+ Trace.trace(Trace.SEVERE,
+ "Error listening for resource deletion", e);
}
}
};
- ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceListener);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(
+ resourceListener);
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserEditorActionBarContributor.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserEditorActionBarContributor.java
index 4c9d702..f5ba6ad 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserEditorActionBarContributor.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserEditorActionBarContributor.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
*/
@@ -15,11 +15,12 @@ import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.actions.ActionFactory;
+
/**
- * ActionBarContributor for the Web browser.
- * Just adds cut, copy, paste actions.
+ * ActionBarContributor for the Web browser. Just adds cut, copy, paste actions.
*/
-public class WebBrowserEditorActionBarContributor implements IEditorActionBarContributor {
+public class WebBrowserEditorActionBarContributor implements
+ IEditorActionBarContributor {
protected IActionBars actionBars;
/**
@@ -32,34 +33,40 @@ public class WebBrowserEditorActionBarContributor implements IEditorActionBarCon
/**
* Initializes this contributor, which is expected to add contributions as
* required to the given action bars and global action handlers.
- *
- * @param bars the action bars
+ *
+ * @param bars
+ * the action bars
*/
public void init(IActionBars bars, IWorkbenchPage page) {
this.actionBars = bars;
}
/**
- * Sets the active editor for the contributor.
- * Implementors should disconnect from the old editor, connect to the
- * new editor, and update the actions to reflect the new editor.
- *
- * @param targetEditor the new editor target
+ * Sets the active editor for the contributor. Implementors should
+ * disconnect from the old editor, connect to the new editor, and update the
+ * actions to reflect the new editor.
+ *
+ * @param targetEditor
+ * the new editor target
*/
public void setActiveEditor(IEditorPart targetEditor) {
if (targetEditor instanceof WebBrowserEditor) {
WebBrowserEditor editor = (WebBrowserEditor) targetEditor;
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), editor.getCopyAction());
- actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), editor.getCutAction());
- actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), editor.getPasteAction());
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),
+ editor.getCopyAction());
+ actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), editor
+ .getCutAction());
+ actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(),
+ editor.getPasteAction());
editor.updateActions();
}
}
/**
- * Disposes this contributor.
+ * Disposes this contributor.
*/
- public void dispose() { }
+ public void dispose() {
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreference.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreference.java
index f8eea79..5c83893 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreference.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreference.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
*/
@@ -18,16 +18,21 @@ import java.util.StringTokenizer;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.preference.IPreferenceStore;
+
/**
* Preferences for the Web browser.
*/
public class WebBrowserPreference {
protected static final String PREF_BROWSER_HISTORY = "webBrowserHistory";
+
protected static final String PREF_INTERNAL_WEB_BROWSER_HISTORY = "internalWebBrowserHistory";
+
protected static final String PREF_INTERNAL_WEB_BROWSER_FAVORITES = "internalWebBrowserFavorites";
+
protected static final String PREF_INTERNAL_WEB_BROWSER_OLD_FAVORITES = "internalWebBrowserOldFavorites";
+
protected static final String URL_PARAMETER = "%URL%";
-
+
/**
* WebBrowserPreference constructor comment.
*/
@@ -43,7 +48,8 @@ public class WebBrowserPreference {
public static String getHomePageURL() {
try {
// get the default home page
- URL url = WebBrowserUIPlugin.getInstance().getBundle().getEntry("home/home.html");
+ URL url = WebBrowserUIPlugin.getInstance().getBundle().getEntry(
+ "home/home.html");
url = Platform.resolve(url);
return url.toExternalForm();
} catch (Exception e) {
@@ -53,20 +59,21 @@ public class WebBrowserPreference {
/**
* Returns the preference store.
- *
+ *
* @return org.eclipse.jface.preference.IPreferenceStore
*/
protected static IPreferenceStore getPreferenceStore() {
return WebBrowserUIPlugin.getInstance().getPreferenceStore();
}
-
+
/**
* Returns the Web browser history list.
*
* @return java.util.List
*/
public static List getInternalWebBrowserHistory() {
- String temp = getPreferenceStore().getString(PREF_INTERNAL_WEB_BROWSER_HISTORY);
+ String temp = getPreferenceStore().getString(
+ PREF_INTERNAL_WEB_BROWSER_HISTORY);
StringTokenizer st = new StringTokenizer(temp, "|*|");
List l = new ArrayList();
while (st.hasMoreTokens()) {
@@ -75,22 +82,23 @@ public class WebBrowserPreference {
}
return l;
}
-
+
/**
* Returns the Web browser favorites.
*
* @return java.util.List
*/
public static List getInternalWebBrowserFavorites() {
- String temp = getPreferenceStore().getString(PREF_INTERNAL_WEB_BROWSER_FAVORITES);
+ String temp = getPreferenceStore().getString(
+ PREF_INTERNAL_WEB_BROWSER_FAVORITES);
StringTokenizer st = new StringTokenizer(temp, "|*|");
List l = new ArrayList();
try {
- while (st.hasMoreTokens()) {
- l.add(new Favorite(st.nextToken(), st.nextToken()));
- }
+ while (st.hasMoreTokens()) {
+ l.add(new Favorite(st.nextToken(), st.nextToken()));
+ }
} catch (Exception e) {
- // ignore
+ // ignore
}
return l;
}
@@ -100,18 +108,18 @@ public class WebBrowserPreference {
*/
public static void initializeDefaultPreferences() {
IPreferenceStore store = getPreferenceStore();
-
+
String temp = store.getString(PREF_INTERNAL_WEB_BROWSER_OLD_FAVORITES);
StringTokenizer st = new StringTokenizer(temp, "|*|");
List def = new ArrayList();
try {
- while (st.hasMoreTokens()) {
- def.add(new Favorite(st.nextToken(), st.nextToken()));
- }
- } catch (Exception e) {
- // ignore
- }
- List list = getInternalWebBrowserFavorites();
+ while (st.hasMoreTokens()) {
+ def.add(new Favorite(st.nextToken(), st.nextToken()));
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+ List list = getInternalWebBrowserFavorites();
Iterator iterator = WebBrowserUtil.getUnlockedFavorites().iterator();
while (iterator.hasNext()) {
Favorite f = (Favorite) iterator.next();
@@ -119,7 +127,7 @@ public class WebBrowserPreference {
list.add(f);
}
setInternalWebBrowserFavorites(list);
-
+
StringBuffer sb = new StringBuffer();
iterator = WebBrowserUtil.getUnlockedFavorites().iterator();
while (iterator.hasNext()) {
@@ -132,10 +140,10 @@ public class WebBrowserPreference {
store.setValue(PREF_INTERNAL_WEB_BROWSER_OLD_FAVORITES, sb.toString());
WebBrowserUIPlugin.getInstance().savePluginPreferences();
}
-
+
/**
* Sets the Web browser history.
- *
+ *
* @param java.util.List
*/
public static void setInternalWebBrowserHistory(List list) {
@@ -148,13 +156,14 @@ public class WebBrowserPreference {
sb.append("|*|");
}
}
- getPreferenceStore().setValue(PREF_INTERNAL_WEB_BROWSER_HISTORY, sb.toString());
+ getPreferenceStore().setValue(PREF_INTERNAL_WEB_BROWSER_HISTORY,
+ sb.toString());
WebBrowserUIPlugin.getInstance().savePluginPreferences();
}
-
+
/**
* Sets the Web browser favorites.
- *
+ *
* @param java.util.List
*/
public static void setInternalWebBrowserFavorites(List list) {
@@ -169,7 +178,8 @@ public class WebBrowserPreference {
sb.append("|*|");
}
}
- getPreferenceStore().setValue(PREF_INTERNAL_WEB_BROWSER_FAVORITES, sb.toString());
+ getPreferenceStore().setValue(PREF_INTERNAL_WEB_BROWSER_FAVORITES,
+ sb.toString());
WebBrowserUIPlugin.getInstance().savePluginPreferences();
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreferencePage.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreferencePage.java
index cda95fd..4a6d28a 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreferencePage.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserPreferencePage.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
*/
@@ -21,10 +21,12 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
+
/**
* The preference page that holds webbrowser preferences.
*/
-public class WebBrowserPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+public class WebBrowserPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
/**
* WebBrowserPreferencePage constructor comment.
*/
@@ -35,8 +37,9 @@ public class WebBrowserPreferencePage extends PreferencePage implements IWorkben
/**
* 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) {
@@ -50,16 +53,20 @@ public class WebBrowserPreferencePage extends PreferencePage implements IWorkben
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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
+ ContextIds.PREF_BROWSER);
Label label = new Label(composite, SWT.WRAP);
- label.setText(WebBrowserUIPlugin.getResource("%preferenceWebBrowserDescription"));
+ label.setText(WebBrowserUIPlugin
+ .getResource("%preferenceWebBrowserDescription"));
data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
label.setLayoutData(data);
- BrowserTableComposite browserComposite = new BrowserTableComposite(composite, SWT.NONE);
+ BrowserTableComposite browserComposite = new BrowserTableComposite(
+ composite, SWT.NONE);
data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
browserComposite.setLayoutData(data);
@@ -71,17 +78,20 @@ public class WebBrowserPreferencePage extends PreferencePage implements IWorkben
/**
* Initializes this preference page using the passed desktop.
- *
- * @param desktop the current desktop
+ *
+ * @param desktop
+ * the current desktop
*/
- public void init(IWorkbench workbench) { }
+ public void init(IWorkbench workbench) {
+ }
/**
- *
+ *
*/
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible)
- setTitle(WebBrowserUIPlugin.getResource("%preferenceWebBrowserTitleLong"));
+ setTitle(WebBrowserUIPlugin
+ .getResource("%preferenceWebBrowserTitleLong"));
}
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserUIPlugin.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserUIPlugin.java
index 89927d4..72d5d5a 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserUIPlugin.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserUIPlugin.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
*/
@@ -15,6 +15,7 @@ import java.text.MessageFormat;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+
/**
* The main web browser plugin class.
*/
@@ -35,7 +36,7 @@ public class WebBrowserUIPlugin extends AbstractUIPlugin {
/**
* Returns the singleton instance of this plugin.
- *
+ *
* @return net.sourceforge.phpeclipse.webbrowser.WebBrowserPlugin
*/
public static WebBrowserUIPlugin getInstance() {
@@ -44,8 +45,9 @@ public class WebBrowserUIPlugin extends AbstractUIPlugin {
/**
* Returns the translated String found with the given key.
- *
- * @param key java.lang.String
+ *
+ * @param key
+ * java.lang.String
* @return java.lang.String
*/
public static String getResource(String key) {
@@ -57,11 +59,13 @@ public class WebBrowserUIPlugin extends AbstractUIPlugin {
}
/**
- * Returns the translated String found with the given key,
- * and formatted with the given arguments using java.text.MessageFormat.
- *
- * @param key java.lang.String
- * @param arg java.lang.String
+ * Returns the translated String found with the given key, and formatted
+ * with the given arguments using java.text.MessageFormat.
+ *
+ * @param key
+ * java.lang.String
+ * @param arg
+ * java.lang.String
* @return java.lang.String
*/
public static String getResource(String key, String arg) {
@@ -80,7 +84,7 @@ public class WebBrowserUIPlugin extends AbstractUIPlugin {
/**
* Shuts down this plug-in and saves all plug-in state.
- *
+ *
* @exception Exception
*/
public void stop(BundleContext context) throws Exception {
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserUtil.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserUtil.java
index 865f645..e5e0e72 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserUtil.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/internal/WebBrowserUtil.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
*/
@@ -35,25 +35,34 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.XMLMemento;
+
/**
* Utility class for the Web browser tooling.
*/
public class WebBrowserUtil {
private static List urlMaps;
+
private static List lockedFavorites;
+
private static List unlockedFavorites;
+
private static final String BROWSER_PACKAGE_NAME = "org.eclipse.swt.browser.Browser";
+
public static Boolean isInternalBrowserOperational;
-
+
private static List defaultBrowsers2;
static class DefaultBrowser {
String name;
+
String params;
+
String executable;
+
String[] locations;
-
- public DefaultBrowser(String name, String executable, String params, String[] locations) {
+
+ public DefaultBrowser(String name, String executable, String params,
+ String[] locations) {
if (name == null)
name = "";
else if (name.startsWith("%"))
@@ -64,9 +73,10 @@ public class WebBrowserUtil {
this.params = params;
this.locations = locations;
}
-
+
public String toString() {
- String s = "Browser: " + name + ", " + executable + ", " + params + ", ";
+ String s = "Browser: " + name + ", " + executable + ", " + params
+ + ", ";
if (locations != null) {
int size = locations.length;
for (int i = 0; i < size; i++) {
@@ -86,7 +96,7 @@ public class WebBrowserUtil {
/**
* Returns true if we're running on Windows.
- *
+ *
* @return boolean
*/
public static boolean isWindows() {
@@ -99,7 +109,7 @@ public class WebBrowserUtil {
/**
* Returns true if we're running on linux.
- *
+ *
* @return boolean
*/
public static boolean isLinux() {
@@ -112,37 +122,43 @@ public class WebBrowserUtil {
/**
* Open a dialog window.
- *
- * @param title java.lang.String
- * @param message java.lang.String
+ *
+ * @param title
+ * java.lang.String
+ * @param message
+ * java.lang.String
*/
public static void openError(String message) {
Display d = Display.getCurrent();
if (d == null)
d = Display.getDefault();
-
+
Shell shell = d.getActiveShell();
- MessageDialog.openError(shell, WebBrowserUIPlugin.getResource("%errorDialogTitle"), message);
+ MessageDialog.openError(shell, WebBrowserUIPlugin
+ .getResource("%errorDialogTitle"), message);
}
-
+
/**
* Open a dialog window.
- *
- * @param title java.lang.String
- * @param message java.lang.String
+ *
+ * @param title
+ * java.lang.String
+ * @param message
+ * java.lang.String
*/
public static void openMessage(String message) {
Display d = Display.getCurrent();
if (d == null)
d = Display.getDefault();
-
+
Shell shell = d.getActiveShell();
- MessageDialog.openInformation(shell, WebBrowserUIPlugin.getResource("%searchingTaskName"), message);
+ MessageDialog.openInformation(shell, WebBrowserUIPlugin
+ .getResource("%searchingTaskName"), message);
}
-
+
/**
* Returns a List of all URL maps.
- *
+ *
* @return java.util.List
*/
public static List getURLMaps() {
@@ -150,33 +166,38 @@ public class WebBrowserUtil {
loadURLMaps();
return urlMaps;
}
-
+
/**
* Load the url map extension point.
*/
private static void loadURLMaps() {
Trace.trace(Trace.FINEST, "->- Loading .urlMap extension point ->-");
IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(WebBrowserUIPlugin.PLUGIN_ID, "urlMap");
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(
+ WebBrowserUIPlugin.PLUGIN_ID, "urlMap");
int size = cf.length;
urlMaps = new ArrayList(size);
for (int i = 0; i < size; i++) {
try {
- IURLMap mapper = (IURLMap) cf[i].createExecutableExtension("class");
+ IURLMap mapper = (IURLMap) cf[i]
+ .createExecutableExtension("class");
urlMaps.add(mapper);
- Trace.trace(Trace.FINEST, " Loaded url map: " + cf[i].getAttribute("id"));
+ Trace.trace(Trace.FINEST, " Loaded url map: "
+ + cf[i].getAttribute("id"));
} catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load url map: " + cf[i].getAttribute("id"), t);
+ Trace.trace(Trace.SEVERE, " Could not load url map: "
+ + cf[i].getAttribute("id"), t);
}
}
-
- Trace.trace(Trace.FINEST, "-<- Done loading .urlMap extension point -<-");
+
+ Trace.trace(Trace.FINEST,
+ "-<- Done loading .urlMap extension point -<-");
}
-
+
/**
* Returns a List of all unlocked favorites.
- *
+ *
* @return java.util.List
*/
public static List getUnlockedFavorites() {
@@ -184,10 +205,10 @@ public class WebBrowserUtil {
loadFavorites();
return unlockedFavorites;
}
-
+
/**
* Returns a List of all locked favorites.
- *
+ *
* @return java.util.List
*/
public static List getLockedFavorites() {
@@ -195,40 +216,47 @@ public class WebBrowserUtil {
loadFavorites();
return lockedFavorites;
}
-
+
/**
* Load the favorites extension point.
*/
private static void loadFavorites() {
Trace.trace(Trace.FINEST, "->- Loading .favorites extension point ->-");
IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(WebBrowserUIPlugin.PLUGIN_ID, "favorites");
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(
+ WebBrowserUIPlugin.PLUGIN_ID, "favorites");
int size = cf.length;
unlockedFavorites = new ArrayList(size);
lockedFavorites = new ArrayList(size);
for (int i = 0; i < size; i++) {
try {
- Favorite f = new Favorite(cf[i].getAttribute("name"), cf[i].getAttribute("url"));
+ Favorite f = new Favorite(cf[i].getAttribute("name"), cf[i]
+ .getAttribute("url"));
String locked = cf[i].getAttribute("locked");
if (!"true".equals(locked))
unlockedFavorites.add(f);
else
lockedFavorites.add(f);
- Trace.trace(Trace.FINEST, " Loaded favorite: " + cf[i].getAttribute("id"));
+ Trace.trace(Trace.FINEST, " Loaded favorite: "
+ + cf[i].getAttribute("id"));
} catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load favorite: " + cf[i].getAttribute("id"), t);
+ Trace.trace(Trace.SEVERE, " Could not load favorite: "
+ + cf[i].getAttribute("id"), t);
}
}
-
- Trace.trace(Trace.FINEST, "-<- Done loading .favorites extension point -<-");
+
+ Trace.trace(Trace.FINEST,
+ "-<- Done loading .favorites extension point -<-");
}
-
+
/**
- * Returns whether it should be possible to use the internal browser or not, based on whether or not
- * the org.eclipse.swt.Browser class can be found/loaded. If it can it means is is supported on the platform in which
- * this plugin is running. If not, disable the ability to use the internal browser.
- *
+ * Returns whether it should be possible to use the internal browser or not,
+ * based on whether or not the org.eclipse.swt.Browser class can be
+ * found/loaded. If it can it means is is supported on the platform in which
+ * this plugin is running. If not, disable the ability to use the internal
+ * browser.
+ *
* @return boolean
*/
public static boolean canUseInternalWebBrowser() {
@@ -236,16 +264,19 @@ public class WebBrowserUtil {
Class clazz = Class.forName(BROWSER_PACKAGE_NAME);
if (clazz != null)
return true;
- } catch (ClassNotFoundException e) { }
+ } catch (ClassNotFoundException e) {
+ }
return false;
}
/**
- * This method checks to see if it can new up a new Browser. If the SWT widget can not be bound
- * to the particular operating system it throws an SWTException. We catch that and set a boolean
- * flag which represents whether or not we were successfully able to create a Browser instance or not.
- * If not, don't bother adding the Internal Web Browser that uses this widget. Designed to be attemped
- * only once and the flag set used throughout.
+ * This method checks to see if it can new up a new Browser. If the SWT
+ * widget can not be bound to the particular operating system it throws an
+ * SWTException. We catch that and set a boolean flag which represents
+ * whether or not we were successfully able to create a Browser instance or
+ * not. If not, don't bother adding the Internal Web Browser that uses this
+ * widget. Designed to be attemped only once and the flag set used
+ * throughout.
*
* @return boolean
*/
@@ -253,21 +284,23 @@ public class WebBrowserUtil {
// if we have already figured this out, don't do it again.
if (isInternalBrowserOperational != null)
return isInternalBrowserOperational.booleanValue();
-
+
try {
new Browser(new Shell(Display.getCurrent()), SWT.NONE);
- isInternalBrowserOperational = new Boolean(true);
+ isInternalBrowserOperational = new Boolean(true);
} catch (Throwable t) {
- WebBrowserUIPlugin.getInstance().getLog().log(new Status(IStatus.WARNING,
- WebBrowserUIPlugin.PLUGIN_ID, 0, "Internal browser is not operational", t));
+ WebBrowserUIPlugin.getInstance().getLog().log(
+ new Status(IStatus.WARNING, WebBrowserUIPlugin.PLUGIN_ID,
+ 0, "Internal browser is not operational", t));
isInternalBrowserOperational = new Boolean(false);
}
return isInternalBrowserOperational.booleanValue();
}
-
+
public static List getExternalBrowserPaths() {
List paths = new ArrayList();
- Iterator iterator = BrowserManager.getInstance().getWebBrowsers().iterator();
+ Iterator iterator = BrowserManager.getInstance().getWebBrowsers()
+ .iterator();
while (iterator.hasNext()) {
IWebBrowser wb = (IWebBrowser) iterator.next();
if (wb instanceof IExternalWebBrowser) {
@@ -278,7 +311,8 @@ public class WebBrowserUtil {
return paths;
}
- // Add any supported EXTERNAL web browsers found after an arbitrary check in specific paths
+ // Add any supported EXTERNAL web browsers found after an arbitrary check in
+ // specific paths
public static void addFoundBrowsers(List list) {
List paths = getExternalBrowserPaths();
@@ -298,11 +332,14 @@ public class WebBrowserUtil {
browser.location = location;
browser.parameters = browser2.params;
list.add(browser);
- //Add browser here so that it get added to the table
- BrowserManager.getInstance().addBrowser(browser);
+ // Add browser here so that it get added to the
+ // table
+ BrowserManager.getInstance()
+ .addBrowser(browser);
j += size;
}
- } catch (Exception e) { }
+ } catch (Exception e) {
+ }
}
}
}
@@ -310,38 +347,42 @@ public class WebBrowserUtil {
}
/**
- * Create an external Web browser if the file matches the default (known) browsers.
+ * Create an external Web browser if the file matches the default (known)
+ * browsers.
+ *
* @param file
* @return
*/
public static IExternalWebBrowserWorkingCopy createExternalBrowser(File file) {
if (file == null || !file.isFile())
return null;
-
+
String executable = file.getName();
Iterator iterator = getDefaultBrowsers().iterator();
while (iterator.hasNext()) {
DefaultBrowser db = (DefaultBrowser) iterator.next();
if (executable.equals(db.executable)) {
- IExternalWebBrowserWorkingCopy browser = BrowserManager.getInstance().createExternalWebBrowser();
+ IExternalWebBrowserWorkingCopy browser = BrowserManager
+ .getInstance().createExternalWebBrowser();
browser.setName(db.name);
browser.setLocation(file.getAbsolutePath());
browser.setParameters(db.params);
return browser;
}
}
-
+
return null;
}
protected static List getDefaultBrowsers() {
if (defaultBrowsers2 != null)
return defaultBrowsers2;
-
+
Reader reader = null;
defaultBrowsers2 = new ArrayList();
try {
- URL url = WebBrowserUIPlugin.getInstance().getBundle().getEntry("defaultBrowsers.xml");
+ URL url = WebBrowserUIPlugin.getInstance().getBundle().getEntry(
+ "defaultBrowsers.xml");
URL url2 = Platform.resolve(url);
reader = new InputStreamReader(url2.openStream());
IMemento memento = XMLMemento.createReadRoot(reader);
@@ -354,17 +395,18 @@ public class WebBrowserUtil {
String executable = child.getString("executable");
String params = child.getString("params");
List locations = new ArrayList();
-
+
IMemento[] locat = child.getChildren("location");
if (locat != null) {
int size2 = locat.length;
for (int j = 0; j < size2; j++)
locations.add(locat[j].getTextData());
}
-
+
String[] loc = new String[locations.size()];
locations.toArray(loc);
- DefaultBrowser db = new DefaultBrowser(name, executable, params, loc);
+ DefaultBrowser db = new DefaultBrowser(name, executable,
+ params, loc);
Trace.trace(Trace.CONFIG, "Default browser: " + db);
defaultBrowsers2.add(db);
}
@@ -374,7 +416,8 @@ public class WebBrowserUtil {
} finally {
try {
reader.close();
- } catch (Exception e) { }
+ } catch (Exception e) {
+ }
}
return defaultBrowsers2;
}
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/views/BrowserView.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/views/BrowserView.java
index db5d321..92face4 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/views/BrowserView.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/views/BrowserView.java
@@ -26,7 +26,7 @@ import org.eclipse.ui.part.ViewPart;
* BrowserView is a simple demonstration of the SWT Browser
* widget. It consists of a workbench view and tab folder where each tab in the
* folder allows the user to interact with a control.
- *
+ *
* @see ViewPart
*/
public class BrowserView extends ViewPart implements IShowInTarget {
@@ -38,7 +38,7 @@ public class BrowserView extends ViewPart implements IShowInTarget {
/**
* Create the example
- *
+ *
* @see ViewPart#createPartControl
*/
public void createPartControl(Composite frame) {
@@ -53,7 +53,7 @@ public class BrowserView extends ViewPart implements IShowInTarget {
/**
* Called when we must grab focus.
- *
+ *
* @see org.eclipse.ui.part.ViewPart#setFocus
*/
public void setFocus() {
diff --git a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/views/ShowInContextBrowser.java b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/views/ShowInContextBrowser.java
index 20c3a98..c0fa7b5 100644
--- a/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/views/ShowInContextBrowser.java
+++ b/net.sourceforge.phpeclipse.webbrowser/src/net/sourceforge/phpeclipse/webbrowser/views/ShowInContextBrowser.java
@@ -5,13 +5,14 @@ import org.eclipse.ui.part.ShowInContext;
/**
* Adds an URL String to the ShowInContext for the BrowserUtil
- *
- *
+ *
+ *
*/
public class ShowInContextBrowser extends ShowInContext {
String fLocalhostUrl;
- public ShowInContextBrowser(Object input, ISelection selection, String localhostUrl) {
+ public ShowInContextBrowser(Object input, ISelection selection,
+ String localhostUrl) {
super(input, selection);
fLocalhostUrl = localhostUrl;
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/Base64.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/Base64.java
index 64cd0ae..1499af2 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/Base64.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/Base64.java
@@ -1,1450 +1,1413 @@
package net.sourceforge.phpeclipse.xdebug.core;
+
/**
* Encodes and decodes to and from Base64 notation.
- *
+ *
*
* Change Log:
*
*
- *
v2.1 - Cleaned up javadoc comments and unused variables and methods. Added
- * some convenience methods for reading and writing to and from files.
- *
v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
- * with other encodings (like EBCDIC).
- *
v2.0.1 - Fixed an error when decoding a single byte, that is, when the
- * encoded data was a single byte.
- *
v2.0 - I got rid of methods that used booleans to set options.
- * Now everything is more consolidated and cleaner. The code now detects
- * when data that's being decoded is gzip-compressed and will decompress it
- * automatically. Generally things are cleaner. You'll probably have to
- * change some method calls that you were making to support the new
- * options format (ints that you "OR" together).
- *
v1.5.1 - Fixed bug when decompressing and decoding to a
- * byte[] using decode( String s, boolean gzipCompressed ).
- * Added the ability to "suspend" encoding in the Output Stream so
- * you can turn on and off the encoding if you need to embed base64
- * data in an otherwise "normal" stream (like an XML file).
- *
v1.5 - Output stream pases on flush() command but doesn't do anything itself.
- * This helps when using GZIP streams.
- * Added the ability to GZip-compress objects before encoding them.
- *
v1.4 - Added helper methods to read/write files.
- *
v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.
- *
v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
- * where last buffer being read, if not completely full, was not returned.
- *
v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.
- *
v1.3.3 - Fixed I/O streams which were totally messed up.
+ *
v2.1 - Cleaned up javadoc comments and unused variables and methods.
+ * Added some convenience methods for reading and writing to and from files.
+ *
v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on
+ * systems with other encodings (like EBCDIC).
+ *
v2.0.1 - Fixed an error when decoding a single byte, that is, when the
+ * encoded data was a single byte.
+ *
v2.0 - I got rid of methods that used booleans to set options. Now
+ * everything is more consolidated and cleaner. The code now detects when data
+ * that's being decoded is gzip-compressed and will decompress it automatically.
+ * Generally things are cleaner. You'll probably have to change some method
+ * calls that you were making to support the new options format (ints
+ * that you "OR" together).
+ *
v1.5.1 - Fixed bug when decompressing and decoding to a byte[] using
+ * decode( String s, boolean gzipCompressed ). Added the ability to
+ * "suspend" encoding in the Output Stream so you can turn on and off the
+ * encoding if you need to embed base64 data in an otherwise "normal" stream
+ * (like an XML file).
+ *
v1.5 - Output stream pases on flush() command but doesn't do anything
+ * itself. This helps when using GZIP streams. Added the ability to
+ * GZip-compress objects before encoding them.
+ *
v1.4 - Added helper methods to read/write files.
+ *
v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.
+ *
v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input
+ * stream where last buffer being read, if not completely full, was not
+ * returned.
+ *
v1.3.4 - Fixed when "improperly padded stream" error was thrown at the
+ * wrong time.
+ *
v1.3.3 - Fixed I/O streams which were totally messed up.
*
- *
+ *
*
- * I am placing this code in the Public Domain. Do with it as you will.
- * This software comes with no guarantees or warranties but with
- * plenty of well-wishing instead!
- * Please visit http://iharder.net/base64
- * periodically to check for updates or to contribute improvements.
+ * I am placing this code in the Public Domain. Do with it as you will. This
+ * software comes with no guarantees or warranties but with plenty of
+ * well-wishing instead! Please visit http://iharder.net/base64 periodically
+ * to check for updates or to contribute improvements.
*
- *
+ *
* @author Robert Harder
* @author rob@iharder.net
* @version 2.1
*/
-public class Base64
-{
-
-/* ******** P U B L I C F I E L D S ******** */
-
-
- /** No options specified. Value is zero. */
- public final static int NO_OPTIONS = 0;
-
- /** Specify encoding. */
- public final static int ENCODE = 1;
-
-
- /** Specify decoding. */
- public final static int DECODE = 0;
-
-
- /** Specify that data should be gzip-compressed. */
- public final static int GZIP = 2;
-
-
- /** Don't break lines when encoding (violates strict Base64 specification) */
- public final static int DONT_BREAK_LINES = 8;
-
-
-/* ******** P R I V A T E F I E L D S ******** */
-
-
- /** Maximum line length (76) of Base64 output. */
- private final static int MAX_LINE_LENGTH = 76;
-
-
- /** The equals sign (=) as a byte. */
- private final static byte EQUALS_SIGN = (byte)'=';
-
-
- /** The new line character (\n) as a byte. */
- private final static byte NEW_LINE = (byte)'\n';
-
-
- /** Preferred encoding. */
- private final static String PREFERRED_ENCODING = "UTF-8";
-
-
- /** The 64 valid Base64 values. */
- private final static byte[] ALPHABET;
- private final static byte[] _NATIVE_ALPHABET = /* May be something funny like EBCDIC */
- {
- (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
- (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
- (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
- (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
- (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
- (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
- (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
- (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
- (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
- (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/'
- };
-
- /** Determine which ALPHABET to use. */
- static
- {
- byte[] __bytes;
- try
- {
- __bytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes( PREFERRED_ENCODING );
- } // end try
- catch (java.io.UnsupportedEncodingException use)
- {
- __bytes = _NATIVE_ALPHABET; // Fall back to native encoding
- } // end catch
- ALPHABET = __bytes;
- } // end static
-
-
- /**
- * Translates a Base64 value to either its 6-bit reconstruction value
- * or a negative number indicating some other meaning.
- **/
- private final static byte[] DECODABET =
- {
- -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
- -5,-5, // Whitespace: Tab and Linefeed
- -9,-9, // Decimal 11 - 12
- -5, // Whitespace: Carriage Return
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
- -9,-9,-9,-9,-9, // Decimal 27 - 31
- -5, // Whitespace: Space
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
- 62, // Plus sign at decimal 43
- -9,-9,-9, // Decimal 44 - 46
- 63, // Slash at decimal 47
- 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
- -9,-9,-9, // Decimal 58 - 60
- -1, // Equals sign at decimal 61
- -9,-9,-9, // Decimal 62 - 64
- 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
- 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
- -9,-9,-9,-9,-9,-9, // Decimal 91 - 96
- 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
- 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
- -9,-9,-9,-9 // Decimal 123 - 126
- /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
- };
-
- // I think I end up not using the BAD_ENCODING indicator.
- //private final static byte BAD_ENCODING = -9; // Indicates error in encoding
- private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
- private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
-
-
- /** Defeats instantiation. */
- private Base64(){}
-
-
-
-/* ******** E N C O D I N G M E T H O D S ******** */
-
-
- /**
- * Encodes up to the first three bytes of array threeBytes
- * and returns a four-byte array in Base64 notation.
- * The actual number of significant bytes in your array is
- * given by numSigBytes.
- * The array threeBytes needs only be as big as
- * numSigBytes.
- * Code can reuse a byte array by passing a four-byte array as b4.
- *
- * @param b4 A reusable byte array to reduce array instantiation
- * @param threeBytes the array to convert
- * @param numSigBytes the number of significant bytes in your array
- * @return four byte array in Base64 notation.
- * @since 1.5.1
- */
- private static byte[] encode3to4( byte[] b4, byte[] threeBytes, int numSigBytes )
- {
- encode3to4( threeBytes, 0, numSigBytes, b4, 0 );
- return b4;
- } // end encode3to4
-
-
- /**
- * Encodes up to three bytes of the array source
- * and writes the resulting four Base64 bytes to destination.
- * The source and destination arrays can be manipulated
- * anywhere along their length by specifying
- * srcOffset and destOffset.
- * This method does not check to make sure your arrays
- * are large enough to accomodate srcOffset + 3 for
- * the source array or destOffset + 4 for
- * the destination array.
- * The actual number of significant bytes in your array is
- * given by numSigBytes.
- *
- * @param source the array to convert
- * @param srcOffset the index where conversion begins
- * @param numSigBytes the number of significant bytes in your array
- * @param destination the array to hold the conversion
- * @param destOffset the index where output will be put
- * @return the destination array
- * @since 1.3
- */
- private static byte[] encode3to4(
- byte[] source, int srcOffset, int numSigBytes,
- byte[] destination, int destOffset )
- {
- // 1 2 3
- // 01234567890123456789012345678901 Bit position
- // --------000000001111111122222222 Array position from threeBytes
- // --------| || || || | Six bit groups to index ALPHABET
- // >>18 >>12 >> 6 >> 0 Right shift necessary
- // 0x3f 0x3f 0x3f Additional AND
-
- // Create buffer with zero-padding if there are only one or two
- // significant bytes passed in the array.
- // We have to shift left 24 in order to flush out the 1's that appear
- // when Java treats a value as negative that is cast from a byte to an int.
- int inBuff = ( numSigBytes > 0 ? ((source[ srcOffset ] << 24) >>> 8) : 0 )
- | ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 )
- | ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 );
-
- switch( numSigBytes )
- {
- case 3:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
- destination[ destOffset + 3 ] = ALPHABET[ (inBuff ) & 0x3f ];
- return destination;
-
- case 2:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
- destination[ destOffset + 3 ] = EQUALS_SIGN;
- return destination;
-
- case 1:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = EQUALS_SIGN;
- destination[ destOffset + 3 ] = EQUALS_SIGN;
- return destination;
-
- default:
- return destination;
- } // end switch
- } // end encode3to4
-
-
-
- /**
- * Serializes an object and returns the Base64-encoded
- * version of that serialized object. If the object
- * cannot be serialized or there is another error,
- * the method will return null.
- * The object is not GZip-compressed before being encoded.
- *
- * @param serializableObject The object to encode
- * @return The Base64-encoded object
- * @since 1.4
- */
- public static String encodeObject( java.io.Serializable serializableObject )
- {
- return encodeObject( serializableObject, NO_OPTIONS );
- } // end encodeObject
-
-
-
- /**
- * Serializes an object and returns the Base64-encoded
- * version of that serialized object. If the object
- * cannot be serialized or there is another error,
- * the method will return null.
- *
- * Valid options:
- * GZIP: gzip-compresses object before encoding it.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * Note: Technically, this makes your encoding non-compliant.
- *
- *
- * Example: encodeObject( myObj, Base64.GZIP ) or
- *
- * Example: encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )
- *
- * @param serializableObject The object to encode
- * @param options Specified options
- * @return The Base64-encoded object
- * @see Base64#GZIP
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public static String encodeObject( java.io.Serializable serializableObject, int options )
- {
- // Streams
- java.io.ByteArrayOutputStream baos = null;
- java.io.OutputStream b64os = null;
- java.io.ObjectOutputStream oos = null;
- java.util.zip.GZIPOutputStream gzos = null;
-
- // Isolate options
- int gzip = (options & GZIP);
- int dontBreakLines = (options & DONT_BREAK_LINES);
-
- try
- {
- // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
- baos = new java.io.ByteArrayOutputStream();
- b64os = new Base64.OutputStream( baos, ENCODE | dontBreakLines );
-
- // GZip?
- if( gzip == GZIP )
- {
- gzos = new java.util.zip.GZIPOutputStream( b64os );
- oos = new java.io.ObjectOutputStream( gzos );
- } // end if: gzip
- else
- oos = new java.io.ObjectOutputStream( b64os );
-
- oos.writeObject( serializableObject );
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- return null;
- } // end catch
- finally
- {
- try{ oos.close(); } catch( Exception e ){}
- try{ gzos.close(); } catch( Exception e ){}
- try{ b64os.close(); } catch( Exception e ){}
- try{ baos.close(); } catch( Exception e ){}
- } // end finally
-
- // Return value according to relevant encoding.
- try
- {
- return new String( baos.toByteArray(), PREFERRED_ENCODING );
- } // end try
- catch (java.io.UnsupportedEncodingException uue)
- {
- return new String( baos.toByteArray() );
- } // end catch
-
- } // end encode
-
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * Does not GZip-compress data.
- *
- * @param source The data to convert
- * @since 1.4
- */
- public static String encodeBytes( byte[] source )
- {
- return encodeBytes( source, 0, source.length, NO_OPTIONS );
- } // end encodeBytes
-
-
-
- /**
- * Encodes a byte array into Base64 notation.
- *
- * Valid options:
- * GZIP: gzip-compresses object before encoding it.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * Note: Technically, this makes your encoding non-compliant.
- *
- *
- * Example: encodeBytes( myData, Base64.GZIP ) or
- *
- * Example: encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )
- *
- *
- * @param source The data to convert
- * @param options Specified options
- * @see Base64#GZIP
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public static String encodeBytes( byte[] source, int options )
- {
- return encodeBytes( source, 0, source.length, options );
- } // end encodeBytes
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * Does not GZip-compress data.
- *
- * @param source The data to convert
- * @param off Offset in array where conversion should begin
- * @param len Length of data to convert
- * @since 1.4
- */
- public static String encodeBytes( byte[] source, int off, int len )
- {
- return encodeBytes( source, off, len, NO_OPTIONS );
- } // end encodeBytes
-
-
-
- /**
- * Encodes a byte array into Base64 notation.
- *
- * Valid options:
- * GZIP: gzip-compresses object before encoding it.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * Note: Technically, this makes your encoding non-compliant.
- *
- *
- * Example: encodeBytes( myData, Base64.GZIP ) or
- *
- * Example: encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )
- *
- *
- * @param source The data to convert
- * @param off Offset in array where conversion should begin
- * @param len Length of data to convert
- * @param options Specified options
- * @see Base64#GZIP
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public static String encodeBytes( byte[] source, int off, int len, int options )
- {
- // Isolate options
- int dontBreakLines = ( options & DONT_BREAK_LINES );
- int gzip = ( options & GZIP );
-
- // Compress?
- if( gzip == GZIP )
- {
- java.io.ByteArrayOutputStream baos = null;
- java.util.zip.GZIPOutputStream gzos = null;
- Base64.OutputStream b64os = null;
-
-
- try
- {
- // GZip -> Base64 -> ByteArray
- baos = new java.io.ByteArrayOutputStream();
- b64os = new Base64.OutputStream( baos, ENCODE | dontBreakLines );
- gzos = new java.util.zip.GZIPOutputStream( b64os );
-
- gzos.write( source, off, len );
- gzos.close();
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- return null;
- } // end catch
- finally
- {
- try{ gzos.close(); } catch( Exception e ){}
- try{ b64os.close(); } catch( Exception e ){}
- try{ baos.close(); } catch( Exception e ){}
- } // end finally
-
- // Return value according to relevant encoding.
- try
- {
- return new String( baos.toByteArray(), PREFERRED_ENCODING );
- } // end try
- catch (java.io.UnsupportedEncodingException uue)
- {
- return new String( baos.toByteArray() );
- } // end catch
- } // end if: compress
-
- // Else, don't compress. Better not to use streams at all then.
- else
- {
- // Convert option to boolean in way that code likes it.
- boolean breakLines = dontBreakLines == 0;
-
- int len43 = len * 4 / 3;
- byte[] outBuff = new byte[ ( len43 ) // Main 4:3
- + ( (len % 3) > 0 ? 4 : 0 ) // Account for padding
- + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
- int d = 0;
- int e = 0;
- int len2 = len - 2;
- int lineLength = 0;
- for( ; d < len2; d+=3, e+=4 )
- {
- encode3to4( source, d+off, 3, outBuff, e );
-
- lineLength += 4;
- if( breakLines && lineLength == MAX_LINE_LENGTH )
- {
- outBuff[e+4] = NEW_LINE;
- e++;
- lineLength = 0;
- } // end if: end of line
- } // en dfor: each piece of array
-
- if( d < len )
- {
- encode3to4( source, d+off, len - d, outBuff, e );
- e += 4;
- } // end if: some padding needed
-
-
- // Return value according to relevant encoding.
- try
- {
- return new String( outBuff, 0, e, PREFERRED_ENCODING );
- } // end try
- catch (java.io.UnsupportedEncodingException uue)
- {
- return new String( outBuff, 0, e );
- } // end catch
-
- } // end else: don't compress
-
- } // end encodeBytes
-
-
-
-
-
-/* ******** D E C O D I N G M E T H O D S ******** */
-
-
- /**
- * Decodes four bytes from array source
- * and writes the resulting bytes (up to three of them)
- * to destination.
- * The source and destination arrays can be manipulated
- * anywhere along their length by specifying
- * srcOffset and destOffset.
- * This method does not check to make sure your arrays
- * are large enough to accomodate srcOffset + 4 for
- * the source array or destOffset + 3 for
- * the destination array.
- * This method returns the actual number of bytes that
- * were converted from the Base64 encoding.
- *
- *
- * @param source the array to convert
- * @param srcOffset the index where conversion begins
- * @param destination the array to hold the conversion
- * @param destOffset the index where output will be put
- * @return the number of decoded bytes converted
- * @since 1.3
- */
- private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset )
- {
- // Example: Dk==
- if( source[ srcOffset + 2] == EQUALS_SIGN )
- {
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
-
- destination[ destOffset ] = (byte)( outBuff >>> 16 );
- return 1;
- }
-
- // Example: DkL=
- else if( source[ srcOffset + 3 ] == EQUALS_SIGN )
- {
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
- // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
- | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 );
-
- destination[ destOffset ] = (byte)( outBuff >>> 16 );
- destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 );
- return 2;
- }
-
- // Example: DkLE
- else
- {
- try{
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
- // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
- // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
- | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6)
- | ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) );
-
-
- destination[ destOffset ] = (byte)( outBuff >> 16 );
- destination[ destOffset + 1 ] = (byte)( outBuff >> 8 );
- destination[ destOffset + 2 ] = (byte)( outBuff );
-
- return 3;
- }catch( Exception e){
- System.out.println(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
- System.out.println(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
- System.out.println(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
- System.out.println(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
- return -1;
- } //e nd catch
- }
- } // end decodeToBytes
-
-
-
-
- /**
- * Very low-level access to decoding ASCII characters in
- * the form of a byte array. Does not support automatically
- * gunzipping or any other "fancy" features.
- *
- * @param source The Base64 encoded data
- * @param off The offset of where to begin decoding
- * @param len The length of characters to decode
- * @return decoded data
- * @since 1.3
- */
- public static byte[] decode( byte[] source, int off, int len )
- {
- int len34 = len * 3 / 4;
- byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
- int outBuffPosn = 0;
-
- byte[] b4 = new byte[4];
- int b4Posn = 0;
- int i = 0;
- byte sbiCrop = 0;
- byte sbiDecode = 0;
- for( i = off; i < off+len; i++ )
- {
- sbiCrop = (byte)(source[i] & 0x7f); // Only the low seven bits
- sbiDecode = DECODABET[ sbiCrop ];
-
- if( sbiDecode >= WHITE_SPACE_ENC ) // White space, Equals sign or better
- {
- if( sbiDecode >= EQUALS_SIGN_ENC )
- {
- b4[ b4Posn++ ] = sbiCrop;
- if( b4Posn > 3 )
- {
- outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn );
- b4Posn = 0;
-
- // If that was the equals sign, break out of 'for' loop
- if( sbiCrop == EQUALS_SIGN )
- break;
- } // end if: quartet built
-
- } // end if: equals sign or better
-
- } // end if: white space, equals sign or better
- else
- {
- System.err.println( "Bad Base64 input character at " + i + ": " + source[i] + "(decimal)" );
- return null;
- } // end else:
- } // each input character
-
- byte[] out = new byte[ outBuffPosn ];
- System.arraycopy( outBuff, 0, out, 0, outBuffPosn );
- return out;
- } // end decode
-
-
-
-
- /**
- * Decodes data from Base64 notation, automatically
- * detecting gzip-compressed data and decompressing it.
- *
- * @param s the string to decode
- * @return the decoded data
- * @since 1.4
- */
- public static byte[] decode( String s )
- {
- byte[] bytes;
- try
- {
- bytes = s.getBytes( PREFERRED_ENCODING );
- } // end try
- catch( java.io.UnsupportedEncodingException uee )
- {
- bytes = s.getBytes();
- } // end catch
- //
-
- // Decode
- bytes = decode( bytes, 0, bytes.length );
-
-
- // Check to see if it's gzip-compressed
- // GZIP Magic Two-Byte Number: 0x8b1f (35615)
- if( bytes != null && bytes.length >= 4 )
- {
-
- int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
- if( java.util.zip.GZIPInputStream.GZIP_MAGIC == head )
- {
- java.io.ByteArrayInputStream bais = null;
- java.util.zip.GZIPInputStream gzis = null;
- java.io.ByteArrayOutputStream baos = null;
- byte[] buffer = new byte[2048];
- int length = 0;
-
- try
- {
- baos = new java.io.ByteArrayOutputStream();
- bais = new java.io.ByteArrayInputStream( bytes );
- gzis = new java.util.zip.GZIPInputStream( bais );
-
- while( ( length = gzis.read( buffer ) ) >= 0 )
- {
- baos.write(buffer,0,length);
- } // end while: reading input
-
- // No error? Get new bytes.
- bytes = baos.toByteArray();
-
- } // end try
- catch( java.io.IOException e )
- {
- // Just return originally-decoded bytes
- } // end catch
- finally
- {
- try{ baos.close(); } catch( Exception e ){}
- try{ gzis.close(); } catch( Exception e ){}
- try{ bais.close(); } catch( Exception e ){}
- } // end finally
-
- } // end if: gzipped
- } // end if: bytes.length >= 2
-
- return bytes;
- } // end decode
-
-
-
-
- /**
- * Attempts to decode Base64 data and deserialize a Java
- * Object within. Returns null if there was an error.
- *
- * @param encodedObject The Base64 data to decode
- * @return The decoded and deserialized object
- * @since 1.5
- */
- public static Object decodeToObject( String encodedObject )
- {
- // Decode and gunzip if necessary
- byte[] objBytes = decode( encodedObject );
-
- java.io.ByteArrayInputStream bais = null;
- java.io.ObjectInputStream ois = null;
- Object obj = null;
-
- try
- {
- bais = new java.io.ByteArrayInputStream( objBytes );
- ois = new java.io.ObjectInputStream( bais );
-
- obj = ois.readObject();
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- obj = null;
- } // end catch
- catch( java.lang.ClassNotFoundException e )
- {
- e.printStackTrace();
- obj = null;
- } // end catch
- finally
- {
- try{ bais.close(); } catch( Exception e ){}
- try{ ois.close(); } catch( Exception e ){}
- } // end finally
-
- return obj;
- } // end decodeObject
-
-
-
- /**
- * Convenience method for encoding data to a file.
- *
- * @param dataToEncode byte array of data to encode in base64 form
- * @param filename Filename for saving encoded data
- * @return true if successful, false otherwise
- *
- * @since 2.1
- */
- public static boolean encodeToFile( byte[] dataToEncode, String filename )
- {
- boolean success = false;
- Base64.OutputStream bos = null;
- try
- {
- bos = new Base64.OutputStream(
- new java.io.FileOutputStream( filename ), Base64.ENCODE );
- bos.write( dataToEncode );
- success = true;
- } // end try
- catch( java.io.IOException e )
- {
-
- success = false;
- } // end catch: IOException
- finally
- {
- try{ bos.close(); } catch( Exception e ){}
- } // end finally
-
- return success;
- } // end encodeToFile
-
-
- /**
- * Convenience method for decoding data to a file.
- *
- * @param dataToDecode Base64-encoded data as a string
- * @param filename Filename for saving decoded data
- * @return true if successful, false otherwise
- *
- * @since 2.1
- */
- public static boolean decodeToFile( String dataToDecode, String filename )
- {
- boolean success = false;
- Base64.OutputStream bos = null;
- try
- {
- bos = new Base64.OutputStream(
- new java.io.FileOutputStream( filename ), Base64.DECODE );
- bos.write( dataToDecode.getBytes( PREFERRED_ENCODING ) );
- success = true;
- } // end try
- catch( java.io.IOException e )
- {
- success = false;
- } // end catch: IOException
- finally
- {
- try{ bos.close(); } catch( Exception e ){}
- } // end finally
-
- return success;
- } // end decodeToFile
-
-
-
-
- /**
- * Convenience method for reading a base64-encoded
- * file and decoding it.
- *
- * @param filename Filename for reading encoded data
- * @return decoded byte array or null if unsuccessful
- *
- * @since 2.1
- */
- public static byte[] decodeFromFile( String filename )
- {
- byte[] decodedData = null;
- Base64.InputStream bis = null;
- try
- {
- // Set up some useful variables
- java.io.File file = new java.io.File( filename );
- byte[] buffer = null;
- int length = 0;
- int numBytes = 0;
-
- // Check for size of file
- if( file.length() > Integer.MAX_VALUE )
- {
- System.err.println( "File is too big for this convenience method (" + file.length() + " bytes)." );
- return null;
- } // end if: file too big for int index
- buffer = new byte[ (int)file.length() ];
-
- // Open a stream
- bis = new Base64.InputStream(
- new java.io.BufferedInputStream(
- new java.io.FileInputStream( file ) ), Base64.DECODE );
-
- // Read until done
- while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
- length += numBytes;
-
- // Save in a variable to return
- decodedData = new byte[ length ];
- System.arraycopy( buffer, 0, decodedData, 0, length );
-
- } // end try
- catch( java.io.IOException e )
- {
- System.err.println( "Error decoding from file " + filename );
- } // end catch: IOException
- finally
- {
- try{ bis.close(); } catch( Exception e) {}
- } // end finally
-
- return decodedData;
- } // end decodeFromFile
-
-
-
- /**
- * Convenience method for reading a binary file
- * and base64-encoding it.
- *
- * @param filename Filename for reading binary data
- * @return base64-encoded string or null if unsuccessful
- *
- * @since 2.1
- */
- public static String encodeFromFile( String filename )
- {
- String encodedData = null;
- Base64.InputStream bis = null;
- try
- {
- // Set up some useful variables
- java.io.File file = new java.io.File( filename );
- byte[] buffer = new byte[ (int)(file.length() * 1.4) ];
- int length = 0;
- int numBytes = 0;
-
- // Open a stream
- bis = new Base64.InputStream(
- new java.io.BufferedInputStream(
- new java.io.FileInputStream( file ) ), Base64.ENCODE );
-
- // Read until done
- while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 )
- length += numBytes;
-
- // Save in a variable to return
- encodedData = new String( buffer, 0, length, Base64.PREFERRED_ENCODING );
-
- } // end try
- catch( java.io.IOException e )
- {
- System.err.println( "Error encoding from file " + filename );
- } // end catch: IOException
- finally
- {
- try{ bis.close(); } catch( Exception e) {}
- } // end finally
-
- return encodedData;
- } // end encodeFromFile
-
-
-
-
- /* ******** I N N E R C L A S S I N P U T S T R E A M ******** */
-
-
-
- /**
- * A {@link Base64.InputStream} will read data from another
- * java.io.InputStream, given in the constructor,
- * and encode/decode to/from Base64 notation on the fly.
- *
- * @see Base64
- * @since 1.3
- */
- public static class InputStream extends java.io.FilterInputStream
- {
- private boolean encode; // Encoding or decoding
- private int position; // Current position in the buffer
- private byte[] buffer; // Small buffer holding converted data
- private int bufferLength; // Length of buffer (3 or 4)
- private int numSigBytes; // Number of meaningful bytes in the buffer
- private int lineLength;
- private boolean breakLines; // Break lines at less than 80 characters
-
-
- /**
- * Constructs a {@link Base64.InputStream} in DECODE mode.
- *
- * @param in the java.io.InputStream from which to read data.
- * @since 1.3
- */
- public InputStream( java.io.InputStream in )
- {
- this( in, DECODE );
- } // end constructor
-
-
- /**
- * Constructs a {@link Base64.InputStream} in
- * either ENCODE or DECODE mode.
- *
- * Valid options:
- * ENCODE or DECODE: Encode or Decode as data is read.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * (only meaningful when encoding)
- * Note: Technically, this makes your encoding non-compliant.
- *
- *
- * Example: new Base64.InputStream( in, Base64.DECODE )
- *
- *
- * @param in the java.io.InputStream from which to read data.
- * @param options Specified options
- * @see Base64#ENCODE
- * @see Base64#DECODE
- * @see Base64#DONT_BREAK_LINES
- * @since 2.0
- */
- public InputStream( java.io.InputStream in, int options )
- {
- super( in );
- this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
- this.encode = (options & ENCODE) == ENCODE;
- this.bufferLength = encode ? 4 : 3;
- this.buffer = new byte[ bufferLength ];
- this.position = -1;
- this.lineLength = 0;
- } // end constructor
-
- /**
- * Reads enough of the input stream to convert
- * to/from Base64 and returns the next byte.
- *
- * @return next byte
- * @since 1.3
- */
- public int read() throws java.io.IOException
- {
- // Do we need to get data?
- if( position < 0 )
- {
- if( encode )
- {
- byte[] b3 = new byte[3];
- int numBinaryBytes = 0;
- for( int i = 0; i < 3; i++ )
- {
- try
- {
- int b = in.read();
-
- // If end of stream, b is -1.
- if( b >= 0 )
- {
- b3[i] = (byte)b;
- numBinaryBytes++;
- } // end if: not end of stream
-
- } // end try: read
- catch( java.io.IOException e )
- {
- // Only a problem if we got no data at all.
- if( i == 0 )
- throw e;
-
- } // end catch
- } // end for: each needed input byte
-
- if( numBinaryBytes > 0 )
- {
- encode3to4( b3, 0, numBinaryBytes, buffer, 0 );
- position = 0;
- numSigBytes = 4;
- } // end if: got data
- else
- {
- return -1;
- } // end else
- } // end if: encoding
-
- // Else decoding
- else
- {
- byte[] b4 = new byte[4];
- int i = 0;
- for( i = 0; i < 4; i++ )
- {
- // Read four "meaningful" bytes:
- int b = 0;
- do{ b = in.read(); }
- while( b >= 0 && DECODABET[ b & 0x7f ] <= WHITE_SPACE_ENC );
-
- if( b < 0 )
- break; // Reads a -1 if end of stream
-
- b4[i] = (byte)b;
- } // end for: each needed input byte
-
- if( i == 4 )
- {
- numSigBytes = decode4to3( b4, 0, buffer, 0 );
- position = 0;
- } // end if: got four characters
- else if( i == 0 ){
- return -1;
- } // end else if: also padded correctly
- else
- {
- // Must have broken out from above.
- throw new java.io.IOException( "Improperly padded Base64 input." );
- } // end
-
- } // end else: decode
- } // end else: get data
-
- // Got data?
- if( position >= 0 )
- {
- // End of relevant data?
- if( /*!encode &&*/ position >= numSigBytes )
- return -1;
-
- if( encode && breakLines && lineLength >= MAX_LINE_LENGTH )
- {
- lineLength = 0;
- return '\n';
- } // end if
- else
- {
- lineLength++; // This isn't important when decoding
- // but throwing an extra "if" seems
- // just as wasteful.
-
- int b = buffer[ position++ ];
-
- if( position >= bufferLength )
- position = -1;
-
- return b & 0xFF; // This is how you "cast" a byte that's
- // intended to be unsigned.
- } // end else
- } // end if: position >= 0
-
- // Else error
- else
- {
- // When JDK1.4 is more accepted, use an assertion here.
- throw new java.io.IOException( "Error in Base64 code reading stream." );
- } // end else
- } // end read
-
-
- /**
- * Calls {@link #read()} repeatedly until the end of stream
- * is reached or len bytes are read.
- * Returns number of bytes read into array or -1 if
- * end of stream is encountered.
- *
- * @param dest array to hold values
- * @param off offset for array
- * @param len max number of bytes to read into array
- * @return bytes read into array or -1 if end of stream is encountered.
- * @since 1.3
- */
- public int read( byte[] dest, int off, int len ) throws java.io.IOException
- {
- int i;
- int b;
- for( i = 0; i < len; i++ )
- {
- b = read();
-
- //if( b < 0 && i == 0 )
- // return -1;
-
- if( b >= 0 )
- dest[off + i] = (byte)b;
- else if( i == 0 )
- return -1;
- else
- break; // Out of 'for' loop
- } // end for: each byte read
- return i;
- } // end read
-
- } // end inner class InputStream
-
-
-
-
-
-
- /* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */
-
-
-
- /**
- * A {@link Base64.OutputStream} will write data to another
- * java.io.OutputStream, given in the constructor,
- * and encode/decode to/from Base64 notation on the fly.
- *
- * @see Base64
- * @since 1.3
- */
- public static class OutputStream extends java.io.FilterOutputStream
- {
- private boolean encode;
- private int position;
- private byte[] buffer;
- private int bufferLength;
- private int lineLength;
- private boolean breakLines;
- private byte[] b4; // Scratch used in a few places
- private boolean suspendEncoding;
-
- /**
- * Constructs a {@link Base64.OutputStream} in ENCODE mode.
- *
- * @param out the java.io.OutputStream to which data will be written.
- * @since 1.3
- */
- public OutputStream( java.io.OutputStream out )
- {
- this( out, ENCODE );
- } // end constructor
-
-
- /**
- * Constructs a {@link Base64.OutputStream} in
- * either ENCODE or DECODE mode.
- *
- * Valid options:
- * ENCODE or DECODE: Encode or Decode as data is read.
- * DONT_BREAK_LINES: don't break lines at 76 characters
- * (only meaningful when encoding)
- * Note: Technically, this makes your encoding non-compliant.
- *
- *
- * Example: new Base64.OutputStream( out, Base64.ENCODE )
- *
- * @param out the java.io.OutputStream to which data will be written.
- * @param options Specified options.
- * @see Base64#ENCODE
- * @see Base64#DECODE
- * @see Base64#DONT_BREAK_LINES
- * @since 1.3
- */
- public OutputStream( java.io.OutputStream out, int options )
- {
- super( out );
- this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
- this.encode = (options & ENCODE) == ENCODE;
- this.bufferLength = encode ? 3 : 4;
- this.buffer = new byte[ bufferLength ];
- this.position = 0;
- this.lineLength = 0;
- this.suspendEncoding = false;
- this.b4 = new byte[4];
- } // end constructor
-
-
- /**
- * Writes the byte to the output stream after
- * converting to/from Base64 notation.
- * When encoding, bytes are buffered three
- * at a time before the output stream actually
- * gets a write() call.
- * When decoding, bytes are buffered four
- * at a time.
- *
- * @param theByte the byte to write
- * @since 1.3
- */
- public void write(int theByte) throws java.io.IOException
- {
- // Encoding suspended?
- if( suspendEncoding )
- {
- super.out.write( theByte );
- return;
- } // end if: supsended
-
- // Encode?
- if( encode )
- {
- buffer[ position++ ] = (byte)theByte;
- if( position >= bufferLength ) // Enough to encode.
- {
- out.write( encode3to4( b4, buffer, bufferLength ) );
-
- lineLength += 4;
- if( breakLines && lineLength >= MAX_LINE_LENGTH )
- {
- out.write( NEW_LINE );
- lineLength = 0;
- } // end if: end of line
-
- position = 0;
- } // end if: enough to output
- } // end if: encoding
-
- // Else, Decoding
- else
- {
- // Meaningful Base64 character?
- if( DECODABET[ theByte & 0x7f ] > WHITE_SPACE_ENC )
- {
- buffer[ position++ ] = (byte)theByte;
- if( position >= bufferLength ) // Enough to output.
- {
- int len = Base64.decode4to3( buffer, 0, b4, 0 );
- out.write( b4, 0, len );
- //out.write( Base64.decode4to3( buffer ) );
- position = 0;
- } // end if: enough to output
- } // end if: meaningful base64 character
- else if( DECODABET[ theByte & 0x7f ] != WHITE_SPACE_ENC )
- {
- throw new java.io.IOException( "Invalid character in Base64 data." );
- } // end else: not white space either
- } // end else: decoding
- } // end write
-
-
-
- /**
- * Calls {@link #write(int)} repeatedly until len
- * bytes are written.
- *
- * @param theBytes array from which to read bytes
- * @param off offset for array
- * @param len max number of bytes to read into array
- * @since 1.3
- */
- public void write( byte[] theBytes, int off, int len ) throws java.io.IOException
- {
- // Encoding suspended?
- if( suspendEncoding )
- {
- super.out.write( theBytes, off, len );
- return;
- } // end if: supsended
-
- for( int i = 0; i < len; i++ )
- {
- write( theBytes[ off + i ] );
- } // end for: each byte written
-
- } // end write
-
-
-
- /**
- * Method added by PHIL. [Thanks, PHIL. -Rob]
- * This pads the buffer without closing the stream.
- */
- public void flushBase64() throws java.io.IOException
- {
- if( position > 0 )
- {
- if( encode )
- {
- out.write( encode3to4( b4, buffer, position ) );
- position = 0;
- } // end if: encoding
- else
- {
- throw new java.io.IOException( "Base64 input not properly padded." );
- } // end else: decoding
- } // end if: buffer partially full
-
- } // end flush
-
-
- /**
- * Flushes and closes (I think, in the superclass) the stream.
- *
- * @since 1.3
- */
- public void close() throws java.io.IOException
- {
- // 1. Ensure that pending characters are written
- flushBase64();
-
- // 2. Actually close the stream
- // Base class both flushes and closes.
- super.close();
-
- buffer = null;
- out = null;
- } // end close
-
-
-
- /**
- * Suspends encoding of the stream.
- * May be helpful if you need to embed a piece of
- * base640-encoded data in a stream.
- *
- * @since 1.5.1
- */
- public void suspendEncoding() throws java.io.IOException
- {
- flushBase64();
- this.suspendEncoding = true;
- } // end suspendEncoding
-
-
- /**
- * Resumes encoding of the stream.
- * May be helpful if you need to embed a piece of
- * base640-encoded data in a stream.
- *
- * @since 1.5.1
- */
- public void resumeEncoding()
- {
- this.suspendEncoding = false;
- } // end resumeEncoding
-
-
-
- } // end inner class OutputStream
-
-
-} // end class Base64
+public class Base64 {
+
+ /* ******** P U B L I C F I E L D S ******** */
+
+ /** No options specified. Value is zero. */
+ public final static int NO_OPTIONS = 0;
+
+ /** Specify encoding. */
+ public final static int ENCODE = 1;
+
+ /** Specify decoding. */
+ public final static int DECODE = 0;
+
+ /** Specify that data should be gzip-compressed. */
+ public final static int GZIP = 2;
+
+ /** Don't break lines when encoding (violates strict Base64 specification) */
+ public final static int DONT_BREAK_LINES = 8;
+
+ /* ******** P R I V A T E F I E L D S ******** */
+
+ /** Maximum line length (76) of Base64 output. */
+ private final static int MAX_LINE_LENGTH = 76;
+
+ /** The equals sign (=) as a byte. */
+ private final static byte EQUALS_SIGN = (byte) '=';
+
+ /** The new line character (\n) as a byte. */
+ private final static byte NEW_LINE = (byte) '\n';
+
+ /** Preferred encoding. */
+ private final static String PREFERRED_ENCODING = "UTF-8";
+
+ /** The 64 valid Base64 values. */
+ private final static byte[] ALPHABET;
+
+ private final static byte[] _NATIVE_ALPHABET = /*
+ * May be something funny
+ * like EBCDIC
+ */
+ { (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F',
+ (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K',
+ (byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P',
+ (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U',
+ (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z',
+ (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e',
+ (byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j',
+ (byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o',
+ (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't',
+ (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y',
+ (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3',
+ (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8',
+ (byte) '9', (byte) '+', (byte) '/' };
+
+ /** Determine which ALPHABET to use. */
+ static {
+ byte[] __bytes;
+ try {
+ __bytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
+ .getBytes(PREFERRED_ENCODING);
+ } // end try
+ catch (java.io.UnsupportedEncodingException use) {
+ __bytes = _NATIVE_ALPHABET; // Fall back to native encoding
+ } // end catch
+ ALPHABET = __bytes;
+ } // end static
+
+ /**
+ * Translates a Base64 value to either its 6-bit reconstruction value or a
+ * negative number indicating some other meaning.
+ */
+ private final static byte[] DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9,
+ -9, // Decimal 0 - 8
+ -5, -5, // Whitespace: Tab and Linefeed
+ -9, -9, // Decimal 11 - 12
+ -5, // Whitespace: Carriage Return
+ -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 -
+ // 26
+ -9, -9, -9, -9, -9, // Decimal 27 - 31
+ -5, // Whitespace: Space
+ -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 42
+ 62, // Plus sign at decimal 43
+ -9, -9, -9, // Decimal 44 - 46
+ 63, // Slash at decimal 47
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine
+ -9, -9, -9, // Decimal 58 - 60
+ -1, // Equals sign at decimal 61
+ -9, -9, -9, // Decimal 62 - 64
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A'
+ // through 'N'
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O'
+ // through 'Z'
+ -9, -9, -9, -9, -9, -9, // Decimal 91 - 96
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a'
+ // through 'm'
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n'
+ // through 'z'
+ -9, -9, -9, -9 // Decimal 123 - 126
+ /*
+ * ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
+ * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
+ * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
+ * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
+ * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
+ * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
+ * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
+ * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
+ * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
+ * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255
+ */
+ };
+
+ // I think I end up not using the BAD_ENCODING indicator.
+ // private final static byte BAD_ENCODING = -9; // Indicates error in
+ // encoding
+ private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in
+ // encoding
+
+ private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in
+ // encoding
+
+ /** Defeats instantiation. */
+ private Base64() {
+ }
+
+ /* ******** E N C O D I N G M E T H O D S ******** */
+
+ /**
+ * Encodes up to the first three bytes of array threeBytes and
+ * returns a four-byte array in Base64 notation. The actual number of
+ * significant bytes in your array is given by numSigBytes. The
+ * array threeBytes needs only be as big as numSigBytes.
+ * Code can reuse a byte array by passing a four-byte array as b4.
+ *
+ * @param b4
+ * A reusable byte array to reduce array instantiation
+ * @param threeBytes
+ * the array to convert
+ * @param numSigBytes
+ * the number of significant bytes in your array
+ * @return four byte array in Base64 notation.
+ * @since 1.5.1
+ */
+ private static byte[] encode3to4(byte[] b4, byte[] threeBytes,
+ int numSigBytes) {
+ encode3to4(threeBytes, 0, numSigBytes, b4, 0);
+ return b4;
+ } // end encode3to4
+
+ /**
+ * Encodes up to three bytes of the array source and writes the
+ * resulting four Base64 bytes to destination. The source and
+ * destination arrays can be manipulated anywhere along their length by
+ * specifying srcOffset and destOffset. This method
+ * does not check to make sure your arrays are large enough to accomodate
+ * srcOffset + 3 for the source array or
+ * destOffset + 4 for the destination array. The
+ * actual number of significant bytes in your array is given by
+ * numSigBytes.
+ *
+ * @param source
+ * the array to convert
+ * @param srcOffset
+ * the index where conversion begins
+ * @param numSigBytes
+ * the number of significant bytes in your array
+ * @param destination
+ * the array to hold the conversion
+ * @param destOffset
+ * the index where output will be put
+ * @return the destination array
+ * @since 1.3
+ */
+ private static byte[] encode3to4(byte[] source, int srcOffset,
+ int numSigBytes, byte[] destination, int destOffset) {
+ // 1 2 3
+ // 01234567890123456789012345678901 Bit position
+ // --------000000001111111122222222 Array position from threeBytes
+ // --------| || || || | Six bit groups to index ALPHABET
+ // >>18 >>12 >> 6 >> 0 Right shift necessary
+ // 0x3f 0x3f 0x3f Additional AND
+
+ // Create buffer with zero-padding if there are only one or two
+ // significant bytes passed in the array.
+ // We have to shift left 24 in order to flush out the 1's that appear
+ // when Java treats a value as negative that is cast from a byte to an
+ // int.
+ int inBuff = (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0)
+ | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0)
+ | (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24) : 0);
+
+ switch (numSigBytes) {
+ case 3:
+ destination[destOffset] = ALPHABET[(inBuff >>> 18)];
+ destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f];
+ destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f];
+ destination[destOffset + 3] = ALPHABET[(inBuff) & 0x3f];
+ return destination;
+
+ case 2:
+ destination[destOffset] = ALPHABET[(inBuff >>> 18)];
+ destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f];
+ destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f];
+ destination[destOffset + 3] = EQUALS_SIGN;
+ return destination;
+
+ case 1:
+ destination[destOffset] = ALPHABET[(inBuff >>> 18)];
+ destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f];
+ destination[destOffset + 2] = EQUALS_SIGN;
+ destination[destOffset + 3] = EQUALS_SIGN;
+ return destination;
+
+ default:
+ return destination;
+ } // end switch
+ } // end encode3to4
+
+ /**
+ * Serializes an object and returns the Base64-encoded version of that
+ * serialized object. If the object cannot be serialized or there is another
+ * error, the method will return null. The object is not
+ * GZip-compressed before being encoded.
+ *
+ * @param serializableObject
+ * The object to encode
+ * @return The Base64-encoded object
+ * @since 1.4
+ */
+ public static String encodeObject(java.io.Serializable serializableObject) {
+ return encodeObject(serializableObject, NO_OPTIONS);
+ } // end encodeObject
+
+ /**
+ * Serializes an object and returns the Base64-encoded version of that
+ * serialized object. If the object cannot be serialized or there is another
+ * error, the method will return null.
+ *
+ * Valid options:
+ *
+ *
+ * GZIP: gzip-compresses object before encoding it.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ *
+ *
+ *
+ * Example: encodeObject( myObj, Base64.GZIP ) or
+ *
+ * Example:
+ * encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )
+ *
+ * @param serializableObject
+ * The object to encode
+ * @param options
+ * Specified options
+ * @return The Base64-encoded object
+ * @see Base64#GZIP
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public static String encodeObject(java.io.Serializable serializableObject,
+ int options) {
+ // Streams
+ java.io.ByteArrayOutputStream baos = null;
+ java.io.OutputStream b64os = null;
+ java.io.ObjectOutputStream oos = null;
+ java.util.zip.GZIPOutputStream gzos = null;
+
+ // Isolate options
+ int gzip = (options & GZIP);
+ int dontBreakLines = (options & DONT_BREAK_LINES);
+
+ try {
+ // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
+ baos = new java.io.ByteArrayOutputStream();
+ b64os = new Base64.OutputStream(baos, ENCODE | dontBreakLines);
+
+ // GZip?
+ if (gzip == GZIP) {
+ gzos = new java.util.zip.GZIPOutputStream(b64os);
+ oos = new java.io.ObjectOutputStream(gzos);
+ } // end if: gzip
+ else
+ oos = new java.io.ObjectOutputStream(b64os);
+
+ oos.writeObject(serializableObject);
+ } // end try
+ catch (java.io.IOException e) {
+ e.printStackTrace();
+ return null;
+ } // end catch
+ finally {
+ try {
+ oos.close();
+ } catch (Exception e) {
+ }
+ try {
+ gzos.close();
+ } catch (Exception e) {
+ }
+ try {
+ b64os.close();
+ } catch (Exception e) {
+ }
+ try {
+ baos.close();
+ } catch (Exception e) {
+ }
+ } // end finally
+
+ // Return value according to relevant encoding.
+ try {
+ return new String(baos.toByteArray(), PREFERRED_ENCODING);
+ } // end try
+ catch (java.io.UnsupportedEncodingException uue) {
+ return new String(baos.toByteArray());
+ } // end catch
+
+ } // end encode
+
+ /**
+ * Encodes a byte array into Base64 notation. Does not GZip-compress data.
+ *
+ * @param source
+ * The data to convert
+ * @since 1.4
+ */
+ public static String encodeBytes(byte[] source) {
+ return encodeBytes(source, 0, source.length, NO_OPTIONS);
+ } // end encodeBytes
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ *
+ * Valid options:
+ *
+ *
+ * GZIP: gzip-compresses object before encoding it.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ *
+ *
+ *
+ * Example: encodeBytes( myData, Base64.GZIP ) or
+ *
+ * Example:
+ * encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )
+ *
+ *
+ * @param source
+ * The data to convert
+ * @param options
+ * Specified options
+ * @see Base64#GZIP
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public static String encodeBytes(byte[] source, int options) {
+ return encodeBytes(source, 0, source.length, options);
+ } // end encodeBytes
+
+ /**
+ * Encodes a byte array into Base64 notation. Does not GZip-compress data.
+ *
+ * @param source
+ * The data to convert
+ * @param off
+ * Offset in array where conversion should begin
+ * @param len
+ * Length of data to convert
+ * @since 1.4
+ */
+ public static String encodeBytes(byte[] source, int off, int len) {
+ return encodeBytes(source, off, len, NO_OPTIONS);
+ } // end encodeBytes
+
+ /**
+ * Encodes a byte array into Base64 notation.
+ *
+ * Valid options:
+ *
+ *
+ * GZIP: gzip-compresses object before encoding it.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ *
+ *
+ *
+ * Example: encodeBytes( myData, Base64.GZIP ) or
+ *
+ * Example:
+ * encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )
+ *
+ *
+ * @param source
+ * The data to convert
+ * @param off
+ * Offset in array where conversion should begin
+ * @param len
+ * Length of data to convert
+ * @param options
+ * Specified options
+ * @see Base64#GZIP
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public static String encodeBytes(byte[] source, int off, int len,
+ int options) {
+ // Isolate options
+ int dontBreakLines = (options & DONT_BREAK_LINES);
+ int gzip = (options & GZIP);
+
+ // Compress?
+ if (gzip == GZIP) {
+ java.io.ByteArrayOutputStream baos = null;
+ java.util.zip.GZIPOutputStream gzos = null;
+ Base64.OutputStream b64os = null;
+
+ try {
+ // GZip -> Base64 -> ByteArray
+ baos = new java.io.ByteArrayOutputStream();
+ b64os = new Base64.OutputStream(baos, ENCODE | dontBreakLines);
+ gzos = new java.util.zip.GZIPOutputStream(b64os);
+
+ gzos.write(source, off, len);
+ gzos.close();
+ } // end try
+ catch (java.io.IOException e) {
+ e.printStackTrace();
+ return null;
+ } // end catch
+ finally {
+ try {
+ gzos.close();
+ } catch (Exception e) {
+ }
+ try {
+ b64os.close();
+ } catch (Exception e) {
+ }
+ try {
+ baos.close();
+ } catch (Exception e) {
+ }
+ } // end finally
+
+ // Return value according to relevant encoding.
+ try {
+ return new String(baos.toByteArray(), PREFERRED_ENCODING);
+ } // end try
+ catch (java.io.UnsupportedEncodingException uue) {
+ return new String(baos.toByteArray());
+ } // end catch
+ } // end if: compress
+
+ // Else, don't compress. Better not to use streams at all then.
+ else {
+ // Convert option to boolean in way that code likes it.
+ boolean breakLines = dontBreakLines == 0;
+
+ int len43 = len * 4 / 3;
+ byte[] outBuff = new byte[(len43) // Main 4:3
+ + ((len % 3) > 0 ? 4 : 0) // Account for padding
+ + (breakLines ? (len43 / MAX_LINE_LENGTH) : 0)]; // New
+ // lines
+ int d = 0;
+ int e = 0;
+ int len2 = len - 2;
+ int lineLength = 0;
+ for (; d < len2; d += 3, e += 4) {
+ encode3to4(source, d + off, 3, outBuff, e);
+
+ lineLength += 4;
+ if (breakLines && lineLength == MAX_LINE_LENGTH) {
+ outBuff[e + 4] = NEW_LINE;
+ e++;
+ lineLength = 0;
+ } // end if: end of line
+ } // en dfor: each piece of array
+
+ if (d < len) {
+ encode3to4(source, d + off, len - d, outBuff, e);
+ e += 4;
+ } // end if: some padding needed
+
+ // Return value according to relevant encoding.
+ try {
+ return new String(outBuff, 0, e, PREFERRED_ENCODING);
+ } // end try
+ catch (java.io.UnsupportedEncodingException uue) {
+ return new String(outBuff, 0, e);
+ } // end catch
+
+ } // end else: don't compress
+
+ } // end encodeBytes
+
+ /* ******** D E C O D I N G M E T H O D S ******** */
+
+ /**
+ * Decodes four bytes from array source and writes the resulting
+ * bytes (up to three of them) to destination. The source and
+ * destination arrays can be manipulated anywhere along their length by
+ * specifying srcOffset and destOffset. This method
+ * does not check to make sure your arrays are large enough to accomodate
+ * srcOffset + 4 for the source array or
+ * destOffset + 3 for the destination array. This
+ * method returns the actual number of bytes that were converted from the
+ * Base64 encoding.
+ *
+ *
+ * @param source
+ * the array to convert
+ * @param srcOffset
+ * the index where conversion begins
+ * @param destination
+ * the array to hold the conversion
+ * @param destOffset
+ * the index where output will be put
+ * @return the number of decoded bytes converted
+ * @since 1.3
+ */
+ private static int decode4to3(byte[] source, int srcOffset,
+ byte[] destination, int destOffset) {
+ // Example: Dk==
+ if (source[srcOffset + 2] == EQUALS_SIGN) {
+ // Two ways to do the same thing. Don't know which way I like best.
+ // int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6
+ // )
+ // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
+ int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18)
+ | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12);
+
+ destination[destOffset] = (byte) (outBuff >>> 16);
+ return 1;
+ }
+
+ // Example: DkL=
+ else if (source[srcOffset + 3] == EQUALS_SIGN) {
+ // Two ways to do the same thing. Don't know which way I like best.
+ // int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6
+ // )
+ // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
+ // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
+ int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18)
+ | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12)
+ | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6);
+
+ destination[destOffset] = (byte) (outBuff >>> 16);
+ destination[destOffset + 1] = (byte) (outBuff >>> 8);
+ return 2;
+ }
+
+ // Example: DkLE
+ else {
+ try {
+ // Two ways to do the same thing. Don't know which way I like
+ // best.
+ // int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 )
+ // >>> 6 )
+ // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
+ // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
+ // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
+ int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18)
+ | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12)
+ | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6)
+ | ((DECODABET[source[srcOffset + 3]] & 0xFF));
+
+ destination[destOffset] = (byte) (outBuff >> 16);
+ destination[destOffset + 1] = (byte) (outBuff >> 8);
+ destination[destOffset + 2] = (byte) (outBuff);
+
+ return 3;
+ } catch (Exception e) {
+ System.out.println("" + source[srcOffset] + ": "
+ + (DECODABET[source[srcOffset]]));
+ System.out.println("" + source[srcOffset + 1] + ": "
+ + (DECODABET[source[srcOffset + 1]]));
+ System.out.println("" + source[srcOffset + 2] + ": "
+ + (DECODABET[source[srcOffset + 2]]));
+ System.out.println("" + source[srcOffset + 3] + ": "
+ + (DECODABET[source[srcOffset + 3]]));
+ return -1;
+ } // e nd catch
+ }
+ } // end decodeToBytes
+
+ /**
+ * Very low-level access to decoding ASCII characters in the form of a byte
+ * array. Does not support automatically gunzipping or any other "fancy"
+ * features.
+ *
+ * @param source
+ * The Base64 encoded data
+ * @param off
+ * The offset of where to begin decoding
+ * @param len
+ * The length of characters to decode
+ * @return decoded data
+ * @since 1.3
+ */
+ public static byte[] decode(byte[] source, int off, int len) {
+ int len34 = len * 3 / 4;
+ byte[] outBuff = new byte[len34]; // Upper limit on size of output
+ int outBuffPosn = 0;
+
+ byte[] b4 = new byte[4];
+ int b4Posn = 0;
+ int i = 0;
+ byte sbiCrop = 0;
+ byte sbiDecode = 0;
+ for (i = off; i < off + len; i++) {
+ sbiCrop = (byte) (source[i] & 0x7f); // Only the low seven bits
+ sbiDecode = DECODABET[sbiCrop];
+
+ if (sbiDecode >= WHITE_SPACE_ENC) // White space, Equals sign or
+ // better
+ {
+ if (sbiDecode >= EQUALS_SIGN_ENC) {
+ b4[b4Posn++] = sbiCrop;
+ if (b4Posn > 3) {
+ outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn);
+ b4Posn = 0;
+
+ // If that was the equals sign, break out of 'for' loop
+ if (sbiCrop == EQUALS_SIGN)
+ break;
+ } // end if: quartet built
+
+ } // end if: equals sign or better
+
+ } // end if: white space, equals sign or better
+ else {
+ System.err.println("Bad Base64 input character at " + i + ": "
+ + source[i] + "(decimal)");
+ return null;
+ } // end else:
+ } // each input character
+
+ byte[] out = new byte[outBuffPosn];
+ System.arraycopy(outBuff, 0, out, 0, outBuffPosn);
+ return out;
+ } // end decode
+
+ /**
+ * Decodes data from Base64 notation, automatically detecting
+ * gzip-compressed data and decompressing it.
+ *
+ * @param s
+ * the string to decode
+ * @return the decoded data
+ * @since 1.4
+ */
+ public static byte[] decode(String s) {
+ byte[] bytes;
+ try {
+ bytes = s.getBytes(PREFERRED_ENCODING);
+ } // end try
+ catch (java.io.UnsupportedEncodingException uee) {
+ bytes = s.getBytes();
+ } // end catch
+ //
+
+ // Decode
+ bytes = decode(bytes, 0, bytes.length);
+
+ // Check to see if it's gzip-compressed
+ // GZIP Magic Two-Byte Number: 0x8b1f (35615)
+ if (bytes != null && bytes.length >= 4) {
+
+ int head = ((int) bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
+ if (java.util.zip.GZIPInputStream.GZIP_MAGIC == head) {
+ java.io.ByteArrayInputStream bais = null;
+ java.util.zip.GZIPInputStream gzis = null;
+ java.io.ByteArrayOutputStream baos = null;
+ byte[] buffer = new byte[2048];
+ int length = 0;
+
+ try {
+ baos = new java.io.ByteArrayOutputStream();
+ bais = new java.io.ByteArrayInputStream(bytes);
+ gzis = new java.util.zip.GZIPInputStream(bais);
+
+ while ((length = gzis.read(buffer)) >= 0) {
+ baos.write(buffer, 0, length);
+ } // end while: reading input
+
+ // No error? Get new bytes.
+ bytes = baos.toByteArray();
+
+ } // end try
+ catch (java.io.IOException e) {
+ // Just return originally-decoded bytes
+ } // end catch
+ finally {
+ try {
+ baos.close();
+ } catch (Exception e) {
+ }
+ try {
+ gzis.close();
+ } catch (Exception e) {
+ }
+ try {
+ bais.close();
+ } catch (Exception e) {
+ }
+ } // end finally
+
+ } // end if: gzipped
+ } // end if: bytes.length >= 2
+
+ return bytes;
+ } // end decode
+
+ /**
+ * Attempts to decode Base64 data and deserialize a Java Object within.
+ * Returns null if there was an error.
+ *
+ * @param encodedObject
+ * The Base64 data to decode
+ * @return The decoded and deserialized object
+ * @since 1.5
+ */
+ public static Object decodeToObject(String encodedObject) {
+ // Decode and gunzip if necessary
+ byte[] objBytes = decode(encodedObject);
+
+ java.io.ByteArrayInputStream bais = null;
+ java.io.ObjectInputStream ois = null;
+ Object obj = null;
+
+ try {
+ bais = new java.io.ByteArrayInputStream(objBytes);
+ ois = new java.io.ObjectInputStream(bais);
+
+ obj = ois.readObject();
+ } // end try
+ catch (java.io.IOException e) {
+ e.printStackTrace();
+ obj = null;
+ } // end catch
+ catch (java.lang.ClassNotFoundException e) {
+ e.printStackTrace();
+ obj = null;
+ } // end catch
+ finally {
+ try {
+ bais.close();
+ } catch (Exception e) {
+ }
+ try {
+ ois.close();
+ } catch (Exception e) {
+ }
+ } // end finally
+
+ return obj;
+ } // end decodeObject
+
+ /**
+ * Convenience method for encoding data to a file.
+ *
+ * @param dataToEncode
+ * byte array of data to encode in base64 form
+ * @param filename
+ * Filename for saving encoded data
+ * @return true if successful, false otherwise
+ *
+ * @since 2.1
+ */
+ public static boolean encodeToFile(byte[] dataToEncode, String filename) {
+ boolean success = false;
+ Base64.OutputStream bos = null;
+ try {
+ bos = new Base64.OutputStream(
+ new java.io.FileOutputStream(filename), Base64.ENCODE);
+ bos.write(dataToEncode);
+ success = true;
+ } // end try
+ catch (java.io.IOException e) {
+
+ success = false;
+ } // end catch: IOException
+ finally {
+ try {
+ bos.close();
+ } catch (Exception e) {
+ }
+ } // end finally
+
+ return success;
+ } // end encodeToFile
+
+ /**
+ * Convenience method for decoding data to a file.
+ *
+ * @param dataToDecode
+ * Base64-encoded data as a string
+ * @param filename
+ * Filename for saving decoded data
+ * @return true if successful, false otherwise
+ *
+ * @since 2.1
+ */
+ public static boolean decodeToFile(String dataToDecode, String filename) {
+ boolean success = false;
+ Base64.OutputStream bos = null;
+ try {
+ bos = new Base64.OutputStream(
+ new java.io.FileOutputStream(filename), Base64.DECODE);
+ bos.write(dataToDecode.getBytes(PREFERRED_ENCODING));
+ success = true;
+ } // end try
+ catch (java.io.IOException e) {
+ success = false;
+ } // end catch: IOException
+ finally {
+ try {
+ bos.close();
+ } catch (Exception e) {
+ }
+ } // end finally
+
+ return success;
+ } // end decodeToFile
+
+ /**
+ * Convenience method for reading a base64-encoded file and decoding it.
+ *
+ * @param filename
+ * Filename for reading encoded data
+ * @return decoded byte array or null if unsuccessful
+ *
+ * @since 2.1
+ */
+ public static byte[] decodeFromFile(String filename) {
+ byte[] decodedData = null;
+ Base64.InputStream bis = null;
+ try {
+ // Set up some useful variables
+ java.io.File file = new java.io.File(filename);
+ byte[] buffer = null;
+ int length = 0;
+ int numBytes = 0;
+
+ // Check for size of file
+ if (file.length() > Integer.MAX_VALUE) {
+ System.err
+ .println("File is too big for this convenience method ("
+ + file.length() + " bytes).");
+ return null;
+ } // end if: file too big for int index
+ buffer = new byte[(int) file.length()];
+
+ // Open a stream
+ bis = new Base64.InputStream(new java.io.BufferedInputStream(
+ new java.io.FileInputStream(file)), Base64.DECODE);
+
+ // Read until done
+ while ((numBytes = bis.read(buffer, length, 4096)) >= 0)
+ length += numBytes;
+
+ // Save in a variable to return
+ decodedData = new byte[length];
+ System.arraycopy(buffer, 0, decodedData, 0, length);
+
+ } // end try
+ catch (java.io.IOException e) {
+ System.err.println("Error decoding from file " + filename);
+ } // end catch: IOException
+ finally {
+ try {
+ bis.close();
+ } catch (Exception e) {
+ }
+ } // end finally
+
+ return decodedData;
+ } // end decodeFromFile
+
+ /**
+ * Convenience method for reading a binary file and base64-encoding it.
+ *
+ * @param filename
+ * Filename for reading binary data
+ * @return base64-encoded string or null if unsuccessful
+ *
+ * @since 2.1
+ */
+ public static String encodeFromFile(String filename) {
+ String encodedData = null;
+ Base64.InputStream bis = null;
+ try {
+ // Set up some useful variables
+ java.io.File file = new java.io.File(filename);
+ byte[] buffer = new byte[(int) (file.length() * 1.4)];
+ int length = 0;
+ int numBytes = 0;
+
+ // Open a stream
+ bis = new Base64.InputStream(new java.io.BufferedInputStream(
+ new java.io.FileInputStream(file)), Base64.ENCODE);
+
+ // Read until done
+ while ((numBytes = bis.read(buffer, length, 4096)) >= 0)
+ length += numBytes;
+
+ // Save in a variable to return
+ encodedData = new String(buffer, 0, length,
+ Base64.PREFERRED_ENCODING);
+
+ } // end try
+ catch (java.io.IOException e) {
+ System.err.println("Error encoding from file " + filename);
+ } // end catch: IOException
+ finally {
+ try {
+ bis.close();
+ } catch (Exception e) {
+ }
+ } // end finally
+
+ return encodedData;
+ } // end encodeFromFile
+
+ /* ******** I N N E R C L A S S I N P U T S T R E A M ******** */
+
+ /**
+ * A {@link Base64.InputStream} will read data from another
+ * java.io.InputStream, given in the constructor, and
+ * encode/decode to/from Base64 notation on the fly.
+ *
+ * @see Base64
+ * @since 1.3
+ */
+ public static class InputStream extends java.io.FilterInputStream {
+ private boolean encode; // Encoding or decoding
+
+ private int position; // Current position in the buffer
+
+ private byte[] buffer; // Small buffer holding converted data
+
+ private int bufferLength; // Length of buffer (3 or 4)
+
+ private int numSigBytes; // Number of meaningful bytes in the buffer
+
+ private int lineLength;
+
+ private boolean breakLines; // Break lines at less than 80 characters
+
+ /**
+ * Constructs a {@link Base64.InputStream} in DECODE mode.
+ *
+ * @param in
+ * the java.io.InputStream from which to read
+ * data.
+ * @since 1.3
+ */
+ public InputStream(java.io.InputStream in) {
+ this(in, DECODE);
+ } // end constructor
+
+ /**
+ * Constructs a {@link Base64.InputStream} in either ENCODE or DECODE
+ * mode.
+ *
+ * Valid options:
+ *
+ *
+ * ENCODE or DECODE: Encode or Decode as data is read.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * (only meaningful when encoding)
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ *
+ *
+ *
+ * Example: new Base64.InputStream( in, Base64.DECODE )
+ *
+ *
+ * @param in
+ * the java.io.InputStream from which to read
+ * data.
+ * @param options
+ * Specified options
+ * @see Base64#ENCODE
+ * @see Base64#DECODE
+ * @see Base64#DONT_BREAK_LINES
+ * @since 2.0
+ */
+ public InputStream(java.io.InputStream in, int options) {
+ super(in);
+ this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
+ this.encode = (options & ENCODE) == ENCODE;
+ this.bufferLength = encode ? 4 : 3;
+ this.buffer = new byte[bufferLength];
+ this.position = -1;
+ this.lineLength = 0;
+ } // end constructor
+
+ /**
+ * Reads enough of the input stream to convert to/from Base64 and
+ * returns the next byte.
+ *
+ * @return next byte
+ * @since 1.3
+ */
+ public int read() throws java.io.IOException {
+ // Do we need to get data?
+ if (position < 0) {
+ if (encode) {
+ byte[] b3 = new byte[3];
+ int numBinaryBytes = 0;
+ for (int i = 0; i < 3; i++) {
+ try {
+ int b = in.read();
+
+ // If end of stream, b is -1.
+ if (b >= 0) {
+ b3[i] = (byte) b;
+ numBinaryBytes++;
+ } // end if: not end of stream
+
+ } // end try: read
+ catch (java.io.IOException e) {
+ // Only a problem if we got no data at all.
+ if (i == 0)
+ throw e;
+
+ } // end catch
+ } // end for: each needed input byte
+
+ if (numBinaryBytes > 0) {
+ encode3to4(b3, 0, numBinaryBytes, buffer, 0);
+ position = 0;
+ numSigBytes = 4;
+ } // end if: got data
+ else {
+ return -1;
+ } // end else
+ } // end if: encoding
+
+ // Else decoding
+ else {
+ byte[] b4 = new byte[4];
+ int i = 0;
+ for (i = 0; i < 4; i++) {
+ // Read four "meaningful" bytes:
+ int b = 0;
+ do {
+ b = in.read();
+ } while (b >= 0
+ && DECODABET[b & 0x7f] <= WHITE_SPACE_ENC);
+
+ if (b < 0)
+ break; // Reads a -1 if end of stream
+
+ b4[i] = (byte) b;
+ } // end for: each needed input byte
+
+ if (i == 4) {
+ numSigBytes = decode4to3(b4, 0, buffer, 0);
+ position = 0;
+ } // end if: got four characters
+ else if (i == 0) {
+ return -1;
+ } // end else if: also padded correctly
+ else {
+ // Must have broken out from above.
+ throw new java.io.IOException(
+ "Improperly padded Base64 input.");
+ } // end
+
+ } // end else: decode
+ } // end else: get data
+
+ // Got data?
+ if (position >= 0) {
+ // End of relevant data?
+ if ( /* !encode && */position >= numSigBytes)
+ return -1;
+
+ if (encode && breakLines && lineLength >= MAX_LINE_LENGTH) {
+ lineLength = 0;
+ return '\n';
+ } // end if
+ else {
+ lineLength++; // This isn't important when decoding
+ // but throwing an extra "if" seems
+ // just as wasteful.
+
+ int b = buffer[position++];
+
+ if (position >= bufferLength)
+ position = -1;
+
+ return b & 0xFF; // This is how you "cast" a byte that's
+ // intended to be unsigned.
+ } // end else
+ } // end if: position >= 0
+
+ // Else error
+ else {
+ // When JDK1.4 is more accepted, use an assertion here.
+ throw new java.io.IOException(
+ "Error in Base64 code reading stream.");
+ } // end else
+ } // end read
+
+ /**
+ * Calls {@link #read()} repeatedly until the end of stream is reached
+ * or len bytes are read. Returns number of bytes read into
+ * array or -1 if end of stream is encountered.
+ *
+ * @param dest
+ * array to hold values
+ * @param off
+ * offset for array
+ * @param len
+ * max number of bytes to read into array
+ * @return bytes read into array or -1 if end of stream is encountered.
+ * @since 1.3
+ */
+ public int read(byte[] dest, int off, int len)
+ throws java.io.IOException {
+ int i;
+ int b;
+ for (i = 0; i < len; i++) {
+ b = read();
+
+ // if( b < 0 && i == 0 )
+ // return -1;
+
+ if (b >= 0)
+ dest[off + i] = (byte) b;
+ else if (i == 0)
+ return -1;
+ else
+ break; // Out of 'for' loop
+ } // end for: each byte read
+ return i;
+ } // end read
+
+ } // end inner class InputStream
+
+ /* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */
+
+ /**
+ * A {@link Base64.OutputStream} will write data to another
+ * java.io.OutputStream, given in the constructor, and
+ * encode/decode to/from Base64 notation on the fly.
+ *
+ * @see Base64
+ * @since 1.3
+ */
+ public static class OutputStream extends java.io.FilterOutputStream {
+ private boolean encode;
+
+ private int position;
+
+ private byte[] buffer;
+
+ private int bufferLength;
+
+ private int lineLength;
+
+ private boolean breakLines;
+
+ private byte[] b4; // Scratch used in a few places
+
+ private boolean suspendEncoding;
+
+ /**
+ * Constructs a {@link Base64.OutputStream} in ENCODE mode.
+ *
+ * @param out
+ * the java.io.OutputStream to which data will be
+ * written.
+ * @since 1.3
+ */
+ public OutputStream(java.io.OutputStream out) {
+ this(out, ENCODE);
+ } // end constructor
+
+ /**
+ * Constructs a {@link Base64.OutputStream} in either ENCODE or DECODE
+ * mode.
+ *
+ * Valid options:
+ *
+ *
+ * ENCODE or DECODE: Encode or Decode as data is read.
+ * DONT_BREAK_LINES: don't break lines at 76 characters
+ * (only meaningful when encoding)
+ * <i>Note: Technically, this makes your encoding non-compliant.</i>
+ *
+ *
+ *
+ * Example: new Base64.OutputStream( out, Base64.ENCODE )
+ *
+ * @param out
+ * the java.io.OutputStream to which data will be
+ * written.
+ * @param options
+ * Specified options.
+ * @see Base64#ENCODE
+ * @see Base64#DECODE
+ * @see Base64#DONT_BREAK_LINES
+ * @since 1.3
+ */
+ public OutputStream(java.io.OutputStream out, int options) {
+ super(out);
+ this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
+ this.encode = (options & ENCODE) == ENCODE;
+ this.bufferLength = encode ? 3 : 4;
+ this.buffer = new byte[bufferLength];
+ this.position = 0;
+ this.lineLength = 0;
+ this.suspendEncoding = false;
+ this.b4 = new byte[4];
+ } // end constructor
+
+ /**
+ * Writes the byte to the output stream after converting to/from Base64
+ * notation. When encoding, bytes are buffered three at a time before
+ * the output stream actually gets a write() call. When decoding, bytes
+ * are buffered four at a time.
+ *
+ * @param theByte
+ * the byte to write
+ * @since 1.3
+ */
+ public void write(int theByte) throws java.io.IOException {
+ // Encoding suspended?
+ if (suspendEncoding) {
+ super.out.write(theByte);
+ return;
+ } // end if: supsended
+
+ // Encode?
+ if (encode) {
+ buffer[position++] = (byte) theByte;
+ if (position >= bufferLength) // Enough to encode.
+ {
+ out.write(encode3to4(b4, buffer, bufferLength));
+
+ lineLength += 4;
+ if (breakLines && lineLength >= MAX_LINE_LENGTH) {
+ out.write(NEW_LINE);
+ lineLength = 0;
+ } // end if: end of line
+
+ position = 0;
+ } // end if: enough to output
+ } // end if: encoding
+
+ // Else, Decoding
+ else {
+ // Meaningful Base64 character?
+ if (DECODABET[theByte & 0x7f] > WHITE_SPACE_ENC) {
+ buffer[position++] = (byte) theByte;
+ if (position >= bufferLength) // Enough to output.
+ {
+ int len = Base64.decode4to3(buffer, 0, b4, 0);
+ out.write(b4, 0, len);
+ // out.write( Base64.decode4to3( buffer ) );
+ position = 0;
+ } // end if: enough to output
+ } // end if: meaningful base64 character
+ else if (DECODABET[theByte & 0x7f] != WHITE_SPACE_ENC) {
+ throw new java.io.IOException(
+ "Invalid character in Base64 data.");
+ } // end else: not white space either
+ } // end else: decoding
+ } // end write
+
+ /**
+ * Calls {@link #write(int)} repeatedly until len bytes are
+ * written.
+ *
+ * @param theBytes
+ * array from which to read bytes
+ * @param off
+ * offset for array
+ * @param len
+ * max number of bytes to read into array
+ * @since 1.3
+ */
+ public void write(byte[] theBytes, int off, int len)
+ throws java.io.IOException {
+ // Encoding suspended?
+ if (suspendEncoding) {
+ super.out.write(theBytes, off, len);
+ return;
+ } // end if: supsended
+
+ for (int i = 0; i < len; i++) {
+ write(theBytes[off + i]);
+ } // end for: each byte written
+
+ } // end write
+
+ /**
+ * Method added by PHIL. [Thanks, PHIL. -Rob] This pads the buffer
+ * without closing the stream.
+ */
+ public void flushBase64() throws java.io.IOException {
+ if (position > 0) {
+ if (encode) {
+ out.write(encode3to4(b4, buffer, position));
+ position = 0;
+ } // end if: encoding
+ else {
+ throw new java.io.IOException(
+ "Base64 input not properly padded.");
+ } // end else: decoding
+ } // end if: buffer partially full
+
+ } // end flush
+
+ /**
+ * Flushes and closes (I think, in the superclass) the stream.
+ *
+ * @since 1.3
+ */
+ public void close() throws java.io.IOException {
+ // 1. Ensure that pending characters are written
+ flushBase64();
+
+ // 2. Actually close the stream
+ // Base class both flushes and closes.
+ super.close();
+
+ buffer = null;
+ out = null;
+ } // end close
+
+ /**
+ * Suspends encoding of the stream. May be helpful if you need to embed
+ * a piece of base640-encoded data in a stream.
+ *
+ * @since 1.5.1
+ */
+ public void suspendEncoding() throws java.io.IOException {
+ flushBase64();
+ this.suspendEncoding = true;
+ } // end suspendEncoding
+
+ /**
+ * Resumes encoding of the stream. May be helpful if you need to embed a
+ * piece of base640-encoded data in a stream.
+ *
+ * @since 1.5.1
+ */
+ public void resumeEncoding() {
+ this.suspendEncoding = false;
+ } // end resumeEncoding
+
+ } // end inner class OutputStream
+
+} // end class Base64
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/BreakpointResponseData.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/BreakpointResponseData.java
index a316b5b..b0f3444 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/BreakpointResponseData.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/BreakpointResponseData.java
@@ -2,17 +2,18 @@ package net.sourceforge.phpeclipse.xdebug.core;
public class BreakpointResponseData extends ResponseData {
- private int BreakpointID=-1;
+ private int BreakpointID = -1;
- BreakpointResponseData(int transactionID,int breakpointID) {
+ BreakpointResponseData(int transactionID, int breakpointID) {
super(transactionID);
- BreakpointID=breakpointID;
+ BreakpointID = breakpointID;
}
-// public BreakpointResponseData(ResponseData data,int breakpointID) {
-// setTransactionID(data.getTransactionID());
-// BreakpointID=breakpointID;
-// }
-
+
+ // public BreakpointResponseData(ResponseData data,int breakpointID) {
+ // setTransactionID(data.getTransactionID());
+ // BreakpointID=breakpointID;
+ // }
+
public int getBreakpointID() {
return BreakpointID;
}
@@ -20,5 +21,5 @@ public class BreakpointResponseData extends ResponseData {
public void setBreakpointID(int breakpointID) {
BreakpointID = breakpointID;
}
-
+
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/DebugConnection.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/DebugConnection.java
index 64c8550..e28b56b 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/DebugConnection.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/DebugConnection.java
@@ -9,17 +9,13 @@ import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-
import net.sourceforge.phpeclipse.xdebug.php.model.XDebugLineBreakpoint;
import net.sourceforge.phpeclipse.xdebug.php.model.XDebugTarget;
-import net.sourceforge.phpeclipse.xdebug.php.model.XDebugThread;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -29,51 +25,68 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IThread;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
public class DebugConnection {
-
+
private ServerSocket fDebugServerSocket;
+
private DebugResponse lastResponse;
+
private Socket fDebugSocket;
+
private OutputStreamWriter fDebugWriter;
+
private DataInputStream fDebugReader;
+
private ResponseListenerJob fResponseListener;
-
+
// Settings for Debug Process
- private int fTransactionID=0;
+ private int fTransactionID = 0;
+
private String fileuri = "";
- private String appID="";
+
+ private String appID = "";
+
private String lastCommand = "";
+
private XDebugTarget fDebugTarget;
+
private HashMap ResponseList;
public class DebugResponse {
private Node parentNode;
- private int fTransactionID=-1;
- private String fCommand="";
+
+ private int fTransactionID = -1;
+
+ private String fCommand = "";
+
private String fStatus;
+
private String fReason;
+
private String fName;
- private boolean fError;
- public synchronized void setParentNode (String xmlInput){
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder=null;
- Document doc=null;
+ private boolean fError;
+
+ public synchronized void setParentNode(String xmlInput) {
+ DocumentBuilderFactory factory = DocumentBuilderFactory
+ .newInstance();
+ DocumentBuilder builder = null;
+ Document doc = null;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- ByteArrayInputStream InputXMLStream = new ByteArrayInputStream(xmlInput.getBytes());
-
+ ByteArrayInputStream InputXMLStream = new ByteArrayInputStream(
+ xmlInput.getBytes());
+
try {
doc = builder.parse(InputXMLStream);
} catch (SAXException e) {
@@ -83,49 +96,49 @@ public class DebugConnection {
// TODO Auto-generated catch block
e.printStackTrace();
}
- parentNode=doc.getFirstChild();
- fName=parentNode.getNodeName();
+ parentNode = doc.getFirstChild();
+ fName = parentNode.getNodeName();
String idStr = getAttributeValue("transaction_id");
- if (idStr!="")
+ if (idStr != "")
fTransactionID = Integer.parseInt(idStr);
fCommand = getAttributeValue("command");
fStatus = getAttributeValue("status");
fReason = getAttributeValue("reason");
-// notifyAll();
+ // notifyAll();
}
-
- public String getAttributeValue (String AttributeName) {
+
+ public String getAttributeValue(String AttributeName) {
String strValue = "";
if (parentNode.hasAttributes()) {
NamedNodeMap listAttribute = parentNode.getAttributes();
Node attribute = listAttribute.getNamedItem(AttributeName);
- if (attribute !=null)
+ if (attribute != null)
strValue = attribute.getNodeValue();
}
return strValue;
}
-
- public synchronized Node getParentNode(){
+
+ public synchronized Node getParentNode() {
return parentNode;
}
-
+
public synchronized String getCommand() {
return fCommand;
}
+
public synchronized String getName() {
return fName;
}
-
-
- DebugResponse () {
+
+ DebugResponse() {
fTransactionID = -1;
fCommand = "";
fStatus = "";
- fReason = "";
- fName= "";
+ fReason = "";
+ fName = "";
}
-
- DebugResponse (String XMLInput) {
+
+ DebugResponse(String XMLInput) {
setParentNode(XMLInput);
}
@@ -140,56 +153,53 @@ public class DebugConnection {
public synchronized int getTransactionID() {
return fTransactionID;
}
-
+
private synchronized DebugResponse waitforTransactionID(int id) {
- while (fTransactionID!= id) {
+ while (fTransactionID != id) {
try {
wait();
} catch (InterruptedException e) {
}
}
-// XDebugCorePlugin.log(IStatus.INFO,"got TransID: "+id);
+ // XDebugCorePlugin.log(IStatus.INFO,"got TransID: "+id);
return this;
}
- public boolean isError() {
+ public boolean isError() {
return fError;
}
public void setError(boolean error) {
fError = error;
}
-
+
protected synchronized void notifyWait() {
notifyAll();
}
}
-
-
+
/**
- * Listens to events from the XDebug and fires corresponding
- * debug events.
+ * Listens to events from the XDebug and fires corresponding debug events.
*/
class ResponseListenerJob extends Job {
-
+
public ResponseListenerJob() {
super("XDebug Event Dispatch");
setSystem(true);
-
+
}
-
-
-
-
+
private void checkResponse(DebugResponse response) {
- Node node=response.getParentNode();
+ Node node = response.getParentNode();
if (node.hasChildNodes()) {
- Node child=node.getFirstChild();
+ Node child = node.getFirstChild();
if (child.getNodeName().equals("error")) {
- int code = Integer.parseInt(PHPDebugUtils.getAttributeValue(child, "code"));
- String text=(child.getFirstChild()).getNodeValue();
- XDebugCorePlugin.log(IStatus.ERROR,lastCommand+" ERROR "+code+": "+text);
+ int code = Integer.parseInt(PHPDebugUtils
+ .getAttributeValue(child, "code"));
+ String text = (child.getFirstChild()).getNodeValue();
+ XDebugCorePlugin.log(IStatus.ERROR, lastCommand + " ERROR "
+ + code + ": " + text);
lastResponse.setError(true);
return;
}
@@ -197,11 +207,12 @@ public class DebugConnection {
lastResponse.setError(false);
if (response.getStatus().equals("stopped"))
terminated();
- else if (response.getStatus().equals("break") && response.getReason().equals("ok")){
- if (response.getCommand().equals("run")) { // breakpoint hit
- int id=-1;
+ else if (response.getStatus().equals("break")
+ && response.getReason().equals("ok")) {
+ if (response.getCommand().equals("run")) { // breakpoint hit
+ int id = -1;
try {
- id=sendRequest("stack_get");
+ id = sendRequest("stack_get");
} catch (DebugException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -210,31 +221,38 @@ public class DebugConnection {
if (InputXML != null) {
XDebugCorePlugin.log(IStatus.INFO, InputXML);
lastResponse.setParentNode(InputXML);
- fDebugTarget.breakpointHit(lastResponse.getParentNode());
+ fDebugTarget
+ .breakpointHit(lastResponse.getParentNode());
}
-
+
} else if (response.getCommand().equals("step_into")) { // step_into
fDebugTarget.suspended(DebugEvent.STEP_END);
-// XDebugCorePlugin.log(IStatus.INFO,response.getCommand()+" STEP_END sent");
+ // XDebugCorePlugin.log(IStatus.INFO,response.getCommand()+"
+ // STEP_END sent");
} else if (response.getCommand().equals("step_over")) { // step_over
fDebugTarget.suspended(DebugEvent.STEP_END);
-// XDebugCorePlugin.log(IStatus.INFO,response.getCommand()+" STEP_END sent");
+ // XDebugCorePlugin.log(IStatus.INFO,response.getCommand()+"
+ // STEP_END sent");
} else if (response.getCommand().equals("step_out")) { // step_over
fDebugTarget.suspended(DebugEvent.STEP_END);
-// XDebugCorePlugin.log(IStatus.INFO,response.getCommand()+" STEP_END sent");
- }
+ // XDebugCorePlugin.log(IStatus.INFO,response.getCommand()+"
+ // STEP_END sent");
+ }
} else if (response.getCommand().equals("breakpoint_set")) { // step_over
- String idStr=response.getAttributeValue("id");
- if (idStr!="") {
- int targetID=response.getTransactionID();
- BreakpointResponseData ResponseData= new BreakpointResponseData(response.getTransactionID(),Integer.parseInt(idStr));
+ String idStr = response.getAttributeValue("id");
+ if (idStr != "") {
+ int targetID = response.getTransactionID();
+ BreakpointResponseData ResponseData = new BreakpointResponseData(
+ response.getTransactionID(), Integer
+ .parseInt(idStr));
fDebugTarget.fireDebugResponseEvent(ResponseData);
- IBreakpoint[] breakpoints=XDebugCorePlugin.getBreakpoints();
- for(int i=0;i< breakpoints.length;i++) {
- XDebugLineBreakpoint breakpoint=(XDebugLineBreakpoint)breakpoints[i];
+ IBreakpoint[] breakpoints = XDebugCorePlugin
+ .getBreakpoints();
+ for (int i = 0; i < breakpoints.length; i++) {
+ XDebugLineBreakpoint breakpoint = (XDebugLineBreakpoint) breakpoints[i];
try {
- if (breakpoint.getID()==targetID)
+ if (breakpoint.getID() == targetID)
breakpoint.setID(Integer.parseInt(idStr));
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
@@ -246,10 +264,12 @@ public class DebugConnection {
}
}
}
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
protected IStatus run(IProgressMonitor monitor) {
@@ -260,49 +280,53 @@ public class DebugConnection {
XDebugCorePlugin.log(IStatus.INFO, InputXML);
lastResponse.setParentNode(InputXML);
if (lastResponse.getName() == "init") {
- Node myNode=lastResponse.getParentNode();
- appID = PHPDebugUtils.getAttributeValue(myNode, "appid");
- fileuri = PHPDebugUtils.getAttributeValue(myNode, "fileuri");
-// fDebugTarget.started();
+ Node myNode = lastResponse.getParentNode();
+ appID = PHPDebugUtils
+ .getAttributeValue(myNode, "appid");
+ fileuri = PHPDebugUtils.getAttributeValue(myNode,
+ "fileuri");
+ // fDebugTarget.started();
fDebugTarget.fireCreationEvent();
} else if (lastResponse.getName() == "response") {
checkResponse(lastResponse);
}
- ResponseList.put(new Integer(lastResponse.getTransactionID()),lastResponse);
+ ResponseList.put(new Integer(lastResponse
+ .getTransactionID()), lastResponse);
lastResponse.notifyWait();
}
}
return Status.OK_STATUS;
}
-
+
}
-
- public DebugConnection (XDebugTarget debugTarget,int debugPort) {
- fDebugTarget=debugTarget;
- lastResponse=new DebugResponse();
- ResponseList= new HashMap();
-
+ public DebugConnection(XDebugTarget debugTarget, int debugPort) {
+ fDebugTarget = debugTarget;
+ lastResponse = new DebugResponse();
+ ResponseList = new HashMap();
+
try {
fDebugServerSocket = new ServerSocket(debugPort);
fDebugSocket = fDebugServerSocket.accept();
- fDebugWriter = new OutputStreamWriter(fDebugSocket.getOutputStream(), "UTF8");
- fDebugReader = new DataInputStream(fDebugSocket.getInputStream());
-// fDebugReader = new BufferedReader(new InputStreamReader(fDebugSocket.getInputStream()));
-
+ fDebugWriter = new OutputStreamWriter(fDebugSocket
+ .getOutputStream(), "UTF8");
+ fDebugReader = new DataInputStream(fDebugSocket.getInputStream());
+ // fDebugReader = new BufferedReader(new
+ // InputStreamReader(fDebugSocket.getInputStream()));
+
} catch (UnknownHostException e) {
-// abort("Unable to connect to PHP Debuger", e);
+ // abort("Unable to connect to PHP Debuger", e);
} catch (IOException e) {
-// abort("Unable to connect to PHP Debuger", e);
+ // abort("Unable to connect to PHP Debuger", e);
}
fResponseListener = new ResponseListenerJob();
fResponseListener.schedule();
}
-
+
private void terminated() {
try {
- fDebugReader.close();
+ fDebugReader.close();
fDebugWriter.close();
fDebugSocket.close();
fDebugServerSocket.close();
@@ -313,96 +337,95 @@ public class DebugConnection {
fDebugTarget.terminated();
}
-
- private String readData()
- {
- byte byteBuffer[]=null,b;
- int count=0;
-
+
+ private String readData() {
+ byte byteBuffer[] = null, b;
+ int count = 0;
+
try {
- while ( (b =fDebugReader.readByte())!=0)
- {
- count=count*10+b-'0';
-// count=count*10+Integer.parseInt(b);
+ while ((b = fDebugReader.readByte()) != 0) {
+ count = count * 10 + b - '0';
+ // count=count*10+Integer.parseInt(b);
}
-// System.out.println(count);
+ // System.out.println(count);
byteBuffer = new byte[count];
- int readCount=0;
- int attempts=0;
- while ((count >0) && (attempts <5)) {
- int rc=fDebugReader.read(byteBuffer,readCount,count);
- count-=rc;
- readCount+=rc;
+ int readCount = 0;
+ int attempts = 0;
+ while ((count > 0) && (attempts < 5)) {
+ int rc = fDebugReader.read(byteBuffer, readCount, count);
+ count -= rc;
+ readCount += rc;
attempts++;
}
- if((b= fDebugReader.readByte())!=0) // reads the NULL Byte at the end;
- System.out.println("NULL-Byte missing!!");
+ if ((b = fDebugReader.readByte()) != 0) // reads the NULL Byte at
+ // the end;
+ System.out.println("NULL-Byte missing!!");
} catch (IOException e) {
// TODO Auto-generated catch block
- if (e instanceof EOFException==false)
+ if (e instanceof EOFException == false)
e.printStackTrace();
return null;
}
return new String(byteBuffer);
}
-
/**
* Sends a request to the Debugengine and waits for an OK.
*
- * @param command debug command
- * @throws DebugException if the request fails
+ * @param command
+ * debug command
+ * @throws DebugException
+ * if the request fails
*/
-
-
- public int sendRequest(String command) throws DebugException {
- return sendRequest(command,"");
+
+ public int sendRequest(String command) throws DebugException {
+ return sendRequest(command, "");
}
-
+
/**
* Sends a request to the Debugengine and waits for an OK.
*
- * @param command debug command
+ * @param command
+ * debug command
* @arguments arguments for the command
- * @throws DebugException if the request fails
+ * @throws DebugException
+ * if the request fails
*/
-
- public synchronized int sendRequest(String command, String arguments) throws DebugException {
-
-// System.out.println(command+" -i "+transactionID+" "+arguments);
- XDebugCorePlugin.log(IStatus.INFO,command+" -i "+fTransactionID+" "+arguments);
+
+ public synchronized int sendRequest(String command, String arguments)
+ throws DebugException {
+
+ // System.out.println(command+" -i "+transactionID+" "+arguments);
+ XDebugCorePlugin.log(IStatus.INFO, command + " -i " + fTransactionID
+ + " " + arguments);
synchronized (fDebugSocket) {
try {
fDebugWriter.write(command);
fDebugWriter.write(" -i " + fTransactionID);
- if (arguments!="")
+ if (arguments != "")
fDebugWriter.write(" " + arguments);
fDebugWriter.write(0);
fDebugWriter.flush();
} catch (IOException e) {
e.printStackTrace();
- }
+ }
}
return fTransactionID++;
}
-
+
public DebugResponse waitforTransID(int id) {
- if (ResponseList.containsKey(new Integer(id)))
- {
-// return (DebugResponse)ResponseList.get(new Integer(id));
- return (DebugResponse)ResponseList.remove(new Integer(id));
- }
- else
+ if (ResponseList.containsKey(new Integer(id))) {
+ // return (DebugResponse)ResponseList.get(new Integer(id));
+ return (DebugResponse) ResponseList.remove(new Integer(id));
+ } else
return lastResponse.waitforTransactionID(id);
}
-
+
public DebugResponse getResponse(int id) {
if (ResponseList.containsKey(new Integer(id)))
- return (DebugResponse)ResponseList.get(new Integer(id));
+ return (DebugResponse) ResponseList.get(new Integer(id));
else
return waitforTransID(id);
}
-
-
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/IXDebugPreferenceConstants.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/IXDebugPreferenceConstants.java
index 51486ae..0662af4 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/IXDebugPreferenceConstants.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/IXDebugPreferenceConstants.java
@@ -2,6 +2,8 @@ package net.sourceforge.phpeclipse.xdebug.core;
public interface IXDebugPreferenceConstants {
public static final String DEBUGPORT_PREFERENCE = "debugport";
+
public static final int DEFAULT_DEBUGPORT = 9000;
+
public static final String PHP_INTERPRETER_PREFERENCE = "phpInterpreter";
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/PHPDebugUtils.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/PHPDebugUtils.java
index 8b377a7..8bdba0b 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/PHPDebugUtils.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/PHPDebugUtils.java
@@ -7,51 +7,52 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
public class PHPDebugUtils {
- public static String getAttributeValue (Node CurrentNode, String AttributeName) {
+ public static String getAttributeValue(Node CurrentNode,
+ String AttributeName) {
String strValue = "";
if (CurrentNode.hasAttributes()) {
NamedNodeMap listAttribute = CurrentNode.getAttributes();
Node attribute = listAttribute.getNamedItem(AttributeName);
- if (attribute !=null)
+ if (attribute != null)
strValue = attribute.getNodeValue();
}
return strValue;
}
-
+
public static String escapeString(String string) {
- StringBuffer escString=new StringBuffer();
- Pattern pattern = Pattern.compile("[a-zA-Z0-9\\._-]");
- Matcher matcher;
- for (int i= 0; i2)
- string.append(s[i].substring(2));
-
+ for (int i = 1; i < s.length; i++) {
+ int c = Integer.parseInt(s[i].substring(0, 2), 16);
+ string.append((char) c);
+ if (s[i].length() > 2)
+ string.append(s[i].substring(2));
+
}
return string.toString();
}
-
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/ResponseData.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/ResponseData.java
index b01ebf4..58e4b9b 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/ResponseData.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/ResponseData.java
@@ -2,11 +2,12 @@ package net.sourceforge.phpeclipse.xdebug.core;
public class ResponseData {
- private int fTransactionID =-1;
+ private int fTransactionID = -1;
- ResponseData(int transactionID){
- fTransactionID=transactionID;
+ ResponseData(int transactionID) {
+ fTransactionID = transactionID;
}
+
public int getTransactionID() {
return fTransactionID;
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugCorePlugin.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugCorePlugin.java
index 716b582..a7ffee0 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugCorePlugin.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/core/XDebugCorePlugin.java
@@ -1,9 +1,7 @@
package net.sourceforge.phpeclipse.xdebug.core;
-
import net.sourceforge.phpeclipse.xdebug.php.launching.IXDebugConstants;
-import org.eclipse.ui.plugin.*;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
@@ -12,6 +10,7 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
@@ -19,11 +18,11 @@ import org.osgi.framework.BundleContext;
*/
public class XDebugCorePlugin extends AbstractUIPlugin {
- //The shared instance.
+ // The shared instance.
private static XDebugCorePlugin plugin;
+
public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.xdebug.core"; //$NON-NLS-1$
-
/**
* The constructor.
*/
@@ -52,29 +51,33 @@ public class XDebugCorePlugin extends AbstractUIPlugin {
public static XDebugCorePlugin getDefault() {
return plugin;
}
-
+
public static IBreakpoint[] getBreakpoints() {
- return getBreakpointManager().getBreakpoints(IXDebugConstants.ID_PHP_DEBUG_MODEL);
+ return getBreakpointManager().getBreakpoints(
+ IXDebugConstants.ID_PHP_DEBUG_MODEL);
}
-
+
public static IBreakpointManager getBreakpointManager() {
return DebugPlugin.getDefault().getBreakpointManager();
}
/**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path.
- *
- * @param path the path
+ * Returns an image descriptor for the image file at the given plug-in
+ * relative path.
+ *
+ * @param path
+ * the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin("net.sourceforge.phpeclipse.xdebug.core", path);
+ return AbstractUIPlugin.imageDescriptorFromPlugin(
+ "net.sourceforge.phpeclipse.xdebug.core", path);
}
-
+
public static void log(int severity, String message) {
- Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null) ;
- XDebugCorePlugin.log(status) ;
+ Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message,
+ null);
+ XDebugCorePlugin.log(status);
}
public static void log(IStatus status) {
@@ -82,15 +85,15 @@ public class XDebugCorePlugin 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$
}
-
- /**
- * Returns the workspace instance.
- */
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
-
+
+ /**
+ * Returns the workspace instance.
+ */
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/IXDebugConstants.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/IXDebugConstants.java
index 81007f3..9dc1bac 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/IXDebugConstants.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/IXDebugConstants.java
@@ -4,34 +4,37 @@ package net.sourceforge.phpeclipse.xdebug.php.launching;
* Constants for the PDA debugger.
*/
public interface IXDebugConstants {
-
+
/**
- * Unique identifier for the PHP debug model (value
+ * Unique identifier for the PHP debug model (value
* et.sourceforge.phpeclipse.debug.).
*/
public static final String ID_PHP_DEBUG_MODEL = "net.sourceforge.phpeclipse.xdebug.php";
-
+
/**
- * Launch configuration key. Value is a PHPProject name
- * program. The path is a string representing a full path
- * to a perl program in the workspace.
+ * Launch configuration key. Value is a PHPProject name program. The path is
+ * a string representing a full path to a perl program in the workspace.
*/
- public static final String ATTR_PHP_PROJECT = ID_PHP_DEBUG_MODEL + ".ATTR_PDA_PROFECT";
+ public static final String ATTR_PHP_PROJECT = ID_PHP_DEBUG_MODEL
+ + ".ATTR_PDA_PROFECT";
+
/**
- * Launch configuration key. Value is a php program.
- * The path is a string representing a relative path
- * to a php program in the project.
+ * Launch configuration key. Value is a php program. The path is a string
+ * representing a relative path to a php program in the project.
*/
- public static final String ATTR_PHP_FILE = ID_PHP_DEBUG_MODEL + ".ATTR_PDA_FILE";
+ public static final String ATTR_PHP_FILE = ID_PHP_DEBUG_MODEL
+ + ".ATTR_PDA_FILE";
- public static final String ATTR_PHP_DEFAULT_INTERPRETER = ID_PHP_DEBUG_MODEL + ".ATTR_PHP_DEFAULT_INTERPRETER";
+ public static final String ATTR_PHP_DEFAULT_INTERPRETER = ID_PHP_DEBUG_MODEL
+ + ".ATTR_PHP_DEFAULT_INTERPRETER";
- public static final String ATTR_PHP_INTERPRETER = ID_PHP_DEBUG_MODEL + ".ATTR_PHP_INTERPRETER";
+ public static final String ATTR_PHP_INTERPRETER = ID_PHP_DEBUG_MODEL
+ + ".ATTR_PHP_INTERPRETER";
- public static final String ATTR_PHP_DEFAULT_DEBUGPORT = ID_PHP_DEBUG_MODEL + ".ATTR_PHP_DEFAULT_DEBUGPORT";
-
- public static final String ATTR_PHP_DEBUGPORT = ID_PHP_DEBUG_MODEL + ".ATTR_PHP_DEBUGPORT";
+ public static final String ATTR_PHP_DEFAULT_DEBUGPORT = ID_PHP_DEBUG_MODEL
+ + ".ATTR_PHP_DEFAULT_DEBUGPORT";
+ public static final String ATTR_PHP_DEBUGPORT = ID_PHP_DEBUG_MODEL
+ + ".ATTR_PHP_DEBUGPORT";
}
-
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java
index 6117961..5880ca0 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/launching/PHPLaunchConfigurationDelegate.java
@@ -38,93 +38,118 @@ import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
-
public class PHPLaunchConfigurationDelegate extends LaunchConfigurationDelegate {
-
+
/**
- * @see ILaunchConfigurationDelegate#launch(ILaunchConfiguration, String, ILaunch, IProgressMonitor)
+ * @see ILaunchConfigurationDelegate#launch(ILaunchConfiguration, String,
+ * ILaunch, 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 {
List commandList = new ArrayList();
-
- String phpInterpreter = configuration.getAttribute(IXDebugConstants.ATTR_PHP_INTERPRETER, (String)null);
- boolean useDefaultInterpreter= configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEFAULT_INTERPRETER, true);
- if (useDefaultInterpreter)
- phpInterpreter=XDebugCorePlugin.getDefault().getPreferenceStore().getString(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE);
+ String phpInterpreter = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_INTERPRETER, (String) null);
+ boolean useDefaultInterpreter = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_DEFAULT_INTERPRETER, true);
+
+ if (useDefaultInterpreter)
+ phpInterpreter = XDebugCorePlugin
+ .getDefault()
+ .getPreferenceStore()
+ .getString(
+ IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE);
File exe = new File(phpInterpreter);
// Just to get sure that the interpreter exists
if (!exe.exists()) {
- abort(MessageFormat.format("Specified PHP executable {0} does not exist. Check value of PHP-Interpreter.", new String[]{phpInterpreter}), null);
+ abort(
+ MessageFormat
+ .format(
+ "Specified PHP executable {0} does not exist. Check value of PHP-Interpreter.",
+ new String[] { phpInterpreter }), null);
}
commandList.add(phpInterpreter);
-
+
// Project name
- String projectName = configuration.getAttribute(IXDebugConstants.ATTR_PHP_PROJECT, (String)null);
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
-// Just to get sure that the project exists
+ String projectName = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_PROJECT, (String) null);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ // Just to get sure that the project exists
if (project == null) {
abort("Project does not exist.", null);
}
- String fileName = configuration.getAttribute(IXDebugConstants.ATTR_PHP_FILE, (String)null);
+ String fileName = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_FILE, (String) null);
IFile file = project.getFile(fileName);
// Just to get sure that the script exists
if (!file.exists()) {
- abort(MessageFormat.format("PHP-Script {0} does not exist.", new String[] {file.getFullPath().toString()}), null);
+ abort(MessageFormat.format("PHP-Script {0} does not exist.",
+ new String[] { file.getFullPath().toString() }), null);
}
-
+
commandList.add(file.getLocation().toOSString());
// Get de Debugport form the Launchconfiguration or from the preferences
- int debugPort = configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEBUGPORT,-1);
- boolean useDefaultPort= configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEFAULT_DEBUGPORT, true);
+ int debugPort = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_DEBUGPORT, -1);
+ boolean useDefaultPort = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_DEFAULT_DEBUGPORT, true);
if (useDefaultPort)
- debugPort=XDebugCorePlugin.getDefault().getPreferenceStore().getInt(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE);
- if (debugPort<1024)
- debugPort=IXDebugPreferenceConstants.DEFAULT_DEBUGPORT;
+ debugPort = XDebugCorePlugin.getDefault().getPreferenceStore()
+ .getInt(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE);
+ if (debugPort < 1024)
+ debugPort = IXDebugPreferenceConstants.DEFAULT_DEBUGPORT;
- String[] envp=DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);
+ String[] envp = DebugPlugin.getDefault().getLaunchManager()
+ .getEnvironment(configuration);
// appends the environment to the native environment
- if (envp==null) {
- Map stringVars = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment();
- int idx=0;
- envp= new String[stringVars.size()];
+ if (envp == null) {
+ Map stringVars = DebugPlugin.getDefault().getLaunchManager()
+ .getNativeEnvironment();
+ int idx = 0;
+ envp = new String[stringVars.size()];
for (Iterator i = stringVars.keySet().iterator(); i.hasNext();) {
String key = (String) i.next();
String value = (String) stringVars.get(key);
- envp[idx++]=key+"="+value;
+ envp[idx++] = key + "=" + value;
}
}
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- String[] env = new String[envp.length+1];
- for(int i=0;i0);
+ return (fVariables.length > 0);
}
-
+
public boolean isArray() {
return ((fType & VALUETYPE_ARRAY) > 0);
}
-
+
public abstract void setType(String typeName);
+
public abstract void renderValueString(String data);
public abstract boolean verifyValue(String expression);
-
+
public boolean setValue(String expression) {
if (!verifyValue(expression))
return false;
- if(fTarget.setVarValue(fVariable.getFullName(),expression)) {
+ if (fTarget.setVarValue(fVariable.getFullName(), expression)) {
renderValueString(expression);
return true;
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugArrayValue.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugArrayValue.java
index dd01675..e7075f8 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugArrayValue.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugArrayValue.java
@@ -10,13 +10,13 @@ public class XDebugArrayValue extends XDebugAbstractValue {
}
public void setType(String typeName) {
- fType=XDebugAbstractValue.VALUETYPE_ARRAY;
- fTypeName=typeName;
+ fType = XDebugAbstractValue.VALUETYPE_ARRAY;
+ fTypeName = typeName;
}
public void renderValueString(String data) {
- fValueString= data +" element(s)";
+ fValueString = data + " element(s)";
}
public boolean verifyValue(String expression) {
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugBooleanValue.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugBooleanValue.java
index 6216046..678a955 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugBooleanValue.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugBooleanValue.java
@@ -14,40 +14,41 @@ public class XDebugBooleanValue extends XDebugAbstractValue {
}
public void setType(String typeName) {
- fType=XDebugAbstractValue.VALUETYPE_BOOLEAN;
- fTypeName=typeName; }
+ fType = XDebugAbstractValue.VALUETYPE_BOOLEAN;
+ fTypeName = typeName;
+ }
public void renderValueString(String data) {
- int value=-1;
+ int value = -1;
try {
- value=Integer.parseInt(data);
+ value = Integer.parseInt(data);
} catch (NumberFormatException e) {
- data=data.toLowerCase();
+ data = data.toLowerCase();
if (data.equals("true") || data.equals("false"))
- fValueString=data;
+ fValueString = data;
else
- fValueString="not defined";
+ fValueString = "not defined";
}
- if (value==0)
- fValueString="false";
- else if (value==1)
- fValueString="true";
+ if (value == 0)
+ fValueString = "false";
+ else if (value == 1)
+ fValueString = "true";
else
- fValueString="not defined";
+ fValueString = "not defined";
}
public boolean verifyValue(String expression) {
- int value=-1;
+ int value = -1;
try {
- value=Integer.parseInt(expression);
+ value = Integer.parseInt(expression);
} catch (NumberFormatException e) {
- expression=expression.toLowerCase();
+ expression = expression.toLowerCase();
if (expression.equals("true") || expression.equals("false"))
return true;
else
return false;
}
- if ((value>=0)&& (value <=1))
+ if ((value >= 0) && (value <= 1))
return true;
return false;
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugElement.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugElement.java
index fcfd8af..7242bd4 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugElement.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugElement.java
@@ -3,7 +3,6 @@
*/
package net.sourceforge.phpeclipse.xdebug.php.model;
-
import net.sourceforge.phpeclipse.xdebug.core.ResponseData;
import net.sourceforge.phpeclipse.xdebug.php.launching.IXDebugConstants;
@@ -17,42 +16,53 @@ import org.eclipse.debug.core.model.IDebugTarget;
/**
* @author Christian
- *
+ *
*/
public class XDebugElement extends PlatformObject implements IDebugElement {
-
- // containing target
+
+ // containing target
protected XDebugTarget fTarget;
-
+
/**
- * Constructs a new debug element contained in the given
- * debug target.
+ * Constructs a new debug element contained in the given debug target.
*
- * @param target debug target (PDA VM)
+ * @param target
+ * debug target (PDA VM)
*/
public XDebugElement(XDebugTarget target) {
fTarget = target;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
*/
public String getModelIdentifier() {
return IXDebugConstants.ID_PHP_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) {
@@ -61,59 +71,64 @@ public class XDebugElement extends PlatformObject implements IDebugElement {
}
return super.getAdapter(adapter);
}
-
+
protected void abort(String message, Throwable e) throws DebugException {
-/* Axel auskommentiert
- throw new DebugException(new Status(IStatus.ERROR, DebugExamplesPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
- DebugPlugin.INTERNAL_ERROR, message, e));
-*/
- }
-
+ /*
+ * Axel auskommentiert throw new DebugException(new
+ * Status(IStatus.ERROR,
+ * 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 });
}
-
+
/**
* Fires a CREATE event for this element.
*/
public void fireCreationEvent() {
fireEvent(new DebugEvent(this, DebugEvent.CREATE));
- }
-
+ }
+
/**
- * Fires a RESUME event for this element with
- * the given detail.
+ * Fires a RESUME event for this element with the given
+ * detail.
*
- * @param detail event detail code
+ * @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.
+ * Fires a SUSPEND event for this element with the given
+ * detail.
*
- * @param detail event detail code
+ * @param detail
+ * event detail code
*/
public void fireSuspendEvent(int detail) {
fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail));
}
-
+
/**
* Fires a TERMINATE event for this element.
*/
protected void fireTerminateEvent() {
fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
}
-
+
public void fireDebugResponseEvent(ResponseData data) {
- DebugEvent de=new DebugEvent(this, DebugEvent.MODEL_SPECIFIC);
+ DebugEvent de = new DebugEvent(this, DebugEvent.MODEL_SPECIFIC);
de.setData(data);
fireEvent(de);
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugFloatValue.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugFloatValue.java
index 5d2d4ee..03a6439 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugFloatValue.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugFloatValue.java
@@ -4,23 +4,23 @@ import org.w3c.dom.Node;
public class XDebugFloatValue extends XDebugAbstractValue {
- public XDebugFloatValue(XDebugVariable variable, Node varNode,String TypeName) {
- super(variable, varNode,TypeName);
-
+ public XDebugFloatValue(XDebugVariable variable, Node varNode,
+ String TypeName) {
+ super(variable, varNode, TypeName);
+
}
public boolean supportsValueModification() {
return true;
}
-
public void setType(String typeName) {
- fType=XDebugAbstractValue.VALUETYPE_FLOAT;
- fTypeName=typeName;
+ fType = XDebugAbstractValue.VALUETYPE_FLOAT;
+ fTypeName = typeName;
}
public void renderValueString(String data) {
- fValueString=data;
+ fValueString = data;
}
public boolean verifyValue(String expression) {
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugIntValue.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugIntValue.java
index b7e0418..9002c3e 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugIntValue.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugIntValue.java
@@ -4,25 +4,24 @@ import org.w3c.dom.Node;
public class XDebugIntValue extends XDebugAbstractValue {
- public XDebugIntValue(XDebugVariable variable, Node varNode,String TypeName) {
- super(variable, varNode,TypeName);
-
+ public XDebugIntValue(XDebugVariable variable, Node varNode, String TypeName) {
+ super(variable, varNode, TypeName);
+
}
-
+
public void setType(String typeName) {
- fType=XDebugAbstractValue.VALUETYPE_INT;
- fTypeName=typeName;
+ fType = XDebugAbstractValue.VALUETYPE_INT;
+ fTypeName = typeName;
}
-
+
public boolean supportsValueModification() {
return true;
}
-
+
public void renderValueString(String dataString) {
- fValueString=dataString;
+ fValueString = dataString;
}
-
public boolean verifyValue(String expression) {
try {
Integer.parseInt(expression);
@@ -31,7 +30,7 @@ public class XDebugIntValue extends XDebugAbstractValue {
}
return true;
}
-
+
public String toString() {
return fValueString;
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugLineBreakpoint.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugLineBreakpoint.java
index a626e8c..bdfe73d 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugLineBreakpoint.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugLineBreakpoint.java
@@ -1,4 +1,3 @@
-
/*
* Created on 25.11.2004
*
@@ -7,7 +6,6 @@
*/
package net.sourceforge.phpeclipse.xdebug.php.model;
-
import java.util.HashMap;
import java.util.Map;
@@ -22,85 +20,96 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.LineBreakpoint;
-
/**
* @author Axel
- *
- * 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 XDebugLineBreakpoint extends LineBreakpoint {
-
+public class XDebugLineBreakpoint extends LineBreakpoint {
+
/**
- * Default constructor is required for the breakpoint manager
- * to re-create persisted breakpoints. After instantiating a breakpoint,
- * the setMarker(...) method is called to restore
- * this breakpoint's attributes.
+ * Default constructor is required for the breakpoint manager to re-create
+ * persisted breakpoints. After instantiating a breakpoint, the
+ * setMarker(...) method is called to restore this
+ * breakpoint's attributes.
*/
private static final String XDEBUG_LINE_BREAKPOINT = "net.sourceforge.phpeclipse.xdebug.core.XDebugLineBreakpoint"; //$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$
-// 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 hitCount, boolean add, Map attributes) throws DebugException {
-// this(resource, lineNumber, -1, -1, hitCount, add, attributes, PHP_LINE_BREAKPOINT);
-// }
-
-
- public static final String BREAKPOINT_ID ="XDebugLineBreakpointID";
-
+ // 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
+ // hitCount, boolean add, Map attributes) throws DebugException {
+ // this(resource, lineNumber, -1, -1, hitCount, add, attributes,
+ // PHP_LINE_BREAKPOINT);
+ // }
+
+ public static final String BREAKPOINT_ID = "XDebugLineBreakpointID";
+
public XDebugLineBreakpoint() {
}
-
+
/**
- * Constructs a line breakpoint on the given resource at the given
- * line number. The line number is 1-based (i.e. the first line of a
- * file is line number 1).
+ * Constructs a line breakpoint on the given resource at the given line
+ * number. The line number is 1-based (i.e. the first line of a file is line
+ * number 1).
*
- * @param resource file on which to set the breakpoint
- * @param lineNumber 1-based line number of the breakpoint
- * @throws CoreException if unable to create the breakpoint
+ * @param resource
+ * file on which to set the breakpoint
+ * @param lineNumber
+ * 1-based line number of the breakpoint
+ * @throws CoreException
+ * if unable to create the breakpoint
*/
- public XDebugLineBreakpoint(final IResource resource, final int lineNumber) throws CoreException {
-// IMarker marker = resource.createMarker("net.sourceforge.phpeclipse.xdebug.core.XDebugLineBreakpoint");
-// setMarker(marker);
-// setEnabled(true);
-// XDebugCorePlugin.log(IStatus.INFO,"Markertype: "+ marker.getType());
-// ensureMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber);
-// ensureMarker().setAttribute(IBreakpoint.ID, IXDebugConstants.ID_PHP_DEBUG_MODEL);
-// ensureMarker().setAttribute(BREAKPOINT_ID,-1);
- IWorkspaceRunnable wr= new IWorkspaceRunnable() {
+ public XDebugLineBreakpoint(final IResource resource, final int lineNumber)
+ throws CoreException {
+ // IMarker marker =
+ // resource.createMarker("net.sourceforge.phpeclipse.xdebug.core.XDebugLineBreakpoint");
+ // setMarker(marker);
+ // setEnabled(true);
+ // XDebugCorePlugin.log(IStatus.INFO,"Markertype: "+ marker.getType());
+ // ensureMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber);
+ // ensureMarker().setAttribute(IBreakpoint.ID,
+ // IXDebugConstants.ID_PHP_DEBUG_MODEL);
+ // ensureMarker().setAttribute(BREAKPOINT_ID,-1);
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
-
+
// create the marker
setMarker(resource.createMarker(XDEBUG_LINE_BREAKPOINT));
// add attributes
Map attributes = new HashMap(10);
- addLineBreakpointAttributes(attributes, getModelIdentifier(), true, lineNumber, -1, -1);
+ addLineBreakpointAttributes(attributes, getModelIdentifier(),
+ true, lineNumber, -1, -1);
// set attributes
ensureMarker().setAttributes(attributes);
-
+
// add to breakpoint manager if requested
- register(true);
+ register(true);
}
};
run(getMarkerRule(resource), wr);
}
-
+
protected void register(boolean register) throws CoreException {
if (register) {
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(this);
@@ -108,34 +117,35 @@ public class XDebugLineBreakpoint extends LineBreakpoint {
setRegistered(false);
}
}
-
- public void addLineBreakpointAttributes(Map attributes, String modelIdentifier, boolean enabled, int lineNumber, int charStart, int charEnd) {
+
+ public void addLineBreakpointAttributes(Map attributes,
+ String modelIdentifier, boolean enabled, int lineNumber,
+ int charStart, int charEnd) {
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(BREAKPOINT_ID,new Integer(-1));
- }
+ attributes.put(BREAKPOINT_ID, new Integer(-1));
+ }
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
*/
public String getModelIdentifier() {
return IXDebugConstants.ID_PHP_DEBUG_MODEL;
}
-
- public void setID(int id) throws CoreException
- {
- ensureMarker().setAttribute(BREAKPOINT_ID,id);
+
+ public void setID(int id) throws CoreException {
+ ensureMarker().setAttribute(BREAKPOINT_ID, id);
}
- public int getID() throws CoreException
- {
- return ensureMarker().getAttribute(BREAKPOINT_ID,-1);
+
+ public int getID() throws CoreException {
+ return ensureMarker().getAttribute(BREAKPOINT_ID, -1);
}
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugObjectValue.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugObjectValue.java
index 370e44d..2f3c66d 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugObjectValue.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugObjectValue.java
@@ -10,18 +10,18 @@ public class XDebugObjectValue extends XDebugAbstractValue {
}
public void setType(String typeName) {
- fType=XDebugAbstractValue.VALUETYPE_OBJECT;
- fTypeName=typeName;
+ fType = XDebugAbstractValue.VALUETYPE_OBJECT;
+ fTypeName = typeName;
}
public void renderValueString(String data) {
- fValueString= data;
+ fValueString = data;
}
-
+
public String toString() {
- return "class "+fValueString;
+ return "class " + fValueString;
}
public boolean verifyValue(String expression) {
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStackFrame.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStackFrame.java
index ece6842..575520d 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStackFrame.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStackFrame.java
@@ -6,9 +6,6 @@
*/
package net.sourceforge.phpeclipse.xdebug.php.model;
-import java.net.URI;
-import java.net.URISyntaxException;
-
import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils;
import net.sourceforge.phpeclipse.xdebug.core.DebugConnection.DebugResponse;
@@ -23,29 +20,37 @@ import org.w3c.dom.NodeList;
/**
* @author Axel
- *
- * 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 XDebugStackFrame extends XDebugElement implements IStackFrame {
-
+public class XDebugStackFrame extends XDebugElement implements IStackFrame {
+
private XDebugThread fThread;
-// private String fName;
+
+ // private String fName;
private int fLineNo;
+
private String fFileName;
+
private int fId;
+
private IVariable[] fVariables;
+
private String fLevel;
+
private String fType;
+
private String fWhere;
-
+
/**
- * Constructs a stack frame in the given thread with the given
- * frame data.
+ * Constructs a stack frame in the given thread with the given frame data.
*
* @param thread
- * @param data frame data
- * @param id stack frame id (0 is the bottom of the stack)
+ * @param data
+ * frame data
+ * @param id
+ * stack frame id (0 is the bottom of the stack)
*/
public XDebugStackFrame(XDebugThread thread, Node stackNode, int id) {
super((XDebugTarget) thread.getDebugTarget());
@@ -53,33 +58,36 @@ public class XDebugStackFrame extends XDebugElement implements IStackFrame {
fThread = thread;
init(stackNode);
}
-
+
/**
* Initializes this frame based on its data
*
* @param data
*/
private void init(Node stackNode) {
-
- fLevel=PHPDebugUtils.getAttributeValue(stackNode,"level");
- fType=PHPDebugUtils.getAttributeValue(stackNode,"type");
- String fileName=PHPDebugUtils.unescapeString(PHPDebugUtils.getAttributeValue(stackNode,"filename"));
- String lineNo=PHPDebugUtils.getAttributeValue(stackNode,"lineno");
-
- if (lineNo!="")
- fLineNo= Integer.parseInt(lineNo);
-
- fWhere=PHPDebugUtils.getAttributeValue(stackNode,"where");
-
+
+ fLevel = PHPDebugUtils.getAttributeValue(stackNode, "level");
+ fType = PHPDebugUtils.getAttributeValue(stackNode, "type");
+ String fileName = PHPDebugUtils.unescapeString(PHPDebugUtils
+ .getAttributeValue(stackNode, "filename"));
+ String lineNo = PHPDebugUtils.getAttributeValue(stackNode, "lineno");
+
+ if (lineNo != "")
+ fLineNo = Integer.parseInt(lineNo);
+
+ fWhere = PHPDebugUtils.getAttributeValue(stackNode, "where");
+
fFileName = (new Path(fileName)).lastSegment();
- int id=-1;
+ int id = -1;
try {
- id=((XDebugTarget)getDebugTarget()).sendRequest("context_get","-d "+fLevel);
+ id = ((XDebugTarget) getDebugTarget()).sendRequest("context_get",
+ "-d " + fLevel);
} catch (DebugException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- DebugResponse response=((XDebugTarget)getDebugTarget()).getResponse(id);
+ DebugResponse response = ((XDebugTarget) getDebugTarget())
+ .getResponse(id);
Node responseNode = response.getParentNode();
NodeList property = responseNode.getChildNodes();
fVariables = new IVariable[property.getLength()];
@@ -88,190 +96,265 @@ public class XDebugStackFrame extends XDebugElement implements IStackFrame {
fVariables[i] = new XDebugVariable(this, propertyNode);
}
-// int numVars = strings.length - 3;
-// fVariables = new IVariable[numVars];
-// for (int i = 0; i < numVars; i++) {
-// fVariables[i] = new XDebugVariable(this, strings[i + 3]);
-// }
+ // int numVars = strings.length - 3;
+ // fVariables = new IVariable[numVars];
+ // for (int i = 0; i < numVars; i++) {
+ // fVariables[i] = new XDebugVariable(this, strings[i + 3]);
+ // }
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getThread()
*/
public IThread getThread() {
return fThread;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getVariables()
*/
public IVariable[] getVariables() throws DebugException {
return fVariables;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#hasVariables()
*/
public boolean hasVariables() throws DebugException {
return fVariables.length > 0;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getLineNumber()
*/
public int getLineNumber() throws DebugException {
return fLineNo;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getCharStart()
*/
public int getCharStart() throws DebugException {
return -1;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getCharEnd()
*/
public int getCharEnd() throws DebugException {
return -1;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getName()
*/
public String getName() throws DebugException {
- return fFileName+"::"+fWhere+ " : lineno "+ fLineNo;
+ return fFileName + "::" + fWhere + " : lineno " + fLineNo;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups()
*/
public IRegisterGroup[] getRegisterGroups() throws DebugException {
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups()
*/
public boolean hasRegisterGroups() throws DebugException {
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#canStepInto()
*/
public boolean canStepInto() {
return getThread().canStepInto();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#canStepOver()
*/
public boolean canStepOver() {
return getThread().canStepOver();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#canStepReturn()
*/
public boolean canStepReturn() {
return getThread().canStepReturn();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#isStepping()
*/
public boolean isStepping() {
return getThread().isStepping();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#stepInto()
*/
public void stepInto() throws DebugException {
getThread().stepInto();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#stepOver()
*/
public void stepOver() throws DebugException {
getThread().stepOver();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#stepReturn()
*/
public void stepReturn() throws DebugException {
getThread().stepReturn();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#canResume()
*/
public boolean canResume() {
return getThread().canResume();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
*/
public boolean canSuspend() {
return getThread().canSuspend();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
*/
public boolean isSuspended() {
return getThread().isSuspended();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#resume()
*/
public void resume() throws DebugException {
getThread().resume();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#suspend()
*/
public void suspend() throws DebugException {
getThread().suspend();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/
public boolean canTerminate() {
return getThread().canTerminate();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#isTerminated()
*/
public boolean isTerminated() {
return getThread().isTerminated();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#terminate()
*/
public void terminate() throws DebugException {
getThread().terminate();
}
-
+
/**
- * Returns the name of the source file this stack frame is associated
- * with.
+ * Returns the name of the source file this stack frame is associated with.
*
- * @return the name of the source file this stack frame is associated
- * with
+ * @return the name of the source file this stack frame is associated with
*/
public String getSourceName() {
return fFileName;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (obj instanceof XDebugStackFrame) {
- XDebugStackFrame sf = (XDebugStackFrame)obj;
+ XDebugStackFrame sf = (XDebugStackFrame) obj;
try {
- return sf.getSourceName().equals(getSourceName()) &&
- sf.getLineNumber() == getLineNumber() &&
- sf.fId == fId;
+ return sf.getSourceName().equals(getSourceName())
+ && sf.getLineNumber() == getLineNumber()
+ && sf.fId == fId;
} catch (DebugException e) {
}
}
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return getSourceName().hashCode() + fId;
}
-
+
/**
* Returns this stack frame's unique identifier within its thread
*
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStringValue.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStringValue.java
index 388c412..b2d0231 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStringValue.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStringValue.java
@@ -5,28 +5,28 @@ import org.w3c.dom.Node;
public class XDebugStringValue extends XDebugAbstractValue {
private String fDataString;
+
public XDebugStringValue(XDebugVariable variable, Node varNode,
String typeName) {
super(variable, varNode, typeName);
- fDataString=null;
+ fDataString = null;
}
public void setType(String typeName) {
- fType=XDebugAbstractValue.VALUETYPE_STRING;
- fTypeName=typeName;
+ fType = XDebugAbstractValue.VALUETYPE_STRING;
+ fTypeName = typeName;
}
public void renderValueString(String data) {
- fDataString=data;
- fValueString="\""+data+"\"";
+ fDataString = data;
+ fValueString = "\"" + data + "\"";
}
public boolean supportsValueModification() {
return true;
}
-
public String toString() {
return fDataString;
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugTarget.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugTarget.java
index b8d3f86..04099c4 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugTarget.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugTarget.java
@@ -31,193 +31,256 @@ import org.w3c.dom.NodeList;
/**
* @author Christian
- *
+ *
*/
-public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugEventSetListener{
+public class XDebugTarget extends XDebugElement implements IDebugTarget,
+ IDebugEventSetListener {
// associated system process (VM)
private IProcess fProcess;
-
+
// containing launch object
private ILaunch fLaunch;
-
+
// debugPort
private int fDebugPort;
-
+
// program name
-// private String fName;
-
-
+ // private String fName;
+
// suspend state
private boolean fSuspended = true;
-
+
// terminated state
private boolean fTerminated = false;
-
+
// threads
private XDebugThread fThread;
+
private IThread[] fThreads;
-
+
// event dispatch job
-// private EventDispatchJob fEventDispatch;
-
+ // private EventDispatchJob fEventDispatch;
private DebugConnection fDebugConnection;
-// private DebugResponse lastResponse;
+ // private DebugResponse lastResponse;
-
/**
- * Constructs a new debug target in the given launch for the
- * associated PDA VM process.
+ * Constructs a new debug target in the given launch for the associated PDA
+ * VM process.
*
- * @param launch containing launch
- * @param debugPort port to read events from
- * @exception CoreException if unable to connect to host
- */
- public XDebugTarget(ILaunch launch, IProcess process, int debugPort) throws CoreException {
+ * @param launch
+ * containing launch
+ * @param debugPort
+ * port to read events from
+ * @exception CoreException
+ * if unable to connect to host
+ */
+ public XDebugTarget(ILaunch launch, IProcess process, int debugPort)
+ throws CoreException {
super(null);
fLaunch = launch;
fProcess = process;
fTarget = this;
- fDebugConnection= new DebugConnection(this,debugPort);
+ fDebugConnection = new DebugConnection(this, debugPort);
fThread = new XDebugThread(this);
- fThreads = new IThread[] {fThread};
- DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
+ fThreads = new IThread[] { fThread };
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(
+ this);
DebugPlugin.getDefault().addDebugEventListener(this);
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugTarget#getProcess()
*/
public IProcess getProcess() {
return fProcess;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugTarget#getThreads()
*/
public IThread[] getThreads() throws DebugException {
return fThreads;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugTarget#hasThreads()
*/
public boolean hasThreads() throws DebugException {
- return (fThreads.length>0);
+ return (fThreads.length > 0);
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugTarget#getName()
*/
public String getName() throws DebugException {
return "PHP XDebug Client at localhost:" + fDebugPort;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint)
*/
public boolean supportsBreakpoint(IBreakpoint breakpoint) {
- if (breakpoint.getModelIdentifier().equals(IXDebugConstants.ID_PHP_DEBUG_MODEL)) {
+ if (breakpoint.getModelIdentifier().equals(
+ IXDebugConstants.ID_PHP_DEBUG_MODEL)) {
return true;
}
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
*/
public IDebugTarget getDebugTarget() {
return this;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
*/
public ILaunch getLaunch() {
return fLaunch;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/
public boolean canTerminate() {
return getProcess().canTerminate();
-// return false;
+ // return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#isTerminated()
*/
public boolean isTerminated() {
-// return getProcess().isTerminated();
+ // return getProcess().isTerminated();
return fTerminated;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#terminate()
*/
public void terminate() throws DebugException {
- fDebugConnection.sendRequest ("stop");
+ fDebugConnection.sendRequest("stop");
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#canResume()
*/
public boolean canResume() {
return !isTerminated() && isSuspended();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
*/
public boolean canSuspend() {
return !isTerminated() && !isSuspended();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
*/
public boolean isSuspended() {
return fSuspended;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#resume()
*/
public void resume() throws DebugException {
fDebugConnection.sendRequest("run");
}
-
+
/**
* Notification the target has resumed for the given reason
*
- * @param detail reason for the resume
+ * @param detail
+ * reason for the resume
*/
private void resumed(int detail) {
fSuspended = false;
fThread.fireResumeEvent(detail);
}
-
+
/**
* Notification the target has suspended for the given reason
*
- * @param detail reason for the suspend
+ * @param detail
+ * reason for the suspend
*/
public void suspended(int detail) {
fSuspended = true;
fThread.fireSuspendEvent(detail);
- }
-
- /* (non-Javadoc)
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#suspend()
*/
public void suspend() throws DebugException {
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint)
*/
public void breakpointAdded(IBreakpoint breakpoint) {
-
+
if (supportsBreakpoint(breakpoint)) {
try {
if (breakpoint.isEnabled()) {
IMarker marker = breakpoint.getMarker();
if (marker != null) {
try {
- String fileName = PHPDebugUtils.escapeString(marker.getResource().getLocation().toString());
- String arg="-t line -f file:///"+fileName+" -n "+((ILineBreakpoint)breakpoint).getLineNumber();
- int id =fDebugConnection.sendRequest("breakpoint_set",arg);
- // set the marker Attribute to make later idetification possible
-// TODO: make sure that attribute is set before response from debugger is beeing prosessed
- marker.setAttribute(XDebugLineBreakpoint.BREAKPOINT_ID,id);
-
+ String fileName = PHPDebugUtils.escapeString(marker
+ .getResource().getLocation().toString());
+ String arg = "-t line -f file:///"
+ + fileName
+ + " -n "
+ + ((ILineBreakpoint) breakpoint)
+ .getLineNumber();
+ int id = fDebugConnection.sendRequest(
+ "breakpoint_set", arg);
+ // set the marker Attribute to make later
+ // idetification possible
+ // TODO: make sure that attribute is set before
+ // response from debugger is beeing prosessed
+ marker.setAttribute(
+ XDebugLineBreakpoint.BREAKPOINT_ID, id);
+
} catch (CoreException e) {
}
}
@@ -227,61 +290,87 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
}
}
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint,
+ * org.eclipse.core.resources.IMarkerDelta)
*/
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
if (supportsBreakpoint(breakpoint)) {
try {
- int id =((XDebugLineBreakpoint)breakpoint).getID();
- if (id >0)
- fDebugConnection.sendRequest("breakpoint_remove","-d "+id);
+ int id = ((XDebugLineBreakpoint) breakpoint).getID();
+ if (id > 0)
+ fDebugConnection.sendRequest("breakpoint_remove", "-d "
+ + id);
} catch (CoreException e) {
}
}
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint,
+ * org.eclipse.core.resources.IMarkerDelta)
*/
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
-// if (supportsBreakpoint(breakpoint)) {
-// try {
-// if (breakpoint.isEnabled()) {
-// breakpointAdded(breakpoint);
-// } else {
-// breakpointRemoved(breakpoint, null);
-// }
-// } catch (CoreException e) {
-// }
-// }
- }
- /* (non-Javadoc)
+ // if (supportsBreakpoint(breakpoint)) {
+ // try {
+ // if (breakpoint.isEnabled()) {
+ // breakpointAdded(breakpoint);
+ // } else {
+ // breakpointRemoved(breakpoint, null);
+ // }
+ // } catch (CoreException e) {
+ // }
+ // }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDisconnect#canDisconnect()
*/
public boolean canDisconnect() {
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDisconnect#disconnect()
*/
public void disconnect() throws DebugException {
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IDisconnect#isDisconnected()
*/
public boolean isDisconnected() {
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval()
*/
public boolean supportsStorageRetrieval() {
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long,
+ * long)
*/
- public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
+ public IMemoryBlock getMemoryBlock(long startAddress, long length)
+ throws DebugException {
return null;
}
@@ -297,11 +386,11 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
installDeferredBreakpoints();
try {
resume();
-// step();
+ // step();
} catch (DebugException e) {
}
}
-
+
/**
* Install breakpoints that are already registered with the breakpoint
* manager.
@@ -312,7 +401,7 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
breakpointAdded(breakpoints[i]);
}
}
-
+
/**
* Called when this debug target terminates.
*/
@@ -324,16 +413,17 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
DebugPlugin.getDefault().removeDebugEventListener(this);
fThread.removeEventListeners();
}
-
+
/**
* Returns the current stack frames in the target.
*
* @return the current stack frames in the target
- * @throws DebugException if unable to perform the request
+ * @throws DebugException
+ * if unable to perform the request
*/
protected IStackFrame[] getStackFrames() throws DebugException {
- int id=fDebugConnection.sendRequest("stack_get");
- DebugResponse lastResponse=fDebugConnection.waitforTransID(id);
+ int id = fDebugConnection.sendRequest("stack_get");
+ DebugResponse lastResponse = fDebugConnection.waitforTransID(id);
if (lastResponse.isError())
return new IStackFrame[0];
Node response = lastResponse.getParentNode();
@@ -345,33 +435,36 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
}
return theFrames;
}
-
+
/**
* Single step the interpreter.
*
- * @throws DebugException if the request fails
+ * @throws DebugException
+ * if the request fails
*/
protected void step_over() throws DebugException {
fThread.setStepping(true);
resumed(DebugEvent.STEP_OVER);
fDebugConnection.sendRequest("step_over");
}
-
+
/**
* Single step the interpreter.
*
- * @throws DebugException if the request fails
+ * @throws DebugException
+ * if the request fails
*/
protected void step_into() throws DebugException {
fThread.setStepping(true);
resumed(DebugEvent.STEP_INTO);
fDebugConnection.sendRequest("step_into");
}
-
+
/**
* Single step the interpreter.
*
- * @throws DebugException if the request fails
+ * @throws DebugException
+ * if the request fails
*/
protected void step_out() throws DebugException {
fThread.setStepping(true);
@@ -379,73 +472,76 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
fDebugConnection.sendRequest("step_out");
}
-
-
/**
* Returns the current value of the given variable.
*
* @param variable
* @return variable value
- * @throws DebugException if the request fails
- */
- protected IValue getVariableValue(XDebugVariable variable) throws DebugException {
-// synchronized (fDebugSocket) {
-// fDebugConnection.sendRequest("var","" + variable.getStackFrame().getIdentifier() + " " + variable.getName());
-// try {
-// String value = fDebugReader.readLine();
-// //return new XDebugValue(this, value);
-//
-// } catch (IOException e) {
-// abort(MessageFormat.format("Unable to retrieve value for variable {0}", new String[]{variable.getName()}), e);
-// }
-// }
+ * @throws DebugException
+ * if the request fails
+ */
+ protected IValue getVariableValue(XDebugVariable variable)
+ throws DebugException {
+ // synchronized (fDebugSocket) {
+ // fDebugConnection.sendRequest("var","" +
+ // variable.getStackFrame().getIdentifier() + " " + variable.getName());
+ // try {
+ // String value = fDebugReader.readLine();
+ // //return new XDebugValue(this, value);
+ //
+ // } catch (IOException e) {
+ // abort(MessageFormat.format("Unable to retrieve value for variable
+ // {0}", new String[]{variable.getName()}), e);
+ // }
+ // }
return null;
}
-
+
/**
* Returns the values on the data stack (top down)
*
* @return the values on the data stack (top down)
*/
public IValue[] getDataStack() throws DebugException {
-// synchronized (fDebugSocket) {
-// fDebugConnection.sendRequest ("data");
-// try {
-// String valueString = fDebugReader.readLine();
-// if (valueString != null && valueString.length() > 0) {
-// String[] values = valueString.split("\\|");
-// IValue[] theValues = new IValue[values.length];
-// for (int i = 0; i < values.length; i++) {
-// String value = values[values.length - i - 1];
-//// theValues[i] = new XDebugValue(this, value);
-// }
-// return theValues;
-// }
-// } catch (IOException e) {
-// abort("Unable to retrieve data stack", e);
-// }
-// }
- return new IValue[0];
- }
-
+ // synchronized (fDebugSocket) {
+ // fDebugConnection.sendRequest ("data");
+ // try {
+ // String valueString = fDebugReader.readLine();
+ // if (valueString != null && valueString.length() > 0) {
+ // String[] values = valueString.split("\\|");
+ // IValue[] theValues = new IValue[values.length];
+ // for (int i = 0; i < values.length; i++) {
+ // String value = values[values.length - i - 1];
+ // // theValues[i] = new XDebugValue(this, value);
+ // }
+ // return theValues;
+ // }
+ // } catch (IOException e) {
+ // abort("Unable to retrieve data stack", e);
+ // }
+ // }
+ return new IValue[0];
+ }
+
public boolean setVarValue(String name, String value) {
- int id=-1;
- String str=Base64.encodeBytes(value.getBytes());
- int len=str.length();
+ int id = -1;
+ String str = Base64.encodeBytes(value.getBytes());
+ int len = str.length();
try {
- id =fDebugConnection.sendRequest("property_set","-n "+name+" -l "+len + " -- "+str);
+ id = fDebugConnection.sendRequest("property_set", "-n " + name
+ + " -l " + len + " -- " + str);
} catch (DebugException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- DebugResponse dr=getResponse(id);
+ DebugResponse dr = getResponse(id);
if ((dr.getAttributeValue("success")).equals("1"))
return true;
-
+
return false;
}
-
+
public DebugResponse getResponse(int id) {
return fDebugConnection.waitforTransID(id);
}
@@ -453,57 +549,69 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
/**
* Sends a request to the Debugengine and waits for an OK.
*
- * @param command debug command
- * @throws DebugException if the request fails
+ * @param command
+ * debug command
+ * @throws DebugException
+ * if the request fails
*/
-
- public int sendRequest(String command) throws DebugException {
- return fDebugConnection.sendRequest(command,"");
+
+ public int sendRequest(String command) throws DebugException {
+ return fDebugConnection.sendRequest(command, "");
}
-
/**
* Sends a request to the Debugengine and waits for an OK.
*
- * @param command debug command
+ * @param command
+ * debug command
* @arguments arguments for the command
- * @throws DebugException if the request fails
+ * @throws DebugException
+ * if the request fails
*/
-
- public int sendRequest(String command, String arguments) throws DebugException {
- return fDebugConnection.sendRequest(command,arguments);
+
+ public int sendRequest(String command, String arguments)
+ throws DebugException {
+ return fDebugConnection.sendRequest(command, arguments);
}
-
+
/**
- * Notification a breakpoint was encountered. Determine
- * which breakpoint was hit and fire a suspend event.
+ * Notification a breakpoint was encountered. Determine which breakpoint was
+ * hit and fire a suspend event.
*
- * @param event debug event
+ * @param event
+ * debug event
*/
public void breakpointHit(Node node) {
// determine which breakpoint was hit, and set the thread's breakpoint
- Node child=node.getFirstChild();
+ Node child = node.getFirstChild();
if (child.getNodeName().equals("stack")) {
- int lineNumber = Integer.parseInt(PHPDebugUtils.getAttributeValue(child, "lineno"));
- String filename=PHPDebugUtils.getAttributeValue(child, "filename").substring(8); // remove file:///
+ int lineNumber = Integer.parseInt(PHPDebugUtils.getAttributeValue(
+ child, "lineno"));
+ String filename = PHPDebugUtils
+ .getAttributeValue(child, "filename").substring(8); // remove
+ // file:///
IBreakpoint[] breakpoints = XDebugCorePlugin.getBreakpoints();
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
if (supportsBreakpoint(breakpoint)) {
if (breakpoint instanceof ILineBreakpoint) {
ILineBreakpoint lineBreakpoint = (ILineBreakpoint) breakpoint;
- try {
+ try {
if (breakpoint.isEnabled()) {
IMarker marker = breakpoint.getMarker();
if (marker != null) {
-
- String name = marker.getResource().getLocation().toOSString();
- if(name.equals(PHPDebugUtils.unescapeString(filename)) && (lineBreakpoint.getLineNumber() == lineNumber)) {
- fThread.setBreakpoints(new IBreakpoint[]{breakpoint});
+
+ String name = marker.getResource()
+ .getLocation().toOSString();
+ if (name.equals(PHPDebugUtils
+ .unescapeString(filename))
+ && (lineBreakpoint.getLineNumber() == lineNumber)) {
+ fThread
+ .setBreakpoints(new IBreakpoint[] { breakpoint });
break;
}
}
-
+
}
} catch (CoreException e) {
}
@@ -513,16 +621,18 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
}
suspended(DebugEvent.BREAKPOINT);
}
+
public void handleDebugEvents(DebugEvent[] events) {
- for (int i=0;inull
- * if none.
+ * Breakpoints this thread is suspended at or null if none.
*/
-
- private IStackFrame[] fStackFrames=null;
-
+
+ private IStackFrame[] fStackFrames = null;
+
private IBreakpoint[] fBreakpoints;
-
+
/**
* Whether this thread is stepping
*/
private boolean fStepping = false;
-
+
/**
* Constructs a new thread for the given target
*
- * @param target VM
+ * @param target
+ * VM
*/
public XDebugThread(XDebugTarget target) {
super(target);
DebugPlugin.getDefault().addDebugEventListener(this);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IThread#getStackFrames()
*/
public IStackFrame[] getStackFrames() throws DebugException {
if (isSuspended()) {
- if (fStackFrames==null)
- {
-// XDebugCorePlugin.log(IStatus.INFO,"vor getStackFrames");
- fStackFrames=((XDebugTarget) getDebugTarget()).getStackFrames();
-// XDebugCorePlugin.log(IStatus.INFO,"nach getStackFrames");
+ if (fStackFrames == null) {
+ // XDebugCorePlugin.log(IStatus.INFO,"vor getStackFrames");
+ fStackFrames = ((XDebugTarget) getDebugTarget())
+ .getStackFrames();
+ // XDebugCorePlugin.log(IStatus.INFO,"nach getStackFrames");
}
return fStackFrames;
} else {
return new IStackFrame[0];
}
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IThread#hasStackFrames()
*/
public boolean hasStackFrames() throws DebugException {
return isSuspended();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IThread#getPriority()
*/
public int getPriority() throws DebugException {
return 0;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IThread#getTopStackFrame()
*/
public IStackFrame getTopStackFrame() throws DebugException {
@@ -84,16 +96,22 @@ public class XDebugThread extends XDebugElement implements IThread, IDebugEventS
}
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IThread#getName()
*/
public String getName() throws DebugException {
-// if (fStackFrames!=null)
-// return fStackFrames[0].getName();
-// else
- return "Thread[1]";
+ // if (fStackFrames!=null)
+ // return fStackFrames[0].getName();
+ // else
+ return "Thread[1]";
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IThread#getBreakpoints()
*/
public IBreakpoint[] getBreakpoints() {
@@ -102,136 +120,184 @@ public class XDebugThread extends XDebugElement implements IThread, IDebugEventS
}
return fBreakpoints;
}
+
/**
* Sets the breakpoints this thread is suspended at, or null
* if none.
*
- * @param breakpoints the breakpoints this thread is suspended at, or null
- * if none
+ * @param breakpoints
+ * the breakpoints this thread is suspended at, or
+ * null if none
*/
protected void setBreakpoints(IBreakpoint[] breakpoints) {
fBreakpoints = breakpoints;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#canResume()
*/
public boolean canResume() {
return isSuspended();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
*/
public boolean canSuspend() {
return !isSuspended();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
*/
public boolean isSuspended() {
return getDebugTarget().isSuspended();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#resume()
*/
public void resume() throws DebugException {
- fStackFrames=null;
- fBreakpoints=null;
+ fStackFrames = null;
+ fBreakpoints = null;
getDebugTarget().resume();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ISuspendResume#suspend()
*/
public void suspend() throws DebugException {
getDebugTarget().suspend();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#canStepInto()
*/
public boolean canStepInto() {
return isSuspended();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#canStepOver()
*/
public boolean canStepOver() {
return isSuspended();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#canStepReturn()
*/
public boolean canStepReturn() {
- if (fStackFrames!=null)
- return (fStackFrames.length>1);
+ if (fStackFrames != null)
+ return (fStackFrames.length > 1);
else
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#isStepping()
*/
public boolean isStepping() {
return fStepping;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#stepInto()
*/
public void stepInto() throws DebugException {
- fStackFrames=null;
- fBreakpoints=null;
- ((XDebugTarget)getDebugTarget()).step_into();
+ fStackFrames = null;
+ fBreakpoints = null;
+ ((XDebugTarget) getDebugTarget()).step_into();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#stepOver()
*/
public void stepOver() throws DebugException {
- fStackFrames=null;
- fBreakpoints=null;
- ((XDebugTarget)getDebugTarget()).step_over();
+ fStackFrames = null;
+ fBreakpoints = null;
+ ((XDebugTarget) getDebugTarget()).step_over();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IStep#stepReturn()
*/
public void stepReturn() throws DebugException {
- fStackFrames=null;
- fBreakpoints=null;
- ((XDebugTarget)getDebugTarget()).step_out();
+ fStackFrames = null;
+ fBreakpoints = null;
+ ((XDebugTarget) getDebugTarget()).step_out();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/
public boolean canTerminate() {
return !isTerminated();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#isTerminated()
*/
public boolean isTerminated() {
return getDebugTarget().isTerminated();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.ITerminate#terminate()
*/
public void terminate() throws DebugException {
getDebugTarget().terminate();
}
-
+
/**
* Sets whether this thread is stepping
*
- * @param stepping whether stepping
+ * @param stepping
+ * whether stepping
*/
protected void setStepping(boolean stepping) {
fStepping = stepping;
}
public void handleDebugEvents(DebugEvent[] events) {
- DebugEvent de=events[0];
+ DebugEvent de = events[0];
System.out.println(de.toString());
-
+
}
public void removeEventListeners() {
DebugPlugin.getDefault().removeDebugEventListener(this);
-
+
}
}
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugValue.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugValue.java
index cc158a9..72a1e70 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugValue.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugValue.java
@@ -10,11 +10,12 @@ public class XDebugValue extends XDebugAbstractValue {
}
public void setType(String typeName) {
- fType=XDebugAbstractValue.VALUETYPE_UNINITIALIZED;
- fTypeName="unknown";
+ fType = XDebugAbstractValue.VALUETYPE_UNINITIALIZED;
+ fTypeName = "unknown";
}
+
public void renderValueString(String data) {
- fValueString="uninitialized";
+ fValueString = "uninitialized";
}
public boolean verifyValue(String expression) {
diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugVariable.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugVariable.java
index a6646da..21663d3 100644
--- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugVariable.java
+++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugVariable.java
@@ -6,7 +6,6 @@
*/
package net.sourceforge.phpeclipse.xdebug.php.model;
-
import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils;
import org.eclipse.debug.core.DebugEvent;
@@ -17,39 +16,53 @@ import org.w3c.dom.Node;
/**
* @author Axel
- *
- * 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 XDebugVariable extends XDebugElement implements IVariable {
-
+public class XDebugVariable extends XDebugElement implements IVariable {
+
public static final int VARTYPE_UNKNOWN = -1;
+
public static final int VARTYPE_UNINITIALIZED = 0;
+
public static final int VARTYPE_STRING = 1;
+
public static final int VARTYPE_INT = 2;
+
public static final int VARTYPE_FLOAT = 3;
+
public static final int VARTYPE_ARRAY = 8;
+
public static final int VARTYPE_HASH = 9;
+
public static final int VARTYPE_OBJECT = 10;
-
// name & stack frmae
private String fName;
+
private XDebugStackFrame fFrame;
+
private String fFullName;
-// private String fTypeName;
-// private int fType;
+
+ // private String fTypeName;
+ // private int fType;
private XDebugAbstractValue fValue;
+
private String fEncoding;
+
private int fNumChildren;
-// private Node fVariableNode;
-
+
+ // private Node fVariableNode;
+
/**
- * Constructs a variable contained in the given stack frame
- * with the given name.
+ * Constructs a variable contained in the given stack frame with the given
+ * name.
*
- * @param frame owning stack frame
- * @param name variable name
+ * @param frame
+ * owning stack frame
+ * @param name
+ * variable name
*/
public XDebugVariable(XDebugStackFrame frame, Node property) {
super((XDebugTarget) frame.getDebugTarget());
@@ -57,62 +70,67 @@ public class XDebugVariable extends XDebugElement implements IVariable {
init(property);
}
-
- private void init(Node property) {
- fFullName=PHPDebugUtils.getAttributeValue(property,"fullname");
- fName=PHPDebugUtils.getAttributeValue(property,"name");
- fEncoding=PHPDebugUtils.getAttributeValue(property,"encoding");
- if (PHPDebugUtils.getAttributeValue(property,"numchildren").equals(""))
+
+ private void init(Node property) {
+ fFullName = PHPDebugUtils.getAttributeValue(property, "fullname");
+ fName = PHPDebugUtils.getAttributeValue(property, "name");
+ fEncoding = PHPDebugUtils.getAttributeValue(property, "encoding");
+ if (PHPDebugUtils.getAttributeValue(property, "numchildren").equals(""))
fNumChildren = 0;
else
- fNumChildren=Integer.parseInt(PHPDebugUtils.getAttributeValue(property,"numchildren"));
-
- String typeName=PHPDebugUtils.getAttributeValue(property,"type");
-
-// if (typeName.equals("uninitialized") )
-// fValue= new XDebugValue(this,property,typeName);
- if (typeName.equals("int") )
- fValue= new XDebugIntValue(this,property,typeName);
- else if (typeName.equals("float") )
- fValue= new XDebugFloatValue(this,property,typeName);
- else if (typeName.equals("bool") )
- fValue= new XDebugBooleanValue(this,property,typeName);
- else if (typeName.equals("string") )
- fValue= new XDebugStringValue(this,property,typeName);
- else if (typeName.equals("array") )
- fValue= new XDebugArrayValue(this,property,typeName);
- else if (typeName.equals("hash") )
- fValue= new XDebugArrayValue(this,property,typeName);
- else if (typeName.equals("object") )
- fValue= new XDebugArrayValue(this,property,typeName);
+ fNumChildren = Integer.parseInt(PHPDebugUtils.getAttributeValue(
+ property, "numchildren"));
+
+ String typeName = PHPDebugUtils.getAttributeValue(property, "type");
+
+ // if (typeName.equals("uninitialized") )
+ // fValue= new XDebugValue(this,property,typeName);
+ if (typeName.equals("int"))
+ fValue = new XDebugIntValue(this, property, typeName);
+ else if (typeName.equals("float"))
+ fValue = new XDebugFloatValue(this, property, typeName);
+ else if (typeName.equals("bool"))
+ fValue = new XDebugBooleanValue(this, property, typeName);
+ else if (typeName.equals("string"))
+ fValue = new XDebugStringValue(this, property, typeName);
+ else if (typeName.equals("array"))
+ fValue = new XDebugArrayValue(this, property, typeName);
+ else if (typeName.equals("hash"))
+ fValue = new XDebugArrayValue(this, property, typeName);
+ else if (typeName.equals("object"))
+ fValue = new XDebugArrayValue(this, property, typeName);
else
- fValue= new XDebugValue(this,property,typeName);
-
-// else if (typeName.equals("float") )
-// fTypeName= VARTYPE_FLOAT;
-// else if (typeName.equals("string") )
-// fTypeName= VARTYPE_STRING;
-// else if (typeName.equals("hash") )
-// fTypeName= VARTYPE_HASH;
-// else if (typeName.equals("array") )
-// fTypeName= VARTYPE_ARRAY;
-// else if (typeName.equals("object") )
-// fTypeName= VARTYPE_OBJECT;
-
-
-
-// fTypeName=type;
-//
-// fValue= new XDebugValue(this,property);
- }
- /* (non-Javadoc)
+ fValue = new XDebugValue(this, property, typeName);
+
+ // else if (typeName.equals("float") )
+ // fTypeName= VARTYPE_FLOAT;
+ // else if (typeName.equals("string") )
+ // fTypeName= VARTYPE_STRING;
+ // else if (typeName.equals("hash") )
+ // fTypeName= VARTYPE_HASH;
+ // else if (typeName.equals("array") )
+ // fTypeName= VARTYPE_ARRAY;
+ // else if (typeName.equals("object") )
+ // fTypeName= VARTYPE_OBJECT;
+
+ // fTypeName=type;
+ //
+ // fValue= new XDebugValue(this,property);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IVariable#getValue()
*/
public IValue getValue() throws DebugException {
return fValue;
-// return ((XDebugTarget)getDebugTarget()).getVariableValue(this);
+ // return ((XDebugTarget)getDebugTarget()).getVariableValue(this);
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IVariable#getName()
*/
public String getName() throws DebugException {
@@ -121,50 +139,72 @@ public class XDebugVariable extends XDebugElement implements IVariable {
else
return fName;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
*/
public String getReferenceTypeName() throws DebugException {
return fValue.getReferenceTypeName();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
*/
public boolean hasValueChanged() throws DebugException {
// TODO Auto-generated method stub
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
*/
public void setValue(String expression) throws DebugException {
- if(fValue.setValue(expression))
- fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT));
+ if (fValue.setValue(expression))
+ fireEvent(new DebugEvent(this, DebugEvent.CHANGE,
+ DebugEvent.CONTENT));
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
*/
public void setValue(IValue value) throws DebugException {
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
*/
public boolean supportsValueModification() {
return fValue.supportsValueModification();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
*/
public boolean verifyValue(String expression) throws DebugException {
return fValue.verifyValue(expression);
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue)
*/
public boolean verifyValue(IValue value) throws DebugException {
return false;
}
-
+
/**
* Returns the stack frame owning this variable.
*
@@ -174,16 +214,16 @@ public class XDebugVariable extends XDebugElement implements IVariable {
return fFrame;
}
-// public int getType() {
-// return fType;
-// }
+ // public int getType() {
+ // return fType;
+ // }
public String getValueString() throws DebugException {
return fValue.getValueString();
}
-
+
public boolean hasChildren() {
- return (fNumChildren>0);
+ return (fNumChildren > 0);
}
public boolean isArray() {
@@ -197,7 +237,7 @@ public class XDebugVariable extends XDebugElement implements IVariable {
public void setEncoding(String encoding) {
fEncoding = encoding;
}
-
+
public String toString() {
return fValue.toString();
}
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/EnvironmentVariable.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/EnvironmentVariable.java
index f615429..293bfe4 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/EnvironmentVariable.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/EnvironmentVariable.java
@@ -3,16 +3,14 @@ package net.sourceforge.phpeclipse.xdebug.ui;
/**
* A key/value set whose data is passed into Runtime.exec(...)
*/
-public class EnvironmentVariable
-{
+public class EnvironmentVariable {
// The name of the environment variable
private String name;
-
+
// The value of the environment variable
private String value;
-
- public EnvironmentVariable(String name, String value)
- {
+
+ public EnvironmentVariable(String name, String value) {
this.name = name;
this.value = value;
}
@@ -23,54 +21,57 @@ public class EnvironmentVariable
*
* @return this variable's name
*/
- public String getName()
- {
+ public String getName() {
return name;
}
-
+
/**
* Returns this variables value.
*
* @return this variable's value
*/
- public String getValue()
- {
+ public String getValue() {
return value;
}
-
+
/**
* Sets this variable's value
+ *
* @param value
*/
- public void setValue(String value)
- {
+ public void setValue(String value) {
this.value = value;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
public String toString() {
return getName();
}
-
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
boolean equal = false;
if (obj instanceof EnvironmentVariable) {
- EnvironmentVariable var = (EnvironmentVariable)obj;
+ EnvironmentVariable var = (EnvironmentVariable) obj;
equal = var.getName().equals(name);
}
- return equal;
+ return equal;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return name.hashCode();
}
}
-
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/MultipleInputDialog.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/MultipleInputDialog.java
index 3af109a..0f23c3e 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/MultipleInputDialog.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/MultipleInputDialog.java
@@ -28,28 +28,34 @@ import org.eclipse.swt.widgets.Text;
public class MultipleInputDialog extends Dialog {
protected static final String FIELD_NAME = "FIELD_NAME"; //$NON-NLS-1$
+
protected static final int TEXT = 100;
+
protected static final int BROWSE = 101;
+
protected static final int VARIABLE = 102;
-
+
protected Composite panel;
-
+
protected List fieldList = new ArrayList();
+
protected List controlList = new ArrayList();
+
protected List validators = new ArrayList();
+
protected Map valueMap = new HashMap();
private String title;
-
-
-
+
public MultipleInputDialog(Shell shell, String title) {
super(shell);
this.title = title;
setShellStyle(getShellStyle() | SWT.RESIZE);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
protected void configureShell(Shell shell) {
@@ -57,10 +63,12 @@ public class MultipleInputDialog extends Dialog {
if (title != null) {
shell.setText(title);
}
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
*/
protected Control createButtonBar(Composite parent) {
@@ -68,66 +76,80 @@ public class MultipleInputDialog extends Dialog {
validateFields();
return bar;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent) {
- Composite container = (Composite)super.createDialogArea(parent);
+ Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(2, false));
container.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
panel = new Composite(container, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
panel.setLayout(layout);
panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
for (Iterator i = fieldList.iterator(); i.hasNext();) {
- FieldSummary field = (FieldSummary)i.next();
- switch(field.type) {
- case TEXT:
- createTextField(field.name, field.initialValue, field.allowsEmpty);
- break;
- case BROWSE:
- createBrowseField(field.name, field.initialValue, field.allowsEmpty);
- break;
- case VARIABLE:
- createVariablesField(field.name, field.initialValue, field.allowsEmpty);
- break;
+ FieldSummary field = (FieldSummary) i.next();
+ switch (field.type) {
+ case TEXT:
+ createTextField(field.name, field.initialValue,
+ field.allowsEmpty);
+ break;
+ case BROWSE:
+ createBrowseField(field.name, field.initialValue,
+ field.allowsEmpty);
+ break;
+ case VARIABLE:
+ createVariablesField(field.name, field.initialValue,
+ field.allowsEmpty);
+ break;
}
}
-
+
fieldList = null; // allow it to be gc'd
Dialog.applyDialogFont(container);
return container;
}
-
- public void addBrowseField(String labelText, String initialValue, boolean allowsEmpty) {
- fieldList.add(new FieldSummary(BROWSE, labelText, initialValue, allowsEmpty));
+
+ public void addBrowseField(String labelText, String initialValue,
+ boolean allowsEmpty) {
+ fieldList.add(new FieldSummary(BROWSE, labelText, initialValue,
+ allowsEmpty));
}
- public void addTextField(String labelText, String initialValue, boolean allowsEmpty) {
- fieldList.add(new FieldSummary(TEXT, labelText, initialValue, allowsEmpty));
+
+ public void addTextField(String labelText, String initialValue,
+ boolean allowsEmpty) {
+ fieldList.add(new FieldSummary(TEXT, labelText, initialValue,
+ allowsEmpty));
}
- public void addVariablesField(String labelText, String initialValue, boolean allowsEmpty) {
- fieldList.add(new FieldSummary(VARIABLE, labelText, initialValue, allowsEmpty));
+
+ public void addVariablesField(String labelText, String initialValue,
+ boolean allowsEmpty) {
+ fieldList.add(new FieldSummary(VARIABLE, labelText, initialValue,
+ allowsEmpty));
}
- protected void createTextField(String labelText, String initialValue, boolean allowEmpty) {
+ protected void createTextField(String labelText, String initialValue,
+ boolean allowEmpty) {
Label label = new Label(panel, SWT.NONE);
label.setText(labelText);
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
+
final Text text = new Text(panel, SWT.SINGLE | SWT.BORDER);
text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
text.setData(FIELD_NAME, labelText);
-
+
// make sure rows are the same height on both panels.
- label.setSize(label.getSize().x, text.getSize().y);
-
+ label.setSize(label.getSize().x, text.getSize().y);
+
if (initialValue != null) {
text.setText(initialValue);
}
-
+
if (!allowEmpty) {
validators.add(new Validator() {
public boolean validate() {
@@ -140,22 +162,23 @@ public class MultipleInputDialog extends Dialog {
}
});
}
-
+
controlList.add(text);
}
-
- protected void createBrowseField(String labelText, String initialValue, boolean allowEmpty) {
+
+ protected void createBrowseField(String labelText, String initialValue,
+ boolean allowEmpty) {
Label label = new Label(panel, SWT.NONE);
label.setText(labelText);
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
+
Composite comp = new Composite(panel, SWT.NONE);
GridLayout layout = new GridLayout();
- layout.marginHeight=0;
- layout.marginWidth=0;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
comp.setLayout(layout);
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = 200;
@@ -163,8 +186,8 @@ public class MultipleInputDialog extends Dialog {
text.setData(FIELD_NAME, labelText);
// make sure rows are the same height on both panels.
- label.setSize(label.getSize().x, text.getSize().y);
-
+ label.setSize(label.getSize().x, text.getSize().y);
+
if (initialValue != null) {
text.setText(initialValue);
}
@@ -182,44 +205,45 @@ public class MultipleInputDialog extends Dialog {
}
});
}
-
- Button button = createButton(comp, IDialogConstants.IGNORE_ID, "&Browse...", false);
+
+ Button button = createButton(comp, IDialogConstants.IGNORE_ID,
+ "&Browse...", false);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
- dialog.setMessage("Select a file:");
+ dialog.setMessage("Select a file:");
String currentWorkingDir = text.getText();
if (!currentWorkingDir.trim().equals("")) { //$NON-NLS-1$
File path = new File(currentWorkingDir);
if (path.exists()) {
dialog.setFilterPath(currentWorkingDir);
- }
+ }
}
-
+
String selectedDirectory = dialog.open();
if (selectedDirectory != null) {
text.setText(selectedDirectory);
- }
+ }
}
});
controlList.add(text);
-
+
}
-
-
- public void createVariablesField(String labelText, String initialValue, boolean allowEmpty) {
+
+ public void createVariablesField(String labelText, String initialValue,
+ boolean allowEmpty) {
Label label = new Label(panel, SWT.NONE);
label.setText(labelText);
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
+
Composite comp = new Composite(panel, SWT.NONE);
GridLayout layout = new GridLayout();
- layout.marginHeight=0;
- layout.marginWidth=0;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
comp.setLayout(layout);
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = 200;
@@ -227,8 +251,8 @@ public class MultipleInputDialog extends Dialog {
text.setData(FIELD_NAME, labelText);
// make sure rows are the same height on both panels.
- label.setSize(label.getSize().x, text.getSize().y);
-
+ label.setSize(label.getSize().x, text.getSize().y);
+
if (initialValue != null) {
text.setText(initialValue);
}
@@ -246,11 +270,13 @@ public class MultipleInputDialog extends Dialog {
}
});
}
-
- Button button = createButton(comp, IDialogConstants.IGNORE_ID, "Varia&bles...", false);
+
+ Button button = createButton(comp, IDialogConstants.IGNORE_ID,
+ "Varia&bles...", false);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(
+ getShell());
int code = dialog.open();
if (code == IDialogConstants.OK_ID) {
String variable = dialog.getVariableExpression();
@@ -262,42 +288,46 @@ public class MultipleInputDialog extends Dialog {
});
controlList.add(text);
-
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
protected void okPressed() {
- for (Iterator i = controlList.iterator(); i.hasNext(); ) {
- Control control = (Control)i.next();
+ for (Iterator i = controlList.iterator(); i.hasNext();) {
+ Control control = (Control) i.next();
if (control instanceof Text) {
- valueMap.put(control.getData(FIELD_NAME), ((Text)control).getText());
+ valueMap.put(control.getData(FIELD_NAME), ((Text) control)
+ .getText());
}
}
controlList = null;
super.okPressed();
}
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.jface.window.Window#open()
*/
public int open() {
applyDialogFont(panel);
return super.open();
}
-
+
public Object getValue(String key) {
return valueMap.get(key);
}
-
+
public String getStringValue(String key) {
- return (String) getValue(key);
+ return (String) getValue(key);
}
-
+
public void validateFields() {
- for(Iterator i = validators.iterator(); i.hasNext(); ) {
+ for (Iterator i = validators.iterator(); i.hasNext();) {
Validator validator = (Validator) i.next();
if (!validator.validate()) {
getButton(IDialogConstants.OK_ID).setEnabled(false);
@@ -307,52 +337,60 @@ public class MultipleInputDialog extends Dialog {
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
-// /* (non-Javadoc)
-// * @see org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
-// */
-// protected Point getInitialLocation(Point initialSize) {
-// Point initialLocation= DialogSettingsHelper.getInitialLocation(getDialogSettingsSectionName());
-// if (initialLocation != null) {
-// return initialLocation;
-// }
-// return super.getInitialLocation(initialSize);
-// }
-
-
+ // /* (non-Javadoc)
+ // * @see
+ // org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
+ // */
+ // protected Point getInitialLocation(Point initialSize) {
+ // Point initialLocation=
+ // DialogSettingsHelper.getInitialLocation(getDialogSettingsSectionName());
+ // if (initialLocation != null) {
+ // return initialLocation;
+ // }
+ // return super.getInitialLocation(initialSize);
+ // }
+
protected String getDialogSettingsSectionName() {
return IDebugUIConstants.PLUGIN_ID + ".MULTIPLE_INPUT_DIALOG_2"; //$NON-NLS-1$
}
-
-// /* (non-Javadoc)
-// * @see org.eclipse.jface.window.Window#getInitialSize()
-// */
-// protected Point getInitialSize() {
-// Point size = super.getInitialSize();
-// return DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(), size);
-// }
-
-// /* (non-Javadoc)
-// * @see org.eclipse.jface.window.Window#close()
-// */
-// public boolean close() {
-// DialogSettingsHelper.persistShellGeometry(getShell(), getDialogSettingsSectionName());
-// return super.close();
-// }
+
+ // /* (non-Javadoc)
+ // * @see org.eclipse.jface.window.Window#getInitialSize()
+ // */
+ // protected Point getInitialSize() {
+ // Point size = super.getInitialSize();
+ // return
+ // DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(),
+ // size);
+ // }
+
+ // /* (non-Javadoc)
+ // * @see org.eclipse.jface.window.Window#close()
+ // */
+ // public boolean close() {
+ // DialogSettingsHelper.persistShellGeometry(getShell(),
+ // getDialogSettingsSectionName());
+ // return super.close();
+ // }
protected class FieldSummary {
int type;
+
String name;
+
String initialValue;
+
boolean allowsEmpty;
-
- public FieldSummary(int type, String name, String initialValue, boolean allowsEmpty) {
+
+ public FieldSummary(int type, String name, String initialValue,
+ boolean allowsEmpty) {
this.type = type;
this.name = name;
this.initialValue = initialValue;
this.allowsEmpty = allowsEmpty;
}
}
-
+
protected class Validator {
boolean validate() {
return true;
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugUIPlugin.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugUIPlugin.java
index 03dc4a5..a069314 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugUIPlugin.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugUIPlugin.java
@@ -3,14 +3,14 @@ package net.sourceforge.phpeclipse.xdebug.ui;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.plugin.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
@@ -22,13 +22,12 @@ public class XDebugUIPlugin extends AbstractUIPlugin {
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
-
- private static final String PLUGIN_ID ="net.sourceforge.phpeclipse.xdebug.ui";
-
- //The shared instance.
+ private static final String PLUGIN_ID = "net.sourceforge.phpeclipse.xdebug.ui";
+
+ // The shared instance.
private static XDebugUIPlugin plugin;
-
+
/**
* The constructor.
*/
@@ -59,51 +58,57 @@ public class XDebugUIPlugin extends AbstractUIPlugin {
}
/**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path.
- *
- * @param path the path
+ * Returns an image descriptor for the image file at the given plug-in
+ * relative path.
+ *
+ * @param path
+ * the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin("net.sourceforge.phpeclipse.xdebug.ui", path);
+ return AbstractUIPlugin.imageDescriptorFromPlugin(
+ "net.sourceforge.phpeclipse.xdebug.ui", path);
}
-
+
/**
* Convenience method which returns the unique identifier of this plugin.
*/
public static String getUniqueIdentifier() {
return PLUGIN_ID;
}
-
+
/**
* Utility method with conventions
*/
- public static void errorDialog(Shell shell, String title, String message, IStatus s) {
- // if the 'message' resource string and the IStatus' message are the same,
+ public static void errorDialog(Shell shell, String title, String message,
+ IStatus s) {
+ // if the 'message' resource string and the IStatus' message are the
+ // same,
// don't show both in the dialog
if (s != null && message.equals(s.getMessage())) {
- message= null;
+ message = null;
}
ErrorDialog.openError(shell, title, message, s);
}
-
/**
* Utility method with conventions
*/
- public static void errorDialog(Shell shell, String title, String message, Throwable t) {
+ public static void errorDialog(Shell shell, String title, String message,
+ Throwable t) {
IStatus status;
if (t instanceof CoreException) {
- status= ((CoreException)t).getStatus();
- // if the 'message' resource string and the IStatus' message are the same,
+ status = ((CoreException) t).getStatus();
+ // if the 'message' resource string and the IStatus' message are the
+ // same,
// don't show both in the dialog
if (status != null && message.equals(status.getMessage())) {
- message= null;
+ message = null;
}
} else {
- status= new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, "Error within Debug UI: ", t); //$NON-NLS-1$
- log(status);
+ status = new Status(IStatus.ERROR, getUniqueIdentifier(),
+ IStatus.ERROR, "Error within Debug UI: ", t); //$NON-NLS-1$
+ log(status);
}
ErrorDialog.openError(shell, title, message, status);
}
@@ -111,32 +116,35 @@ public class XDebugUIPlugin extends AbstractUIPlugin {
/**
* Logs the specified status with this plug-in's log.
*
- * @param status status to log
+ * @param status
+ * status to log
*/
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
-
+
/**
* Logs an internal error with the specified throwable
*
- * @param e the exception to be logged
- */
+ * @param e
+ * the exception to be logged
+ */
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, "Internal Error", e));
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR,
+ "Internal Error", e));
}
-
+
/**
- * 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;
}
public static String getString(String key) {
@@ -146,5 +154,5 @@ public class XDebugUIPlugin extends AbstractUIPlugin {
return '!' + key + '!';
}
}
-
+
}
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugUIPluginImages.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugUIPluginImages.java
index 69e49cc..1c48a08 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugUIPluginImages.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/XDebugUIPluginImages.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package net.sourceforge.phpeclipse.xdebug.ui;
-
import java.net.MalformedURLException;
import java.net.URL;
@@ -20,143 +19,160 @@ import org.eclipse.swt.graphics.Image;
public class XDebugUIPluginImages {
-
/* Declare Common paths */
- private static URL ICON_BASE_URL= null;
+ private static URL ICON_BASE_URL = null;
static {
String pathSuffix = "icons/"; //$NON-NLS-1$
- ICON_BASE_URL= XDebugUIPlugin.getDefault().getBundle().getEntry(pathSuffix);
+ ICON_BASE_URL = XDebugUIPlugin.getDefault().getBundle().getEntry(
+ pathSuffix);
}
-
+
// The plugin registry
private static ImageRegistry fgImageRegistry = null;
-
+
/*
* Set of predefined Image Descriptors.
*/
- private static final String T_OBJ= "obj16/"; //$NON-NLS-1$
-// private static final String T_OVR= "ovr16/"; //$NON-NLS-1$
- private static final String T_EVIEW= "eview16/"; //$NON-NLS-1$
- private static final String T_LCL="elcl16/";
+ private static final String T_OBJ = "obj16/"; //$NON-NLS-1$
+ // private static final String T_OVR= "ovr16/"; //$NON-NLS-1$
+
+ private static final String T_EVIEW = "eview16/"; //$NON-NLS-1$
+
+ private static final String T_LCL = "elcl16/";
public static final String IMG_EVIEW_ARGUMENTS_TAB = "IMG_EVIEW_ARGUMENTS_TAB";
+
public static final String IMG_EVIEW_ENVIROMENT_TAB = "IMG_EVIEW_ENVIROMENT_TAB";
-
- public static final String IMG_PREV_EVENT="IMG_PREV_EVENT";
- public static final String DESC_NEXT_EVENT="DESC_NEXT_EVENT";
- public static final String IMG_ERROR_ST_OBJ="IMG_ERROR_ST_OBJ";
- public static final String IMG_WARNING_ST_OBJ="IMG_WARNING_ST_OBJ";
- public static final String IMG_INFO_ST_OBJ="IMG_INFO_ST_OBJ";
- public static final String IMG_ERROR_STACK_OBJ="IMG_ERROR_STACK_OBJ";
+ public static final String IMG_PREV_EVENT = "IMG_PREV_EVENT";
+
+ public static final String DESC_NEXT_EVENT = "DESC_NEXT_EVENT";
+ public static final String IMG_ERROR_ST_OBJ = "IMG_ERROR_ST_OBJ";
- public static final String IMG_PROPERTIES = "IMG_PROPERTIES";
-// public static final String IMG_PROPERTIES_DISABLED = "IMG_PROPERTIES_DISABLED";
- public static final String IMG_CLEAR = "IMG_CLEAR";
-// public static final String IMG_CLEAR_DISABLED = "IMG_CLEAR_DISABLED";
- public static final String IMG_READ_LOG = "IMG_READ_LOG";
-// public static final String IMG_READ_LOG_DISABLED = "IMG_READ_LOG_DISABLED";
- public static final String IMG_REMOVE_LOG = "IMG_REMOVE_LOG";
-// public static final String IMG_REMOVE_LOG_DISABLED = "IMG_REMOVE_LOG_DISABLED";
- public static final String IMG_FILTER = "IMG_FILTER";
-// public static final String IMG_FILTER_DISABLED = "IMG_FILTER_DISABLED";
- public static final String IMG_EXPORT = "IMG_EXPORT";
-// public static final String IMG_EXPORT_DISABLED = "IMG_EXPORT_DISABLED";
- public static final String IMG_IMPORT = "IMG_IMPORT";
-// public static final String IMG_IMPORT_DISABLED = "IMG_IMPORT_DISABLED";
- public static final String IMG_OPEN_LOG = "IMG_OPEN_LOG";
+ public static final String IMG_WARNING_ST_OBJ = "IMG_WARNING_ST_OBJ";
+ public static final String IMG_INFO_ST_OBJ = "IMG_INFO_ST_OBJ";
+ public static final String IMG_ERROR_STACK_OBJ = "IMG_ERROR_STACK_OBJ";
+ public static final String IMG_PROPERTIES = "IMG_PROPERTIES";
+ // public static final String IMG_PROPERTIES_DISABLED =
+ // "IMG_PROPERTIES_DISABLED";
+ public static final String IMG_CLEAR = "IMG_CLEAR";
+
+ // public static final String IMG_CLEAR_DISABLED = "IMG_CLEAR_DISABLED";
+ public static final String IMG_READ_LOG = "IMG_READ_LOG";
+
+ // public static final String IMG_READ_LOG_DISABLED =
+ // "IMG_READ_LOG_DISABLED";
+ public static final String IMG_REMOVE_LOG = "IMG_REMOVE_LOG";
+
+ // public static final String IMG_REMOVE_LOG_DISABLED =
+ // "IMG_REMOVE_LOG_DISABLED";
+ public static final String IMG_FILTER = "IMG_FILTER";
+
+ // public static final String IMG_FILTER_DISABLED = "IMG_FILTER_DISABLED";
+ public static final String IMG_EXPORT = "IMG_EXPORT";
+
+ // public static final String IMG_EXPORT_DISABLED = "IMG_EXPORT_DISABLED";
+ public static final String IMG_IMPORT = "IMG_IMPORT";
+
+ // public static final String IMG_IMPORT_DISABLED = "IMG_IMPORT_DISABLED";
+ public static final String IMG_OPEN_LOG = "IMG_OPEN_LOG";
/**
* 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) {
return getImageRegistry().get(key);
}
-
+
/**
* Returns the ImageDescriptor identified by the given key,
* or null if it does not exist.
*/
public static ImageDescriptor getImageDescriptor(String key) {
return getImageRegistry().getDescriptor(key);
- }
-
+ }
+
/*
* Helper method to access the image registry from the XDebugUIPlugin class.
*/
- public static ImageRegistry getImageRegistry() {
+ public static ImageRegistry getImageRegistry() {
if (fgImageRegistry == null) {
initializeImageRegistry();
}
return fgImageRegistry;
}
-
+
public static void initializeImageRegistry() {
- fgImageRegistry= new ImageRegistry(XDebugUIPlugin.getStandardDisplay());
+ fgImageRegistry = new ImageRegistry(XDebugUIPlugin.getStandardDisplay());
declareImages();
}
-
+
private static void declareImages() {
- declareRegistryImage(IMG_EVIEW_ARGUMENTS_TAB, T_EVIEW + "arguments_tab.gif"); //$NON-NLS-1$
- declareRegistryImage(IMG_EVIEW_ENVIROMENT_TAB, T_EVIEW + "environment_tab.gif"); //$NON-NLS-1$
-
- declareRegistryImage(IMG_ERROR_ST_OBJ,T_OBJ+"error_st_obj.gif");
- declareRegistryImage(IMG_WARNING_ST_OBJ,T_OBJ + "warning_st_obj.gif");
- declareRegistryImage(IMG_INFO_ST_OBJ,T_OBJ +"info_st_obj.gif");
- declareRegistryImage(IMG_ERROR_STACK_OBJ,T_OBJ +"error_stack.gif");
-
- declareRegistryImage(IMG_PROPERTIES,T_LCL + "properties.gif");
-// declareRegistryImage(IMG_PROPERTIES_DISABLED
- declareRegistryImage(IMG_CLEAR,T_LCL + "clear_log.gif");
-// declareRegistryImage(IMG_CLEAR_DISABLED
- declareRegistryImage(IMG_READ_LOG ,T_LCL + "restore_log.gif");
-// declareRegistryImage(IMG_READ_LOG_DISABLED
- declareRegistryImage(IMG_REMOVE_LOG,T_LCL + "remove_log.gif");
-// declareRegistryImage(IMG_REMOVE_LOG_DISABLED
- declareRegistryImage(IMG_FILTER,T_LCL + "filter_log.gif");
-// declareRegistryImage(IMG_FILTER_DISABLED
- declareRegistryImage(IMG_EXPORT,T_LCL + "export_log.gif");
-// declareRegistryImage(IMG_EXPORT_DISABLED
- declareRegistryImage(IMG_IMPORT,T_LCL + "import_log.gif");
-// declareRegistryImage(IMG_IMPORT_DISABLED
- declareRegistryImage(IMG_OPEN_LOG,T_LCL + "open_log.gif");
-
- }
-
+ declareRegistryImage(IMG_EVIEW_ARGUMENTS_TAB, T_EVIEW
+ + "arguments_tab.gif"); //$NON-NLS-1$
+ declareRegistryImage(IMG_EVIEW_ENVIROMENT_TAB, T_EVIEW
+ + "environment_tab.gif"); //$NON-NLS-1$
+
+ declareRegistryImage(IMG_ERROR_ST_OBJ, T_OBJ + "error_st_obj.gif");
+ declareRegistryImage(IMG_WARNING_ST_OBJ, T_OBJ + "warning_st_obj.gif");
+ declareRegistryImage(IMG_INFO_ST_OBJ, T_OBJ + "info_st_obj.gif");
+ declareRegistryImage(IMG_ERROR_STACK_OBJ, T_OBJ + "error_stack.gif");
+
+ declareRegistryImage(IMG_PROPERTIES, T_LCL + "properties.gif");
+ // declareRegistryImage(IMG_PROPERTIES_DISABLED
+ declareRegistryImage(IMG_CLEAR, T_LCL + "clear_log.gif");
+ // declareRegistryImage(IMG_CLEAR_DISABLED
+ declareRegistryImage(IMG_READ_LOG, T_LCL + "restore_log.gif");
+ // declareRegistryImage(IMG_READ_LOG_DISABLED
+ declareRegistryImage(IMG_REMOVE_LOG, T_LCL + "remove_log.gif");
+ // declareRegistryImage(IMG_REMOVE_LOG_DISABLED
+ declareRegistryImage(IMG_FILTER, T_LCL + "filter_log.gif");
+ // declareRegistryImage(IMG_FILTER_DISABLED
+ declareRegistryImage(IMG_EXPORT, T_LCL + "export_log.gif");
+ // declareRegistryImage(IMG_EXPORT_DISABLED
+ declareRegistryImage(IMG_IMPORT, T_LCL + "import_log.gif");
+ // declareRegistryImage(IMG_IMPORT_DISABLED
+ declareRegistryImage(IMG_OPEN_LOG, T_LCL + "open_log.gif");
+
+ }
+
/**
* 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) {
XDebugUIPlugin.log(me);
}
fgImageRegistry.put(key, desc);
- }
-
- 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);
- }
-
-
+ return new URL(ICON_BASE_URL, iconPath);
+ }
}
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/actions/BreakpointRulerActionDelegate.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/actions/BreakpointRulerActionDelegate.java
index 5f906be..d222c4e 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/actions/BreakpointRulerActionDelegate.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/actions/BreakpointRulerActionDelegate.java
@@ -5,15 +5,13 @@ import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
import org.eclipse.ui.texteditor.ITextEditor;
-
-
public class BreakpointRulerActionDelegate extends AbstractRulerActionDelegate {
private ToggleBreakpointRulerAction fTargetAction;
protected IAction createAction(ITextEditor editor,
IVerticalRulerInfo rulerInfo) {
- fTargetAction = new ToggleBreakpointRulerAction( editor, rulerInfo );
+ fTargetAction = new ToggleBreakpointRulerAction(editor, rulerInfo);
return fTargetAction;
}
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/actions/ToggleBreakpointRulerAction.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/actions/ToggleBreakpointRulerAction.java
index d6a03d2..98e294d 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/actions/ToggleBreakpointRulerAction.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/actions/ToggleBreakpointRulerAction.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.phpeclipse.xdebug.ui.actions;
import net.sourceforge.phpeclipse.xdebug.ui.XDebugUIPlugin;
@@ -27,47 +27,52 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
-public class ToggleBreakpointRulerAction extends Action {
-
+public class ToggleBreakpointRulerAction extends Action {
+
static class EmptySelection implements ISelection {
public boolean isEmpty() {
return true;
- }
+ }
}
-
+
private IVerticalRulerInfo fRuler;
+
private IWorkbenchPart fTargetPart;
+
private PHPLineBreakpointAdapter fBreakpointAdapter;
- private static final ISelection EMPTY_SELECTION = new EmptySelection();
-
- public ToggleBreakpointRulerAction( IWorkbenchPart part, IVerticalRulerInfo ruler ) {
- super( "Toggle Breakpoint" ); //$NON-NLS-1$
- fRuler= ruler;
+ private static final ISelection EMPTY_SELECTION = new EmptySelection();
+
+ public ToggleBreakpointRulerAction(IWorkbenchPart part,
+ IVerticalRulerInfo ruler) {
+ super("Toggle Breakpoint"); //$NON-NLS-1$
+
+ fRuler = ruler;
fRuler = ruler;
- setTargetPart( part );
+ setTargetPart(part);
fBreakpointAdapter = new PHPLineBreakpointAdapter();
-// part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.TOGGLE_BREAKPOINT_ACTION );
-// setId( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT );
+ // part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp(
+ // this, ICDebugHelpContextIds.TOGGLE_BREAKPOINT_ACTION );
+ // setId( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT );
}
-
-
+
/**
* @see Action#run()
*/
public void run() {
try {
- fBreakpointAdapter.toggleLineBreakpoints( getTargetPart(), getTargetSelection() );
- }
- catch( CoreException e ) {
- XDebugUIPlugin.errorDialog( getTargetPart().getSite().getShell(),"Error", "Operation failed" , e.getStatus() );
+ fBreakpointAdapter.toggleLineBreakpoints(getTargetPart(),
+ getTargetSelection());
+ } catch (CoreException e) {
+ XDebugUIPlugin.errorDialog(getTargetPart().getSite().getShell(),
+ "Error", "Operation failed", e.getStatus());
}
}
-
+
/**
* Returns this action's vertical ruler info.
- *
+ *
* @return this action's vertical ruler
*/
protected IVerticalRulerInfo getVerticalRulerInfo() {
@@ -78,45 +83,46 @@ public class ToggleBreakpointRulerAction extends Action {
return this.fTargetPart;
}
- private void setTargetPart( IWorkbenchPart targetPart ) {
+ private void setTargetPart(IWorkbenchPart targetPart) {
this.fTargetPart = targetPart;
}
/**
- * Returns the current selection in the active part, possibly
- * and empty selection, but never null.
+ * Returns the current selection in the active part, possibly and empty
+ * selection, but never null.
*
* @return the selection in the active part, possibly empty
*/
private ISelection getTargetSelection() {
IDocument doc = getDocument();
- if ( doc != null ) {
- int line = getVerticalRulerInfo().getLineOfLastMouseButtonActivity();
+ if (doc != null) {
+ int line = getVerticalRulerInfo()
+ .getLineOfLastMouseButtonActivity();
try {
- IRegion region = doc.getLineInformation( line );
- return new TextSelection( doc, region.getOffset(), region.getLength() );
+ IRegion region = doc.getLineInformation(line);
+ return new TextSelection(doc, region.getOffset(), region
+ .getLength());
+ } catch (BadLocationException e) {
+ DebugPlugin.log(e);
}
- catch( BadLocationException e ) {
- DebugPlugin.log( e );
- }
}
return EMPTY_SELECTION;
}
private IDocument getDocument() {
IWorkbenchPart targetPart = getTargetPart();
- if ( targetPart instanceof ITextEditor ) {
- ITextEditor textEditor = (ITextEditor)targetPart;
+ if (targetPart instanceof ITextEditor) {
+ ITextEditor textEditor = (ITextEditor) targetPart;
IDocumentProvider provider = textEditor.getDocumentProvider();
- if ( provider != null )
- return provider.getDocument( textEditor.getEditorInput() );
+ if (provider != null)
+ return provider.getDocument(textEditor.getEditorInput());
}
-// else if ( targetPart instanceof DisassemblyView ) {
-// DisassemblyView dv = (DisassemblyView)targetPart;
-// IDocumentProvider provider = dv.getDocumentProvider();
-// if ( provider != null )
-// return provider.getDocument( dv.getInput() );
-// }
+ // else if ( targetPart instanceof DisassemblyView ) {
+ // DisassemblyView dv = (DisassemblyView)targetPart;
+ // IDocumentProvider provider = dv.getDocumentProvider();
+ // if ( provider != null )
+ // return provider.getDocument( dv.getInput() );
+ // }
return null;
}
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java
index 858937f..07b24f1 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPDebugModelPresentation.java
@@ -1,7 +1,5 @@
package net.sourceforge.phpeclipse.xdebug.ui.php.launching;
-
-
import net.sourceforge.phpeclipse.xdebug.php.model.XDebugLineBreakpoint;
import net.sourceforge.phpeclipse.xdebug.php.model.XDebugStackFrame;
import net.sourceforge.phpeclipse.xdebug.php.model.XDebugTarget;
@@ -40,26 +38,28 @@ public class PHPDebugModelPresentation implements IDebugModelPresentation {
return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
} else if (element instanceof IMarker) {
return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
- } else if (element instanceof XDebugStackFrame || element instanceof XDebugThread || element instanceof XDebugTarget) {
+ } else if (element instanceof XDebugStackFrame
+ || element instanceof XDebugThread
+ || element instanceof XDebugTarget) {
return null;
} else if (element instanceof XDebugVariable) {
- return getVariableImage((XDebugVariable)element);
+ return getVariableImage((XDebugVariable) element);
} else if (element instanceof XDebugValue) {
- return getValueImage((XDebugValue)element);
+ return getValueImage((XDebugValue) element);
}
return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
}
+
private Image getVariableImage(XDebugVariable phpVar) {
- /* if (phpVar != null) {
- if (phpVar.isLocal())
- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
- if (phpVar.isHashValue())
- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
- }
+ /*
+ * if (phpVar != null) { if (phpVar.isLocal()) return
+ * DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); if
+ * (phpVar.isHashValue()) return
+ * DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE); }
*/
return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
}
-
+
private Image getValueImage(XDebugValue phpVar) {
if (phpVar != null) {
return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
@@ -67,7 +67,6 @@ public class PHPDebugModelPresentation implements IDebugModelPresentation {
return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_VARIABLE);
}
-
public String getText(Object element) {
// TODO Auto-generated method stub
return null;
@@ -101,20 +100,23 @@ public class PHPDebugModelPresentation implements IDebugModelPresentation {
public IEditorInput getEditorInput(Object element) {
if (element instanceof IFile) {
- return new FileEditorInput((IFile)element);
+ return new FileEditorInput((IFile) element);
}
if (element instanceof ILineBreakpoint) {
- return new FileEditorInput((IFile)((ILineBreakpoint)element).getMarker().getResource());
+ return new FileEditorInput((IFile) ((ILineBreakpoint) element)
+ .getMarker().getResource());
}
return null;
}
public String getEditorId(IEditorInput input, Object element) {
- IEditorRegistry registry= PlatformUI.getWorkbench().getEditorRegistry();
- IEditorDescriptor descriptor= registry.getDefaultEditor(input.getName());
+ IEditorRegistry registry = PlatformUI.getWorkbench()
+ .getEditorRegistry();
+ IEditorDescriptor descriptor = registry.getDefaultEditor(input
+ .getName());
if (descriptor != null)
return descriptor.getId();
-
+
return null;
}
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPEnvironmentTab.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPEnvironmentTab.java
index 9133de0..eb99160 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPEnvironmentTab.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPEnvironmentTab.java
@@ -419,8 +419,14 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
EnvironmentVariable existingVariable = (EnvironmentVariable) items[i]
.getData();
if (existingVariable.getName().equals(name)) {
- boolean overWrite = MessageDialog.openQuestion(getShell(),"Overwrite variable?",
- MessageFormat.format("A variable named {0} already exists. Overwrite?",new String[] { name }));
+ boolean overWrite = MessageDialog
+ .openQuestion(
+ getShell(),
+ "Overwrite variable?",
+ MessageFormat
+ .format(
+ "A variable named {0} already exists. Overwrite?",
+ new String[] { name }));
if (!overWrite) {
return false;
}
@@ -756,8 +762,9 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
*
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
*/
- public Image getImage() {
- return XDebugUIPluginImages.get(XDebugUIPluginImages.IMG_EVIEW_ENVIROMENT_TAB);
+ public Image getImage() {
+ return XDebugUIPluginImages
+ .get(XDebugUIPluginImages.IMG_EVIEW_ENVIROMENT_TAB);
}
/*
@@ -826,16 +833,19 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab {
// * @see org.eclipse.jface.window.Window#getInitialSize()
// */
// protected Point getInitialSize() {
- // Point size = super.getInitialSize();
- // return DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(), size);
- // }
-
- // /* (non-Javadoc)
- // * @see org.eclipse.jface.window.Window#close()
- // */
- // public boolean close() {
- // DialogSettingsHelper.persistShellGeometry(getShell(), getDialogSettingsSectionName());
- // return super.close();
- // }
+ // Point size = super.getInitialSize();
+ // return
+ // DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(),
+ // size);
+ // }
+
+ // /* (non-Javadoc)
+ // * @see org.eclipse.jface.window.Window#close()
+ // */
+ // public boolean close() {
+ // DialogSettingsHelper.persistShellGeometry(getShell(),
+ // getDialogSettingsSectionName());
+ // return super.close();
+ // }
}
}
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPMainTab.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPMainTab.java
index ba510c2..ed5f1b0 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPMainTab.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPMainTab.java
@@ -1,6 +1,7 @@
package net.sourceforge.phpeclipse.xdebug.ui.php.launching;
import java.io.File;
+
import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import net.sourceforge.phpdt.internal.ui.util.PHPFileSelector;
import net.sourceforge.phpdt.internal.ui.util.PHPProjectSelector;
@@ -39,15 +40,22 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
// Project UI widgets
protected Text fProjText;
+
protected Button fProjButton;
// Main class UI widgets
protected Text fMainText;
+
protected Button fSearchButton;
+
protected PHPProjectSelector projectSelector;
+
protected PHPFileSelector fileSelector;
+
private Button fUseDefaultInterpreterButton;
+
private Button fInterpreterButton;
+
private Text fInterpreterText;
public PHPMainTab() {
@@ -59,7 +67,8 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
Composite comp = new Composite(parent, SWT.NONE);
setControl(comp);
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB);
+ // PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
+ // IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB);
GridLayout topLayout = new GridLayout();
topLayout.verticalSpacing = 0;
comp.setLayout(topLayout);
@@ -74,12 +83,13 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
/**
* Creates the widgets for specifying a main type.
- *
- * @param parent the parent composite
+ *
+ * @param parent
+ * the parent composite
*/
private void createProjectEditor(Composite parent) {
- Font font= parent.getFont();
- Group group= new Group(parent, SWT.NONE);
+ Font font = parent.getFont();
+ Group group = new Group(parent, SWT.NONE);
group.setText("Project:");
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
group.setLayoutData(gd);
@@ -89,7 +99,8 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
group.setFont(font);
projectSelector = new PHPProjectSelector(group);
- projectSelector.setBrowseDialogMessage("Choose the project containing the application entry point:");
+ projectSelector
+ .setBrowseDialogMessage("Choose the project containing the application entry point:");
projectSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
projectSelector.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
@@ -98,15 +109,15 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
});
}
-
/**
* Creates the widgets for specifying a php file.
- *
- * @param parent the parent composite
+ *
+ * @param parent
+ * the parent composite
*/
private void createMainTypeEditor(Composite parent) {
- Font font= parent.getFont();
- Group mainGroup= new Group(parent, SWT.NONE);
+ Font font = parent.getFont();
+ Group mainGroup = new Group(parent, SWT.NONE);
mainGroup.setText("File: ");
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
mainGroup.setLayoutData(gd);
@@ -116,7 +127,8 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
mainGroup.setFont(font);
fileSelector = new PHPFileSelector(mainGroup, projectSelector);
- fileSelector.setBrowseDialogMessage("Choose the PHP file that represents the application entry point:");
+ fileSelector
+ .setBrowseDialogMessage("Choose the PHP file that represents the application entry point:");
fileSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fileSelector.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
@@ -127,12 +139,13 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
/**
* Creates the widgets for specifying debug settings.
- *
- * @param parent the parent composite
+ *
+ * @param parent
+ * the parent composite
*/
private void createInterpreterEditor(Composite parent) {
- Font font= parent.getFont();
- Group interpreterGroup= new Group(parent, SWT.NONE);
+ Font font = parent.getFont();
+ Group interpreterGroup = new Group(parent, SWT.NONE);
interpreterGroup.setText("Interpreter: ");
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
interpreterGroup.setLayoutData(gd);
@@ -141,8 +154,8 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
interpreterGroup.setLayout(layout);
interpreterGroup.setFont(font);
- fInterpreterText= new Text(interpreterGroup, SWT.SINGLE | SWT.BORDER);
- gd= new GridData(GridData.FILL_HORIZONTAL);
+ fInterpreterText = new Text(interpreterGroup, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
fInterpreterText.setLayoutData(gd);
fInterpreterText.setFont(font);
fInterpreterText.addModifyListener(new ModifyListener() {
@@ -151,24 +164,25 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
}
});
-
- fInterpreterButton= createPushButton(interpreterGroup,"Browse..", null);
+ fInterpreterButton = createPushButton(interpreterGroup, "Browse..",
+ null);
fInterpreterButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleBrowseSellected(event);
}
});
- fUseDefaultInterpreterButton = new Button(interpreterGroup,SWT.CHECK);
+ fUseDefaultInterpreterButton = new Button(interpreterGroup, SWT.CHECK);
fUseDefaultInterpreterButton.setText("Use default interpreter");
gd = new GridData(GridData.FILL_HORIZONTAL);
fUseDefaultInterpreterButton.setLayoutData(gd);
fUseDefaultInterpreterButton.setFont(font);
- fUseDefaultInterpreterButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleDefaultSellected(event);
- }
- });
+ fUseDefaultInterpreterButton
+ .addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ handleDefaultSellected(event);
+ }
+ });
}
@@ -192,28 +206,27 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
return fUseDefaultInterpreterButton.getSelection();
}
-
-
protected void handleDefaultSellected(SelectionEvent event) {
setInterpreterTextEnabledState();
updateLaunchConfigurationDialog();
-// if (isDefaultInterpreter()) {
-// fInterpreterText.setText("default Interpreter");
-// }
+ // if (isDefaultInterpreter()) {
+ // fInterpreterText.setText("default Interpreter");
+ // }
}
protected void handleBrowseSellected(SelectionEvent event) {
- FileDialog dlg=new FileDialog(getShell(),SWT.OPEN);
- String fileName=dlg.open();
- if (fileName!=null) {
+ FileDialog dlg = new FileDialog(getShell(), SWT.OPEN);
+ String fileName = dlg.open();
+ if (fileName != null) {
fInterpreterText.setText(fileName);
updateLaunchConfigurationDialog();
}
}
protected IProject getContext() {
- IWorkbenchPage page= XDebugCorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage page = XDebugCorePlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
if (page != null) {
ISelection selection = page.getSelection();
if (selection instanceof IStructuredSelection) {
@@ -239,25 +252,29 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
IProject project = getContext();
if (project != null)
- configuration.setAttribute(IXDebugConstants.ATTR_PHP_PROJECT, project.getName());
+ configuration.setAttribute(IXDebugConstants.ATTR_PHP_PROJECT,
+ project.getName());
}
-
public void initializeFrom(ILaunchConfiguration configuration) {
try {
- String project = configuration.getAttribute(IXDebugConstants.ATTR_PHP_PROJECT, (String)null);
+ String project = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_PROJECT, (String) null);
if (project != null) {
- projectSelector.setSelectionText(project);
+ projectSelector.setSelectionText(project);
}
- String file = configuration.getAttribute(IXDebugConstants.ATTR_PHP_FILE, (String)null);
+ String file = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_FILE, (String) null);
if (file != null) {
fileSelector.setSelectionText(file);
}
- String interpreterFile=configuration.getAttribute(IXDebugConstants.ATTR_PHP_INTERPRETER, (String) null);
- if(interpreterFile!=null)
+ String interpreterFile = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_INTERPRETER, (String) null);
+ if (interpreterFile != null)
fInterpreterText.setText(interpreterFile);
- boolean selection=configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEFAULT_INTERPRETER, true);
+ boolean selection = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_DEFAULT_INTERPRETER, true);
fUseDefaultInterpreterButton.setSelection(selection);
setInterpreterTextEnabledState();
@@ -274,30 +291,36 @@ public class PHPMainTab extends AbstractLaunchConfigurationTab {
configuration.setAttribute(IXDebugConstants.ATTR_PHP_PROJECT, project);
IFile file = fileSelector.getSelection();
- configuration.setAttribute(IXDebugConstants.ATTR_PHP_FILE, file == null ? "" : file.getProjectRelativePath()
- .toString());
- configuration.setAttribute(IXDebugConstants.ATTR_PHP_DEFAULT_INTERPRETER, this.fUseDefaultInterpreterButton.getSelection());
- configuration.setAttribute(IXDebugConstants.ATTR_PHP_INTERPRETER, this.fInterpreterText.getText());
+ configuration.setAttribute(IXDebugConstants.ATTR_PHP_FILE,
+ file == null ? "" : file.getProjectRelativePath().toString());
+ configuration.setAttribute(
+ IXDebugConstants.ATTR_PHP_DEFAULT_INTERPRETER,
+ this.fUseDefaultInterpreterButton.getSelection());
+ configuration.setAttribute(IXDebugConstants.ATTR_PHP_INTERPRETER,
+ this.fInterpreterText.getText());
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
public boolean isValid(ILaunchConfiguration launchConfig) {
setErrorMessage(null);
- String projectName=projectSelector.getSelectionText().trim();
- IProject project=ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ String projectName = projectSelector.getSelectionText().trim();
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
if (!project.exists()) {
setErrorMessage("Project does not exist");
return false;
}
- String fileName=fileSelector.getSelectionText().trim();
+ String fileName = fileSelector.getSelectionText().trim();
if (fileName.equals("")) {
setErrorMessage("No file selected.");
return false;
}
- IFile file=project.getFile(fileName);
+ IFile file = project.getFile(fileName);
if (!file.exists()) {
setErrorMessage("File does not exist");
return false;
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPTabGroup.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPTabGroup.java
index 74e0284..7f2c6e4 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPTabGroup.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/PHPTabGroup.java
@@ -8,14 +8,9 @@ import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
public class PHPTabGroup extends AbstractLaunchConfigurationTabGroup {
-
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- setTabs(new ILaunchConfigurationTab[] {
- new PHPMainTab(),
- new XDebugTab(),
- new SourceLookupTab(),
- new PHPEnvironmentTab(),
- new CommonTab()
- });
+ setTabs(new ILaunchConfigurationTab[] { new PHPMainTab(),
+ new XDebugTab(), new SourceLookupTab(),
+ new PHPEnvironmentTab(), new CommonTab() });
}
}
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/XDebugTab.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/XDebugTab.java
index 70dd943..e3ed6ac 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/XDebugTab.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/launching/XDebugTab.java
@@ -23,7 +23,9 @@ import org.eclipse.swt.widgets.Text;
public class XDebugTab extends AbstractLaunchConfigurationTab {
private Label fPortLabel;
+
private Button fUseDefaultPortButton;
+
private Text fPortText;
public XDebugTab() {
@@ -32,10 +34,11 @@ public class XDebugTab extends AbstractLaunchConfigurationTab {
public void createControl(Composite parent) {
Font font = parent.getFont();
-
+
Composite comp = new Composite(parent, SWT.NONE);
setControl(comp);
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB);
+ // PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
+ // IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_MAIN_TAB);
GridLayout topLayout = new GridLayout();
topLayout.verticalSpacing = 0;
comp.setLayout(topLayout);
@@ -43,27 +46,26 @@ public class XDebugTab extends AbstractLaunchConfigurationTab {
createDebugPortEditor(comp);
}
-
+
private void createDebugPortEditor(Composite parent) {
- Font font= parent.getFont();
- Group debugGroup= new Group(parent, SWT.NONE);
- debugGroup.setText("Debug: ");
+ Font font = parent.getFont();
+ Group debugGroup = new Group(parent, SWT.NONE);
+ debugGroup.setText("Debug: ");
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
debugGroup.setLayoutData(gd);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
debugGroup.setLayout(layout);
debugGroup.setFont(font);
-
+
fPortLabel = new Label(debugGroup, SWT.NONE);
fPortLabel.setText("&DebugPort:");
-// gd = new GridData(GridData.BEGINNING);
-// fPortLabel.setLayoutData(gd);
+ // gd = new GridData(GridData.BEGINNING);
+ // fPortLabel.setLayoutData(gd);
fPortLabel.setFont(font);
-
fPortText = new Text(debugGroup, SWT.SINGLE | SWT.BORDER);
- gd= new GridData(GridData.FILL_HORIZONTAL);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
fPortText.setLayoutData(gd);
fPortText.setFont(font);
fPortText.addModifyListener(new ModifyListener() {
@@ -72,9 +74,7 @@ public class XDebugTab extends AbstractLaunchConfigurationTab {
}
});
-
-
- fUseDefaultPortButton = new Button(debugGroup,SWT.CHECK);
+ fUseDefaultPortButton = new Button(debugGroup, SWT.CHECK);
fUseDefaultPortButton.setText("Use default interpreter");
gd = new GridData(GridData.FILL_HORIZONTAL);
fUseDefaultPortButton.setLayoutData(gd);
@@ -85,7 +85,7 @@ public class XDebugTab extends AbstractLaunchConfigurationTab {
}
});
}
-
+
/**
* Set the appropriate enabled state for the appletviewqer text widget.
*/
@@ -98,7 +98,7 @@ public class XDebugTab extends AbstractLaunchConfigurationTab {
fPortLabel.setEnabled(true);
}
}
-
+
/**
* Returns whether the default appletviewer is to be used
*/
@@ -106,13 +106,11 @@ public class XDebugTab extends AbstractLaunchConfigurationTab {
return fUseDefaultPortButton.getSelection();
}
-
protected void handleDefaultSellected(SelectionEvent event) {
setDebugportEnabledState();
updateLaunchConfigurationDialog();
}
-
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
// TODO Auto-generated method stub
@@ -120,36 +118,42 @@ public class XDebugTab extends AbstractLaunchConfigurationTab {
public void initializeFrom(ILaunchConfiguration configuration) {
try {
- String portText=""+configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEBUGPORT, 9000);
+ String portText = ""
+ + configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_DEBUGPORT, 9000);
fPortText.setText(portText);
- boolean selection=configuration.getAttribute(IXDebugConstants.ATTR_PHP_DEFAULT_DEBUGPORT, true);
+ boolean selection = configuration.getAttribute(
+ IXDebugConstants.ATTR_PHP_DEFAULT_DEBUGPORT, true);
fUseDefaultPortButton.setSelection(selection);
setDebugportEnabledState();
} catch (CoreException e) {
setErrorMessage(e.getMessage());
}
-
}
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(IXDebugConstants.ATTR_PHP_DEFAULT_DEBUGPORT, this.fUseDefaultPortButton.getSelection());
+ configuration.setAttribute(IXDebugConstants.ATTR_PHP_DEFAULT_DEBUGPORT,
+ this.fUseDefaultPortButton.getSelection());
try {
- configuration.setAttribute(IXDebugConstants.ATTR_PHP_DEBUGPORT, Integer.parseInt(this.fPortText.getText().trim()));
+ configuration.setAttribute(IXDebugConstants.ATTR_PHP_DEBUGPORT,
+ Integer.parseInt(this.fPortText.getText().trim()));
} catch (NumberFormatException nfe) {
}
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
public boolean isValid(ILaunchConfiguration launchConfig) {
setErrorMessage(null);
try {
Integer.parseInt(fPortText.getText().trim());
- } catch(NumberFormatException nfe) {
- setErrorMessage("Debugport is not a valid integer");
+ } catch (NumberFormatException nfe) {
+ setErrorMessage("Debugport is not a valid integer");
return false;
}
return true;
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/model/PHPBreakpointAdapterFactory.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/model/PHPBreakpointAdapterFactory.java
index 1124273..7defbc5 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/model/PHPBreakpointAdapterFactory.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/model/PHPBreakpointAdapterFactory.java
@@ -13,7 +13,7 @@ public class PHPBreakpointAdapterFactory implements IAdapterFactory {
}
public Class[] getAdapterList() {
- return new Class[]{IToggleBreakpointsTarget.class};
+ return new Class[] { IToggleBreakpointsTarget.class };
}
}
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/model/PHPLineBreakpointAdapter.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/model/PHPLineBreakpointAdapter.java
index e2a5415..0138aee 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/model/PHPLineBreakpointAdapter.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/php/model/PHPLineBreakpointAdapter.java
@@ -18,26 +18,30 @@ public class PHPLineBreakpointAdapter implements IToggleBreakpointsTarget {
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection)
throws CoreException {
- IEditorPart editorPart = (IEditorPart)part;
+ IEditorPart editorPart = (IEditorPart) part;
- IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
+ IResource resource = (IResource) editorPart.getEditorInput()
+ .getAdapter(IResource.class);
ITextSelection textSelection = (ITextSelection) selection;
- int lineNumber = textSelection.getStartLine()+1;
- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IXDebugConstants.ID_PHP_DEBUG_MODEL);
+ int lineNumber = textSelection.getStartLine() + 1;
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault()
+ .getBreakpointManager().getBreakpoints(
+ IXDebugConstants.ID_PHP_DEBUG_MODEL);
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
if (resource.equals(breakpoint.getMarker().getResource())) {
- if (((ILineBreakpoint)breakpoint).getLineNumber() == (lineNumber )) {
- // remove
+ if (((ILineBreakpoint) breakpoint).getLineNumber() == (lineNumber)) {
+ // remove
breakpoint.delete();
return;
}
}
}
- // create line breakpoint (doc line numbers start at 0)
- XDebugLineBreakpoint lineBreakpoint = new XDebugLineBreakpoint(resource, lineNumber);
-// DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
-
+ // create line breakpoint (doc line numbers start at 0)
+ XDebugLineBreakpoint lineBreakpoint = new XDebugLineBreakpoint(
+ resource, lineNumber);
+ // DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
+
}
public boolean canToggleLineBreakpoints(IWorkbenchPart part,
diff --git a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/preference/XDebugPreferencePage.java b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/preference/XDebugPreferencePage.java
index 58580b8..50435bf 100644
--- a/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/preference/XDebugPreferencePage.java
+++ b/net.sourceforge.phpeclipse.xdebug.ui/src/net/sourceforge/phpeclipse/xdebug/ui/preference/XDebugPreferencePage.java
@@ -11,22 +11,25 @@ import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-
public class XDebugPreferencePage extends FieldEditorPreferencePage implements
IWorkbenchPreferencePage {
/* Preference page for the default XDebug-Settings */
-
+
public XDebugPreferencePage() {
super(FieldEditorPreferencePage.GRID);
// Set the preference store for the preference page.
- IPreferenceStore store =
- XDebugCorePlugin.getDefault().getPreferenceStore();
- store.setDefault(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE,IXDebugPreferenceConstants.DEFAULT_DEBUGPORT);
- // get the default form the externalToolsPlugin
- String interpreter=ExternalToolsPlugin.getDefault().getPreferenceStore().getString(ExternalToolsPlugin.PHP_RUN_PREF);
- store.setDefault(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE,interpreter);
+ IPreferenceStore store = XDebugCorePlugin.getDefault()
+ .getPreferenceStore();
+ store.setDefault(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE,
+ IXDebugPreferenceConstants.DEFAULT_DEBUGPORT);
+ // get the default form the externalToolsPlugin
+ String interpreter = ExternalToolsPlugin.getDefault()
+ .getPreferenceStore().getString(
+ ExternalToolsPlugin.PHP_RUN_PREF);
+ store.setDefault(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE,
+ interpreter);
setPreferenceStore(store);
}
@@ -35,18 +38,19 @@ public class XDebugPreferencePage extends FieldEditorPreferencePage implements
}
protected void createFieldEditors() {
- IntegerFieldEditor debugPort = new IntegerFieldEditor(IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE, "&Debugport:", getFieldEditorParent(),5);
- debugPort.setValidRange(1025,65535);
+ IntegerFieldEditor debugPort = new IntegerFieldEditor(
+ IXDebugPreferenceConstants.DEBUGPORT_PREFERENCE, "&Debugport:",
+ getFieldEditorParent(), 5);
+ debugPort.setValidRange(1025, 65535);
debugPort.setErrorMessage("Debugport must be between 1024 and 65536");
addField(debugPort);
-
- FileFieldEditor phpInterpreter = new FileFieldEditor(IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE, "PHP &Interpreter:",true,getFieldEditorParent());
- phpInterpreter.setErrorMessage("File not found");
- addField(phpInterpreter);
-
- }
-
+ FileFieldEditor phpInterpreter = new FileFieldEditor(
+ IXDebugPreferenceConstants.PHP_INTERPRETER_PREFERENCE,
+ "PHP &Interpreter:", true, getFieldEditorParent());
+ phpInterpreter.setErrorMessage("File not found");
+ addField(phpInterpreter);
+ }
}
diff --git a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/model/XMLDocument.java b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/model/XMLDocument.java
index 7fb5ab3..c0b5680 100644
--- a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/model/XMLDocument.java
+++ b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/model/XMLDocument.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API
*
- * $Id: XMLDocument.java,v 1.1 2004-09-02 18:26:55 jsurfer Exp $
+ * $Id: XMLDocument.java,v 1.2 2006-10-21 23:13:43 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.core.internal.model;
@@ -26,124 +26,135 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
/**
- *
+ *
*/
-public class XMLDocument extends SourceReference implements IXMLDocument, IDocumentListener {
- // Instance Variables ------------------------------------------------------
-
- private IXMLElement root;
-
- private String systemId;
-
- private Object dirtyLock = new Object();
-
- private boolean dirty = true;
-
- // Constructors ------------------------------------------------------------
-
- public XMLDocument(IDocument document, String systemId) {
- super(document, 0, document.getLength());
- this.systemId = systemId;
- }
-
- // IXMLDocument Implementation ---------------------------------------------
-
- /*
- * @see IXMLDocument#getRoot()
- */
- public IXMLElement getRoot() {
- return root;
- }
-
- /*
- * @see net.sourceforge.phpeclipse.xml.core.model.IXMLDocument#getSystemId()
- */
- public String getSystemId() {
- return systemId;
- }
-
- /*
- * @see IStyleSheet#reconcile(IProblemCollector)
- */
- public void reconcile(IProblemCollector problemCollector, IFile file) {
- synchronized (dirtyLock) {
- if (!dirty) {
- return;
- }
- dirty = false;
- }
-
- synchronized (this) {
- boolean doParse = false;
- root = null;
- if (file != null) {
- String filename = file.getLocation().toString();
- int len = filename.length();
- if (len >= 4) {
- if ((filename.charAt(len - 1) != 'l' && filename.charAt(len - 1) != 'L')
- || (filename.charAt(len - 2) != 'p' && filename.charAt(len - 2) != 'P')
- || (filename.charAt(len - 3) != 't' && filename.charAt(len - 3) != 'T')
- || (filename.charAt(len - 4) != '.')) {
- if ((filename.charAt(len - 1) != 'm' && filename.charAt(len - 1) != 'M')
- || (filename.charAt(len - 2) != 't' && filename.charAt(len - 2) != 'T')
- || (filename.charAt(len - 3) != 'h' && filename.charAt(len - 3) != 'H')
- || (filename.charAt(len - 4) != '.')) {
- if (len >= 5) {
- if ((filename.charAt(len - 1) != 'l' && filename.charAt(len - 1) != 'L')
- || (filename.charAt(len - 2) != 'm' && filename.charAt(len - 2) != 'M')
- || (filename.charAt(len - 3) != 't' && filename.charAt(len - 3) != 'T')
- || (filename.charAt(len - 4) != 'h' && filename.charAt(len - 4) != 'H')
- || (filename.charAt(len - 5) != '.')) {
- doParse = true;
- }
- }
- }
- }
- } else {
- doParse = true;
- }
- }
- if (doParse) {
- IXMLParser parser = new XMLParser();
- parser.setProblemCollector(problemCollector);
- parser.setSource(getDocument());
- parser.setSystemId(systemId);
- IXMLDocument model = parser.parse();
- if (model != null) {
- root = model.getRoot();
- }
- }
- }
- }
-
- // IDocumentListener Implementation ----------------------------------------
-
- /*
- * @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- // do nothing
- }
-
- /*
- * @see IDocumentListener#documentChanged(DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- synchronized (dirtyLock) {
- dirty = true;
- }
- }
-
- // Public Methods ----------------------------------------------------------
-
- /**
- * Sets the root element.
- *
- * @param root
- * the root element to set
- */
- public void setRoot(IXMLElement root) {
- this.root = root;
- }
+public class XMLDocument extends SourceReference implements IXMLDocument,
+ IDocumentListener {
+ // Instance Variables ------------------------------------------------------
+
+ private IXMLElement root;
+
+ private String systemId;
+
+ private Object dirtyLock = new Object();
+
+ private boolean dirty = true;
+
+ // Constructors ------------------------------------------------------------
+
+ public XMLDocument(IDocument document, String systemId) {
+ super(document, 0, document.getLength());
+ this.systemId = systemId;
+ }
+
+ // IXMLDocument Implementation ---------------------------------------------
+
+ /*
+ * @see IXMLDocument#getRoot()
+ */
+ public IXMLElement getRoot() {
+ return root;
+ }
+
+ /*
+ * @see net.sourceforge.phpeclipse.xml.core.model.IXMLDocument#getSystemId()
+ */
+ public String getSystemId() {
+ return systemId;
+ }
+
+ /*
+ * @see IStyleSheet#reconcile(IProblemCollector)
+ */
+ public void reconcile(IProblemCollector problemCollector, IFile file) {
+ synchronized (dirtyLock) {
+ if (!dirty) {
+ return;
+ }
+ dirty = false;
+ }
+
+ synchronized (this) {
+ boolean doParse = false;
+ root = null;
+ if (file != null) {
+ String filename = file.getLocation().toString();
+ int len = filename.length();
+ if (len >= 4) {
+ if ((filename.charAt(len - 1) != 'l' && filename
+ .charAt(len - 1) != 'L')
+ || (filename.charAt(len - 2) != 'p' && filename
+ .charAt(len - 2) != 'P')
+ || (filename.charAt(len - 3) != 't' && filename
+ .charAt(len - 3) != 'T')
+ || (filename.charAt(len - 4) != '.')) {
+ if ((filename.charAt(len - 1) != 'm' && filename
+ .charAt(len - 1) != 'M')
+ || (filename.charAt(len - 2) != 't' && filename
+ .charAt(len - 2) != 'T')
+ || (filename.charAt(len - 3) != 'h' && filename
+ .charAt(len - 3) != 'H')
+ || (filename.charAt(len - 4) != '.')) {
+ if (len >= 5) {
+ if ((filename.charAt(len - 1) != 'l' && filename
+ .charAt(len - 1) != 'L')
+ || (filename.charAt(len - 2) != 'm' && filename
+ .charAt(len - 2) != 'M')
+ || (filename.charAt(len - 3) != 't' && filename
+ .charAt(len - 3) != 'T')
+ || (filename.charAt(len - 4) != 'h' && filename
+ .charAt(len - 4) != 'H')
+ || (filename.charAt(len - 5) != '.')) {
+ doParse = true;
+ }
+ }
+ }
+ }
+ } else {
+ doParse = true;
+ }
+ }
+ if (doParse) {
+ IXMLParser parser = new XMLParser();
+ parser.setProblemCollector(problemCollector);
+ parser.setSource(getDocument());
+ parser.setSystemId(systemId);
+ IXMLDocument model = parser.parse();
+ if (model != null) {
+ root = model.getRoot();
+ }
+ }
+ }
+ }
+
+ // IDocumentListener Implementation ----------------------------------------
+
+ /*
+ * @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
+ */
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ // do nothing
+ }
+
+ /*
+ * @see IDocumentListener#documentChanged(DocumentEvent)
+ */
+ public void documentChanged(DocumentEvent event) {
+ synchronized (dirtyLock) {
+ dirty = true;
+ }
+ }
+
+ // Public Methods ----------------------------------------------------------
+
+ /**
+ * Sets the root element.
+ *
+ * @param root
+ * the root element to set
+ */
+ public void setRoot(IXMLElement root) {
+ this.root = root;
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/model/XMLElement.java b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/model/XMLElement.java
index 2200619..3499412 100644
--- a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/model/XMLElement.java
+++ b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/model/XMLElement.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API
*
- * $Id: XMLElement.java,v 1.1 2004-09-02 18:26:55 jsurfer Exp $
+ * $Id: XMLElement.java,v 1.2 2006-10-21 23:13:43 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.core.internal.model;
@@ -31,7 +31,9 @@ public class XMLElement extends SourceReference implements IXMLElement {
private List children;
private String localName;
+
private String namespaceURI;
+
private String prefix;
private IXMLElement parent;
@@ -50,41 +52,42 @@ public class XMLElement extends SourceReference implements IXMLElement {
super(document, offset, length);
}
- // IXMLElement Implementation -------------------------------------------------
+ // IXMLElement Implementation
+ // -------------------------------------------------
- /*
+ /*
* @see IXMLElement#getChildren()
*/
public IXMLElement[] getChildren() {
if (children != null) {
- return (IXMLElement[]) children.toArray(
- new IXMLElement[children.size()]);
+ return (IXMLElement[]) children.toArray(new IXMLElement[children
+ .size()]);
}
return new IXMLElement[0];
}
- /*
+ /*
* @see IXMLElement#getLocalName()
*/
public String getLocalName() {
return localName;
}
- /*
+ /*
* @see IXMLElement#getNamespaceURI()
*/
public String getNamespaceURI() {
return namespaceURI;
}
- /*
+ /*
* @see IXMLElement#getPrefix()
*/
public String getPrefix() {
return prefix;
}
- /*
+ /*
* @see IXMLElement#getParent()
*/
public IXMLElement getParent() {
diff --git a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/parser/DefaultProblem.java b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/parser/DefaultProblem.java
index bb933e1..39ca7e5 100644
--- a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/parser/DefaultProblem.java
+++ b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/parser/DefaultProblem.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: DefaultProblem.java,v 1.1 2004-09-02 18:26:55 jsurfer Exp $
+ * $Id: DefaultProblem.java,v 1.2 2006-10-21 23:13:43 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.core.internal.parser;
@@ -20,9 +20,13 @@ public class DefaultProblem implements IProblem {
// Instance Variables ------------------------------------------------------
private String message;
+
private int sourceStart;
+
private int sourceEnd;
+
private int sourceLineNumber;
+
private boolean error;
// Constructors ------------------------------------------------------------
diff --git a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/parser/XMLParser.java b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/parser/XMLParser.java
index 81a0e64..0428da4 100644
--- a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/parser/XMLParser.java
+++ b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/internal/parser/XMLParser.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API
*
- * $Id: XMLParser.java,v 1.1 2004-09-02 18:26:55 jsurfer Exp $
+ * $Id: XMLParser.java,v 1.2 2006-10-21 23:13:43 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.core.internal.parser;
@@ -39,13 +39,12 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
-
/**
* SAX-based default implementation of the {@link IXMLParser} interface.
*
* TODO This implementation doesn't do error recovery, as SAX doesn't allow it.
- * Maybe we partition the document and parse individual fragments so that
- * errors can be isolated to their source
+ * Maybe we partition the document and parse individual fragments so that errors
+ * can be isolated to their source
*/
public class XMLParser implements IXMLParser {
/**
@@ -58,7 +57,7 @@ public class XMLParser implements IXMLParser {
XMLDocument document;
/**
- * The current top element. That is the element that has been most
+ * The current top element. That is the element that has been most
* recently opened by a start tag.
*/
private XMLElement top;
@@ -83,11 +82,11 @@ public class XMLParser implements IXMLParser {
}
/*
- * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes)
+ * @see org.xml.sax.ContentHandler#startElement(String, String, String,
+ * Attributes)
*/
- public void startElement(
- String namespaceURI, String localName, String qName, Attributes atts
- ) throws SAXException {
+ public void startElement(String namespaceURI, String localName,
+ String qName, Attributes atts) throws SAXException {
if (System.currentTimeMillis() > timeout) {
throw new SAXException("timeout");
}
@@ -103,9 +102,8 @@ public class XMLParser implements IXMLParser {
}
}
- int offset = computeOffset(newTop,
- locator.getLineNumber(),
- locator.getColumnNumber());
+ int offset = computeOffset(newTop, locator.getLineNumber(), locator
+ .getColumnNumber());
if (offset >= 0) {
newTop.setSourceRegion(offset, 0);
@@ -119,12 +117,10 @@ public class XMLParser implements IXMLParser {
/*
* @see org.xml.sax.ContentHandler#endElement(String, String, String)
*/
- public void endElement(
- String namespaceURI, String localName, String qName
- ) throws SAXException {
- int length = computeLength(top,
- locator.getLineNumber(),
- locator.getColumnNumber());
+ public void endElement(String namespaceURI, String localName,
+ String qName) throws SAXException {
+ int length = computeLength(top, locator.getLineNumber(), locator
+ .getColumnNumber());
if (length >= 0) {
top.setSourceRegion(top.getSourceRegion().getOffset(), length);
@@ -136,11 +132,11 @@ public class XMLParser implements IXMLParser {
} else {
// this is the root element
document.setRoot(top);
- }
+ }
top = previousTop;
}
- /*
+ /*
* @see org.xml.sax.ErrorHandler#error(SAXParseException)
*/
public void error(SAXParseException e) throws SAXException {
@@ -149,7 +145,7 @@ public class XMLParser implements IXMLParser {
}
}
- /*
+ /*
* @see org.xml.sax.ErrorHandler#fatalError(SAXParseException)
*/
public void fatalError(SAXParseException e) throws SAXException {
@@ -158,7 +154,7 @@ public class XMLParser implements IXMLParser {
}
}
- /*
+ /*
* @see org.xml.sax.ErrorHandler#warning(SAXParseException)
*/
public void warning(SAXParseException e) throws SAXException {
@@ -182,8 +178,10 @@ public class XMLParser implements IXMLParser {
*
* TODO Limit the location to the current top element
*
- * @param e the SAX parse exception
- * @param error whether the problem is an error or a warning
+ * @param e
+ * the SAX parse exception
+ * @param error
+ * whether the problem is an error or a warning
* @return the created problem object
*/
private IProblem createProblem(SAXParseException e, boolean error) {
@@ -204,8 +202,8 @@ public class XMLParser implements IXMLParser {
ble.printStackTrace();
}
- return new DefaultProblem(e.getLocalizedMessage(),
- offset, offset + length, line, error);
+ return new DefaultProblem(e.getLocalizedMessage(), offset, offset
+ + length, line, error);
}
}
@@ -262,21 +260,21 @@ public class XMLParser implements IXMLParser {
return null;
}
- /*
+ /*
* @see IProblemReporter#setProblemCollector(IProblemCollector)
*/
public void setProblemCollector(IProblemCollector problemCollector) {
this.problemCollector = problemCollector;
}
- /*
+ /*
* @see IXMLParser#setSource(IDocument)
*/
public void setSource(IDocument source) {
this.source = source;
}
- /*
+ /*
* @see IXMLParser#setSystemId(String)
*/
public void setSystemId(String systemId) {
@@ -337,8 +335,8 @@ public class XMLParser implements IXMLParser {
if (column <= 0) {
offset = getOffset(line, 0);
int lastCharColumn = getLastCharColumn(line);
- String lineText = source
- .get(source.getLineOffset(line - 1), lastCharColumn);
+ String lineText = source.get(source.getLineOffset(line - 1),
+ lastCharColumn);
String startTag = getStartTag(element);
int lastIndex = lineText.indexOf(startTag);
@@ -364,9 +362,8 @@ public class XMLParser implements IXMLParser {
return -1;
}
- private IRegion findStringBackward(
- int startOffset, String string
- ) throws BadLocationException {
+ private IRegion findStringBackward(int startOffset, String string)
+ throws BadLocationException {
int offset = startOffset;
int length = string.length();
@@ -382,9 +379,8 @@ public class XMLParser implements IXMLParser {
return null;
}
- private IRegion findStringForward(
- int startOffset, String string
- ) throws BadLocationException {
+ private IRegion findStringForward(int startOffset, String string)
+ throws BadLocationException {
int offset = startOffset;
int length = string.length();
@@ -403,9 +399,10 @@ public class XMLParser implements IXMLParser {
/**
* Given an XML element, this method reconstructs the corresponding end tag
- * of the element, including the namespace prefix if there was one.
+ * of the element, including the namespace prefix if there was one.
*
- * @param element the XML element for which the end tag should be contructed
+ * @param element
+ * the XML element for which the end tag should be contructed
* @return the end tag as string
*/
private String getEndTag(IXMLElement element) {
@@ -422,11 +419,11 @@ public class XMLParser implements IXMLParser {
/**
* Reconstructs and returns the start tag corresponding to the given XML
- * element, excluding any attribute specifications or the closing
+ * element, excluding any attribute specifications or the closing
* > character.
*
- * @param element the XML element for which the start tag should be
- * constructed
+ * @param element
+ * the XML element for which the start tag should be constructed
* @return the start tag as string, excluding everything after the tag name
* itself
*/
@@ -451,8 +448,8 @@ public class XMLParser implements IXMLParser {
int getLastCharColumn(int line) throws BadLocationException {
String lineDelimiter = source.getLineDelimiter(line - 1);
- int lineDelimiterLength = (lineDelimiter != null)
- ? lineDelimiter.length() : 0;
+ int lineDelimiterLength = (lineDelimiter != null) ? lineDelimiter
+ .length() : 0;
return source.getLineLength(line - 1) - lineDelimiterLength;
}
diff --git a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblem.java b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblem.java
index 89e0c2b..cb3cc0b 100644
--- a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblem.java
+++ b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblem.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API
*
- * $Id: IProblem.java,v 1.1 2004-09-02 18:26:55 jsurfer Exp $
+ * $Id: IProblem.java,v 1.2 2006-10-21 23:13:43 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.core.parser;
@@ -50,16 +50,16 @@ public interface IProblem {
/**
* Returns whether the problem is an error.
*
- * @return true if the problem is an error, false
- * otherwise
+ * @return true if the problem is an error,
+ * false otherwise
*/
boolean isError();
/**
* Returns whether the problem is a warning.
*
- * @return true if the problem is a warning, false
- * otherwise
+ * @return true if the problem is a warning,
+ * false otherwise
*/
boolean isWarning();
diff --git a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblemCollector.java b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblemCollector.java
index 72b88fa..0956439 100644
--- a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblemCollector.java
+++ b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblemCollector.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API
*
- * $Id: IProblemCollector.java,v 1.1 2004-09-02 18:26:55 jsurfer Exp $
+ * $Id: IProblemCollector.java,v 1.2 2006-10-21 23:13:43 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.core.parser;
@@ -21,7 +21,8 @@ public interface IProblemCollector {
/**
* Notification of an error or warning.
*
- * @param problem the discovered problem
+ * @param problem
+ * the discovered problem
*/
void addProblem(IProblem problem);
diff --git a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblemReporter.java b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblemReporter.java
index 6d74ec8..7e61474 100644
--- a/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblemReporter.java
+++ b/net.sourceforge.phpeclipse.xml.core/src/net/sourceforge/phpeclipse/xml/core/parser/IProblemReporter.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API
*
- * $Id: IProblemReporter.java,v 1.1 2004-09-02 18:26:55 jsurfer Exp $
+ * $Id: IProblemReporter.java,v 1.2 2006-10-21 23:13:43 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.core.parser;
@@ -21,7 +21,8 @@ public interface IProblemReporter {
/**
* Sets the problem collector that should be used by the reporter.
*
- * @param problemCollector the problem collector to use
+ * @param problemCollector
+ * the problem collector to use
*/
void setProblemCollector(IProblemCollector problemCollector);
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/XMLPlugin.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/XMLPlugin.java
index bbbf329..d886c5a 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/XMLPlugin.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/XMLPlugin.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: XMLPlugin.java,v 1.1 2004-09-02 18:28:04 jsurfer Exp $
+ * $Id: XMLPlugin.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui;
@@ -30,7 +30,7 @@ import org.osgi.framework.BundleContext;
*/
public class XMLPlugin extends AbstractUIPlugin {
public static final String ICON_ELEMENT = "element_obj.gif"; //$NON-NLS-1$
-
+
// The shared instance.
private static XMLPlugin plugin;
@@ -38,6 +38,7 @@ public class XMLPlugin extends AbstractUIPlugin {
private ResourceBundle resources;
private XMLTextTools xmlTextTools;
+
private DTDTextTools dtdTextTools;
/**
@@ -47,8 +48,8 @@ public class XMLPlugin extends AbstractUIPlugin {
plugin = this;
try {
- resources = ResourceBundle.getBundle(
- "net.sourceforge.phpeclipse.xml.ui.XMLPluginResources"); //$NON-NLS-1$
+ resources = ResourceBundle
+ .getBundle("net.sourceforge.phpeclipse.xml.ui.XMLPluginResources"); //$NON-NLS-1$
} catch (MissingResourceException x) {
}
}
@@ -130,8 +131,9 @@ public class XMLPlugin extends AbstractUIPlugin {
* Returns an image descriptor for the image corresponding to the specified
* key (which is the name of the image file).
*
- * @param key The key of the image
- * @return The descriptor for the requested image, or null if
+ * @param key
+ * The key of the image
+ * @return The descriptor for the requested image, or null if
* the image could not be found
*/
private ImageDescriptor getImageDescriptor(String key) {
@@ -142,7 +144,5 @@ public class XMLPlugin extends AbstractUIPlugin {
return null;
}
}
-
-
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/compare/DTDMergeViewer.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/compare/DTDMergeViewer.java
index ac2567d..a833e92 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/compare/DTDMergeViewer.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/compare/DTDMergeViewer.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: DTDMergeViewer.java,v 1.2 2005-05-06 00:55:42 stefanbjarni Exp $
+ * $Id: DTDMergeViewer.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.compare;
@@ -42,7 +42,7 @@ public class DTDMergeViewer extends TextMergeViewer {
private IPreferenceStore preferenceStore;
/**
- * The listener for changes to the preference store.
+ * The listener for changes to the preference store.
*/
private IPropertyChangeListener propertyChangeListener;
@@ -52,11 +52,11 @@ public class DTDMergeViewer extends TextMergeViewer {
private DTDTextTools textTools;
/*
- * @see TextMergeViewer#TextMergeViewer(Composite, int, CompareConfiguration)
+ * @see TextMergeViewer#TextMergeViewer(Composite, int,
+ * CompareConfiguration)
*/
- public DTDMergeViewer(
- Composite parent, int style, CompareConfiguration configuration
- ) {
+ public DTDMergeViewer(Composite parent, int style,
+ CompareConfiguration configuration) {
super(parent, style, configuration);
}
@@ -109,7 +109,7 @@ public class DTDMergeViewer extends TextMergeViewer {
if (propertyChangeListener != null) {
if (preferenceStore != null) {
preferenceStore
- .removePropertyChangeListener(propertyChangeListener);
+ .removePropertyChangeListener(propertyChangeListener);
}
propertyChangeListener = null;
@@ -121,10 +121,9 @@ public class DTDMergeViewer extends TextMergeViewer {
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
String p = event.getProperty();
- if (p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND) ||
- p.equals(AbstractTextEditor
- .PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)
- ) {
+ if (p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)
+ || p
+ .equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
updateBackgroundColor();
} else if (textTools.affectsBehavior(event)) {
invalidateTextPresentation();
@@ -132,14 +131,13 @@ public class DTDMergeViewer extends TextMergeViewer {
}
private void updateBackgroundColor() {
- boolean defaultBackgroundColor = preferenceStore.getBoolean(
- AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
+ boolean defaultBackgroundColor = preferenceStore
+ .getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
if (defaultBackgroundColor) {
setBackgroundColor(null);
} else {
- RGB backgroundColor = PreferenceConverter
- .getColor(preferenceStore,
+ RGB backgroundColor = PreferenceConverter.getColor(preferenceStore,
AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
setBackgroundColor(backgroundColor);
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/compare/XMLMergeViewer.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/compare/XMLMergeViewer.java
index f4f309c..7947a8e 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/compare/XMLMergeViewer.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/compare/XMLMergeViewer.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: XMLMergeViewer.java,v 1.2 2005-05-06 00:55:42 stefanbjarni Exp $
+ * $Id: XMLMergeViewer.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.compare;
@@ -109,8 +109,8 @@ public class XMLMergeViewer extends TextMergeViewer {
protected void handleDispose(DisposeEvent event) {
if (propertyChangeListener != null) {
if (preferenceStore != null) {
- preferenceStore.removePropertyChangeListener(
- propertyChangeListener);
+ preferenceStore
+ .removePropertyChangeListener(propertyChangeListener);
}
propertyChangeListener = null;
@@ -123,7 +123,8 @@ public class XMLMergeViewer extends TextMergeViewer {
String p = event.getProperty();
if (p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)
- || p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
+ || p
+ .equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
updateBackgroundColor();
} else if (textTools.affectsBehavior(event)) {
invalidateTextPresentation();
@@ -131,8 +132,8 @@ public class XMLMergeViewer extends TextMergeViewer {
}
private void updateBackgroundColor() {
- boolean defaultBackgroundColor = preferenceStore.getBoolean(
- AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
+ boolean defaultBackgroundColor = preferenceStore
+ .getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
if (defaultBackgroundColor) {
setBackgroundColor(null);
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/DTDEditor.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/DTDEditor.java
index 953cdbf..43f76d7 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/DTDEditor.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/DTDEditor.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: DTDEditor.java,v 1.2 2005-05-06 00:55:42 stefanbjarni Exp $
+ * $Id: DTDEditor.java,v 1.3 2006-10-21 23:14:14 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.editor;
@@ -24,7 +24,6 @@ import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.texteditor.ContentAssistAction;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-
/**
* DTD Editor.
*
@@ -52,23 +51,24 @@ public class DTDEditor extends TextEditor {
protected boolean affectsTextPresentation(PropertyChangeEvent event) {
return XMLPlugin.getDefault().getDTDTextTools().affectsBehavior(event);
}
+
protected void createActions() {
super.createActions();
- IAction action = new ContentAssistAction(XMLEditorMessages.getResourceBundle(),
- "ContentAssistProposal.", this); //$NON-NLS-1$
- action
- .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- setAction("ContentAssistProposal", action); //$NON-NLS-1$
- markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
-
-// IAction action= new TextOperationAction(
-// TemplateMessages.getResourceBundle(),
-// "Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$
-// this,
-// ISourceViewer.CONTENTASSIST_PROPOSALS);
-// action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
-// setAction(TEMPLATE_PROPOSALS, action);
-// markAsStateDependentAction(TEMPLATE_PROPOSALS, true);
+ IAction action = new ContentAssistAction(XMLEditorMessages
+ .getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
+ action
+ .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ setAction("ContentAssistProposal", action); //$NON-NLS-1$
+ markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
+
+ // IAction action= new TextOperationAction(
+ // TemplateMessages.getResourceBundle(),
+ // "Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$
+ // this,
+ // ISourceViewer.CONTENTASSIST_PROPOSALS);
+ // action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ // setAction(TEMPLATE_PROPOSALS, action);
+ // markAsStateDependentAction(TEMPLATE_PROPOSALS, true);
}
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLDocumentProvider.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLDocumentProvider.java
index 5d751b7..999fd08 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLDocumentProvider.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLDocumentProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: XMLDocumentProvider.java,v 1.2 2005-05-06 00:55:42 stefanbjarni Exp $
+ * $Id: XMLDocumentProvider.java,v 1.3 2006-10-21 23:14:14 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.editor;
@@ -23,16 +23,14 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
-
/**
* Document provider for XML files.
*
* TODO Merge the encoding detection support from I18NDocumentProvider and
- * AbstractDocumentProvider into this class
+ * AbstractDocumentProvider into this class
*
- * TODO This class currently doubles as a model manager which will need to be
- * moved into core at some point, and would make this class pretty much
- * useless
+ * TODO This class currently doubles as a model manager which will need to be
+ * moved into core at some point, and would make this class pretty much useless
*/
public class XMLDocumentProvider extends TextFileDocumentProvider {
@@ -80,7 +78,8 @@ public class XMLDocumentProvider extends TextFileDocumentProvider {
}
/*
- * @see TextFileDocumentProvider#disposeFileInfo(Object, TextFileDocumentProvider.FileInfo)
+ * @see TextFileDocumentProvider#disposeFileInfo(Object,
+ * TextFileDocumentProvider.FileInfo)
*/
protected void disposeFileInfo(Object element, FileInfo info) {
if (info instanceof XMLFileInfo) {
@@ -88,8 +87,8 @@ public class XMLDocumentProvider extends TextFileDocumentProvider {
if (document != null) {
IXMLDocument xmlDocument = ((XMLFileInfo) info).xmlDocument;
if (xmlDocument instanceof IDocumentListener) {
- document.removeDocumentListener(
- (IDocumentListener) xmlDocument);
+ document
+ .removeDocumentListener((IDocumentListener) xmlDocument);
}
}
}
@@ -100,11 +99,13 @@ public class XMLDocumentProvider extends TextFileDocumentProvider {
// Public Methods ----------------------------------------------------------
/**
- * Creates the XML document model object corresponding to the specified
+ * Creates the XML document model object corresponding to the specified
* document.
*
- * @param document the document to parse
- * @param systemId the system ID of the document
+ * @param document
+ * the document to parse
+ * @param systemId
+ * the system ID of the document
* @return the document model object
*/
public IXMLDocument createModel(IDocument document, String systemId) {
@@ -114,7 +115,8 @@ public class XMLDocumentProvider extends TextFileDocumentProvider {
/**
* Returns the XML document model associated with the specified element.
*
- * @param element the element
+ * @param element
+ * the element
* @return the document model associated with the element
*/
public IXMLDocument getModel(Object element) {
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLDocumentSetupParticipant.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLDocumentSetupParticipant.java
index 3da7597..40fa9a4 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLDocumentSetupParticipant.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLDocumentSetupParticipant.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial implementation
*
- * $Id: XMLDocumentSetupParticipant.java,v 1.2 2005-05-06 00:55:42 stefanbjarni Exp $
+ * $Id: XMLDocumentSetupParticipant.java,v 1.3 2006-10-21 23:14:14 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.editor;
@@ -25,7 +25,7 @@ import org.eclipse.jface.text.IDocumentPartitioner;
*/
public class XMLDocumentSetupParticipant implements IDocumentSetupParticipant {
- /*
+ /*
* @see IDocumentSetupParticipant#setup(IDocument)
*/
public void setup(IDocument document) {
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditor.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditor.java
index 282e5db..bd096c2 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditor.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditor.java
@@ -9,7 +9,7 @@
* Igor Malinin - initial contribution
* Christopher Lenz - integrated outline page
*
- * $Id: XMLEditor.java,v 1.3 2004-09-22 18:57:42 jsurfer Exp $
+ * $Id: XMLEditor.java,v 1.4 2006-10-21 23:14:14 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.editor;
@@ -46,147 +46,162 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
* @author Igor Malinin
*/
public class XMLEditor extends TextEditor implements IReconcilingParticipant {
-
-
- /**
- * Listens to changes to the selection in the outline page, and changes the selection and highlight range in the editor
- * accordingly.
- */
- private class OutlineSelectionChangedListener implements ISelectionChangedListener {
-
- /*
- * @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- if (selection.isEmpty()) {
- resetHighlightRange();
- } else {
- ISourceReference element = (ISourceReference) selection.getFirstElement();
- highlightElement(element, true);
- }
- }
-
- }
-
- /**
- * The associated outline page.
- */
- XMLOutlinePage outlinePage;
- int fType;
- /**
- * Listens to changes in the outline page's selection to update the editor selection and highlight range.
- */
- private ISelectionChangedListener outlineSelectionChangedListener;
-
- public XMLEditor() {
- this(ShowExternalPreviewAction.XML_TYPE);
- }
- /**
- * Constructor.
- */
- public XMLEditor(int type) {
- fType = type;
- List stores = new ArrayList(3);
-
- stores.add(XMLPlugin.getDefault().getPreferenceStore());
- stores.add(EditorsUI.getPreferenceStore());
-
- setPreferenceStore(new ChainedPreferenceStore((IPreferenceStore[]) stores.toArray(new IPreferenceStore[stores.size()])));
- }
-
- /*
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter.equals(IContentOutlinePage.class)) {
- if (outlinePage == null) {
- outlinePage = new XMLOutlinePage(this);
- outlineSelectionChangedListener = new OutlineSelectionChangedListener();
- outlinePage.addSelectionChangedListener(outlineSelectionChangedListener);
- }
-
- return outlinePage;
- }
-
- return super.getAdapter(adapter);
- }
-
- /*
- * @see IReconcilingParticipant#reconciled()
- */
- public void reconciled() {
- Shell shell = getSite().getShell();
- if ((shell != null) && !shell.isDisposed()) {
- shell.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (outlinePage != null) {
- outlinePage.update();
- }
- }
- });
- }
- }
-
- /*
- * @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
- */
- protected void initializeEditor() {
- super.initializeEditor();
-
- XMLTextTools xmlTextTools = XMLPlugin.getDefault().getXMLTextTools();
- setSourceViewerConfiguration(new XMLConfiguration(xmlTextTools, this));
- setDocumentProvider(new XMLDocumentProvider());
-
- ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction.getInstance();
- fShowExternalPreviewAction.setEditor(this);
- fShowExternalPreviewAction.update();
- if (fShowExternalPreviewAction != null)
- fShowExternalPreviewAction.doRun(fType);
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#affectsTextPresentation(PropertyChangeEvent)
- */
- protected boolean affectsTextPresentation(PropertyChangeEvent event) {
- return XMLPlugin.getDefault().getXMLTextTools().affectsBehavior(event);
- }
-
- void highlightElement(ISourceReference element, boolean moveCursor) {
- if (element != null) {
- IRegion highlightRegion = element.getSourceRegion();
- setHighlightRange(highlightRegion.getOffset(), highlightRegion.getLength(), moveCursor);
- } else {
- resetHighlightRange();
- }
- }
-
- protected void createActions() {
- super.createActions();
-
- IAction action = new ContentAssistAction(XMLEditorMessages.getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- setAction("ContentAssistProposal", action); //$NON-NLS-1$
- markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
-
- // IAction action= new TextOperationAction(
- // TemplateMessages.getResourceBundle(),
- // "Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$
- // this,
- // ISourceViewer.CONTENTASSIST_PROPOSALS);
- // action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- // setAction(TEMPLATE_PROPOSALS, action);
- // markAsStateDependentAction(TEMPLATE_PROPOSALS, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorSaved()
- */
- protected void editorSaved() {
- super.editorSaved();
- ShowExternalPreviewAction a = ShowExternalPreviewAction.getInstance();
- if (a != null) {
- a.refresh(fType);
- }
- }
+
+ /**
+ * Listens to changes to the selection in the outline page, and changes the
+ * selection and highlight range in the editor accordingly.
+ */
+ private class OutlineSelectionChangedListener implements
+ ISelectionChangedListener {
+
+ /*
+ * @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event
+ .getSelection();
+ if (selection.isEmpty()) {
+ resetHighlightRange();
+ } else {
+ ISourceReference element = (ISourceReference) selection
+ .getFirstElement();
+ highlightElement(element, true);
+ }
+ }
+
+ }
+
+ /**
+ * The associated outline page.
+ */
+ XMLOutlinePage outlinePage;
+
+ int fType;
+
+ /**
+ * Listens to changes in the outline page's selection to update the editor
+ * selection and highlight range.
+ */
+ private ISelectionChangedListener outlineSelectionChangedListener;
+
+ public XMLEditor() {
+ this(ShowExternalPreviewAction.XML_TYPE);
+ }
+
+ /**
+ * Constructor.
+ */
+ public XMLEditor(int type) {
+ fType = type;
+ List stores = new ArrayList(3);
+
+ stores.add(XMLPlugin.getDefault().getPreferenceStore());
+ stores.add(EditorsUI.getPreferenceStore());
+
+ setPreferenceStore(new ChainedPreferenceStore(
+ (IPreferenceStore[]) stores.toArray(new IPreferenceStore[stores
+ .size()])));
+ }
+
+ /*
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter.equals(IContentOutlinePage.class)) {
+ if (outlinePage == null) {
+ outlinePage = new XMLOutlinePage(this);
+ outlineSelectionChangedListener = new OutlineSelectionChangedListener();
+ outlinePage
+ .addSelectionChangedListener(outlineSelectionChangedListener);
+ }
+
+ return outlinePage;
+ }
+
+ return super.getAdapter(adapter);
+ }
+
+ /*
+ * @see IReconcilingParticipant#reconciled()
+ */
+ public void reconciled() {
+ Shell shell = getSite().getShell();
+ if ((shell != null) && !shell.isDisposed()) {
+ shell.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (outlinePage != null) {
+ outlinePage.update();
+ }
+ }
+ });
+ }
+ }
+
+ /*
+ * @see org.eclipse.ui.editors.text.TextEditor#initializeEditor()
+ */
+ protected void initializeEditor() {
+ super.initializeEditor();
+
+ XMLTextTools xmlTextTools = XMLPlugin.getDefault().getXMLTextTools();
+ setSourceViewerConfiguration(new XMLConfiguration(xmlTextTools, this));
+ setDocumentProvider(new XMLDocumentProvider());
+
+ ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction
+ .getInstance();
+ fShowExternalPreviewAction.setEditor(this);
+ fShowExternalPreviewAction.update();
+ if (fShowExternalPreviewAction != null)
+ fShowExternalPreviewAction.doRun(fType);
+ }
+
+ /*
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#affectsTextPresentation(PropertyChangeEvent)
+ */
+ protected boolean affectsTextPresentation(PropertyChangeEvent event) {
+ return XMLPlugin.getDefault().getXMLTextTools().affectsBehavior(event);
+ }
+
+ void highlightElement(ISourceReference element, boolean moveCursor) {
+ if (element != null) {
+ IRegion highlightRegion = element.getSourceRegion();
+ setHighlightRange(highlightRegion.getOffset(), highlightRegion
+ .getLength(), moveCursor);
+ } else {
+ resetHighlightRange();
+ }
+ }
+
+ protected void createActions() {
+ super.createActions();
+
+ IAction action = new ContentAssistAction(XMLEditorMessages
+ .getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
+ action
+ .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ setAction("ContentAssistProposal", action); //$NON-NLS-1$
+ markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
+
+ // IAction action= new TextOperationAction(
+ // TemplateMessages.getResourceBundle(),
+ // "Editor." + TEMPLATE_PROPOSALS + ".", //$NON-NLS-1$ //$NON-NLS-2$
+ // this,
+ // ISourceViewer.CONTENTASSIST_PROPOSALS);
+ // action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ // setAction(TEMPLATE_PROPOSALS, action);
+ // markAsStateDependentAction(TEMPLATE_PROPOSALS, true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorSaved()
+ */
+ protected void editorSaved() {
+ super.editorSaved();
+ ShowExternalPreviewAction a = ShowExternalPreviewAction.getInstance();
+ if (a != null) {
+ a.refresh(fType);
+ }
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditorActionContributor.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditorActionContributor.java
index 95c2f5c..8d65d7c 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditorActionContributor.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditorActionContributor.java
@@ -22,7 +22,8 @@ import org.eclipse.ui.texteditor.ITextEditor;
/**
* Common base class for action contributors for Java editors.
*/
-public class XMLEditorActionContributor extends BasicTextEditorActionContributor {
+public class XMLEditorActionContributor extends
+ BasicTextEditorActionContributor {
/*
* (non-Javadoc)
@@ -43,11 +44,13 @@ public class XMLEditorActionContributor extends BasicTextEditorActionContributor
file = ((IFileEditorInput) editorInput).getFile();
}
- ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction.getInstance();
+ ShowExternalPreviewAction fShowExternalPreviewAction = ShowExternalPreviewAction
+ .getInstance();
fShowExternalPreviewAction.setEditor(textEditor);
fShowExternalPreviewAction.update();
if (fShowExternalPreviewAction != null)
- fShowExternalPreviewAction.doRun(ShowExternalPreviewAction.PHP_TYPE);
+ fShowExternalPreviewAction
+ .doRun(ShowExternalPreviewAction.PHP_TYPE);
}
}
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditorMessages.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditorMessages.java
index f63bc52..906e74b 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditorMessages.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/editor/XMLEditorMessages.java
@@ -1,14 +1,14 @@
/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
+ Copyright (c) 2000, 2002 IBM Corp. and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v10.html
+
+ Contributors:
+ IBM Corporation - Initial implementation
+ www.phpeclipse.de
+ **********************************************************************/
package net.sourceforge.phpeclipse.xml.ui.internal.editor;
import java.text.MessageFormat;
@@ -17,9 +17,10 @@ import java.util.ResourceBundle;
public class XMLEditorMessages {
- private static final String RESOURCE_BUNDLE= "net.sourceforge.phpeclipse.xml.ui.internal.editor.XMLEditorMessages";//$NON-NLS-1$
+ private static final String RESOURCE_BUNDLE = "net.sourceforge.phpeclipse.xml.ui.internal.editor.XMLEditorMessages";//$NON-NLS-1$
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ private static ResourceBundle fgResourceBundle = ResourceBundle
+ .getBundle(RESOURCE_BUNDLE);
private XMLEditorMessages() {
}
@@ -31,14 +32,14 @@ public class XMLEditorMessages {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
}
-
+
/**
* 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);
}
-
+
public static ResourceBundle getResourceBundle() {
return fgResourceBundle;
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlineContentProvider.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlineContentProvider.java
index a42a47d..4484e94 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlineContentProvider.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlineContentProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: XMLOutlineContentProvider.java,v 1.2 2005-05-06 00:55:42 stefanbjarni Exp $
+ * $Id: XMLOutlineContentProvider.java,v 1.3 2006-10-21 23:14:14 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.outline;
@@ -78,7 +78,8 @@ public class XMLOutlineContentProvider implements ITreeContentProvider {
}
/*
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer,
+ * Object, Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (oldInput != newInput) {
@@ -87,7 +88,7 @@ public class XMLOutlineContentProvider implements ITreeContentProvider {
}
if (newInput instanceof IXMLDocument) {
document = (IXMLDocument) newInput;
- }
+ }
}
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlineLabelProvider.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlineLabelProvider.java
index e895ce3..38fd25c 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlineLabelProvider.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlineLabelProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: XMLOutlineLabelProvider.java,v 1.2 2005-05-06 00:55:42 stefanbjarni Exp $
+ * $Id: XMLOutlineLabelProvider.java,v 1.3 2006-10-21 23:14:14 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.outline;
@@ -32,7 +32,7 @@ public class XMLOutlineLabelProvider extends LabelProvider {
public Image getImage(Object element) {
if (element instanceof IXMLElement) {
return XMLPlugin.getDefault().getImageRegistry().get(
- XMLPlugin.ICON_ELEMENT);
+ XMLPlugin.ICON_ELEMENT);
}
return null;
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlinePage.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlinePage.java
index e1da92e..0daae7d 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlinePage.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/outline/XMLOutlinePage.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: XMLOutlinePage.java,v 1.2 2005-05-06 00:55:42 stefanbjarni Exp $
+ * $Id: XMLOutlinePage.java,v 1.3 2006-10-21 23:14:14 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.outline;
@@ -48,7 +48,8 @@ public class XMLOutlinePage extends ContentOutlinePage {
/**
* Constructor.
*
- * @param editor The associated text editor
+ * @param editor
+ * The associated text editor
*/
public XMLOutlinePage(XMLEditor editor) {
this.editor = editor;
@@ -64,8 +65,8 @@ public class XMLOutlinePage extends ContentOutlinePage {
TreeViewer viewer = getTreeViewer();
viewer.setContentProvider(new XMLOutlineContentProvider());
viewer.setLabelProvider(new DecoratingLabelProvider(
- new XMLOutlineLabelProvider(),
- new ProblemsLabelDecorator(editor)));
+ new XMLOutlineLabelProvider(), new ProblemsLabelDecorator(
+ editor)));
viewer.setInput(getDocument());
}
@@ -74,15 +75,15 @@ public class XMLOutlinePage extends ContentOutlinePage {
/**
* Selects a specific element in the outline page.
*
- * @param element the element to select
+ * @param element
+ * the element to select
*/
public void select(ISourceReference element) {
TreeViewer viewer = getTreeViewer();
if (viewer != null) {
ISelection selection = viewer.getSelection();
if (selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection =
- (IStructuredSelection) selection;
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
List elements = structuredSelection.toList();
if (!elements.contains(element)) {
if (element == null) {
@@ -118,7 +119,7 @@ public class XMLOutlinePage extends ContentOutlinePage {
// Private Methods ---------------------------------------------------------
/**
- * Returns the parsed model of the XML document that is loaded into the
+ * Returns the parsed model of the XML document that is loaded into the
* associated editor.
*
* @return the parsed XML document
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/ContentAssistPreference.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/ContentAssistPreference.java
index 46eeace..25b27d1 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/ContentAssistPreference.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/ContentAssistPreference.java
@@ -8,52 +8,58 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-
public class ContentAssistPreference {
- /** Preference key for html content assist auto activation triggers */
- private final static String AUTOACTIVATION_TRIGGERS_HTML = PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML;
-
- /** Preference key for alphabetic ordering of proposals */
- private final static String ORDER_PROPOSALS = PreferenceConstants.CODEASSIST_ORDER_PROPOSALS;
-
- private static BasicCompletionProcessor getHTMLProcessor(ContentAssistant assistant) {
- IContentAssistProcessor p = assistant.getContentAssistProcessor(XMLPartitionScanner.XML_TAG);
- if (p instanceof BasicCompletionProcessor)
- return (BasicCompletionProcessor) p;
- return null;
- }
-
- private static void configureHTMLProcessor(ContentAssistant assistant, IPreferenceStore store) {
- BasicCompletionProcessor hcp = getHTMLProcessor(assistant);
- if (hcp == null)
- return;
-
- String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
- if (triggers != null)
- hcp.setCompletionProposalAutoActivationCharacters(triggers.toCharArray());
-
- boolean enabled;
- // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
- // jdcp.restrictProposalsToMatchingCases(enabled);
-
- enabled = store.getBoolean(ORDER_PROPOSALS);
- // hcp.orderProposalsAlphabetically(enabled);
- }
- private static void changeHTMLProcessor(ContentAssistant assistant, IPreferenceStore store, String key) {
- BasicCompletionProcessor jdcp = getHTMLProcessor(assistant);
- if (jdcp == null)
- return;
-
- if (AUTOACTIVATION_TRIGGERS_HTML.equals(key)) {
- String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
- if (triggers != null)
- jdcp.setCompletionProposalAutoActivationCharacters(triggers.toCharArray());
- // } else if (CASE_SENSITIVITY.equals(key)) {
- // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
- // jdcp.restrictProposalsToMatchingCases(enabled);
- } else if (ORDER_PROPOSALS.equals(key)) {
- boolean enable = store.getBoolean(ORDER_PROPOSALS);
- // jdcp.orderProposalsAlphabetically(enable);
- }
- }
+ /** Preference key for html content assist auto activation triggers */
+ private final static String AUTOACTIVATION_TRIGGERS_HTML = PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML;
+
+ /** Preference key for alphabetic ordering of proposals */
+ private final static String ORDER_PROPOSALS = PreferenceConstants.CODEASSIST_ORDER_PROPOSALS;
+
+ private static BasicCompletionProcessor getHTMLProcessor(
+ ContentAssistant assistant) {
+ IContentAssistProcessor p = assistant
+ .getContentAssistProcessor(XMLPartitionScanner.XML_TAG);
+ if (p instanceof BasicCompletionProcessor)
+ return (BasicCompletionProcessor) p;
+ return null;
+ }
+
+ private static void configureHTMLProcessor(ContentAssistant assistant,
+ IPreferenceStore store) {
+ BasicCompletionProcessor hcp = getHTMLProcessor(assistant);
+ if (hcp == null)
+ return;
+
+ String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
+ if (triggers != null)
+ hcp.setCompletionProposalAutoActivationCharacters(triggers
+ .toCharArray());
+
+ boolean enabled;
+ // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
+ // jdcp.restrictProposalsToMatchingCases(enabled);
+
+ enabled = store.getBoolean(ORDER_PROPOSALS);
+ // hcp.orderProposalsAlphabetically(enabled);
+ }
+
+ private static void changeHTMLProcessor(ContentAssistant assistant,
+ IPreferenceStore store, String key) {
+ BasicCompletionProcessor jdcp = getHTMLProcessor(assistant);
+ if (jdcp == null)
+ return;
+
+ if (AUTOACTIVATION_TRIGGERS_HTML.equals(key)) {
+ String triggers = store.getString(AUTOACTIVATION_TRIGGERS_HTML);
+ if (triggers != null)
+ jdcp.setCompletionProposalAutoActivationCharacters(triggers
+ .toCharArray());
+ // } else if (CASE_SENSITIVITY.equals(key)) {
+ // boolean enabled = store.getBoolean(CASE_SENSITIVITY);
+ // jdcp.restrictProposalsToMatchingCases(enabled);
+ } else if (ORDER_PROPOSALS.equals(key)) {
+ boolean enable = store.getBoolean(ORDER_PROPOSALS);
+ // jdcp.orderProposalsAlphabetically(enable);
+ }
+ }
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/XMLPreferenceInitializer.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/XMLPreferenceInitializer.java
index aac1795..2099183 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/XMLPreferenceInitializer.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/XMLPreferenceInitializer.java
@@ -9,7 +9,7 @@
* Roberto Gonzalez Rocha - Initial version
* Igor Malinin - refactoring, minor changes
*
- * $Id: XMLPreferenceInitializer.java,v 1.2 2005-12-18 15:50:53 bananeweizen Exp $
+ * $Id: XMLPreferenceInitializer.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.preferences;
@@ -24,7 +24,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.texteditor.AbstractTextEditor;
-
/**
* @author Igor Malinin
*/
@@ -33,73 +32,78 @@ public class XMLPreferenceInitializer extends AbstractPreferenceInitializer {
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
public void initializeDefaultPreferences() {
- final IPreferenceStore store = XMLPlugin.getDefault().getPreferenceStore();
- final Display display=Display.getDefault();
+ final IPreferenceStore store = XMLPlugin.getDefault()
+ .getPreferenceStore();
+ final Display display = Display.getDefault();
// TODO: ChainedPreferenceStore does not work for preferences preview
display.syncExec(new Runnable() {
public void run() {
PreferenceConverter.setDefault(store,
- AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND,
- display.getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB());
- }});
+ AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, display
+ .getSystemColor(SWT.COLOR_LIST_FOREGROUND)
+ .getRGB());
+ }
+ });
store.setDefault(
- AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT,
- true);
+ AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT,
+ true);
display.syncExec(new Runnable() {
public void run() {
PreferenceConverter.setDefault(store,
- AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND,
- display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB());
- }});
+ AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, display
+ .getSystemColor(SWT.COLOR_LIST_BACKGROUND)
+ .getRGB());
+ }
+ });
store.setDefault(
- AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT,
- true);
+ AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT,
+ true);
// end of common preferences
- setDefault(store, IXMLSyntaxConstants.XML_DEFAULT,
- "0,0,0", ITextStylePreferences.STYLE_NORMAL);
+ setDefault(store, IXMLSyntaxConstants.XML_DEFAULT, "0,0,0",
+ ITextStylePreferences.STYLE_NORMAL);
+
+ setDefault(store, IXMLSyntaxConstants.XML_TAG, "127,0,127",
+ ITextStylePreferences.STYLE_NORMAL);
- setDefault(store, IXMLSyntaxConstants.XML_TAG,
- "127,0,127", ITextStylePreferences.STYLE_NORMAL);
+ setDefault(store, IXMLSyntaxConstants.XML_ATT_NAME, "0,127,0",
+ ITextStylePreferences.STYLE_NORMAL);
- setDefault(store, IXMLSyntaxConstants.XML_ATT_NAME,
- "0,127,0", ITextStylePreferences.STYLE_NORMAL);
+ setDefault(store, IXMLSyntaxConstants.XML_ATT_VALUE, "0,0,255",
+ ITextStylePreferences.STYLE_NORMAL);
- setDefault(store, IXMLSyntaxConstants.XML_ATT_VALUE,
- "0,0,255", ITextStylePreferences.STYLE_NORMAL);
+ setDefault(store, IXMLSyntaxConstants.XML_ENTITY, "127,127,0",
+ ITextStylePreferences.STYLE_NORMAL);
- setDefault(store, IXMLSyntaxConstants.XML_ENTITY,
- "127,127,0", ITextStylePreferences.STYLE_NORMAL);
+ setDefault(store, IXMLSyntaxConstants.XML_CDATA, "127,127,0",
+ ITextStylePreferences.STYLE_NORMAL);
- setDefault(store, IXMLSyntaxConstants.XML_CDATA,
- "127,127,0", ITextStylePreferences.STYLE_NORMAL);
+ setDefault(store, IXMLSyntaxConstants.XML_PI, "127,127,127",
+ ITextStylePreferences.STYLE_BOLD);
- setDefault(store, IXMLSyntaxConstants.XML_PI,
- "127,127,127", ITextStylePreferences.STYLE_BOLD);
+ setDefault(store, IXMLSyntaxConstants.XML_COMMENT, "127,0,0",
+ ITextStylePreferences.STYLE_NORMAL);
- setDefault(store, IXMLSyntaxConstants.XML_COMMENT,
- "127,0,0", ITextStylePreferences.STYLE_NORMAL);
+ setDefault(store, IXMLSyntaxConstants.XML_DECL, "127,0,127",
+ ITextStylePreferences.STYLE_BOLD);
- setDefault(store, IXMLSyntaxConstants.XML_DECL,
- "127,0,127", ITextStylePreferences.STYLE_BOLD);
+ setDefault(store, IXMLSyntaxConstants.XML_SMARTY, "255,0,127",
+ ITextStylePreferences.STYLE_BOLD);
- setDefault(store, IXMLSyntaxConstants.XML_SMARTY,
- "255,0,127", ITextStylePreferences.STYLE_BOLD);
-
- setDefault(store, IXMLSyntaxConstants.DTD_CONDITIONAL,
- "127,127,0", ITextStylePreferences.STYLE_BOLD);
+ setDefault(store, IXMLSyntaxConstants.DTD_CONDITIONAL, "127,127,0",
+ ITextStylePreferences.STYLE_BOLD);
}
- private static void setDefault(
- IPreferenceStore store, String constant, String color, String style
- ) {
- store.setDefault(constant + ITextStylePreferences.SUFFIX_FOREGROUND, color);
+ private static void setDefault(IPreferenceStore store, String constant,
+ String color, String style) {
+ store.setDefault(constant + ITextStylePreferences.SUFFIX_FOREGROUND,
+ color);
store.setDefault(constant + ITextStylePreferences.SUFFIX_STYLE, style);
}
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/XMLSyntaxPreferencePage.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/XMLSyntaxPreferencePage.java
index a0f8a5b..e855df2 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/XMLSyntaxPreferencePage.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/XMLSyntaxPreferencePage.java
@@ -9,7 +9,7 @@
* Roberto Gonzalez Rocha - Initial version
* Igor Malinin - refactoring, minor changes
*
- * $Id: XMLSyntaxPreferencePage.java,v 1.2 2005-05-06 00:55:41 stefanbjarni Exp $
+ * $Id: XMLSyntaxPreferencePage.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.preferences;
@@ -59,440 +59,529 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.texteditor.AbstractTextEditor;
/**
- * The XMLSyntaxPreferencePage is a preference page that handles setting the colors used by the XML editors.
+ * The XMLSyntaxPreferencePage is a preference page that handles setting the
+ * colors used by the XML editors.
*/
-public class XMLSyntaxPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+public class XMLSyntaxPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ public final PreferenceDescriptor[] fKeys = new PreferenceDescriptor[] {
+ new PreferenceDescriptor(
+ PreferenceDescriptor.BOOLEAN,
+ AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_DEFAULT
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_DEFAULT
+ + ITextStylePreferences.SUFFIX_STYLE),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_TAG
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_TAG
+ + ITextStylePreferences.SUFFIX_STYLE),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_ATT_NAME
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_ATT_NAME
+ + ITextStylePreferences.SUFFIX_STYLE),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_ATT_VALUE
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_ATT_VALUE
+ + ITextStylePreferences.SUFFIX_STYLE),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_ENTITY
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_ENTITY
+ + ITextStylePreferences.SUFFIX_STYLE),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_CDATA
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_CDATA
+ + ITextStylePreferences.SUFFIX_STYLE),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_PI
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_PI
+ + ITextStylePreferences.SUFFIX_STYLE),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_COMMENT
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_COMMENT
+ + ITextStylePreferences.SUFFIX_STYLE),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_DECL
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_DECL
+ + ITextStylePreferences.SUFFIX_STYLE),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_SMARTY
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.XML_SMARTY
+ + ITextStylePreferences.SUFFIX_STYLE),
+
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.DTD_CONDITIONAL
+ + ITextStylePreferences.SUFFIX_FOREGROUND),
+ new PreferenceDescriptor(PreferenceDescriptor.STRING,
+ IXMLSyntaxConstants.DTD_CONDITIONAL
+ + ITextStylePreferences.SUFFIX_STYLE), };
+
+ OverlayPreferenceStore overlay;
+
+ final String[][] fSyntaxColorListModel = new String[][] {
+ { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.others"), //$NON-NLS-1$
+ IXMLSyntaxConstants.XML_DEFAULT },
+ { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.Tag"), //$NON-NLS-1$
+ IXMLSyntaxConstants.XML_TAG },
+ { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.AttName"), //$NON-NLS-1$
+ IXMLSyntaxConstants.XML_ATT_NAME },
+ { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.AttValue"), //$NON-NLS-1$
+ IXMLSyntaxConstants.XML_ATT_VALUE },
+ { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.Entity"), //$NON-NLS-1$
+ IXMLSyntaxConstants.XML_ENTITY },
+ { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.CDATA"), //$NON-NLS-1$
+ IXMLSyntaxConstants.XML_CDATA },
+ { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.PI"), //$NON-NLS-1$
+ IXMLSyntaxConstants.XML_PI },
+ { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.Comment"), //$NON-NLS-1$
+ IXMLSyntaxConstants.XML_COMMENT },
+ {
+ XMLPlugin
+ .getResourceString("XmlSyntaxPreferencePage.Declaration"), //$NON-NLS-1$
+ IXMLSyntaxConstants.XML_DECL },
+ {
+ XMLPlugin
+ .getResourceString("XmlSyntaxPreferencePage.Conditional"), //$NON-NLS-1$
+ IXMLSyntaxConstants.XML_SMARTY },
+ { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.SmartyTag"), //$NON-NLS-1$
+ IXMLSyntaxConstants.DTD_CONDITIONAL }, };
+
+ private XMLTextTools xmlTextTools;
+
+ private Color bgColor;
+
+ Button bgDefault;
+
+ Button bgCustom;
+
+ ColorEditor bgColorEditor;
+
+ List colors;
+
+ ColorEditor fgColorEditor;
+
+ Button fgBold;
+
+ SourceViewer preview;
+
+ /**
+ * Constructor for XMLSyntaxPreferencePage.
+ */
+ public XMLSyntaxPreferencePage() {
+ setDescription(XMLPlugin
+ .getResourceString("XmlSyntaxPreferencePage.description")); //$NON-NLS-1$
+
+ setPreferenceStore(XMLPlugin.getDefault().getPreferenceStore());
+
+ overlay = new OverlayPreferenceStore(getPreferenceStore(), fKeys);
+ }
+
+ protected Control createContents(Composite parent) {
+ overlay.load();
+ overlay.start();
+
+ Composite colorComposite = new Composite(parent, SWT.NULL);
+ colorComposite.setLayout(new GridLayout());
+
+ Group backgroundComposite = new Group(colorComposite,
+ SWT.SHADOW_ETCHED_IN);
+
+ backgroundComposite.setLayout(new RowLayout());
+ backgroundComposite.setText(XMLPlugin
+ .getResourceString("XmlSyntaxPreferencePage.backgroundColor")); //$NON-NLS-1$
+
+ SelectionListener backgroundSelectionListener = new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ boolean custom = bgCustom.getSelection();
+ bgColorEditor.getButton().setEnabled(custom);
+ overlay
+ .setValue(
+ AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT,
+ !custom);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ };
+
+ bgDefault = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
+ bgDefault.setText(XMLPlugin
+ .getResourceString("XmlSyntaxPreferencePage.systemDefault")); //$NON-NLS-1$
+ bgDefault.addSelectionListener(backgroundSelectionListener);
+
+ bgCustom = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
+ bgCustom.setText(XMLPlugin
+ .getResourceString("XmlSyntaxPreferencePage.custom")); //$NON-NLS-1$
+ bgCustom.addSelectionListener(backgroundSelectionListener);
+
+ bgColorEditor = new ColorEditor(backgroundComposite);
+
+ Label label = new Label(colorComposite, SWT.LEFT);
+ label.setText(XMLPlugin
+ .getResourceString("XmlSyntaxPreferencePage.foreground")); //$NON-NLS-1$
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite editorComposite = new Composite(colorComposite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ editorComposite.setLayout(layout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ editorComposite.setLayoutData(gd);
+
+ colors = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL
+ | SWT.BORDER);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = convertHeightInCharsToPixels(5);
+ colors.setLayoutData(gd);
+
+ Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ stylesComposite.setLayout(layout);
+ stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- public final PreferenceDescriptor[] fKeys = new PreferenceDescriptor[] {
- new PreferenceDescriptor(PreferenceDescriptor.BOOLEAN, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_DEFAULT
- + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_DEFAULT + ITextStylePreferences.SUFFIX_STYLE),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_TAG + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_TAG + ITextStylePreferences.SUFFIX_STYLE),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_ATT_NAME
- + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_ATT_NAME + ITextStylePreferences.SUFFIX_STYLE),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_ATT_VALUE
- + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_ATT_VALUE + ITextStylePreferences.SUFFIX_STYLE),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_ENTITY
- + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_ENTITY + ITextStylePreferences.SUFFIX_STYLE),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_CDATA + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_CDATA + ITextStylePreferences.SUFFIX_STYLE),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_PI + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_PI + ITextStylePreferences.SUFFIX_STYLE),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_COMMENT
- + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_COMMENT + ITextStylePreferences.SUFFIX_STYLE),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_DECL + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_DECL + ITextStylePreferences.SUFFIX_STYLE),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_SMARTY + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.XML_SMARTY + ITextStylePreferences.SUFFIX_STYLE),
-
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.DTD_CONDITIONAL
- + ITextStylePreferences.SUFFIX_FOREGROUND),
- new PreferenceDescriptor(PreferenceDescriptor.STRING, IXMLSyntaxConstants.DTD_CONDITIONAL
- + ITextStylePreferences.SUFFIX_STYLE),};
-
- OverlayPreferenceStore overlay;
-
- final String[][] fSyntaxColorListModel = new String[][] { {
- XMLPlugin.getResourceString("XmlSyntaxPreferencePage.others"), //$NON-NLS-1$
- IXMLSyntaxConstants.XML_DEFAULT }, { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.Tag"), //$NON-NLS-1$
- IXMLSyntaxConstants.XML_TAG }, { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.AttName"), //$NON-NLS-1$
- IXMLSyntaxConstants.XML_ATT_NAME }, { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.AttValue"), //$NON-NLS-1$
- IXMLSyntaxConstants.XML_ATT_VALUE }, { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.Entity"), //$NON-NLS-1$
- IXMLSyntaxConstants.XML_ENTITY }, { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.CDATA"), //$NON-NLS-1$
- IXMLSyntaxConstants.XML_CDATA }, { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.PI"), //$NON-NLS-1$
- IXMLSyntaxConstants.XML_PI }, { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.Comment"), //$NON-NLS-1$
- IXMLSyntaxConstants.XML_COMMENT }, { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.Declaration"), //$NON-NLS-1$
- IXMLSyntaxConstants.XML_DECL }, { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.Conditional"), //$NON-NLS-1$
- IXMLSyntaxConstants.XML_SMARTY }, { XMLPlugin.getResourceString("XmlSyntaxPreferencePage.SmartyTag"), //$NON-NLS-1$
- IXMLSyntaxConstants.DTD_CONDITIONAL },
- };
-
- private XMLTextTools xmlTextTools;
-
- private Color bgColor;
-
- Button bgDefault;
-
- Button bgCustom;
-
- ColorEditor bgColorEditor;
-
- List colors;
-
- ColorEditor fgColorEditor;
-
- Button fgBold;
-
- SourceViewer preview;
-
- /**
- * Constructor for XMLSyntaxPreferencePage.
- */
- public XMLSyntaxPreferencePage() {
- setDescription(XMLPlugin.getResourceString("XmlSyntaxPreferencePage.description")); //$NON-NLS-1$
-
- setPreferenceStore(XMLPlugin.getDefault().getPreferenceStore());
-
- overlay = new OverlayPreferenceStore(getPreferenceStore(), fKeys);
- }
-
- protected Control createContents(Composite parent) {
- overlay.load();
- overlay.start();
-
- Composite colorComposite = new Composite(parent, SWT.NULL);
- colorComposite.setLayout(new GridLayout());
-
- Group backgroundComposite = new Group(colorComposite, SWT.SHADOW_ETCHED_IN);
-
- backgroundComposite.setLayout(new RowLayout());
- backgroundComposite.setText(XMLPlugin.getResourceString("XmlSyntaxPreferencePage.backgroundColor")); //$NON-NLS-1$
-
- SelectionListener backgroundSelectionListener = new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- boolean custom = bgCustom.getSelection();
- bgColorEditor.getButton().setEnabled(custom);
- overlay.setValue(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, !custom);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
-
- bgDefault = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
- bgDefault.setText(XMLPlugin.getResourceString("XmlSyntaxPreferencePage.systemDefault")); //$NON-NLS-1$
- bgDefault.addSelectionListener(backgroundSelectionListener);
-
- bgCustom = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
- bgCustom.setText(XMLPlugin.getResourceString("XmlSyntaxPreferencePage.custom")); //$NON-NLS-1$
- bgCustom.addSelectionListener(backgroundSelectionListener);
-
- bgColorEditor = new ColorEditor(backgroundComposite);
-
- Label label = new Label(colorComposite, SWT.LEFT);
- label.setText(XMLPlugin.getResourceString("XmlSyntaxPreferencePage.foreground")); //$NON-NLS-1$
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite editorComposite = new Composite(colorComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- editorComposite.setLayout(layout);
- GridData gd = new GridData(GridData.FILL_BOTH);
- editorComposite.setLayoutData(gd);
-
- colors = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = convertHeightInCharsToPixels(5);
- colors.setLayoutData(gd);
-
- Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.numColumns = 2;
- stylesComposite.setLayout(layout);
- stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- label = new Label(stylesComposite, SWT.LEFT);
- label.setText(XMLPlugin.getResourceString("XmlSyntaxPreferencePage.color")); //$NON-NLS-1$
- gd = new GridData();
- gd.horizontalAlignment = GridData.BEGINNING;
- label.setLayoutData(gd);
-
- fgColorEditor = new ColorEditor(stylesComposite);
-
- Button fgColorButton = fgColorEditor.getButton();
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment = GridData.BEGINNING;
- fgColorButton.setLayoutData(gd);
-
- label = new Label(stylesComposite, SWT.LEFT);
- label.setText(XMLPlugin.getResourceString("XmlSyntaxPreferencePage.bold")); //$NON-NLS-1$
- gd = new GridData();
- gd.horizontalAlignment = GridData.BEGINNING;
- label.setLayoutData(gd);
-
- fgBold = new Button(stylesComposite, SWT.CHECK);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment = GridData.BEGINNING;
- fgBold.setLayoutData(gd);
-
- label = new Label(colorComposite, SWT.LEFT);
- label.setText(XMLPlugin.getResourceString("XmlSyntaxPreferencePage.preview")); //$NON-NLS-1$
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Control previewer = createPreviewer(colorComposite);
- gd = new GridData(GridData.FILL_BOTH);
- gd.widthHint = convertWidthInCharsToPixels(20);
- gd.heightHint = convertHeightInCharsToPixels(5);
- previewer.setLayoutData(gd);
-
- colors.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- handleSyntaxColorListSelection();
- }
- });
-
- bgColorEditor.getButton().addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- PreferenceConverter.setValue(overlay, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, bgColorEditor.getColorValue());
- }
- });
-
- fgColorButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- int i = colors.getSelectionIndex();
-
- String key = fSyntaxColorListModel[i][1];
-
- PreferenceConverter.setValue(overlay, key + ITextStylePreferences.SUFFIX_FOREGROUND, fgColorEditor.getColorValue());
- }
- });
-
- fgBold.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- int i = colors.getSelectionIndex();
-
- String key = fSyntaxColorListModel[i][1];
-
- String value = (fgBold.getSelection()) ? ITextStylePreferences.STYLE_BOLD : ITextStylePreferences.STYLE_NORMAL;
-
- overlay.setValue(key + ITextStylePreferences.SUFFIX_STYLE, value);
- }
- });
-
- initialize();
-
- return colorComposite;
- }
-
- private Control createPreviewer(Composite parent) {
- xmlTextTools = new XMLTextTools(overlay); // REVISIT: DTD
-
- preview = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
-
- preview.configure(new XMLConfiguration(xmlTextTools));
- preview.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
- preview.setEditable(false);
-
- initializeViewerColors(preview);
-
- String content = loadPreviewContentFromFile("preview.xml"); //$NON-NLS-1$
- IDocument document = new Document(content);
-
- // REVISIT: DTD
- IDocumentPartitioner partitioner = xmlTextTools.createXMLPartitioner();
-
- partitioner.connect(document);
- document.setDocumentPartitioner(partitioner);
-
- preview.setDocument(document);
-
- overlay.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String p = event.getProperty();
- if (p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)
- || p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
- initializeViewerColors(preview);
- }
-
- preview.invalidateTextPresentation();
- }
- });
-
- return preview.getControl();
- }
-
- /**
- * Initializes the given viewer's colors.
- *
- * @param viewer
- * the viewer to be initialized
- */
- void initializeViewerColors(ISourceViewer viewer) {
- if (overlay != null) {
- StyledText styledText = viewer.getTextWidget();
-
- // ---------- background color ----------------------
- Color color = null;
- if (!overlay.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
- color = createColor(overlay, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, styledText.getDisplay());
- }
-
- styledText.setBackground(color);
-
- if (bgColor != null) {
- bgColor.dispose();
- }
-
- bgColor = color;
- }
- }
-
- /**
- * Creates a color from the information stored in the given preference store. Returns null if there is no such
- * information available.
- */
- private Color createColor(IPreferenceStore store, String key, Display display) {
- RGB rgb = null;
-
- if (store.contains(key)) {
- if (store.isDefault(key)) {
- rgb = PreferenceConverter.getDefaultColor(store, key);
- } else {
- rgb = PreferenceConverter.getColor(store, key);
- }
-
- if (rgb != null) {
- return new Color(display, rgb);
- }
- }
-
- return null;
- }
-
- void handleSyntaxColorListSelection() {
- int i = colors.getSelectionIndex();
-
- String key = fSyntaxColorListModel[i][1];
-
- RGB rgb = PreferenceConverter.getColor(overlay, key + ITextStylePreferences.SUFFIX_FOREGROUND);
-
- fgColorEditor.setColorValue(rgb);
-
- // REVISIT
- fgBold.setSelection(overlay.getString(key + ITextStylePreferences.SUFFIX_STYLE).indexOf(ITextStylePreferences.STYLE_BOLD) >= 0);
- }
-
- private String loadPreviewContentFromFile(String filename) {
- StringBuffer string = new StringBuffer(512);
-
- try {
- char[] buf = new char[512];
- BufferedReader reader = new BufferedReader(new InputStreamReader(XMLSyntaxPreferencePage.class.getResourceAsStream(filename)));
-
- try {
- while (true) {
- int n = reader.read(buf);
- if (n < 0) {
- break;
- }
-
- string.append(buf, 0, n);
- }
- } finally {
- reader.close();
- }
- } catch (IOException e) {
- }
-
- return string.toString();
- }
-
- /**
- *
- */
- private void initialize() {
- initializeFields();
-
- for (int i = 0; i < fSyntaxColorListModel.length; i++) {
- colors.add(fSyntaxColorListModel[i][0]);
- }
-
- colors.getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- colors.select(0);
- handleSyntaxColorListSelection();
- }
- });
- }
-
- private void initializeFields() {
- RGB rgb = PreferenceConverter.getColor(overlay, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
- bgColorEditor.setColorValue(rgb);
-
- boolean def = overlay.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
- bgDefault.setSelection(def);
- bgCustom.setSelection(!def);
- bgColorEditor.getButton().setEnabled(!def);
- }
-
- /*
- * @see IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /*
- * @see PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- overlay.loadDefaults();
- //initializeFields();
- handleSyntaxColorListSelection();
-
- super.performDefaults();
-
- preview.invalidateTextPresentation();
- }
-
- /*
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- overlay.propagate();
- XMLPlugin.getDefault().savePluginPreferences();
-
- return true;
- }
-
- /*
- * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
- */
- public void dispose() {
- if (xmlTextTools != null) {
- xmlTextTools.dispose();
- xmlTextTools = null;
- }
-
- if (overlay != null) {
- overlay.stop();
- overlay = null;
- }
-
- super.dispose();
- }
+ label = new Label(stylesComposite, SWT.LEFT);
+ label.setText(XMLPlugin
+ .getResourceString("XmlSyntaxPreferencePage.color")); //$NON-NLS-1$
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
+ label.setLayoutData(gd);
+
+ fgColorEditor = new ColorEditor(stylesComposite);
+
+ Button fgColorButton = fgColorEditor.getButton();
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
+ fgColorButton.setLayoutData(gd);
+
+ label = new Label(stylesComposite, SWT.LEFT);
+ label.setText(XMLPlugin
+ .getResourceString("XmlSyntaxPreferencePage.bold")); //$NON-NLS-1$
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
+ label.setLayoutData(gd);
+
+ fgBold = new Button(stylesComposite, SWT.CHECK);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
+ fgBold.setLayoutData(gd);
+
+ label = new Label(colorComposite, SWT.LEFT);
+ label.setText(XMLPlugin
+ .getResourceString("XmlSyntaxPreferencePage.preview")); //$NON-NLS-1$
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Control previewer = createPreviewer(colorComposite);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.widthHint = convertWidthInCharsToPixels(20);
+ gd.heightHint = convertHeightInCharsToPixels(5);
+ previewer.setLayoutData(gd);
+
+ colors.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ handleSyntaxColorListSelection();
+ }
+ });
+
+ bgColorEditor.getButton().addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ PreferenceConverter.setValue(overlay,
+ AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND,
+ bgColorEditor.getColorValue());
+ }
+ });
+
+ fgColorButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ int i = colors.getSelectionIndex();
+
+ String key = fSyntaxColorListModel[i][1];
+
+ PreferenceConverter.setValue(overlay, key
+ + ITextStylePreferences.SUFFIX_FOREGROUND,
+ fgColorEditor.getColorValue());
+ }
+ });
+
+ fgBold.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ int i = colors.getSelectionIndex();
+
+ String key = fSyntaxColorListModel[i][1];
+
+ String value = (fgBold.getSelection()) ? ITextStylePreferences.STYLE_BOLD
+ : ITextStylePreferences.STYLE_NORMAL;
+
+ overlay.setValue(key + ITextStylePreferences.SUFFIX_STYLE,
+ value);
+ }
+ });
+
+ initialize();
+
+ return colorComposite;
+ }
+
+ private Control createPreviewer(Composite parent) {
+ xmlTextTools = new XMLTextTools(overlay); // REVISIT: DTD
+
+ preview = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL
+ | SWT.BORDER);
+
+ preview.configure(new XMLConfiguration(xmlTextTools));
+ preview.getTextWidget().setFont(
+ JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
+ preview.setEditable(false);
+
+ initializeViewerColors(preview);
+
+ String content = loadPreviewContentFromFile("preview.xml"); //$NON-NLS-1$
+ IDocument document = new Document(content);
+
+ // REVISIT: DTD
+ IDocumentPartitioner partitioner = xmlTextTools.createXMLPartitioner();
+
+ partitioner.connect(document);
+ document.setDocumentPartitioner(partitioner);
+
+ preview.setDocument(document);
+
+ overlay.addPropertyChangeListener(new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ String p = event.getProperty();
+ if (p.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)
+ || p
+ .equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
+ initializeViewerColors(preview);
+ }
+
+ preview.invalidateTextPresentation();
+ }
+ });
+
+ return preview.getControl();
+ }
+
+ /**
+ * Initializes the given viewer's colors.
+ *
+ * @param viewer
+ * the viewer to be initialized
+ */
+ void initializeViewerColors(ISourceViewer viewer) {
+ if (overlay != null) {
+ StyledText styledText = viewer.getTextWidget();
+
+ // ---------- background color ----------------------
+ Color color = null;
+ if (!overlay
+ .getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
+ color = createColor(overlay,
+ AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND,
+ styledText.getDisplay());
+ }
+
+ styledText.setBackground(color);
+
+ if (bgColor != null) {
+ bgColor.dispose();
+ }
+
+ bgColor = color;
+ }
+ }
+
+ /**
+ * Creates a color from the information stored in the given preference
+ * store. Returns null if there is no such information
+ * available.
+ */
+ private Color createColor(IPreferenceStore store, String key,
+ Display display) {
+ RGB rgb = null;
+
+ if (store.contains(key)) {
+ if (store.isDefault(key)) {
+ rgb = PreferenceConverter.getDefaultColor(store, key);
+ } else {
+ rgb = PreferenceConverter.getColor(store, key);
+ }
+
+ if (rgb != null) {
+ return new Color(display, rgb);
+ }
+ }
+
+ return null;
+ }
+
+ void handleSyntaxColorListSelection() {
+ int i = colors.getSelectionIndex();
+
+ String key = fSyntaxColorListModel[i][1];
+
+ RGB rgb = PreferenceConverter.getColor(overlay, key
+ + ITextStylePreferences.SUFFIX_FOREGROUND);
+
+ fgColorEditor.setColorValue(rgb);
+
+ // REVISIT
+ fgBold.setSelection(overlay.getString(
+ key + ITextStylePreferences.SUFFIX_STYLE).indexOf(
+ ITextStylePreferences.STYLE_BOLD) >= 0);
+ }
+
+ private String loadPreviewContentFromFile(String filename) {
+ StringBuffer string = new StringBuffer(512);
+
+ try {
+ char[] buf = new char[512];
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(XMLSyntaxPreferencePage.class
+ .getResourceAsStream(filename)));
+
+ try {
+ while (true) {
+ int n = reader.read(buf);
+ if (n < 0) {
+ break;
+ }
+
+ string.append(buf, 0, n);
+ }
+ } finally {
+ reader.close();
+ }
+ } catch (IOException e) {
+ }
+
+ return string.toString();
+ }
+
+ /**
+ *
+ */
+ private void initialize() {
+ initializeFields();
+
+ for (int i = 0; i < fSyntaxColorListModel.length; i++) {
+ colors.add(fSyntaxColorListModel[i][0]);
+ }
+
+ colors.getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ colors.select(0);
+ handleSyntaxColorListSelection();
+ }
+ });
+ }
+
+ private void initializeFields() {
+ RGB rgb = PreferenceConverter.getColor(overlay,
+ AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
+ bgColorEditor.setColorValue(rgb);
+
+ boolean def = overlay
+ .getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
+ bgDefault.setSelection(def);
+ bgCustom.setSelection(!def);
+ bgColorEditor.getButton().setEnabled(!def);
+ }
+
+ /*
+ * @see IWorkbenchPreferencePage#init(IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+ /*
+ * @see PreferencePage#performDefaults()
+ */
+ protected void performDefaults() {
+ overlay.loadDefaults();
+ // initializeFields();
+ handleSyntaxColorListSelection();
+
+ super.performDefaults();
+
+ preview.invalidateTextPresentation();
+ }
+
+ /*
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ overlay.propagate();
+ XMLPlugin.getDefault().savePluginPreferences();
+
+ return true;
+ }
+
+ /*
+ * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
+ */
+ public void dispose() {
+ if (xmlTextTools != null) {
+ xmlTextTools.dispose();
+ xmlTextTools = null;
+ }
+
+ if (overlay != null) {
+ overlay.stop();
+ overlay = null;
+ }
+
+ super.dispose();
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/AbstractDocumentProvider.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/AbstractDocumentProvider.java
index 67489c2..10d4fee 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/AbstractDocumentProvider.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/AbstractDocumentProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: AbstractDocumentProvider.java,v 1.2 2005-05-06 00:55:41 stefanbjarni Exp $
+ * $Id: AbstractDocumentProvider.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -21,7 +21,6 @@ import net.sourceforge.phpeclipse.ui.editor.I18NDocumentProvider;
import org.eclipse.jface.text.rules.IWhitespaceDetector;
-
/**
*
*
@@ -37,41 +36,41 @@ public abstract class AbstractDocumentProvider extends I18NDocumentProvider {
return "UTF-8";
}
- public String getDeclaredEncoding( InputStream in ) throws IOException {
- if ( !in.markSupported() ) {
- in = new BufferedInputStream( in, 512 );
+ public String getDeclaredEncoding(InputStream in) throws IOException {
+ if (!in.markSupported()) {
+ in = new BufferedInputStream(in, 512);
}
- in.mark( 512 );
- String encoding = super.getDeclaredEncoding( in );
- if ( encoding != null ) {
+ in.mark(512);
+ String encoding = super.getDeclaredEncoding(in);
+ if (encoding != null) {
return encoding;
}
in.reset();
// check Prolog-Start ':
- state = STATE_DEFAULT;
- return getToken(XML_TAG);
+ case ICharacterScanner.EOF:
+ case '>':
+ state = STATE_DEFAULT;
+ return getToken(XML_TAG);
- case '"': case '\'':
- while (true) {
- int ch = read();
+ case '"':
+ case '\'':
+ while (true) {
+ int ch = read();
- if (ch == quot) {
- state = STATE_TAG;
- return getToken(XML_ATTRIBUTE);
- }
+ if (ch == quot) {
+ state = STATE_TAG;
+ return getToken(XML_ATTRIBUTE);
+ }
- switch (ch) {
- case '<':
- unread();
+ switch (ch) {
+ case '<':
+ unread();
- case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
- return getToken(XML_ATTRIBUTE);
- }
+ case ICharacterScanner.EOF:
+ state = STATE_DEFAULT;
+ return getToken(XML_ATTRIBUTE);
}
- default:
- unread();
+ }
+ default:
+ unread();
}
while (true) {
switch (read()) {
- case '<':
- unread();
+ case '<':
+ unread();
- case ICharacterScanner.EOF:
- case '>':
- state = STATE_DEFAULT;
- return getToken(XML_TAG);
+ case ICharacterScanner.EOF:
+ case '>':
+ state = STATE_DEFAULT;
+ return getToken(XML_TAG);
- case '"': case '\'':
- unread();
+ case '"':
+ case '\'':
+ unread();
- state = STATE_TAG;
- return getToken(XML_TAG);
+ state = STATE_TAG;
+ return getToken(XML_TAG);
}
}
}
@@ -253,38 +266,38 @@ loop:
private IToken nextDeclToken() {
loop: while (true) {
switch (read()) {
- case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
- return getToken(isInternal() ? DTD_INTERNAL_DECL : XML_DECL);
+ case ICharacterScanner.EOF:
+ state = STATE_DEFAULT;
+ return getToken(isInternal() ? DTD_INTERNAL_DECL : XML_DECL);
- case '<':
- if (parsedtd || isInternal()) {
- switch (read()) {
- case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
- return getToken(isInternal() ? DTD_INTERNAL : null);
-
- case '!':
- case '?':
- unread();
- break;
-
- default:
- continue loop;
- }
+ case '<':
+ if (parsedtd || isInternal()) {
+ switch (read()) {
+ case ICharacterScanner.EOF:
+ state = STATE_DEFAULT;
+ return getToken(isInternal() ? DTD_INTERNAL : null);
+
+ case '!':
+ case '?':
+ unread();
+ break;
+
+ default:
+ continue loop;
}
+ }
- unread();
+ unread();
- case '>':
- state &= STATE_INTERNAL;
- return getToken(isInternal() ? DTD_INTERNAL_DECL : XML_DECL);
+ case '>':
+ state &= STATE_INTERNAL;
+ return getToken(isInternal() ? DTD_INTERNAL_DECL : XML_DECL);
- case '[': //
- if (!isInternal()) {
- state = STATE_INTERNAL;
- return getToken(XML_DECL);
- }
+ case '[': //
+ if (!isInternal()) {
+ state = STATE_INTERNAL;
+ return getToken(XML_DECL);
+ }
}
}
}
@@ -294,24 +307,24 @@ loop:
loop: while (true) {
switch (read()) {
+ case ICharacterScanner.EOF:
+ break loop;
+
+ case '-': // - -->
+ switch (read()) {
case ICharacterScanner.EOF:
break loop;
- case '-': // - -->
+ case '-': // -- -->
switch (read()) {
- case ICharacterScanner.EOF:
- break loop;
-
- case '-': // -- -->
- switch (read()) {
- case ICharacterScanner.EOF:
- case '>':
- break loop;
- }
-
- unread();
- continue loop;
+ case ICharacterScanner.EOF:
+ case '>':
+ break loop;
}
+
+ unread();
+ continue loop;
+ }
}
}
@@ -321,28 +334,27 @@ loop:
private IToken nextCDATAToken() {
state = STATE_DEFAULT;
-loop:
- while (true) {
+ loop: while (true) {
switch (read()) {
+ case ICharacterScanner.EOF:
+ break loop;
+
+ case ']': // ] ]]>
+ switch (read()) {
case ICharacterScanner.EOF:
break loop;
- case ']': // ] ]]>
+ case ']': // ]] ]]>
switch (read()) {
- case ICharacterScanner.EOF:
- break loop;
-
- case ']': // ]] ]]>
- switch (read()) {
- case ICharacterScanner.EOF:
- case '>': // ]]>
- break loop;
- }
-
- unread();
- unread();
- continue loop;
+ case ICharacterScanner.EOF:
+ case '>': // ]]>
+ break loop;
}
+
+ unread();
+ unread();
+ continue loop;
+ }
}
}
@@ -354,54 +366,53 @@ loop:
int level = 1;
-loop:
- while (true) {
+ loop: while (true) {
switch (read()) {
+ case ICharacterScanner.EOF:
+ break loop;
+
+ case '<': // - -->
+ switch (read()) {
case ICharacterScanner.EOF:
break loop;
- case '<': // - -->
+ case '!': // -- -->
switch (read()) {
- case ICharacterScanner.EOF:
- break loop;
-
- case '!': // -- -->
- switch (read()) {
- case ICharacterScanner.EOF:
- break loop;
-
- case '[':
- ++level;
- continue loop;
- }
+ case ICharacterScanner.EOF:
+ break loop;
- unread();
- continue loop;
+ case '[':
+ ++level;
+ continue loop;
}
unread();
continue loop;
+ }
- case ']': // - -->
- switch (read()) {
- case ICharacterScanner.EOF:
- break loop;
+ unread();
+ continue loop;
- case ']': // -- -->
- switch (read()) {
- case ICharacterScanner.EOF:
- case '>':
- if (--level == 0) {
- break loop;
- }
+ case ']': // - -->
+ switch (read()) {
+ case ICharacterScanner.EOF:
+ break loop;
- continue loop;
- }
+ case ']': // -- -->
+ switch (read()) {
+ case ICharacterScanner.EOF:
+ case '>':
+ if (--level == 0) {
+ break loop;
+ }
- unread();
- unread();
- continue loop;
+ continue loop;
}
+
+ unread();
+ unread();
+ continue loop;
+ }
}
}
@@ -453,7 +464,7 @@ loop:
* @see org.eclipse.jface.text.rules.ITokenScanner#getTokenOffset()
*/
public int getTokenOffset() {
- Assert.isTrue(offset>=0, Integer.toString(offset));
+ Assert.isTrue(offset >= 0, Integer.toString(offset));
return offset;
}
@@ -465,7 +476,8 @@ loop:
}
/*
- * @see org.eclipse.jface.text.rules.ITokenScanner#setRange(IDocument, int, int)
+ * @see org.eclipse.jface.text.rules.ITokenScanner#setRange(IDocument, int,
+ * int)
*/
public void setRange(IDocument document, int offset, int length) {
this.document = document;
@@ -475,48 +487,47 @@ loop:
this.position = offset;
this.length = 0;
- this.state = STATE_DEFAULT;
+ this.state = STATE_DEFAULT;
}
/*
- * @see org.eclipse.jface.text.rules.IPartitionTokenScanner
- */
-// public void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) {
-// state = STATE_DEFAULT;
-// if (partitionOffset > -1) {
-// int delta = offset - partitionOffset;
-// if (delta > 0) {
-// setRange(document, partitionOffset, length + delta);
-// return;
-// }
-// }
-// setRange(document, partitionOffset, length);
-// }
+ * @see org.eclipse.jface.text.rules.IPartitionTokenScanner
+ */
+ // public void setPartialRange(IDocument document, int offset, int length,
+ // String contentType, int partitionOffset) {
+ // state = STATE_DEFAULT;
+ // if (partitionOffset > -1) {
+ // int delta = offset - partitionOffset;
+ // if (delta > 0) {
+ // setRange(document, partitionOffset, length + delta);
+ // return;
+ // }
+ // }
+ // setRange(document, partitionOffset, length);
+ // }
/*
* @see org.eclipse.jface.text.rules.IPartitionTokenScanner
*/
- public void setPartialRange(
- IDocument document, int offset, int length,
- String contentType, int partitionOffset
- ) {
-// boolean flag = false;
+ public void setPartialRange(IDocument document, int offset, int length,
+ String contentType, int partitionOffset) {
+ // boolean flag = false;
this.document = document;
this.end = offset + length;
// NB! Undocumented value: -1
if (partitionOffset >= 0) {
offset = partitionOffset;
-// flag = true;
+ // flag = true;
}
this.offset = offset;
this.position = offset;
this.length = 0;
-// if (flag) {
-// state = STATE_DEFAULT;
-// return;
-// }
+ // if (flag) {
+ // state = STATE_DEFAULT;
+ // return;
+ // }
if (contentType == XML_ATTRIBUTE) {
state = STATE_TAG;
return;
@@ -532,10 +543,8 @@ loop:
return;
}
- if (contentType == DTD_INTERNAL ||
- contentType == DTD_INTERNAL_DECL ||
- contentType == DTD_INTERNAL_COMMENT
- ) {
+ if (contentType == DTD_INTERNAL || contentType == DTD_INTERNAL_DECL
+ || contentType == DTD_INTERNAL_COMMENT) {
state = STATE_INTERNAL;
return;
}
@@ -550,7 +559,8 @@ loop:
if (type != IDocument.DEFAULT_CONTENT_TYPE) {
return true;
}
- } catch (BadLocationException e) {}
+ } catch (BadLocationException e) {
+ }
return false;
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/SimpleDoubleClickStrategy.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/SimpleDoubleClickStrategy.java
index d61fb9e..3eb545a 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/SimpleDoubleClickStrategy.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/SimpleDoubleClickStrategy.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: SimpleDoubleClickStrategy.java,v 1.2 2005-05-06 00:55:41 stefanbjarni Exp $
+ * $Id: SimpleDoubleClickStrategy.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -20,7 +20,6 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITypedRegion;
-
/**
*
*
@@ -30,33 +29,34 @@ public class SimpleDoubleClickStrategy extends TextDoubleClickStrategy {
/*
* @see org.eclipse.jface.text.ITextDoubleClickStrategy#doubleClicked(ITextViewer)
*/
- public void doubleClicked( ITextViewer viewer ) {
+ public void doubleClicked(ITextViewer viewer) {
int offset = viewer.getSelectedRange().x;
- if ( offset < 0 ) {
+ if (offset < 0) {
return;
}
try {
IDocument document = viewer.getDocument();
- ITypedRegion region = document.getPartition( offset );
+ ITypedRegion region = document.getPartition(offset);
int start = region.getOffset();
int length = region.getLength();
- if ( offset == start ) {
- viewer.setSelectedRange( start, length );
+ if (offset == start) {
+ viewer.setSelectedRange(start, length);
return;
}
int end = start + length - 1;
- if ( offset == end && document.getChar(end) == '>' ) {
- viewer.setSelectedRange( start, length );
+ if (offset == end && document.getChar(end) == '>') {
+ viewer.setSelectedRange(start, length);
return;
}
- super.doubleClicked( viewer );
- } catch ( BadLocationException e ) {}
+ super.doubleClicked(viewer);
+ } catch (BadLocationException e) {
+ }
}
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/TagDoubleClickStrategy.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/TagDoubleClickStrategy.java
index 696b909..3e70d8f 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/TagDoubleClickStrategy.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/TagDoubleClickStrategy.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: TagDoubleClickStrategy.java,v 1.2 2005-05-06 00:55:41 stefanbjarni Exp $
+ * $Id: TagDoubleClickStrategy.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -20,7 +20,6 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITypedRegion;
-
/**
*
*
@@ -30,44 +29,44 @@ public class TagDoubleClickStrategy extends TextDoubleClickStrategy {
/*
* @see org.eclipse.jface.text.ITextDoubleClickStrategy#doubleClicked(ITextViewer)
*/
- public void doubleClicked( ITextViewer viewer ) {
+ public void doubleClicked(ITextViewer viewer) {
int offset = viewer.getSelectedRange().x;
- if ( offset < 0 ) {
+ if (offset < 0) {
return;
}
try {
IDocument document = viewer.getDocument();
- ITypedRegion region = document.getPartition( offset );
+ ITypedRegion region = document.getPartition(offset);
int start = region.getOffset();
- if ( offset == start && document.getChar(offset) == '<' ) {
- region = document.getPartition( offset );
+ if (offset == start && document.getChar(offset) == '<') {
+ region = document.getPartition(offset);
offset = region.getOffset() + region.getLength();
- if ( document.getChar(offset - 1) != '>' ) {
- while ( true ) {
- if ( offset >= document.getLength() ) {
+ if (document.getChar(offset - 1) != '>') {
+ while (true) {
+ if (offset >= document.getLength()) {
break;
}
- region = document.getPartition( offset );
+ region = document.getPartition(offset);
offset = region.getOffset() + region.getLength();
- if ( XMLPartitionScanner.XML_ATTRIBUTE
- .equals(region.getType()) ) {
+ if (XMLPartitionScanner.XML_ATTRIBUTE.equals(region
+ .getType())) {
continue;
}
- if ( XMLPartitionScanner.XML_TAG
- .equals(region.getType()) ) {
- if ( document.getChar(region.getOffset()) == '<' ) {
+ if (XMLPartitionScanner.XML_TAG
+ .equals(region.getType())) {
+ if (document.getChar(region.getOffset()) == '<') {
break;
}
- if ( document.getChar(offset - 1) == '>' ) {
+ if (document.getChar(offset - 1) == '>') {
break;
}
@@ -79,33 +78,33 @@ public class TagDoubleClickStrategy extends TextDoubleClickStrategy {
}
}
- viewer.setSelectedRange( start, offset - start );
+ viewer.setSelectedRange(start, offset - start);
return;
}
int end = start + region.getLength();
- if ( offset == end - 1 && document.getChar(offset) == '>' ) {
- region = document.getPartition( offset );
+ if (offset == end - 1 && document.getChar(offset) == '>') {
+ region = document.getPartition(offset);
offset = region.getOffset();
- if ( document.getChar(offset) != '<' ) {
- while ( true ) {
- if ( offset <= 0 ) {
+ if (document.getChar(offset) != '<') {
+ while (true) {
+ if (offset <= 0) {
break;
}
- region = document.getPartition( offset - 1 );
+ region = document.getPartition(offset - 1);
offset = region.getOffset();
- if ( XMLPartitionScanner.XML_ATTRIBUTE
- .equals(region.getType()) ) {
+ if (XMLPartitionScanner.XML_ATTRIBUTE.equals(region
+ .getType())) {
continue;
}
- if ( XMLPartitionScanner.XML_TAG
- .equals(region.getType()) ) {
- if ( document.getChar(offset) == '<' ) {
+ if (XMLPartitionScanner.XML_TAG
+ .equals(region.getType())) {
+ if (document.getChar(offset) == '<') {
break;
}
@@ -117,11 +116,12 @@ public class TagDoubleClickStrategy extends TextDoubleClickStrategy {
}
}
- viewer.setSelectedRange( offset, end - offset );
+ viewer.setSelectedRange(offset, end - offset);
return;
}
- super.doubleClicked( viewer );
- } catch ( BadLocationException e ) {}
+ super.doubleClicked(viewer);
+ } catch (BadLocationException e) {
+ }
}
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/TextScanner.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/TextScanner.java
index 6eb0912..3ef9542 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/TextScanner.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/TextScanner.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: TextScanner.java,v 1.2 2005-05-06 00:55:41 stefanbjarni Exp $
+ * $Id: TextScanner.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -35,7 +35,7 @@ public class TextScanner extends BufferedRuleBasedScanner {
IToken entity = (Token) tokens.get(IXMLSyntaxConstants.XML_ENTITY);
- IRule[] rules = { new EntityRule(startEntity, entity)};
+ IRule[] rules = { new EntityRule(startEntity, entity) };
setRules(rules);
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/WhitespaceDetector.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/WhitespaceDetector.java
index 7591394..3efcc3e 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/WhitespaceDetector.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/WhitespaceDetector.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: WhitespaceDetector.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: WhitespaceDetector.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -27,14 +27,14 @@ public class WhitespaceDetector implements IWhitespaceDetector {
*/
public boolean isWhitespace(char ch) {
switch (ch) {
- case 0x09:
- case 0x0A:
- case 0x0D:
- case 0x20:
- return true;
+ case 0x09:
+ case 0x0A:
+ case 0x0D:
+ case 0x20:
+ return true;
- default:
- return false;
+ default:
+ return false;
}
}
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotation.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotation.java
index 153c7f7..fb371b8 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotation.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotation.java
@@ -8,23 +8,21 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: XMLAnnotation.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLAnnotation.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
import org.eclipse.jface.text.source.Annotation;
-
/**
* @author Igor Malinin
*/
public class XMLAnnotation extends Annotation {
- public static final String TYPE_ERROR =
- "org.eclipse.ui.workbench.texteditor.warning"; //$NON-NLS-1$
- public static final String TYPE_WARNING =
- "org.eclipse.ui.workbench.texteditor.error"; //$NON-NLS-1$
- public static final String TYPE_INFO =
- "org.eclipse.ui.workbench.texteditor.info"; //$NON-NLS-1$
+ public static final String TYPE_ERROR = "org.eclipse.ui.workbench.texteditor.warning"; //$NON-NLS-1$
+
+ public static final String TYPE_WARNING = "org.eclipse.ui.workbench.texteditor.error"; //$NON-NLS-1$
+
+ public static final String TYPE_INFO = "org.eclipse.ui.workbench.texteditor.info"; //$NON-NLS-1$
public XMLAnnotation(String type, boolean persistent, String text) {
super(type, persistent, text);
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotationHover.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotationHover.java
index 11d45ca..3e38663 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotationHover.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotationHover.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: XMLAnnotationHover.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLAnnotationHover.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -24,13 +24,13 @@ import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.ISourceViewer;
-
/**
* Implements simple annotation hover to show the associated messages.
*/
public class XMLAnnotationHover implements IAnnotationHover {
/*
- * @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer, int)
+ * @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer,
+ * int)
*/
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
List annotations = getAnnotationsForLine(sourceViewer, lineNumber);
@@ -69,7 +69,7 @@ public class XMLAnnotationHover implements IAnnotationHover {
StringBuffer buffer = new StringBuffer();
Iterator e = messages.iterator();
- while (e.hasNext()) {
+ while (e.hasNext()) {
buffer.append("- "); //$NON-NLS-1$
buffer.append(e.next());
buffer.append('\n');
@@ -98,8 +98,8 @@ public class XMLAnnotationHover implements IAnnotationHover {
Position position = model.getPosition(a);
if (position != null) {
try {
- int annotationLine = document
- .getLineOfOffset(position.getOffset());
+ int annotationLine = document.getLineOfOffset(position
+ .getOffset());
if (annotationLine == line) {
retVal.add(a);
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotationIterator.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotationIterator.java
index 838bd66..b86dea6 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotationIterator.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLAnnotationIterator.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: XMLAnnotationIterator.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLAnnotationIterator.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -17,7 +17,6 @@ import java.util.Iterator;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
-
/**
* @author Igor Malinin
*/
@@ -25,11 +24,10 @@ public class XMLAnnotationIterator implements Iterator {
private boolean skipIrrelevants;
private Iterator iterator;
+
private Annotation next;
- public XMLAnnotationIterator(
- IAnnotationModel model, boolean skipIrrelevants
- ) {
+ public XMLAnnotationIterator(IAnnotationModel model, boolean skipIrrelevants) {
this.skipIrrelevants = skipIrrelevants;
iterator = model.getAnnotationIterator();
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLConfiguration.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLConfiguration.java
index eeb3235..14a17c9 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLConfiguration.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLConfiguration.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: XMLConfiguration.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLConfiguration.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -43,184 +43,209 @@ import org.eclipse.ui.texteditor.ITextEditor;
* @author Igor Malinin
*/
public class XMLConfiguration extends TextSourceViewerConfiguration {
- protected XMLTextTools xmlTextTools;
-
- private ITextDoubleClickStrategy dcsDefault;
-
- private ITextDoubleClickStrategy dcsSimple;
-
- private ITextDoubleClickStrategy dcsTag;
-
- private ITextDoubleClickStrategy dcsAttValue;
-
- /** The associated editor. */
- private ITextEditor editor;
-
- public XMLConfiguration(XMLTextTools tools) {
- this(tools, null);
- }
-
- public XMLConfiguration(XMLTextTools tools, ITextEditor editor) {
- xmlTextTools = tools;
- this.editor = editor;
- dcsDefault = new TextDoubleClickStrategy();
- dcsSimple = new SimpleDoubleClickStrategy();
- dcsTag = new TagDoubleClickStrategy();
- dcsAttValue = new AttValueDoubleClickStrategy();
- }
-
- /*
- * @see SourceViewerConfiguration#getAnnotationHover(ISourceViewer)
- */
- public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
- return new XMLAnnotationHover();
- }
-
- /*
- * @see SourceViewerConfiguration#getTextHover(ISourceViewer, String)
- */
- public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
- if (editor != null) {
- IDocumentProvider provider = editor.getDocumentProvider();
- IEditorInput input = editor.getEditorInput();
- IAnnotationModel model = provider.getAnnotationModel(input);
- return new XMLTextHover(model);
- }
-
- return super.getTextHover(sourceViewer, contentType);
- }
-
- /*
- * @see SourceViewerConfiguration#getDoubleClickStrategy(ISourceViewer, String)
- */
- public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) {
- if (XMLPartitionScanner.XML_COMMENT.equals(contentType)) {
- return dcsSimple;
- }
-
- if (XMLPartitionScanner.XML_PI.equals(contentType)) {
- return dcsSimple;
- }
-
- if (XMLPartitionScanner.XML_TAG.equals(contentType)) {
- return dcsTag;
- }
-
- if (XMLPartitionScanner.XML_ATTRIBUTE.equals(contentType)) {
- return dcsAttValue;
- }
-
- if (XMLPartitionScanner.XML_CDATA.equals(contentType)) {
- return dcsSimple;
- }
-
- if (contentType.startsWith(XMLPartitionScanner.DTD_INTERNAL)) {
- return dcsSimple;
- }
-
- return dcsDefault;
- }
-
- /*
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredContentTypes(ISourceViewer)
- */
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return new String[] { IDocument.DEFAULT_CONTENT_TYPE, XMLPartitionScanner.XML_PI, XMLPartitionScanner.XML_COMMENT,
- XMLPartitionScanner.XML_DECL, XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_ATTRIBUTE,
- XMLPartitionScanner.XML_CDATA, XMLPartitionScanner.DTD_INTERNAL, XMLPartitionScanner.DTD_INTERNAL_PI,
- XMLPartitionScanner.DTD_INTERNAL_COMMENT, XMLPartitionScanner.DTD_INTERNAL_DECL, };
- }
-
- /*
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(ISourceViewer)
- */
- public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- PresentationReconciler reconciler = new PresentationReconciler();
-
- DefaultDamagerRepairer dr;
-
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLTextScanner());
- reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
- reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
-
- dr = new DefaultDamagerRepairer(xmlTextTools.getDTDTextScanner());
- reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL);
- reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL);
-
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLPIScanner());
-
- reconciler.setDamager(dr, XMLPartitionScanner.XML_PI);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_PI);
- reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_PI);
- reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_PI);
-
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLCommentScanner());
-
- reconciler.setDamager(dr, XMLPartitionScanner.XML_COMMENT);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_COMMENT);
- reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
- reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
-
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLDeclScanner());
-
- reconciler.setDamager(dr, XMLPartitionScanner.XML_DECL);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_DECL);
- reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_DECL);
- reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_DECL);
-
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLTagScanner());
-
- reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
-
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLAttributeScanner());
-
- reconciler.setDamager(dr, XMLPartitionScanner.XML_ATTRIBUTE);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_ATTRIBUTE);
-
- dr = new DefaultDamagerRepairer(xmlTextTools.getXMLCDATAScanner());
-
- reconciler.setDamager(dr, XMLPartitionScanner.XML_CDATA);
- reconciler.setRepairer(dr, XMLPartitionScanner.XML_CDATA);
-
- return reconciler;
- }
-
- /*
- * @see SourceViewerConfiguration#getReconciler(ISourceViewer)
- */
- public IReconciler getReconciler(ISourceViewer sourceViewer) {
- if ((editor != null) && editor.isEditable()) {
- MonoReconciler reconciler = new MonoReconciler(new XMLReconcilingStrategy(editor), false);
- reconciler.setProgressMonitor(new NullProgressMonitor());
- reconciler.setDelay(500);
- return reconciler;
- }
-
- return null;
- }
-
- public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- ContentAssistant assistant = new ContentAssistant();
- assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
-
- IContentAssistProcessor processor = new BasicCompletionProcessor();
- assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_TAG);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_PI);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_COMMENT);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_DECL);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_TAG);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_ATTRIBUTE);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.XML_CDATA);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.DTD_INTERNAL);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.DTD_INTERNAL_PI);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
- assistant.setContentAssistProcessor(processor, XMLPartitionScanner.DTD_INTERNAL_DECL);
- assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
- assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
-
- return assistant;
- }
+ protected XMLTextTools xmlTextTools;
+
+ private ITextDoubleClickStrategy dcsDefault;
+
+ private ITextDoubleClickStrategy dcsSimple;
+
+ private ITextDoubleClickStrategy dcsTag;
+
+ private ITextDoubleClickStrategy dcsAttValue;
+
+ /** The associated editor. */
+ private ITextEditor editor;
+
+ public XMLConfiguration(XMLTextTools tools) {
+ this(tools, null);
+ }
+
+ public XMLConfiguration(XMLTextTools tools, ITextEditor editor) {
+ xmlTextTools = tools;
+ this.editor = editor;
+ dcsDefault = new TextDoubleClickStrategy();
+ dcsSimple = new SimpleDoubleClickStrategy();
+ dcsTag = new TagDoubleClickStrategy();
+ dcsAttValue = new AttValueDoubleClickStrategy();
+ }
+
+ /*
+ * @see SourceViewerConfiguration#getAnnotationHover(ISourceViewer)
+ */
+ public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
+ return new XMLAnnotationHover();
+ }
+
+ /*
+ * @see SourceViewerConfiguration#getTextHover(ISourceViewer, String)
+ */
+ public ITextHover getTextHover(ISourceViewer sourceViewer,
+ String contentType) {
+ if (editor != null) {
+ IDocumentProvider provider = editor.getDocumentProvider();
+ IEditorInput input = editor.getEditorInput();
+ IAnnotationModel model = provider.getAnnotationModel(input);
+ return new XMLTextHover(model);
+ }
+
+ return super.getTextHover(sourceViewer, contentType);
+ }
+
+ /*
+ * @see SourceViewerConfiguration#getDoubleClickStrategy(ISourceViewer,
+ * String)
+ */
+ public ITextDoubleClickStrategy getDoubleClickStrategy(
+ ISourceViewer sourceViewer, String contentType) {
+ if (XMLPartitionScanner.XML_COMMENT.equals(contentType)) {
+ return dcsSimple;
+ }
+
+ if (XMLPartitionScanner.XML_PI.equals(contentType)) {
+ return dcsSimple;
+ }
+
+ if (XMLPartitionScanner.XML_TAG.equals(contentType)) {
+ return dcsTag;
+ }
+
+ if (XMLPartitionScanner.XML_ATTRIBUTE.equals(contentType)) {
+ return dcsAttValue;
+ }
+
+ if (XMLPartitionScanner.XML_CDATA.equals(contentType)) {
+ return dcsSimple;
+ }
+
+ if (contentType.startsWith(XMLPartitionScanner.DTD_INTERNAL)) {
+ return dcsSimple;
+ }
+
+ return dcsDefault;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredContentTypes(ISourceViewer)
+ */
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
+ XMLPartitionScanner.XML_PI, XMLPartitionScanner.XML_COMMENT,
+ XMLPartitionScanner.XML_DECL, XMLPartitionScanner.XML_TAG,
+ XMLPartitionScanner.XML_ATTRIBUTE,
+ XMLPartitionScanner.XML_CDATA,
+ XMLPartitionScanner.DTD_INTERNAL,
+ XMLPartitionScanner.DTD_INTERNAL_PI,
+ XMLPartitionScanner.DTD_INTERNAL_COMMENT,
+ XMLPartitionScanner.DTD_INTERNAL_DECL, };
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(ISourceViewer)
+ */
+ public IPresentationReconciler getPresentationReconciler(
+ ISourceViewer sourceViewer) {
+ PresentationReconciler reconciler = new PresentationReconciler();
+
+ DefaultDamagerRepairer dr;
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLTextScanner());
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getDTDTextScanner());
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLPIScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_PI);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_PI);
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_PI);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_PI);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLCommentScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_COMMENT);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_COMMENT);
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_COMMENT);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLDeclScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_DECL);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_DECL);
+ reconciler.setDamager(dr, XMLPartitionScanner.DTD_INTERNAL_DECL);
+ reconciler.setRepairer(dr, XMLPartitionScanner.DTD_INTERNAL_DECL);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLTagScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLAttributeScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_ATTRIBUTE);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_ATTRIBUTE);
+
+ dr = new DefaultDamagerRepairer(xmlTextTools.getXMLCDATAScanner());
+
+ reconciler.setDamager(dr, XMLPartitionScanner.XML_CDATA);
+ reconciler.setRepairer(dr, XMLPartitionScanner.XML_CDATA);
+
+ return reconciler;
+ }
+
+ /*
+ * @see SourceViewerConfiguration#getReconciler(ISourceViewer)
+ */
+ public IReconciler getReconciler(ISourceViewer sourceViewer) {
+ if ((editor != null) && editor.isEditable()) {
+ MonoReconciler reconciler = new MonoReconciler(
+ new XMLReconcilingStrategy(editor), false);
+ reconciler.setProgressMonitor(new NullProgressMonitor());
+ reconciler.setDelay(500);
+ return reconciler;
+ }
+
+ return null;
+ }
+
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ ContentAssistant assistant = new ContentAssistant();
+ assistant
+ .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+
+ IContentAssistProcessor processor = new BasicCompletionProcessor();
+ assistant.setContentAssistProcessor(processor,
+ IDocument.DEFAULT_CONTENT_TYPE);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_TAG);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_PI);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_COMMENT);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_DECL);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_TAG);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_ATTRIBUTE);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.XML_CDATA);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.DTD_INTERNAL);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.DTD_INTERNAL_PI);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.DTD_INTERNAL_COMMENT);
+ assistant.setContentAssistProcessor(processor,
+ XMLPartitionScanner.DTD_INTERNAL_DECL);
+ assistant
+ .setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
+ assistant
+ .setInformationControlCreator(getInformationControlCreator(sourceViewer));
+
+ return assistant;
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLPartitionScanner.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLPartitionScanner.java
index fd44b54..eca1657 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLPartitionScanner.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLPartitionScanner.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: XMLPartitionScanner.java,v 1.4 2006-01-15 12:24:16 bananeweizen Exp $
+ * $Id: XMLPartitionScanner.java,v 1.5 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -24,40 +24,54 @@ import org.eclipse.jface.text.rules.IPartitionTokenScanner;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.Token;
-
/**
- *
- *
+ *
+ *
* @author Igor Malinin
*/
public class XMLPartitionScanner implements IPartitionTokenScanner {
- public static final String XML_PI = "__xml_processing_instruction";
- public static final String XML_COMMENT = "__xml_comment";
- public static final String XML_DECL = "__xml_declaration";
- public static final String XML_TAG = "__xml_tag";
- public static final String XML_ATTRIBUTE = "__xml_attribute";
- public static final String XML_CDATA = "__xml_cdata";
-
- public static final String DTD_INTERNAL = "__dtd_internal";
- public static final String DTD_INTERNAL_PI = "__dtd_internal_pi";
+ public static final String XML_PI = "__xml_processing_instruction";
+
+ public static final String XML_COMMENT = "__xml_comment";
+
+ public static final String XML_DECL = "__xml_declaration";
+
+ public static final String XML_TAG = "__xml_tag";
+
+ public static final String XML_ATTRIBUTE = "__xml_attribute";
+
+ public static final String XML_CDATA = "__xml_cdata";
+
+ public static final String DTD_INTERNAL = "__dtd_internal";
+
+ public static final String DTD_INTERNAL_PI = "__dtd_internal_pi";
+
public static final String DTD_INTERNAL_COMMENT = "__dtd_internal_comment";
- public static final String DTD_INTERNAL_DECL = "__dtd_internal_declaration";
- public static final String DTD_CONDITIONAL = "__dtd_conditional";
- public static final int STATE_DEFAULT = 0;
- public static final int STATE_TAG = 1;
- public static final int STATE_DECL = 2;
- public static final int STATE_CDATA = 4;
+ public static final String DTD_INTERNAL_DECL = "__dtd_internal_declaration";
+
+ public static final String DTD_CONDITIONAL = "__dtd_conditional";
+
+ public static final int STATE_DEFAULT = 0;
- public static final int STATE_INTERNAL = 8;
+ public static final int STATE_TAG = 1;
+
+ public static final int STATE_DECL = 2;
+
+ public static final int STATE_CDATA = 4;
+
+ public static final int STATE_INTERNAL = 8;
protected IDocument document;
+
protected int end;
protected int offset;
+
protected int length;
protected int position;
+
protected int state;
protected boolean parsedtd;
@@ -75,125 +89,124 @@ public class XMLPartitionScanner implements IPartitionTokenScanner {
offset += length;
switch (state) {
- case STATE_TAG:
- return nextTagToken();
+ case STATE_TAG:
+ return nextTagToken();
- case STATE_DECL:
- return nextDeclToken();
+ case STATE_DECL:
+ return nextDeclToken();
- case STATE_CDATA:
- return nextCDATAToken();
+ case STATE_CDATA:
+ return nextCDATAToken();
}
switch (read()) {
+ case ICharacterScanner.EOF:
+ state = STATE_DEFAULT;
+ return getToken(null);
+
+ case '<':
+ switch (read()) {
case ICharacterScanner.EOF:
+ if (parsedtd || isInternal()) {
+ break;
+ }
+
state = STATE_DEFAULT;
- return getToken(null);
+ return getToken(XML_TAG);
- case '<':
+ case '?': // ':
- state = STATE_DEFAULT;
- return getToken(XML_TAG);
+ case ICharacterScanner.EOF:
+ case '>':
+ state = STATE_DEFAULT;
+ return getToken(XML_TAG);
- case '"': case '\'':
- while (true) {
- int ch = read();
+ case '"':
+ case '\'':
+ while (true) {
+ int ch = read();
- if (ch == quot) {
- state = STATE_TAG;
- return getToken(XML_ATTRIBUTE);
- }
+ if (ch == quot) {
+ state = STATE_TAG;
+ return getToken(XML_ATTRIBUTE);
+ }
- switch (ch) {
- case '<':
- unread();
+ switch (ch) {
+ case '<':
+ unread();
- case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
- return getToken(XML_ATTRIBUTE);
- }
+ case ICharacterScanner.EOF:
+ state = STATE_DEFAULT;
+ return getToken(XML_ATTRIBUTE);
}
- default:
- unread();
+ }
+ default:
+ unread();
}
while (true) {
switch (read()) {
- case '<':
- unread();
+ case '<':
+ unread();
- case ICharacterScanner.EOF:
- case '>':
- state = STATE_DEFAULT;
- return getToken(XML_TAG);
+ case ICharacterScanner.EOF:
+ case '>':
+ state = STATE_DEFAULT;
+ return getToken(XML_TAG);
- case '"': case '\'':
- unread();
+ case '"':
+ case '\'':
+ unread();
- state = STATE_TAG;
- return getToken(XML_TAG);
+ state = STATE_TAG;
+ return getToken(XML_TAG);
}
}
}
@@ -251,38 +266,38 @@ loop:
private IToken nextDeclToken() {
loop: while (true) {
switch (read()) {
- case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
- return getToken(isInternal() ? DTD_INTERNAL_DECL : XML_DECL);
+ case ICharacterScanner.EOF:
+ state = STATE_DEFAULT;
+ return getToken(isInternal() ? DTD_INTERNAL_DECL : XML_DECL);
- case '<':
- if (parsedtd || isInternal()) {
- switch (read()) {
- case ICharacterScanner.EOF:
- state = STATE_DEFAULT;
- return getToken(isInternal() ? DTD_INTERNAL : null);
-
- case '!':
- case '?':
- unread();
- break;
-
- default:
- continue loop;
- }
+ case '<':
+ if (parsedtd || isInternal()) {
+ switch (read()) {
+ case ICharacterScanner.EOF:
+ state = STATE_DEFAULT;
+ return getToken(isInternal() ? DTD_INTERNAL : null);
+
+ case '!':
+ case '?':
+ unread();
+ break;
+
+ default:
+ continue loop;
}
+ }
- unread();
+ unread();
- case '>':
- state &= STATE_INTERNAL;
- return getToken(isInternal() ? DTD_INTERNAL_DECL : XML_DECL);
+ case '>':
+ state &= STATE_INTERNAL;
+ return getToken(isInternal() ? DTD_INTERNAL_DECL : XML_DECL);
- case '[': //
- if (!isInternal()) {
- state = STATE_INTERNAL;
- return getToken(XML_DECL);
- }
+ case '[': //
+ if (!isInternal()) {
+ state = STATE_INTERNAL;
+ return getToken(XML_DECL);
+ }
}
}
}
@@ -292,24 +307,24 @@ loop:
loop: while (true) {
switch (read()) {
+ case ICharacterScanner.EOF:
+ break loop;
+
+ case '-': // - -->
+ switch (read()) {
case ICharacterScanner.EOF:
break loop;
- case '-': // - -->
+ case '-': // -- -->
switch (read()) {
- case ICharacterScanner.EOF:
- break loop;
-
- case '-': // -- -->
- switch (read()) {
- case ICharacterScanner.EOF:
- case '>':
- break loop;
- }
-
- unread();
- continue loop;
+ case ICharacterScanner.EOF:
+ case '>':
+ break loop;
}
+
+ unread();
+ continue loop;
+ }
}
}
@@ -321,17 +336,17 @@ loop:
loop: while (true) {
switch (read()) {
+ case ICharacterScanner.EOF:
+ break loop;
+
+ case '?': // ? ?>
+ switch (read()) {
case ICharacterScanner.EOF:
+ case '>':
break loop;
+ }
- case '?': // ? ?>
- switch (read()) {
- case ICharacterScanner.EOF:
- case '>':
- break loop;
- }
-
- unread();
+ unread();
}
}
@@ -341,28 +356,27 @@ loop:
private IToken nextCDATAToken() {
state = STATE_DEFAULT;
-loop:
- while (true) {
+ loop: while (true) {
switch (read()) {
+ case ICharacterScanner.EOF:
+ break loop;
+
+ case ']': // ] ]]>
+ switch (read()) {
case ICharacterScanner.EOF:
break loop;
- case ']': // ] ]]>
+ case ']': // ]] ]]>
switch (read()) {
- case ICharacterScanner.EOF:
- break loop;
-
- case ']': // ]] ]]>
- switch (read()) {
- case ICharacterScanner.EOF:
- case '>': // ]]>
- break loop;
- }
-
- unread();
- unread();
- continue loop;
+ case ICharacterScanner.EOF:
+ case '>': // ]]>
+ break loop;
}
+
+ unread();
+ unread();
+ continue loop;
+ }
}
}
@@ -374,54 +388,53 @@ loop:
int level = 1;
-loop:
- while (true) {
+ loop: while (true) {
switch (read()) {
+ case ICharacterScanner.EOF:
+ break loop;
+
+ case '<': // - -->
+ switch (read()) {
case ICharacterScanner.EOF:
break loop;
- case '<': // - -->
+ case '!': // -- -->
switch (read()) {
- case ICharacterScanner.EOF:
- break loop;
-
- case '!': // -- -->
- switch (read()) {
- case ICharacterScanner.EOF:
- break loop;
-
- case '[':
- ++level;
- continue loop;
- }
+ case ICharacterScanner.EOF:
+ break loop;
- unread();
- continue loop;
+ case '[':
+ ++level;
+ continue loop;
}
unread();
continue loop;
+ }
- case ']': // - -->
- switch (read()) {
- case ICharacterScanner.EOF:
- break loop;
+ unread();
+ continue loop;
- case ']': // -- -->
- switch (read()) {
- case ICharacterScanner.EOF:
- case '>':
- if (--level == 0) {
- break loop;
- }
+ case ']': // - -->
+ switch (read()) {
+ case ICharacterScanner.EOF:
+ break loop;
- continue loop;
- }
+ case ']': // -- -->
+ switch (read()) {
+ case ICharacterScanner.EOF:
+ case '>':
+ if (--level == 0) {
+ break loop;
+ }
- unread();
- unread();
- continue loop;
+ continue loop;
}
+
+ unread();
+ unread();
+ continue loop;
+ }
}
}
@@ -473,7 +486,7 @@ loop:
* @see org.eclipse.jface.text.rules.ITokenScanner#getTokenOffset()
*/
public int getTokenOffset() {
- Assert.isTrue(offset>=0, Integer.toString(offset));
+ Assert.isTrue(offset >= 0, Integer.toString(offset));
return offset;
}
@@ -485,7 +498,8 @@ loop:
}
/*
- * @see org.eclipse.jface.text.rules.ITokenScanner#setRange(IDocument, int, int)
+ * @see org.eclipse.jface.text.rules.ITokenScanner#setRange(IDocument, int,
+ * int)
*/
public void setRange(IDocument document, int offset, int length) {
this.document = document;
@@ -495,48 +509,47 @@ loop:
this.position = offset;
this.length = 0;
- this.state = STATE_DEFAULT;
+ this.state = STATE_DEFAULT;
}
/*
- * @see org.eclipse.jface.text.rules.IPartitionTokenScanner
- */
-// public void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) {
-// state = STATE_DEFAULT;
-// if (partitionOffset > -1) {
-// int delta = offset - partitionOffset;
-// if (delta > 0) {
-// setRange(document, partitionOffset, length + delta);
-// return;
-// }
-// }
-// setRange(document, partitionOffset, length);
-// }
+ * @see org.eclipse.jface.text.rules.IPartitionTokenScanner
+ */
+ // public void setPartialRange(IDocument document, int offset, int length,
+ // String contentType, int partitionOffset) {
+ // state = STATE_DEFAULT;
+ // if (partitionOffset > -1) {
+ // int delta = offset - partitionOffset;
+ // if (delta > 0) {
+ // setRange(document, partitionOffset, length + delta);
+ // return;
+ // }
+ // }
+ // setRange(document, partitionOffset, length);
+ // }
/*
* @see org.eclipse.jface.text.rules.IPartitionTokenScanner
*/
- public void setPartialRange(
- IDocument document, int offset, int length,
- String contentType, int partitionOffset
- ) {
-// boolean flag = false;
+ public void setPartialRange(IDocument document, int offset, int length,
+ String contentType, int partitionOffset) {
+ // boolean flag = false;
this.document = document;
this.end = offset + length;
// NB! Undocumented value: -1
if (partitionOffset >= 0) {
offset = partitionOffset;
-// flag = true;
+ // flag = true;
}
this.offset = offset;
this.position = offset;
this.length = 0;
-// if (flag) {
-// state = STATE_DEFAULT;
-// return;
-// }
+ // if (flag) {
+ // state = STATE_DEFAULT;
+ // return;
+ // }
if (contentType == XML_ATTRIBUTE) {
state = STATE_TAG;
return;
@@ -552,11 +565,9 @@ loop:
return;
}
- if (contentType == DTD_INTERNAL ||
- contentType == DTD_INTERNAL_PI ||
- contentType == DTD_INTERNAL_DECL ||
- contentType == DTD_INTERNAL_COMMENT
- ) {
+ if (contentType == DTD_INTERNAL || contentType == DTD_INTERNAL_PI
+ || contentType == DTD_INTERNAL_DECL
+ || contentType == DTD_INTERNAL_COMMENT) {
state = STATE_INTERNAL;
return;
}
@@ -571,7 +582,8 @@ loop:
if (type != IDocument.DEFAULT_CONTENT_TYPE) {
return true;
}
- } catch (BadLocationException e) {}
+ } catch (BadLocationException e) {
+ }
return false;
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLReconcileStep.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLReconcileStep.java
index 3b54d70..4bfbac7 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLReconcileStep.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLReconcileStep.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: XMLReconcileStep.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLReconcileStep.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -95,13 +95,14 @@ public class XMLReconcileStep extends AbstractReconcileStep {
*/
private class ProblemAdapter extends AnnotationAdapter {
private IProblem problem;
+
private Position position;
- public ProblemAdapter(IProblem problem) {
+ public ProblemAdapter(IProblem problem) {
this.problem = problem;
}
- public Position getPosition() {
+ public Position getPosition() {
if (position == null) {
position = createPositionFromProblem();
}
@@ -168,8 +169,10 @@ public class XMLReconcileStep extends AbstractReconcileStep {
/**
* Constructor.
*
- * @param step the step to add to the pipe
- * @param editor the associated text editor
+ * @param step
+ * the step to add to the pipe
+ * @param editor
+ * the associated text editor
*/
public XMLReconcileStep(IReconcileStep step, ITextEditor editor) {
super(step);
@@ -184,21 +187,19 @@ public class XMLReconcileStep extends AbstractReconcileStep {
/*
* @see AbstractReconcileStep#reconcileModel(DirtyRegion, IRegion)
*/
- protected IReconcileResult[] reconcileModel(
- DirtyRegion dirtyRegion, IRegion subRegion
- ) {
+ protected IReconcileResult[] reconcileModel(DirtyRegion dirtyRegion,
+ IRegion subRegion) {
IXMLDocument model = xmlDocumentAdapter.getDocument();
-
IEditorInput editorInput = null;
IFile file = null;
- if (editor != null) {
- editorInput = editor.getEditorInput();
- }
+ if (editor != null) {
+ editorInput = editor.getEditorInput();
+ }
- if (editorInput instanceof IFileEditorInput)
- file = ((IFileEditorInput) editorInput).getFile();
- ProblemCollector problemCollector = new ProblemCollector();
+ if (editorInput instanceof IFileEditorInput)
+ file = ((IFileEditorInput) editorInput).getFile();
+ ProblemCollector problemCollector = new ProblemCollector();
model.reconcile(problemCollector, file);
List problems = problemCollector.getProblems();
@@ -226,8 +227,7 @@ public class XMLReconcileStep extends AbstractReconcileStep {
private IXMLDocument getXMLDocument() {
IDocumentProvider documentProvider = editor.getDocumentProvider();
if (documentProvider instanceof XMLDocumentProvider) {
- XMLDocumentProvider xmlDocumentProvider =
- (XMLDocumentProvider) documentProvider;
+ XMLDocumentProvider xmlDocumentProvider = (XMLDocumentProvider) documentProvider;
return xmlDocumentProvider.getModel(editor.getEditorInput());
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLReconcilingStrategy.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLReconcilingStrategy.java
index 9ee1eba..47a7798 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLReconcilingStrategy.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLReconcilingStrategy.java
@@ -8,11 +8,10 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: XMLReconcilingStrategy.java,v 1.2 2005-05-06 00:55:41 stefanbjarni Exp $
+ * $Id: XMLReconcilingStrategy.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
-
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
@@ -38,8 +37,8 @@ import org.eclipse.ui.texteditor.ITextEditor;
* Reconciling strategy for XML document. This class is responsible for keeping
* the parsed model in sync with the text.
*/
-public class XMLReconcilingStrategy
- implements IReconcilingStrategy, IReconcilingStrategyExtension {
+public class XMLReconcilingStrategy implements IReconcilingStrategy,
+ IReconcilingStrategyExtension {
// Instance Variables ------------------------------------------------------
@@ -88,7 +87,7 @@ public class XMLReconcilingStrategy
*/
public void setDocument(IDocument document) {
// FIXME
- firstStep.setInputModel(null); //new DocumentAdapter(document);
+ firstStep.setInputModel(null); // new DocumentAdapter(document);
}
// IReconcilingStrategyExtension Implementation ----------------------------
@@ -115,7 +114,7 @@ public class XMLReconcilingStrategy
*
* @return the annotation model
*/
- IAnnotationModel getAnnotationModel() {
+ IAnnotationModel getAnnotationModel() {
IEditorInput input = editor.getEditorInput();
return editor.getDocumentProvider().getAnnotationModel(input);
}
@@ -130,10 +129,9 @@ public class XMLReconcilingStrategy
IRunnableWithProgress runnable = new WorkspaceModifyOperation() {
protected void execute(IProgressMonitor monitor) {
- for (int i = 0; i < results.length; i++) {
- if ((progressMonitor != null) &&
- (progressMonitor.isCanceled()))
- {
+ for (int i = 0; i < results.length; i++) {
+ if ((progressMonitor != null)
+ && (progressMonitor.isCanceled())) {
return;
}
@@ -162,11 +160,11 @@ public class XMLReconcilingStrategy
/*
* TODO A "real" implementation must be smarter, i.e. don't remove and add
- * the annotations which are the same.
- */
+ * the annotations which are the same.
+ */
private void removeTemporaryAnnotations() {
Iterator i = getAnnotationModel().getAnnotationIterator();
- while (i.hasNext()) {
+ while (i.hasNext()) {
Annotation annotation = (Annotation) i.next();
if (!annotation.isPersistent()) {
getAnnotationModel().removeAnnotation(annotation);
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTagRule.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTagRule.java
index 7c4c4f7..da8fa87 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTagRule.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTagRule.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: XMLTagRule.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLTagRule.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -53,12 +53,12 @@ public class XMLTagRule implements IRule {
}
loop: while (true) {
switch (ch) {
- case ICharacterScanner.EOF:
- case 0x09:
- case 0x0A:
- case 0x0D:
- case 0x20:
- break loop;
+ case ICharacterScanner.EOF:
+ case 0x09:
+ case 0x0A:
+ case 0x0D:
+ case 0x20:
+ break loop;
}
ch = scanner.read();
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTagScanner.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTagScanner.java
index 991212e..f0ef3d1 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTagScanner.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTagScanner.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: XMLTagScanner.java,v 1.2 2005-05-06 00:55:41 stefanbjarni Exp $
+ * $Id: XMLTagScanner.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -32,14 +32,14 @@ public class XMLTagScanner extends BufferedRuleBasedScanner {
* Creates a color token scanner.
*/
public XMLTagScanner(Map tokens) {
- setDefaultReturnToken((Token) tokens.get(
- IXMLSyntaxConstants.XML_DEFAULT));
+ setDefaultReturnToken((Token) tokens
+ .get(IXMLSyntaxConstants.XML_DEFAULT));
IToken tag = (Token) tokens.get(IXMLSyntaxConstants.XML_TAG);
IToken attribute = (Token) tokens.get(IXMLSyntaxConstants.XML_ATT_NAME);
IRule[] rules = { new XMLTagRule(tag),
- new WordRule(new NameDetector(), attribute),};
+ new WordRule(new NameDetector(), attribute), };
setRules(rules);
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTextHover.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTextHover.java
index 29a61dc..998f415 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTextHover.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLTextHover.java
@@ -8,7 +8,7 @@
* Contributors:
* Christopher Lenz - initial API and implementation
*
- * $Id: XMLTextHover.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLTextHover.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -21,7 +21,6 @@ import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
-
/**
* Implements simple annotation hover to show the associated messages.
*/
@@ -34,12 +33,13 @@ public class XMLTextHover implements ITextHover {
/**
* Creates a new annotation hover.
*
- * @param model this hover's annotation model
+ * @param model
+ * this hover's annotation model
*/
- public XMLTextHover(IAnnotationModel model) {
+ public XMLTextHover(IAnnotationModel model) {
this.model = model;
}
-
+
/*
* @see ITextHover#getHoverInfo(ITextViewer, IRegion)
*/
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLWordFinder.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLWordFinder.java
index 7348ff5..4e2fbd8 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLWordFinder.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/text/XMLWordFinder.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial implementation
*
- * $Id: XMLWordFinder.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLWordFinder.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.internal.text;
@@ -17,7 +17,6 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
-
/**
*
*
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/DTDTextTools.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/DTDTextTools.java
index 032b700..bb2fbbc 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/DTDTextTools.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/DTDTextTools.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: DTDTextTools.java,v 1.2 2005-05-06 00:55:41 stefanbjarni Exp $
+ * $Id: DTDTextTools.java,v 1.3 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.text;
@@ -27,30 +27,21 @@ import org.eclipse.jface.text.rules.DefaultPartitioner;
import org.eclipse.jface.text.rules.IPartitionTokenScanner;
import org.eclipse.jface.text.rules.RuleBasedScanner;
-
/**
*
*
* @author Igor Malinin
*/
public class DTDTextTools extends AbstractTextTools {
- private static final String[] TOKENS = {
- IXMLSyntaxConstants.XML_DEFAULT,
- IXMLSyntaxConstants.XML_ATT_NAME,
- IXMLSyntaxConstants.XML_ATT_VALUE,
- IXMLSyntaxConstants.XML_ENTITY,
- IXMLSyntaxConstants.XML_PI,
- IXMLSyntaxConstants.XML_COMMENT,
- IXMLSyntaxConstants.XML_DECL,
- IXMLSyntaxConstants.DTD_CONDITIONAL,
- };
-
- private static final String[] TYPES = {
- XMLPartitionScanner.XML_PI,
- XMLPartitionScanner.XML_COMMENT,
- XMLPartitionScanner.XML_DECL,
- XMLPartitionScanner.DTD_CONDITIONAL,
- };
+ private static final String[] TOKENS = { IXMLSyntaxConstants.XML_DEFAULT,
+ IXMLSyntaxConstants.XML_ATT_NAME,
+ IXMLSyntaxConstants.XML_ATT_VALUE, IXMLSyntaxConstants.XML_ENTITY,
+ IXMLSyntaxConstants.XML_PI, IXMLSyntaxConstants.XML_COMMENT,
+ IXMLSyntaxConstants.XML_DECL, IXMLSyntaxConstants.DTD_CONDITIONAL, };
+
+ private static final String[] TYPES = { XMLPartitionScanner.XML_PI,
+ XMLPartitionScanner.XML_COMMENT, XMLPartitionScanner.XML_DECL,
+ XMLPartitionScanner.DTD_CONDITIONAL, };
/** The DTD partitions scanner */
private XMLPartitionScanner dtdPartitionScanner;
@@ -64,7 +55,7 @@ public class DTDTextTools extends AbstractTextTools {
/** The XML processing instructions scanner */
private SingleTokenScanner xmlPIScanner;
- /** The XML comments scanner */
+ /** The XML comments scanner */
private SingleTokenScanner xmlCommentScanner;
/** The XML declarations scanner */
@@ -73,33 +64,33 @@ public class DTDTextTools extends AbstractTextTools {
/**
* Creates a new DTD text tools collection.
*/
- public DTDTextTools( IPreferenceStore store ) {
- super( store, TOKENS );
+ public DTDTextTools(IPreferenceStore store) {
+ super(store, TOKENS);
- dtdPartitionScanner = new XMLPartitionScanner( true );
+ dtdPartitionScanner = new XMLPartitionScanner(true);
Map tokens = getTokens();
- dtdTextScanner = new TextScanner(
- tokens, '%', IXMLSyntaxConstants.XML_DEFAULT );
+ dtdTextScanner = new TextScanner(tokens, '%',
+ IXMLSyntaxConstants.XML_DEFAULT);
- dtdConditionalScanner = new SingleTokenScanner(
- tokens, IXMLSyntaxConstants.DTD_CONDITIONAL ); //cond
+ dtdConditionalScanner = new SingleTokenScanner(tokens,
+ IXMLSyntaxConstants.DTD_CONDITIONAL); // cond
- xmlPIScanner = new SingleTokenScanner(
- tokens, IXMLSyntaxConstants.XML_PI );
+ xmlPIScanner = new SingleTokenScanner(tokens,
+ IXMLSyntaxConstants.XML_PI);
- xmlCommentScanner = new SingleTokenScanner(
- tokens, IXMLSyntaxConstants.XML_COMMENT );
+ xmlCommentScanner = new SingleTokenScanner(tokens,
+ IXMLSyntaxConstants.XML_COMMENT);
- xmlDeclScanner = new DeclScanner( tokens );
+ xmlDeclScanner = new DeclScanner(tokens);
}
/**
*
*/
public IDocumentPartitioner createDTDPartitioner() {
- return new DefaultPartitioner( dtdPartitionScanner, TYPES );
+ return new DefaultPartitioner(dtdPartitionScanner, TYPES);
}
/**
@@ -112,27 +103,26 @@ public class DTDTextTools extends AbstractTextTools {
/**
* Returns a scanner which is configured to scan DTD text.
*
- * @return an DTD text scanner
+ * @return an DTD text scanner
*/
public RuleBasedScanner getDTDTextScanner() {
return dtdTextScanner;
}
/**
- * Returns a scanner which is configured to scan DTD
- * conditional sections.
+ * Returns a scanner which is configured to scan DTD conditional sections.
*
- * @return an DTD conditional section scanner
+ * @return an DTD conditional section scanner
*/
public RuleBasedScanner getDTDConditionalScanner() {
return dtdConditionalScanner;
}
/**
- * Returns a scanner which is configured to scan XML
- * processing instructions.
+ * Returns a scanner which is configured to scan XML processing
+ * instructions.
*
- * @return an XML processing instruction scanner
+ * @return an XML processing instruction scanner
*/
public RuleBasedScanner getXMLPIScanner() {
return xmlPIScanner;
@@ -141,7 +131,7 @@ public class DTDTextTools extends AbstractTextTools {
/**
* Returns a scanner which is configured to scan XML comments.
*
- * @return an XML comment scanner
+ * @return an XML comment scanner
*/
public RuleBasedScanner getXMLCommentScanner() {
return xmlCommentScanner;
@@ -150,7 +140,7 @@ public class DTDTextTools extends AbstractTextTools {
/**
* Returns a scanner which is configured to scan XML declarations.
*
- * @return an XML declaration scanner
+ * @return an XML declaration scanner
*/
public RuleBasedScanner getXMLDeclScanner() {
return xmlDeclScanner;
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/IXMLSyntaxConstants.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/IXMLSyntaxConstants.java
index e279c65..7f3e194 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/IXMLSyntaxConstants.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/IXMLSyntaxConstants.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: IXMLSyntaxConstants.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: IXMLSyntaxConstants.java,v 1.2 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.text;
@@ -19,8 +19,8 @@ package net.sourceforge.phpeclipse.xml.ui.text;
public interface IXMLSyntaxConstants {
/**
- * Note: This constant is for internal use only. Clients should not use
- * this constant. The prefix all color constants start with.
+ * Note: This constant is for internal use only. Clients should not use this
+ * constant. The prefix all color constants start with.
*/
String PREFIX = "xml_"; //$NON-NLS-1$
@@ -53,7 +53,7 @@ public interface IXMLSyntaxConstants {
/** The style key for external DTD conditional sections. */
String DTD_CONDITIONAL = PREFIX + "conditional"; //$NON-NLS-1$
-
+
/** The style key for SMARTY tag names. */
String XML_SMARTY = PREFIX + "smarty"; //$NON-NLS-1$
}
diff --git a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/XMLTextTools.java b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/XMLTextTools.java
index 8d05650..5c6d32b 100644
--- a/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/XMLTextTools.java
+++ b/net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/text/XMLTextTools.java
@@ -8,7 +8,7 @@
* Contributors:
* Igor Malinin - initial contribution
*
- * $Id: XMLTextTools.java,v 1.3 2005-05-15 23:23:02 axelcl Exp $
+ * $Id: XMLTextTools.java,v 1.4 2006-10-21 23:14:13 pombredanne Exp $
*/
package net.sourceforge.phpeclipse.xml.ui.text;
@@ -30,7 +30,6 @@ import org.eclipse.jface.text.rules.DefaultPartitioner;
import org.eclipse.jface.text.rules.ITokenScanner;
import org.eclipse.jface.text.rules.RuleBasedScanner;
-
/**
*
*
@@ -38,37 +37,27 @@ import org.eclipse.jface.text.rules.RuleBasedScanner;
*/
public class XMLTextTools extends AbstractTextTools {
/** Text Attributes for XML editors */
- public static final String[] TOKENS = {
- IXMLSyntaxConstants.XML_DEFAULT,
- IXMLSyntaxConstants.XML_TAG,
- IXMLSyntaxConstants.XML_ATT_NAME,
- IXMLSyntaxConstants.XML_ATT_VALUE,
- IXMLSyntaxConstants.XML_ENTITY,
- IXMLSyntaxConstants.XML_PI,
- IXMLSyntaxConstants.XML_CDATA,
- IXMLSyntaxConstants.XML_COMMENT,
- IXMLSyntaxConstants.XML_SMARTY,
- IXMLSyntaxConstants.XML_DECL,
- };
+ public static final String[] TOKENS = { IXMLSyntaxConstants.XML_DEFAULT,
+ IXMLSyntaxConstants.XML_TAG, IXMLSyntaxConstants.XML_ATT_NAME,
+ IXMLSyntaxConstants.XML_ATT_VALUE, IXMLSyntaxConstants.XML_ENTITY,
+ IXMLSyntaxConstants.XML_PI, IXMLSyntaxConstants.XML_CDATA,
+ IXMLSyntaxConstants.XML_COMMENT, IXMLSyntaxConstants.XML_SMARTY,
+ IXMLSyntaxConstants.XML_DECL, };
/** Content types for XML editors */
- public static final String[] TYPES = {
- XMLPartitionScanner.XML_PI,
- XMLPartitionScanner.XML_COMMENT,
- XMLPartitionScanner.XML_DECL,
- XMLPartitionScanner.XML_TAG,
- XMLPartitionScanner.XML_ATTRIBUTE,
- XMLPartitionScanner.XML_CDATA,
- XMLPartitionScanner.DTD_INTERNAL,
- XMLPartitionScanner.DTD_INTERNAL_PI,
- XMLPartitionScanner.DTD_INTERNAL_COMMENT,
- XMLPartitionScanner.DTD_INTERNAL_DECL,
- };
+ public static final String[] TYPES = { XMLPartitionScanner.XML_PI,
+ XMLPartitionScanner.XML_COMMENT, XMLPartitionScanner.XML_DECL,
+ XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_ATTRIBUTE,
+ XMLPartitionScanner.XML_CDATA, XMLPartitionScanner.DTD_INTERNAL,
+ XMLPartitionScanner.DTD_INTERNAL_PI,
+ XMLPartitionScanner.DTD_INTERNAL_COMMENT,
+ XMLPartitionScanner.DTD_INTERNAL_DECL, };
/** The XML partitions scanner */
- private XMLPartitionScanner xmlPartitionScanner;
-
+ private XMLPartitionScanner xmlPartitionScanner;
+
private PHPXMLPartitionScanner phpXMLPartitionScanner;
+
/** The XML text scanner */
private TextScanner xmlTextScanner;
@@ -87,68 +76,69 @@ public class XMLTextTools extends AbstractTextTools {
/** The XML processing instructions scanner */
private SingleTokenScanner xmlPIScanner;
- /** The XML comments scanner */
+ /** The XML comments scanner */
private SingleTokenScanner xmlCommentScanner;
/** The XML declarations scanner */
private DeclScanner xmlDeclScanner;
- public XMLTextTools( IPreferenceStore store ) {
- this( store, TOKENS );
+
+ public XMLTextTools(IPreferenceStore store) {
+ this(store, TOKENS);
}
+
/**
* Creates a new XML text tools collection.
*/
- public XMLTextTools( IPreferenceStore store, String[] strTokens ) {
- super( store, strTokens );
+ public XMLTextTools(IPreferenceStore store, String[] strTokens) {
+ super(store, strTokens);
- xmlPartitionScanner = new XMLPartitionScanner( false );
- phpXMLPartitionScanner = new PHPXMLPartitionScanner( false );
+ xmlPartitionScanner = new XMLPartitionScanner(false);
+ phpXMLPartitionScanner = new PHPXMLPartitionScanner(false);
Map tokens = getTokens();
- xmlTextScanner = new TextScanner(
- tokens, '&', IXMLSyntaxConstants.XML_DEFAULT );
+ xmlTextScanner = new TextScanner(tokens, '&',
+ IXMLSyntaxConstants.XML_DEFAULT);
- dtdTextScanner = new TextScanner(
- tokens, '%', IXMLSyntaxConstants.XML_DEFAULT );
+ dtdTextScanner = new TextScanner(tokens, '%',
+ IXMLSyntaxConstants.XML_DEFAULT);
- xmlPIScanner = new SingleTokenScanner(
- tokens, IXMLSyntaxConstants.XML_PI );
+ xmlPIScanner = new SingleTokenScanner(tokens,
+ IXMLSyntaxConstants.XML_PI);
- xmlCommentScanner = new SingleTokenScanner(
- tokens, IXMLSyntaxConstants.XML_COMMENT );
+ xmlCommentScanner = new SingleTokenScanner(tokens,
+ IXMLSyntaxConstants.XML_COMMENT);
- xmlDeclScanner = new DeclScanner( tokens );
+ xmlDeclScanner = new DeclScanner(tokens);
- xmlTagScanner = new XMLTagScanner( tokens );
+ xmlTagScanner = new XMLTagScanner(tokens);
- xmlAttributeScanner = new TextScanner(
- tokens, '&', IXMLSyntaxConstants.XML_ATT_VALUE );
+ xmlAttributeScanner = new TextScanner(tokens, '&',
+ IXMLSyntaxConstants.XML_ATT_VALUE);
- xmlCDATAScanner = new XMLCDATAScanner( tokens );
+ xmlCDATAScanner = new XMLCDATAScanner(tokens);
}
/**
*
*/
public IDocumentPartitioner createXMLPartitioner() {
- return new DefaultPartitioner( xmlPartitionScanner, TYPES );
+ return new DefaultPartitioner(xmlPartitionScanner, TYPES);
}
public IDocumentPartitioner createPHPXMLPartitioner() {
- return new DefaultPartitioner( phpXMLPartitionScanner, TYPES );
+ return new DefaultPartitioner(phpXMLPartitionScanner, TYPES);
}
-
+
/**
*
*/
-// public IPartitionTokenScanner getXMLPartitionScanner() {
-// return xmlPartitionScanner;
-// }
-
+ // public IPartitionTokenScanner getXMLPartitionScanner() {
+ // return xmlPartitionScanner;
+ // }
/**
* Returns a scanner which is configured to scan XML text.
*
- * @return an XML text scanner
+ * @return an XML text scanner
*/
public RuleBasedScanner getXMLTextScanner() {
return xmlTextScanner;
@@ -157,7 +147,7 @@ public class XMLTextTools extends AbstractTextTools {
/**
* Returns a scanner which is configured to scan DTD text.
*
- * @return an DTD text scanner
+ * @return an DTD text scanner
*/
public RuleBasedScanner getDTDTextScanner() {
return dtdTextScanner;
@@ -166,7 +156,7 @@ public class XMLTextTools extends AbstractTextTools {
/**
* Returns a scanner which is configured to scan XML tags.
*
- * @return an XML tag scanner
+ * @return an XML tag scanner
*/
public RuleBasedScanner getXMLTagScanner() {
return xmlTagScanner;
@@ -175,7 +165,7 @@ public class XMLTextTools extends AbstractTextTools {
/**
* Returns a scanner which is configured to scan XML tag attributes.
*
- * @return an XML tag attribute scanner
+ * @return an XML tag attribute scanner
*/
public RuleBasedScanner getXMLAttributeScanner() {
return xmlAttributeScanner;
@@ -184,17 +174,17 @@ public class XMLTextTools extends AbstractTextTools {
/**
* Returns a scanner which is configured to scan XML CDATA sections.
*
- * @return an XML CDATA section scanner
+ * @return an XML CDATA section scanner
*/
public ITokenScanner getXMLCDATAScanner() {
return xmlCDATAScanner;
}
/**
- * Returns a scanner which is configured to scan XML
- * processing instructions.
+ * Returns a scanner which is configured to scan XML processing
+ * instructions.
*
- * @return an XML processing instruction scanner
+ * @return an XML processing instruction scanner
*/
public RuleBasedScanner getXMLPIScanner() {
return xmlPIScanner;
@@ -203,7 +193,7 @@ public class XMLTextTools extends AbstractTextTools {
/**
* Returns a scanner which is configured to scan XML comments.
*
- * @return an XML comment scanner
+ * @return an XML comment scanner
*/
public RuleBasedScanner getXMLCommentScanner() {
return xmlCommentScanner;
@@ -212,7 +202,7 @@ public class XMLTextTools extends AbstractTextTools {
/**
* Returns a scanner which is configured to scan XML declarations.
*
- * @return an XML declaration scanner
+ * @return an XML declaration scanner
*/
public RuleBasedScanner getXMLDeclScanner() {
return xmlDeclScanner;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/BufferChangedEvent.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/BufferChangedEvent.java
index 2b030b5..b178c4c 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/BufferChangedEvent.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/BufferChangedEvent.java
@@ -16,31 +16,31 @@ import java.util.EventObject;
* A buffer changed event describes how a buffer has changed. These events are
* used in IBufferChangedListener notifications.
*
- * For text insertions, getOffset is the offset
- * of the first inserted character, getText is the
- * inserted text, and getLength is 0.
+ * For text insertions, getOffset is the offset of the first
+ * inserted character, getText is the inserted text, and
+ * getLength is 0.
*
*
- * For text removals, getOffset is the offset
- * of the first removed character, getText is null,
- * and getLength is the length of the text that was removed.
+ * For text removals, getOffset is the offset of the first
+ * removed character, getText is null, and
+ * getLength is the length of the text that was removed.
*
*
- * For replacements (including IBuffer.setContents),
- * getOffset is the offset
- * of the first replaced character, getText is the replacement
- * text, and getLength is the length of the original text
- * that was replaced.
+ * For replacements (including IBuffer.setContents),
+ * getOffset is the offset of the first replaced character,
+ * getText is the replacement text, and getLength
+ * is the length of the original text that was replaced.
*
*
- * When a buffer is closed, getOffset is 0, getLength
- * is 0, and getText is null.
+ * When a buffer is closed, getOffset is 0,
+ * getLength is 0, and getText is
+ * null.
*
*
* This class is not intended to be instantiated or subclassed by clients.
* Instances of this class are automatically created by the Java model.
*
- *
+ *
* @see IBuffer
*/
public class BufferChangedEvent extends EventObject {
@@ -60,55 +60,65 @@ public class BufferChangedEvent extends EventObject {
*/
private String text;
-/**
- * Creates a new buffer changed event indicating that the given buffer has changed.
- *
- * @param buffer the given buffer
- * @param offset the given offset
- * @param length the given length
- * @param text the given text
- */
-public BufferChangedEvent(IBuffer buffer, int offset, int length, String text) {
- super(buffer);
- this.offset = offset;
- this.length = length;
- this.text = text;
-}
-/**
- * Returns the buffer which has changed.
- *
- * @return the buffer affected by the change
- */
-public IBuffer getBuffer() {
- return (IBuffer) source;
-}
-/**
- * Returns the length of text removed or replaced in the buffer, or
- * 0 if text has been inserted into the buffer.
- *
- * @return the length of the original text fragment modified by the
- * buffer change ( 0 in case of insertion).
- */
-public int getLength() {
- return this.length;
-}
-/**
- * Returns the index of the first character inserted, removed, or replaced
- * in the buffer.
- *
- * @return the source offset of the textual manipulation in the buffer
- */
-public int getOffset() {
- return this.offset;
-}
-/**
- * Returns the text that was inserted, the replacement text,
- * or null if text has been removed.
- *
- * @return the text corresponding to the buffer change ( null
- * in case of deletion).
- */
-public String getText() {
- return this.text;
-}
+ /**
+ * Creates a new buffer changed event indicating that the given buffer has
+ * changed.
+ *
+ * @param buffer
+ * the given buffer
+ * @param offset
+ * the given offset
+ * @param length
+ * the given length
+ * @param text
+ * the given text
+ */
+ public BufferChangedEvent(IBuffer buffer, int offset, int length,
+ String text) {
+ super(buffer);
+ this.offset = offset;
+ this.length = length;
+ this.text = text;
+ }
+
+ /**
+ * Returns the buffer which has changed.
+ *
+ * @return the buffer affected by the change
+ */
+ public IBuffer getBuffer() {
+ return (IBuffer) source;
+ }
+
+ /**
+ * Returns the length of text removed or replaced in the buffer, or 0 if
+ * text has been inserted into the buffer.
+ *
+ * @return the length of the original text fragment modified by the buffer
+ * change ( 0 in case of insertion).
+ */
+ public int getLength() {
+ return this.length;
+ }
+
+ /**
+ * Returns the index of the first character inserted, removed, or replaced
+ * in the buffer.
+ *
+ * @return the source offset of the textual manipulation in the buffer
+ */
+ public int getOffset() {
+ return this.offset;
+ }
+
+ /**
+ * Returns the text that was inserted, the replacement text, or
+ * null if text has been removed.
+ *
+ * @return the text corresponding to the buffer change ( null
+ * in case of deletion).
+ */
+ public String getText() {
+ return this.text;
+ }
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java
index 38a8934..a8fd2f2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ClasspathVariableInitializer.java
@@ -19,36 +19,37 @@ import org.eclipse.core.runtime.IProgressMonitor;
* Classpath variable initializers are used in conjunction with the
* "net.sourceforge.phpdt.core.classpathVariableInitializer" extension point.
*
- * Clients should subclass this class to implement a specific classpath
- * variable initializer. The subclass must have a public 0-argument
- * constructor and a concrete implementation of initialize.
+ * Clients should subclass this class to implement a specific classpath variable
+ * initializer. The subclass must have a public 0-argument constructor and a
+ * concrete implementation of initialize.
*
* @see IClasspathEntry
* @since 2.0
*/
public abstract class ClasspathVariableInitializer {
- /**
- * Creates a new classpath variable initializer.
- */
- public ClasspathVariableInitializer() {
- }
+ /**
+ * Creates a new classpath variable initializer.
+ */
+ public ClasspathVariableInitializer() {
+ }
- /**
- * Binds a value to the workspace classpath variable with the given name,
- * or fails silently if this cannot be done.
- *
- * A variable initializer is automatically activated whenever a variable value
- * is needed and none has been recorded so far. The implementation of
- * the initializer can set the corresponding variable using
- * JavaCore#setClasspathVariable.
- *
- * @param variable the name of the workspace classpath variable
- * that requires a binding
- *
- * @see JavaCore#getClasspathVariable(String)
- * @see JavaCore#setClasspathVariable(String, IPath, IProgressMonitor)
- * @see JavaCore#setClasspathVariables(String[], IPath[], IProgressMonitor)
- */
- public abstract void initialize(String variable);
+ /**
+ * Binds a value to the workspace classpath variable with the given name, or
+ * fails silently if this cannot be done.
+ *
+ * A variable initializer is automatically activated whenever a variable
+ * value is needed and none has been recorded so far. The implementation of
+ * the initializer can set the corresponding variable using
+ * JavaCore#setClasspathVariable.
+ *
+ * @param variable
+ * the name of the workspace classpath variable that requires a
+ * binding
+ *
+ * @see JavaCore#getClasspathVariable(String)
+ * @see JavaCore#setClasspathVariable(String, IPath, IProgressMonitor)
+ * @see JavaCore#setClasspathVariables(String[], IPath[], IProgressMonitor)
+ */
+ public abstract void initialize(String variable);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionProposal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionProposal.java
index 400dae5..0e3e548 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionProposal.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionProposal.java
@@ -17,34 +17,31 @@ import org.eclipse.core.runtime.IProgressMonitor;
/**
* Completion proposal.
*
- * In typical usage, the user working in a Java code editor issues
- * a code assist command. This command results in a call to
+ * In typical usage, the user working in a Java code editor issues a code assist
+ * command. This command results in a call to
* ICodeAssist.codeComplete(position, completionRequestor)
- * passing the current position in the source code. The code assist
- * engine analyzes the code in the buffer, determines what kind of
- * Java language construct is at that position, and proposes ways
- * to complete that construct. These proposals are instances of
- * subclasses of CompletionProposal. These proposals,
- * perhaps after sorting and filtering, are presented to the user
- * to make a choice.
+ * passing the current position in the source code. The code assist engine
+ * analyzes the code in the buffer, determines what kind of Java language
+ * construct is at that position, and proposes ways to complete that construct.
+ * These proposals are instances of subclasses of
+ * CompletionProposal. These proposals, perhaps after sorting
+ * and filtering, are presented to the user to make a choice.
*
*
- * The proposal is as follows: insert
- * the {@linkplain #getCompletion() completion string} into the
- * source file buffer, replacing the characters between
- * {@linkplain #getReplaceStart() the start}
- * and {@linkplain #getReplaceEnd() end}. The string
- * can be arbitrary; for example, it might include not only the
- * name of a method but a set of parentheses. Moreover, the source
- * range may include source positions before or after the source
- * position where ICodeAssist.codeComplete was invoked.
- * The rest of the information associated with the proposal is
- * to provide context that may help a user to choose from among
- * competing proposals.
+ * The proposal is as follows: insert the
+ * {@linkplain #getCompletion() completion string} into the source file buffer,
+ * replacing the characters between {@linkplain #getReplaceStart() the start}
+ * and {@linkplain #getReplaceEnd() end}. The string can be arbitrary; for
+ * example, it might include not only the name of a method but a set of
+ * parentheses. Moreover, the source range may include source positions before
+ * or after the source position where ICodeAssist.codeComplete
+ * was invoked. The rest of the information associated with the proposal is to
+ * provide context that may help a user to choose from among competing
+ * proposals.
*
*
- * The completion engine creates instances of this class; it is not
- * intended to be used by other clients.
+ * The completion engine creates instances of this class; it is not intended to
+ * be used by other clients.
*
*
* @see ICodeAssist#codeComplete(int, CompletionRequestor)
@@ -53,24 +50,20 @@ import org.eclipse.core.runtime.IProgressMonitor;
public final class CompletionProposal {
/**
- * Completion is a declaration of an anonymous class.
- * This kind of completion might occur in a context like
- * "new List^;" and complete it to
- * "new List() {}".
+ * Completion is a declaration of an anonymous class. This kind of
+ * completion might occur in a context like "new List^;" and
+ * complete it to "new List() {}".
*
- * The following additional context information is available
- * for this kind of completion proposal at little extra cost:
+ * The following additional context information is available for this kind
+ * of completion proposal at little extra cost:
*
- *
{@link #getDeclarationSignature()} -
- * the type signature of the type being implemented or subclassed
- *
- *
- *
{@link #getSignature()} -
- * the method signature of the constructor that is referenced
- *
- *
{@link #getFlags()} -
- * the modifiers flags of the constructor that is referenced
+ *
{@link #getDeclarationSignature()} - the type signature of the type
+ * being implemented or subclassed
*
+ *
{@link #getSignature()} - the method signature of the constructor
+ * that is referenced
+ *
{@link #getFlags()} - the modifiers flags of the constructor that is
+ * referenced
*
*
*
@@ -79,28 +72,22 @@ public final class CompletionProposal {
public static final int ANONYMOUS_CLASS_DECLARATION = 1;
/**
- * Completion is a reference to a field.
- * This kind of completion might occur in a context like
- * "this.ref^ = 0;" and complete it to
+ * Completion is a reference to a field. This kind of completion might occur
+ * in a context like "this.ref^ = 0;" and complete it to
* "this.refcount = 0;".
*
- * The following additional context information is available
- * for this kind of completion proposal at little extra cost:
+ * The following additional context information is available for this kind
+ * of completion proposal at little extra cost:
*
- *
{@link #getDeclarationSignature()} -
- * the type signature of the type that declares the field that is referenced
- *
- *
{@link #getFlags()} -
- * the modifiers flags (including ACC_ENUM) of the field that is referenced
- *
- *
{@link #getName()} -
- * the simple name of the field that is referenced
- *
- *
{@link #getSignature()} -
- * the type signature of the field's type (as opposed to the
- * signature of the type in which the referenced field
- * is declared)
- *
+ *
{@link #getDeclarationSignature()} - the type signature of the type
+ * that declares the field that is referenced
+ *
{@link #getFlags()} - the modifiers flags (including ACC_ENUM) of
+ * the field that is referenced
+ *
{@link #getName()} - the simple name of the field that is referenced
+ *
+ *
{@link #getSignature()} - the type signature of the field's type (as
+ * opposed to the signature of the type in which the referenced field is
+ * declared)
*
*
*
@@ -109,20 +96,16 @@ public final class CompletionProposal {
public static final int FIELD_REF = 2;
/**
- * Completion is a keyword.
- * This kind of completion might occur in a context like
- * "public cl^ Foo {}" and complete it to
+ * Completion is a keyword. This kind of completion might occur in a context
+ * like "public cl^ Foo {}" and complete it to
* "public class Foo {}".
*
- * The following additional context information is available
- * for this kind of completion proposal at little extra cost:
+ * The following additional context information is available for this kind
+ * of completion proposal at little extra cost:
*
- *
{@link #getName()} -
- * the keyword token
- *
- *
{@link #getFlags()} -
- * the corresponding modifier flags if the keyword is a modifier
- *
+ *
{@link #getName()} - the keyword token
+ *
{@link #getFlags()} - the corresponding modifier flags if the
+ * keyword is a modifier
*
*
*
@@ -131,16 +114,14 @@ public final class CompletionProposal {
public static final int KEYWORD = 3;
/**
- * Completion is a reference to a label.
- * This kind of completion might occur in a context like
- * "break lo^;" and complete it to
+ * Completion is a reference to a label. This kind of completion might occur
+ * in a context like "break lo^;" and complete it to
* "break loop;".
*
- * The following additional context information is available
- * for this kind of completion proposal at little extra cost:
+ * The following additional context information is available for this kind
+ * of completion proposal at little extra cost:
*
- *
{@link #getName()} -
- * the simple name of the label that is referenced
+ *
{@link #getName()} - the simple name of the label that is referenced
*
*
*
@@ -150,23 +131,19 @@ public final class CompletionProposal {
public static final int LABEL_REF = 4;
/**
- * Completion is a reference to a local variable.
- * This kind of completion might occur in a context like
- * "ke^ = 4;" and complete it to
- * "keys = 4;".
+ * Completion is a reference to a local variable. This kind of completion
+ * might occur in a context like "ke^ = 4;" and complete it
+ * to "keys = 4;".
*
- * The following additional context information is available
- * for this kind of completion proposal at little extra cost:
+ * The following additional context information is available for this kind
+ * of completion proposal at little extra cost:
*
- *
{@link #getFlags()} -
- * the modifiers flags of the local variable that is referenced
- *
- *
{@link #getName()} -
- * the simple name of the local variable that is referenced
- *
- *
{@link #getSignature()} -
- * the type signature of the local variable's type
- *
+ *
{@link #getFlags()} - the modifiers flags of the local variable that
+ * is referenced
+ *
{@link #getName()} - the simple name of the local variable that is
+ * referenced
+ *
{@link #getSignature()} - the type signature of the local variable's
+ * type
*
*
*
@@ -175,26 +152,21 @@ public final class CompletionProposal {
public static final int LOCAL_VARIABLE_REF = 5;
/**
- * Completion is a reference to a method.
- * This kind of completion might occur in a context like
- * "System.out.pr^();" and complete it to
- * ""System.out.println();".
+ * Completion is a reference to a method. This kind of completion might
+ * occur in a context like "System.out.pr^();" and complete
+ * it to ""System.out.println();".
*
- * The following additional context information is available
- * for this kind of completion proposal at little extra cost:
+ * The following additional context information is available for this kind
+ * of completion proposal at little extra cost:
*
- *
{@link #getDeclarationSignature()} -
- * the type signature of the type that declares the method that is referenced
- *
- *
{@link #getFlags()} -
- * the modifiers flags of the method that is referenced
- *
- *
{@link #getName()} -
- * the simple name of the method that is referenced
- *
- *
{@link #getSignature()} -
- * the method signature of the method that is referenced
- *
+ *
{@link #getDeclarationSignature()} - the type signature of the type
+ * that declares the method that is referenced
+ *
{@link #getFlags()} - the modifiers flags of the method that is
+ * referenced
+ *
{@link #getName()} - the simple name of the method that is
+ * referenced
+ *
{@link #getSignature()} - the method signature of the method that is
+ * referenced
*
*
*
@@ -203,30 +175,21 @@ public final class CompletionProposal {
public static final int METHOD_REF = 6;
/**
- * Completion is a declaration of a method.
- * This kind of completion might occur in a context like
- * "new List() {si^};" and complete it to
- * "new List() {public int size() {} };".
+ * Completion is a declaration of a method. This kind of completion might
+ * occur in a context like "new List() {si^};" and complete
+ * it to "new List() {public int size() {} };".
*
- * The following additional context information is available
- * for this kind of completion proposal at little extra cost:
+ * The following additional context information is available for this kind
+ * of completion proposal at little extra cost:
*
- *
{@link #getDeclarationSignature()} -
- * the type signature of the type that declares the
- * method that is being overridden or implemented
- *
- *
{@link #getName()} -
- * the simple name of the method that is being overridden
- * or implemented
- *
- *
{@link #getSignature()} -
- * the method signature of the method that is being
- * overridden or implemented
- *
- *
{@link #getFlags()} -
- * the modifiers flags of the method that is being
- * overridden or implemented
- *
+ *
{@link #getDeclarationSignature()} - the type signature of the type
+ * that declares the method that is being overridden or implemented
+ *
{@link #getName()} - the simple name of the method that is being
+ * overridden or implemented
+ *
{@link #getSignature()} - the method signature of the method that is
+ * being overridden or implemented
+ *
{@link #getFlags()} - the modifiers flags of the method that is
+ * being overridden or implemented
*
*
*
@@ -235,17 +198,15 @@ public final class CompletionProposal {
public static final int METHOD_DECLARATION = 7;
/**
- * Completion is a reference to a package.
- * This kind of completion might occur in a context like
- * "import java.u^.*;" and complete it to
- * "import java.util.*;".
+ * Completion is a reference to a package. This kind of completion might
+ * occur in a context like "import java.u^.*;" and complete
+ * it to "import java.util.*;".
*
- * The following additional context information is available
- * for this kind of completion proposal at little extra cost:
+ * The following additional context information is available for this kind
+ * of completion proposal at little extra cost:
*
- *
{@link #getDeclarationSignature()} -
- * the dot-based package signature of the package that is referenced
- *
+ *
{@link #getDeclarationSignature()} - the dot-based package signature
+ * of the package that is referenced
*
*
*
@@ -254,27 +215,22 @@ public final class CompletionProposal {
public static final int PACKAGE_REF = 8;
/**
- * Completion is a reference to a type. Any kind of type
- * is allowed, including primitive types, reference types,
- * array types, parameterized types, and type variables.
- * This kind of completion might occur in a context like
- * "public static Str^ key;" and complete it to
+ * Completion is a reference to a type. Any kind of type is allowed,
+ * including primitive types, reference types, array types, parameterized
+ * types, and type variables. This kind of completion might occur in a
+ * context like "public static Str^ key;" and complete it to
* "public static String key;".
*
- * The following additional context information is available
- * for this kind of completion proposal at little extra cost:
+ * The following additional context information is available for this kind
+ * of completion proposal at little extra cost:
*
- *
{@link #getDeclarationSignature()} -
- * the dot-based package signature of the package that contains
- * the type that is referenced
- *
- *
{@link #getSignature()} -
- * the type signature of the type that is referenced
- *
- *
{@link #getFlags()} -
- * the modifiers flags (including Flags.AccInterface, AccEnum,
- * and AccAnnotation) of the type that is referenced
- *
+ *
{@link #getDeclarationSignature()} - the dot-based package signature
+ * of the package that contains the type that is referenced
+ *
{@link #getSignature()} - the type signature of the type that is
+ * referenced
+ *
{@link #getFlags()} - the modifiers flags (including
+ * Flags.AccInterface, AccEnum, and AccAnnotation) of the type that is
+ * referenced
*
*
*
@@ -283,147 +239,137 @@ public final class CompletionProposal {
public static final int TYPE_REF = 9;
/**
- * Completion is a declaration of a variable (locals, parameters,
- * fields, etc.).
+ * Completion is a declaration of a variable (locals, parameters, fields,
+ * etc.).
*
- * The following additional context information is available
- * for this kind of completion proposal at little extra cost:
+ * The following additional context information is available for this kind
+ * of completion proposal at little extra cost:
*
- *
{@link #getName()} -
- * the simple name of the variable being declared
- *
- *
{@link #getSignature()} -
- * the type signature of the type of the variable
- * being declared
- *
- *
{@link #getFlags()} -
- * the modifiers flags of the variable being declared
+ *
{@link #getName()} - the simple name of the variable being declared
*
+ *
{@link #getSignature()} - the type signature of the type of the
+ * variable being declared
+ *
{@link #getFlags()} - the modifiers flags of the variable being
+ * declared
*
*
+ *
* @see #getKind()
*/
public static final int VARIABLE_DECLARATION = 10;
-
+
/**
* Kind of completion request.
*/
private int completionKind;
-
+
/**
- * Offset in original buffer where ICodeAssist.codeComplete() was
- * requested.
+ * Offset in original buffer where ICodeAssist.codeComplete() was requested.
*/
private int completionLocation;
-
+
/**
- * Start position (inclusive) of source range in original buffer
- * containing the relevant token
- * defaults to empty subrange at [0,0).
+ * Start position (inclusive) of source range in original buffer containing
+ * the relevant token defaults to empty subrange at [0,0).
*/
private int tokenStart = 0;
-
+
/**
- * End position (exclusive) of source range in original buffer
- * containing the relevant token;
- * defaults to empty subrange at [0,0).
+ * End position (exclusive) of source range in original buffer containing
+ * the relevant token; defaults to empty subrange at [0,0).
*/
private int tokenEnd = 0;
-
+
/**
* Completion string; defaults to empty string.
*/
private char[] completion = CharOperation.NO_CHAR;
-
+
/**
- * Start position (inclusive) of source range in original buffer
- * to be replaced by completion string;
- * defaults to empty subrange at [0,0).
+ * Start position (inclusive) of source range in original buffer to be
+ * replaced by completion string; defaults to empty subrange at [0,0).
*/
private int replaceStart = 0;
-
+
/**
- * End position (exclusive) of source range in original buffer
- * to be replaced by completion string;
- * defaults to empty subrange at [0,0).
+ * End position (exclusive) of source range in original buffer to be
+ * replaced by completion string; defaults to empty subrange at [0,0).
*/
private int replaceEnd = 0;
-
+
/**
- * Relevance rating; positive; higher means better;
- * defaults to minimum rating.
+ * Relevance rating; positive; higher means better; defaults to minimum
+ * rating.
*/
private int relevance = 1;
-
+
/**
- * Signature of the relevant package or type declaration
- * in the context, or null if none.
- * Defaults to null.
+ * Signature of the relevant package or type declaration in the context, or
+ * null if none. Defaults to null.
*/
private char[] declarationSignature = null;
-
+
/**
- * Simple name of the method, field,
- * member, or variable relevant in the context, or
- * null if none.
- * Defaults to null.
+ * Simple name of the method, field, member, or variable relevant in the
+ * context, or null if none. Defaults to null.
*/
private char[] name = null;
-
+
/**
- * Signature of the method, field type, member type,
- * relevant in the context, or null if none.
- * Defaults to null.
+ * Signature of the method, field type, member type, relevant in the
+ * context, or null if none. Defaults to null.
*/
private char[] signature = null;
-
+
/**
- * Modifier flags relevant in the context, or
- * Flags.AccDefault if none.
- * Defaults to Flags.AccDefault.
+ * Modifier flags relevant in the context, or Flags.AccDefault
+ * if none. Defaults to Flags.AccDefault.
*/
private int flags = Flags.AccDefault;
-
+
/**
- * Parameter names (for method completions), or
- * null if none. Lazily computed.
- * Defaults to null.
+ * Parameter names (for method completions), or null if none.
+ * Lazily computed. Defaults to null.
*/
private char[][] parameterNames = null;
-
+
/**
* Indicates whether parameter names have been computed.
*/
private boolean parameterNamesComputed = false;
-
+
/**
- * Creates a basic completion proposal. All instance
- * field have plausible default values unless otherwise noted.
+ * Creates a basic completion proposal. All instance field have plausible
+ * default values unless otherwise noted.
*
- * Note that the constructors for this class are internal to the
- * Java model implementation. Clients cannot directly create
- * CompletionProposal objects.
+ * Note that the constructors for this class are internal to the Java model
+ * implementation. Clients cannot directly create CompletionProposal
+ * objects.
*
*
- * @param kind one of the kind constants declared on this class
- * @param completionOffset original offset of code completion request
+ * @param kind
+ * one of the kind constants declared on this class
+ * @param completionOffset
+ * original offset of code completion request
* @return a new completion proposal
*/
public static CompletionProposal create(int kind, int completionOffset) {
return new CompletionProposal(kind, completionOffset);
}
-
+
/**
- * Creates a basic completion proposal. All instance
- * field have plausible default values unless otherwise noted.
+ * Creates a basic completion proposal. All instance field have plausible
+ * default values unless otherwise noted.
*
- * Note that the constructors for this class are internal to the
- * Java model implementation. Clients cannot directly create
- * CompletionProposal objects.
+ * Note that the constructors for this class are internal to the Java model
+ * implementation. Clients cannot directly create CompletionProposal
+ * objects.
*
*
- * @param kind one of the kind constants declared on this class
- * @param completionLocation original offset of code completion request
+ * @param kind
+ * one of the kind constants declared on this class
+ * @param completionLocation
+ * original offset of code completion request
*/
CompletionProposal(int kind, int completionLocation) {
if ((kind < CompletionProposal.ANONYMOUS_CLASS_DECLARATION)
@@ -436,29 +382,26 @@ public final class CompletionProposal {
this.completionKind = kind;
this.completionLocation = completionLocation;
}
-
+
/**
* Returns the kind of completion being proposed.
*
- * The set of different kinds of completion proposals is
- * expected to change over time. It is strongly recommended
- * that clients do not assume that the kind is one of the
- * ones they know about, and code defensively for the
- * possibility of unexpected future growth.
+ * The set of different kinds of completion proposals is expected to change
+ * over time. It is strongly recommended that clients do not assume
+ * that the kind is one of the ones they know about, and code defensively
+ * for the possibility of unexpected future growth.
*
*
- * @return the kind; one of the kind constants
- * declared on this class, or possibly a kind unknown
- * to the caller
+ * @return the kind; one of the kind constants declared on this class, or
+ * possibly a kind unknown to the caller
*/
public int getKind() {
return this.completionKind;
}
-
+
/**
- * Returns the character index in the source file buffer
- * where source completion was requested (the
- * offsetparameter to
+ * Returns the character index in the source file buffer where source
+ * completion was requested (the offsetparameter to
* ICodeAssist.codeComplete.
*
* @return character index in source file buffer
@@ -467,52 +410,48 @@ public final class CompletionProposal {
public int getCompletionLocation() {
return this.completionLocation;
}
-
- /**
- * Returns the character index of the start of the
- * subrange in the source file buffer containing the
- * relevant token being completed. This
- * token is either the identifier or Java language keyword
- * under, or immediately preceding, the original request
- * offset. If the original request offset is not within
- * or immediately after an identifier or keyword, then the
- * position returned is original request offset and the
- * token range is empty.
+
+ /**
+ * Returns the character index of the start of the subrange in the source
+ * file buffer containing the relevant token being completed. This token is
+ * either the identifier or Java language keyword under, or immediately
+ * preceding, the original request offset. If the original request offset is
+ * not within or immediately after an identifier or keyword, then the
+ * position returned is original request offset and the token range is
+ * empty.
*
* @return character index of token start position (inclusive)
*/
public int getTokenStart() {
return this.tokenStart;
}
-
+
/**
- * Returns the character index of the end (exclusive) of the subrange
- * in the source file buffer containing the
- * relevant token. When there is no relevant token, the
- * range is empty
- * (getEndToken() == getStartToken()).
+ * Returns the character index of the end (exclusive) of the subrange in the
+ * source file buffer containing the relevant token. When there is no
+ * relevant token, the range is empty (getEndToken() == getStartToken()).
*
* @return character index of token end position (exclusive)
*/
public int getTokenEnd() {
return this.tokenEnd;
}
-
+
/**
- * Sets the character indices of the subrange in the
- * source file buffer containing the relevant token being
- * completed. This token is either the identifier or
- * Java language keyword under, or immediately preceding,
- * the original request offset. If the original request
- * offset is not within or immediately after an identifier
- * or keyword, then the source range begins at original
- * request offset and is empty.
+ * Sets the character indices of the subrange in the source file buffer
+ * containing the relevant token being completed. This token is either the
+ * identifier or Java language keyword under, or immediately preceding, the
+ * original request offset. If the original request offset is not within or
+ * immediately after an identifier or keyword, then the source range begins
+ * at original request offset and is empty.
*
* If not set, defaults to empty subrange at [0,0).
*
*
- * @param startIndex character index of token start position (inclusive)
- * @param endIndex character index of token end position (exclusive)
+ * @param startIndex
+ * character index of token start position (inclusive)
+ * @param endIndex
+ * character index of token end position (exclusive)
*/
public void setTokenRange(int startIndex, int endIndex) {
if (startIndex < 0 || endIndex < startIndex) {
@@ -521,12 +460,12 @@ public final class CompletionProposal {
this.tokenStart = startIndex;
this.tokenEnd = endIndex;
}
-
+
/**
- * Returns the proposed sequence of characters to insert into the
- * source file buffer, replacing the characters at the specified
- * source range. The string can be arbitrary; for example, it might
- * include not only the name of a method but a set of parentheses.
+ * Returns the proposed sequence of characters to insert into the source
+ * file buffer, replacing the characters at the specified source range. The
+ * string can be arbitrary; for example, it might include not only the name
+ * of a method but a set of parentheses.
*
* The client must not modify the array returned.
*
@@ -536,43 +475,39 @@ public final class CompletionProposal {
public char[] getCompletion() {
return this.completion;
}
-
+
/**
- * Sets the proposed sequence of characters to insert into the
- * source file buffer, replacing the characters at the specified
- * source range. The string can be arbitrary; for example, it might
- * include not only the name of a method but a set of parentheses.
+ * Sets the proposed sequence of characters to insert into the source file
+ * buffer, replacing the characters at the specified source range. The
+ * string can be arbitrary; for example, it might include not only the name
+ * of a method but a set of parentheses.
*
* If not set, defaults to an empty character array.
*
*
- * The completion engine creates instances of this class and sets
- * its properties; this method is not intended to be used by other clients.
+ * The completion engine creates instances of this class and sets its
+ * properties; this method is not intended to be used by other clients.
*
*
- * @param completion the completion string
+ * @param completion
+ * the completion string
*/
public void setCompletion(char[] completion) {
this.completion = completion;
}
-
- /**
- * Returns the character index of the start of the
- * subrange in the source file buffer to be replaced
- * by the completion string. If the subrange is empty
- * (getReplaceEnd() == getReplaceStart()),
- * the completion string is to be inserted at this
- * index.
- *
- * Note that while the token subrange is precisely
- * specified, the replacement range is loosely
- * constrained and may not bear any direct relation
- * to the original request offset. For example, a
- * it would be possible for a type completion to
- * propose inserting an import declaration at the
- * top of the compilation unit; or the completion
- * might include trailing parentheses and
- * punctuation for a method completion.
+
+ /**
+ * Returns the character index of the start of the subrange in the source
+ * file buffer to be replaced by the completion string. If the subrange is
+ * empty (getReplaceEnd() == getReplaceStart()), the
+ * completion string is to be inserted at this index.
+ *
+ * Note that while the token subrange is precisely specified, the
+ * replacement range is loosely constrained and may not bear any direct
+ * relation to the original request offset. For example, a it would be
+ * possible for a type completion to propose inserting an import declaration
+ * at the top of the compilation unit; or the completion might include
+ * trailing parentheses and punctuation for a method completion.
*
*
* @return replacement start position (inclusive)
@@ -580,38 +515,34 @@ public final class CompletionProposal {
public int getReplaceStart() {
return this.replaceStart;
}
-
+
/**
- * Returns the character index of the end of the
- * subrange in the source file buffer to be replaced
- * by the completion string. If the subrange is empty
- * (getReplaceEnd() == getReplaceStart()),
- * the completion string is to be inserted at this
- * index.
+ * Returns the character index of the end of the subrange in the source file
+ * buffer to be replaced by the completion string. If the subrange is empty (getReplaceEnd() == getReplaceStart()),
+ * the completion string is to be inserted at this index.
*
* @return replacement end position (exclusive)
*/
public int getReplaceEnd() {
return this.replaceEnd;
}
-
+
/**
- * Sets the character indices of the subrange in the
- * source file buffer to be replaced by the completion
- * string. If the subrange is empty
- * (startIndex == endIndex),
- * the completion string is to be inserted at this
- * index.
+ * Sets the character indices of the subrange in the source file buffer to
+ * be replaced by the completion string. If the subrange is empty (startIndex == endIndex),
+ * the completion string is to be inserted at this index.
*
* If not set, defaults to empty subrange at [0,0).
*
*
- * The completion engine creates instances of this class and sets
- * its properties; this method is not intended to be used by other clients.
+ * The completion engine creates instances of this class and sets its
+ * properties; this method is not intended to be used by other clients.
*
*
- * @param startIndex character index of replacement start position (inclusive)
- * @param endIndex character index of replacement end position (exclusive)
+ * @param startIndex
+ * character index of replacement start position (inclusive)
+ * @param endIndex
+ * character index of replacement end position (exclusive)
*/
public void setReplaceRange(int startIndex, int endIndex) {
if (startIndex < 0 || endIndex < startIndex) {
@@ -620,27 +551,30 @@ public final class CompletionProposal {
this.replaceStart = startIndex;
this.replaceEnd = endIndex;
}
-
+
/**
* Returns the relative relevance rating of this proposal.
*
- * @return relevance rating of this proposal; ratings are positive; higher means better
+ * @return relevance rating of this proposal; ratings are positive; higher
+ * means better
*/
public int getRelevance() {
return this.relevance;
}
-
+
/**
* Sets the relative relevance rating of this proposal.
*
* If not set, defaults to the lowest possible rating (1).
*
*
- * The completion engine creates instances of this class and sets
- * its properties; this method is not intended to be used by other clients.
+ * The completion engine creates instances of this class and sets its
+ * properties; this method is not intended to be used by other clients.
*
*
- * @param rating relevance rating of this proposal; ratings are positive; higher means better
+ * @param rating
+ * relevance rating of this proposal; ratings are positive;
+ * higher means better
*/
public void setRelevance(int rating) {
if (rating <= 0) {
@@ -648,132 +582,122 @@ public final class CompletionProposal {
}
this.relevance = rating;
}
-
+
/**
- * Returns the type or package signature of the relevant
- * declaration in the context, or null if none.
+ * Returns the type or package signature of the relevant declaration in the
+ * context, or null if none.
*
- * This field is available for the following kinds of
- * completion proposals:
+ * This field is available for the following kinds of completion proposals:
*
- *
ANONYMOUS_CLASS_DECLARATION - type signature
- * of the type that is being subclassed or implemented
- *
FIELD_REF - type signature
- * of the type that declares the field that is referenced
- *
METHOD_REF - type signature
- * of the type that declares the method that is referenced
- *
METHOD_DECLARATION - type signature
- * of the type that declares the method that is being
- * implemented or overridden
- *
PACKAGE_REF - dot-based package
- * signature of the package that is referenced
- *
TYPE_REF - dot-based package
- * signature of the package containing the type that is referenced
+ *
ANONYMOUS_CLASS_DECLARATION - type signature of the
+ * type that is being subclassed or implemented
+ *
FIELD_REF - type signature of the type that declares
+ * the field that is referenced
+ *
METHOD_REF - type signature of the type that declares
+ * the method that is referenced
+ *
METHOD_DECLARATION - type signature of the type that
+ * declares the method that is being implemented or overridden
+ *
PACKAGE_REF - dot-based package signature of the
+ * package that is referenced
+ *
TYPE_REF - dot-based package signature of the package
+ * containing the type that is referenced
*
- * For kinds of completion proposals, this method returns
- * null. Clients must not modify the array
- * returned.
+ * For kinds of completion proposals, this method returns null.
+ * Clients must not modify the array returned.
*
*
- * @return the declaration signature, or
- * null if none
+ * @return the declaration signature, or null if none
* @see Signature
*/
public char[] getDeclarationSignature() {
return this.declarationSignature;
}
-
+
/**
- * Sets the type or package signature of the relevant
- * declaration in the context, or null if none.
+ * Sets the type or package signature of the relevant declaration in the
+ * context, or null if none.
*
* If not set, defaults to none.
*
*
- * The completion engine creates instances of this class and sets
- * its properties; this method is not intended to be used by other clients.
+ * The completion engine creates instances of this class and sets its
+ * properties; this method is not intended to be used by other clients.
*
*
- * @param signature the type or package signature, or
- * null if none
+ * @param signature
+ * the type or package signature, or null if none
*/
public void setDeclarationSignature(char[] signature) {
this.declarationSignature = signature;
}
-
+
/**
- * Returns the simple name of the method, field,
- * member, or variable relevant in the context, or
- * null if none.
+ * Returns the simple name of the method, field, member, or variable
+ * relevant in the context, or null if none.
*
- * This field is available for the following kinds of
- * completion proposals:
+ * This field is available for the following kinds of completion proposals:
*
- *
FIELD_REF - the name of the field
- *
KEYWORD - the keyword
- *
LABEL_REF - the name of the label
- *
LOCAL_VARIABLE_REF - the name of the local variable
- *
METHOD_REF - the name of the method
- *
METHOD_DECLARATION - the name of the method
- *
VARIABLE_DECLARATION - the name of the variable
+ *
FIELD_REF - the name of the field
+ *
KEYWORD - the keyword
+ *
LABEL_REF - the name of the label
+ *
LOCAL_VARIABLE_REF - the name of the local variable
+ *
METHOD_REF - the name of the method
+ *
METHOD_DECLARATION - the name of the method
+ *
VARIABLE_DECLARATION - the name of the variable
*
- * For kinds of completion proposals, this method returns
- * null. Clients must not modify the array
- * returned.
+ * For kinds of completion proposals, this method returns null.
+ * Clients must not modify the array returned.
*
*
- * @return the keyword, field, method, local variable, or member
- * name, or null if none
+ * @return the keyword, field, method, local variable, or member name, or
+ * null if none
*/
public char[] getName() {
return this.name;
}
-
-
+
/**
- * Sets the simple name of the method, field,
- * member, or variable relevant in the context, or
- * null if none.
+ * Sets the simple name of the method, field, member, or variable relevant
+ * in the context, or null if none.
*
* If not set, defaults to none.
*
*
- * The completion engine creates instances of this class and sets
- * its properties; this method is not intended to be used by other clients.
+ * The completion engine creates instances of this class and sets its
+ * properties; this method is not intended to be used by other clients.
*
*
- * @param name the keyword, field, method, local variable,
- * or member name, or null if none
+ * @param name
+ * the keyword, field, method, local variable, or member name, or
+ * null if none
*/
public void setName(char[] name) {
this.name = name;
}
-
+
/**
- * Returns the signature of the method or type
- * relevant in the context, or null if none.
+ * Returns the signature of the method or type relevant in the context, or
+ * null if none.
*
- * This field is available for the following kinds of
- * completion proposals:
+ * This field is available for the following kinds of completion proposals:
*
- *
ANONYMOUS_CLASS_DECLARATION - method signature
- * of the constructor that is being invoked
- *
FIELD_REF - the type signature
- * of the referenced field's type
- *
LOCAL_VARIABLE_REF - the type signature
- * of the referenced local variable's type
- *
METHOD_REF - method signature
- * of the method that is referenced
- *
METHOD_DECLARATION - method signature
- * of the method that is being implemented or overridden
- *
TYPE_REF - type signature
- * of the type that is referenced
- *
VARIABLE_DECLARATION - the type signature
- * of the type of the variable being declared
+ *
ANONYMOUS_CLASS_DECLARATION - method signature of the
+ * constructor that is being invoked
+ *
FIELD_REF - the type signature of the referenced
+ * field's type
+ *
LOCAL_VARIABLE_REF - the type signature of the
+ * referenced local variable's type
+ *
METHOD_REF - method signature of the method that is
+ * referenced
+ *
METHOD_DECLARATION - method signature of the method
+ * that is being implemented or overridden
+ *
TYPE_REF - type signature of the type that is
+ * referenced
+ *
VARIABLE_DECLARATION - the type signature of the type
+ * of the variable being declared
*
- * For kinds of completion proposals, this method returns
- * null. Clients must not modify the array
- * returned.
+ * For kinds of completion proposals, this method returns null.
+ * Clients must not modify the array returned.
*
*
* @return the signature, or null if none
@@ -782,91 +706,83 @@ public final class CompletionProposal {
public char[] getSignature() {
return this.signature;
}
-
+
/**
- * Sets the signature of the method, field type, member type,
- * relevant in the context, or null if none.
+ * Sets the signature of the method, field type, member type, relevant in
+ * the context, or null if none.
*
* If not set, defaults to none.
*
*
- * The completion engine creates instances of this class and sets
- * its properties; this method is not intended to be used by other clients.
+ * The completion engine creates instances of this class and sets its
+ * properties; this method is not intended to be used by other clients.
*
*
- * @param signature the signature, or null if none
+ * @param signature
+ * the signature, or null if none
*/
public void setSignature(char[] signature) {
this.signature = signature;
}
-
+
/**
* Returns the modifier flags relevant in the context, or
* Flags.AccDefault if none.
*
- * This field is available for the following kinds of
- * completion proposals:
+ * This field is available for the following kinds of completion proposals:
*
- *
ANONYMOUS_CLASS_DECLARATION - modifier flags
- * of the constructor that is referenced
- *
FIELD_REF - modifier flags
- * of the field that is referenced;
- * Flags.AccEnum can be used to recognize
- * references to enum constants
- *
- *
KEYWORD - modifier flag
- * corrresponding to the modifier keyword
- *
LOCAL_VARIABLE_REF - modifier flags
- * of the local variable that is referenced
- *
METHOD_REF - modifier flags
- * of the method that is referenced;
- * Flags.AccAnnotation can be used to recognize
- * references to annotation type members
- *
- *
METHOD_DECLARATION - modifier flags
- * for the method that is being implemented or overridden
- *
TYPE_REF - modifier flags
- * of the type that is referenced; Flags.AccInterface
- * can be used to recognize references to interfaces,
- * Flags.AccEnum enum types,
- * and Flags.AccAnnotation annotation types
- *
- *
VARIABLE_DECLARATION - modifier flags
- * for the variable being declared
+ *
ANONYMOUS_CLASS_DECLARATION - modifier flags of the
+ * constructor that is referenced
+ *
FIELD_REF - modifier flags of the field that is
+ * referenced; Flags.AccEnum can be used to recognize
+ * references to enum constants
+ *
KEYWORD - modifier flag corrresponding to the
+ * modifier keyword
+ *
LOCAL_VARIABLE_REF - modifier flags of the local
+ * variable that is referenced
+ *
METHOD_REF - modifier flags of the method that is
+ * referenced; Flags.AccAnnotation can be used to recognize
+ * references to annotation type members
+ *
METHOD_DECLARATION - modifier flags for the method
+ * that is being implemented or overridden
+ *
TYPE_REF - modifier flags of the type that is
+ * referenced; Flags.AccInterface can be used to recognize
+ * references to interfaces, Flags.AccEnum enum types, and
+ * Flags.AccAnnotation annotation types
+ *
VARIABLE_DECLARATION - modifier flags for the
+ * variable being declared
*
* For kinds of completion proposals, this method returns
* Flags.AccDefault.
*
*
- * @return the modifier flags, or
- * Flags.AccDefault if none
+ * @return the modifier flags, or Flags.AccDefault if none
* @see Flags
*/
public int getFlags() {
return this.flags;
}
-
+
/**
* Sets the modifier flags relevant in the context.
*
* If not set, defaults to none.
*
*
- * The completion engine creates instances of this class and sets
- * its properties; this method is not intended to be used by other clients.
+ * The completion engine creates instances of this class and sets its
+ * properties; this method is not intended to be used by other clients.
*
*
- * @param flags the modifier flags, or
- * Flags.AccDefault if none
+ * @param flags
+ * the modifier flags, or Flags.AccDefault if none
*/
public void setFlags(int flags) {
this.flags = flags;
}
-
+
/**
- * Finds the method parameter names.
- * This information is relevant to method reference (and
- * method declaration proposals). Returns null
+ * Finds the method parameter names. This information is relevant to method
+ * reference (and method declaration proposals). Returns null
* if not available or not relevant.
*
* The client must not modify the array returned.
@@ -876,9 +792,10 @@ public final class CompletionProposal {
* parsing Java source files, etc. Use sparingly.
*
*
- * @param monitor the progress monitor, or null if none
- * @return the parameter names, or null if none
- * or not available or not relevant
+ * @param monitor
+ * the progress monitor, or null if none
+ * @return the parameter names, or null if none or not
+ * available or not relevant
*/
public char[][] findParameterNames(IProgressMonitor monitor) {
if (!this.parameterNamesComputed) {
@@ -887,17 +804,17 @@ public final class CompletionProposal {
}
return this.parameterNames;
}
-
+
/**
- * Sets the method parameter names.
- * This information is relevant to method reference (and
- * method declaration proposals).
+ * Sets the method parameter names. This information is relevant to method
+ * reference (and method declaration proposals).
*
- * The completion engine creates instances of this class and sets
- * its properties; this method is not intended to be used by other clients.
+ * The completion engine creates instances of this class and sets its
+ * properties; this method is not intended to be used by other clients.
*
*
- * @param parameterNames the parameter names, or null if none
+ * @param parameterNames
+ * the parameter names, or null if none
*/
public void setParameterNames(char[][] parameterNames) {
this.parameterNames = parameterNames;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionRequestor.java
index 2195c82..735d867 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionRequestor.java
@@ -19,30 +19,35 @@ import net.sourceforge.phpdt.core.compiler.IProblem;
* This class is intended to be subclassed by clients.
*
*
- * The code assist engine normally invokes methods on completion
- * requestors in the following sequence:
+ * The code assist engine normally invokes methods on completion requestors in
+ * the following sequence:
+ *
*
- * If, however, the engine is unable to offer completion proposals
- * for whatever reason, completionFailure is called
- * with a problem object describing why completions were unavailable.
- * In this case, the sequence of calls is:
+ *
+ * If, however, the engine is unable to offer completion proposals for whatever
+ * reason, completionFailure is called with a problem object
+ * describing why completions were unavailable. In this case, the sequence of
+ * calls is:
+ *
*
+ *
* In either case, the bracketing beginReporting
- * endReporting calls are always made.
+ * endReporting
+ * calls are always made.
*
*
- * The class was introduced in 3.0 as a more evolvable replacement
- * for the ICompletionRequestor interface.
+ * The class was introduced in 3.0 as a more evolvable replacement for the
+ * ICompletionRequestor interface.
*
*
* @see ICodeAssist
@@ -51,16 +56,14 @@ import net.sourceforge.phpdt.core.compiler.IProblem;
public abstract class CompletionRequestor {
/**
- * The set of CompletionProposal kinds that this requestor
- * ignores; 0 means the set is empty.
- * 1 << completionProposalKind
+ * The set of CompletionProposal kinds that this requestor ignores;
+ * 0 means the set is empty. 1 << completionProposalKind
*/
private int ignoreSet = 0;
/**
- * Creates a new completion requestor.
- * The requestor is interested in all kinds of completion
- * proposals; none will be ignored.
+ * Creates a new completion requestor. The requestor is interested in all
+ * kinds of completion proposals; none will be ignored.
*/
public CompletionRequestor() {
// do nothing
@@ -69,37 +72,40 @@ public abstract class CompletionRequestor {
/**
* Returns whether the given kind of completion proposal is ignored.
*
- * @param completionProposalKind one of the kind constants declared
- * on CompletionProposal
- * @return true if the given kind of completion proposal
- * is ignored by this requestor, and false if it is of
- * interest
+ * @param completionProposalKind
+ * one of the kind constants declared on
+ * CompletionProposal
+ * @return true if the given kind of completion proposal is
+ * ignored by this requestor, and false if it is of
+ * interest
* @see #setIgnored(int, boolean)
* @see CompletionProposal#getKind()
*/
public final boolean isIgnored(int completionProposalKind) {
if (completionProposalKind < CompletionProposal.ANONYMOUS_CLASS_DECLARATION
- || completionProposalKind > CompletionProposal.VARIABLE_DECLARATION) {
- throw new IllegalArgumentException();
+ || completionProposalKind > CompletionProposal.VARIABLE_DECLARATION) {
+ throw new IllegalArgumentException();
}
return 0 != (this.ignoreSet & (1 << completionProposalKind));
}
-
+
/**
* Sets whether the given kind of completion proposal is ignored.
*
- * @param completionProposalKind one of the kind constants declared
- * on CompletionProposal
- * @param ignore true if the given kind of completion proposal
- * is ignored by this requestor, and false if it is of
- * interest
+ * @param completionProposalKind
+ * one of the kind constants declared on
+ * CompletionProposal
+ * @param ignore
+ * true if the given kind of completion proposal
+ * is ignored by this requestor, and false if it
+ * is of interest
* @see #isIgnored(int)
* @see CompletionProposal#getKind()
*/
public final void setIgnored(int completionProposalKind, boolean ignore) {
if (completionProposalKind < CompletionProposal.ANONYMOUS_CLASS_DECLARATION
- || completionProposalKind > CompletionProposal.VARIABLE_DECLARATION) {
- throw new IllegalArgumentException();
+ || completionProposalKind > CompletionProposal.VARIABLE_DECLARATION) {
+ throw new IllegalArgumentException();
}
if (ignore) {
this.ignoreSet |= (1 << completionProposalKind);
@@ -107,13 +113,13 @@ public abstract class CompletionRequestor {
this.ignoreSet &= ~(1 << completionProposalKind);
}
}
-
+
/**
- * Pro forma notification sent before reporting a batch of
- * completion proposals.
+ * Pro forma notification sent before reporting a batch of completion
+ * proposals.
*
- * The default implementation of this method does nothing.
- * Clients may override.
+ * The default implementation of this method does nothing. Clients may
+ * override.
*
*/
public void beginReporting() {
@@ -121,11 +127,11 @@ public abstract class CompletionRequestor {
}
/**
- * Pro forma notification sent after reporting a batch of
- * completion proposals.
+ * Pro forma notification sent after reporting a batch of completion
+ * proposals.
*
- * The default implementation of this method does nothing.
- * Clients may override.
+ * The default implementation of this method does nothing. Clients may
+ * override.
*
*/
public void endReporting() {
@@ -133,33 +139,36 @@ public abstract class CompletionRequestor {
}
/**
- * Notification of failure to produce any completions.
- * The problem object explains what prevented completing.
+ * Notification of failure to produce any completions. The problem object
+ * explains what prevented completing.
*
- * The default implementation of this method does nothing.
- * Clients may override to receive this kind of notice.
+ * The default implementation of this method does nothing. Clients may
+ * override to receive this kind of notice.
*
*
- * @param problem the problem object
+ * @param problem
+ * the problem object
*/
public void completionFailure(IProblem problem) {
// default behavior is to ignore
}
/**
- * Proposes a completion. Has no effect if the kind of proposal
- * is being ignored by this requestor. Callers should consider
- * checking {@link #isIgnored(int)} before avoid creating proposal
- * objects that would only be ignored.
+ * Proposes a completion. Has no effect if the kind of proposal is being
+ * ignored by this requestor. Callers should consider checking
+ * {@link #isIgnored(int)} before avoid creating proposal objects that would
+ * only be ignored.
*
- * Similarly, implementers should check
- * {@link #isIgnored(int) isIgnored(proposal.getKind())}
- * and ignore proposals that have been declared as uninteresting.
- * The proposal object passed in only valid for the duration of
- * this call; implementors must not hang on to these objects.
+ * Similarly, implementers should check
+ * {@link #isIgnored(int) isIgnored(proposal.getKind())} and ignore
+ * proposals that have been declared as uninteresting. The proposal object
+ * passed in only valid for the duration of this call; implementors must not
+ * hang on to these objects.
*
- * @param proposal the completion proposal
- * @exception IllegalArgumentException if the proposal is null
+ * @param proposal
+ * the completion proposal
+ * @exception IllegalArgumentException
+ * if the proposal is null
*/
public abstract void accept(CompletionProposal proposal);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionRequestorAdapter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionRequestorAdapter.java
index c473feb..0a79dc5 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionRequestorAdapter.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/CompletionRequestorAdapter.java
@@ -12,45 +12,35 @@ package net.sourceforge.phpdt.core;
import net.sourceforge.phpdt.core.compiler.IProblem;
-
/**
* Adapter of the requestor interface ICompletionRequestor.
*
* This class is intended to be instanciated and subclassed by clients.
*
- *
+ *
* @see ICompletionRequestor
* @since 2.0
*/
public class CompletionRequestorAdapter implements ICompletionRequestor {
/*
- * @see ICompletionRequestor#acceptAnonymousType(char[], char[], char[][], char[][], char[][], char[], int, int, int)
+ * @see ICompletionRequestor#acceptAnonymousType(char[], char[], char[][],
+ * char[][], char[][], char[], int, int, int)
*/
- public void acceptAnonymousType(
- char[] superTypePackageName,
- char[] superTypeName,
- char[][] parameterPackageNames,
- char[][] parameterTypeNames,
- char[][] parameterNames,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptAnonymousType(char[] superTypePackageName,
+ char[] superTypeName, char[][] parameterPackageNames,
+ char[][] parameterTypeNames, char[][] parameterNames,
+ char[] completionName, int modifiers, int completionStart,
+ int completionEnd, int relevance) {
}
/*
- * @see ICompletionRequestor#acceptClass(char[], char[], char[], int, int, int)
+ * @see ICompletionRequestor#acceptClass(char[], char[], char[], int, int,
+ * int)
*/
- public void acceptClass(
- char[] packageName,
- char[] className,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptClass(char[] packageName, char[] className,
+ char[] completionName, int modifiers, int completionStart,
+ int completionEnd, int relevance) {
}
/*
@@ -60,148 +50,99 @@ public class CompletionRequestorAdapter implements ICompletionRequestor {
}
/*
- * @see ICompletionRequestor#acceptField(char[], char[], char[], char[], char[], char[], int, int, int)
+ * @see ICompletionRequestor#acceptField(char[], char[], char[], char[],
+ * char[], char[], int, int, int)
*/
- public void acceptField(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] name,
- char[] typePackageName,
- char[] typeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptField(char[] declaringTypePackageName,
+ char[] declaringTypeName, char[] name, char[] typePackageName,
+ char[] typeName, char[] completionName, int modifiers,
+ int completionStart, int completionEnd, int relevance) {
}
/*
- * @see ICompletionRequestor#acceptInterface(char[], char[], char[], int, int, int)
+ * @see ICompletionRequestor#acceptInterface(char[], char[], char[], int,
+ * int, int)
*/
- public void acceptInterface(
- char[] packageName,
- char[] interfaceName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptInterface(char[] packageName, char[] interfaceName,
+ char[] completionName, int modifiers, int completionStart,
+ int completionEnd, int relevance) {
}
/*
* @see ICompletionRequestor#acceptKeyword(char[], int, int)
*/
- public void acceptKeyword(
- char[] keywordName,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptKeyword(char[] keywordName, int completionStart,
+ int completionEnd, int relevance) {
}
/*
* @see ICompletionRequestor#acceptLabel(char[], int, int)
*/
- public void acceptLabel(
- char[] labelName,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptLabel(char[] labelName, int completionStart,
+ int completionEnd, int relevance) {
}
/*
- * @see ICompletionRequestor#acceptLocalVariable(char[], char[], char[], int, int, int)
+ * @see ICompletionRequestor#acceptLocalVariable(char[], char[], char[],
+ * int, int, int)
*/
- public void acceptLocalVariable(
- char[] name,
- char[] typePackageName,
- char[] typeName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptLocalVariable(char[] name, char[] typePackageName,
+ char[] typeName, int modifiers, int completionStart,
+ int completionEnd, int relevance) {
}
/*
- * @see ICompletionRequestor#acceptMethod(char[], char[], char[], char[][], char[][], char[][], char[], char[], char[], int, int, int)
+ * @see ICompletionRequestor#acceptMethod(char[], char[], char[], char[][],
+ * char[][], char[][], char[], char[], char[], int, int, int)
*/
- public void acceptMethod(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] selector,
- char[][] parameterPackageNames,
- char[][] parameterTypeNames,
- char[][] parameterNames,
- char[] returnTypePackageName,
- char[] returnTypeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptMethod(char[] declaringTypePackageName,
+ char[] declaringTypeName, char[] selector,
+ char[][] parameterPackageNames, char[][] parameterTypeNames,
+ char[][] parameterNames, char[] returnTypePackageName,
+ char[] returnTypeName, char[] completionName, int modifiers,
+ int completionStart, int completionEnd, int relevance) {
}
/*
- * @see ICompletionRequestor#acceptMethodDeclaration(char[], char[], char[], char[][], char[][], char[][], char[], char[], char[], int, int, int)
+ * @see ICompletionRequestor#acceptMethodDeclaration(char[], char[], char[],
+ * char[][], char[][], char[][], char[], char[], char[], int, int, int)
*/
- public void acceptMethodDeclaration(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] selector,
- char[][] parameterPackageNames,
- char[][] parameterTypeNames,
- char[][] parameterNames,
- char[] returnTypePackageName,
- char[] returnTypeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptMethodDeclaration(char[] declaringTypePackageName,
+ char[] declaringTypeName, char[] selector,
+ char[][] parameterPackageNames, char[][] parameterTypeNames,
+ char[][] parameterNames, char[] returnTypePackageName,
+ char[] returnTypeName, char[] completionName, int modifiers,
+ int completionStart, int completionEnd, int relevance) {
}
/*
* @see ICompletionRequestor#acceptModifier(char[], int, int)
*/
- public void acceptModifier(
- char[] modifierName,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptModifier(char[] modifierName, int completionStart,
+ int completionEnd, int relevance) {
}
/*
* @see ICompletionRequestor#acceptPackage(char[], char[], int, int)
*/
- public void acceptPackage(
- char[] packageName,
- char[] completionName,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptPackage(char[] packageName, char[] completionName,
+ int completionStart, int completionEnd, int relevance) {
}
/*
* @see ICompletionRequestor#acceptType(char[], char[], char[], int, int)
*/
- public void acceptType(
- char[] packageName,
- char[] typeName,
- char[] completionName,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptType(char[] packageName, char[] typeName,
+ char[] completionName, int completionStart, int completionEnd,
+ int relevance) {
}
/*
- * @see ICompletionRequestor#acceptVariableName(char[], char[], char[], char[], int, int)
+ * @see ICompletionRequestor#acceptVariableName(char[], char[], char[],
+ * char[], int, int)
*/
- public void acceptVariableName(
- char[] typePackageName,
- char[] typeName,
- char[] name,
- char[] completionName,
- int completionStart,
- int completionEnd,
- int relevance) {
+ public void acceptVariableName(char[] typePackageName, char[] typeName,
+ char[] name, char[] completionName, int completionStart,
+ int completionEnd, int relevance) {
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ElementChangedEvent.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ElementChangedEvent.java
index 9c16bea..ad7e315 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ElementChangedEvent.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ElementChangedEvent.java
@@ -13,29 +13,29 @@ package net.sourceforge.phpdt.core;
import java.util.EventObject;
/**
- * An element changed event describes a change to the structure or contents
- * of a tree of Java elements. The changes to the elements are described by
- * the associated delta object carried by this event.
+ * An element changed event describes a change to the structure or contents of a
+ * tree of Java elements. The changes to the elements are described by the
+ * associated delta object carried by this event.
*
* This class is not intended to be instantiated or subclassed by clients.
* Instances of this class are automatically created by the Java model.
*
- *
+ *
* @see IElementChangedListener
* @see IJavaElementDelta
*/
public class ElementChangedEvent extends EventObject {
-
+
/**
- * Event type constant (bit mask) indicating an after-the-fact
- * report of creations, deletions, and modifications
- * to one or more Java element(s) expressed as a hierarchical
- * java element delta as returned by getDelta().
- *
+ * Event type constant (bit mask) indicating an after-the-fact report of
+ * creations, deletions, and modifications to one or more Java element(s)
+ * expressed as a hierarchical java element delta as returned by
+ * getDelta().
+ *
* Note: this notification occurs during the corresponding POST_CHANGE
* resource change notification, and contains a full delta accounting for
- * any JavaModel operation and/or resource change.
- *
+ * any JavaModel operation and/or resource change.
+ *
* @see IJavaElementDelta
* @see org.eclipse.core.resources.IResourceChangeEvent
* @see #getDelta()
@@ -44,18 +44,19 @@ public class ElementChangedEvent extends EventObject {
public static final int POST_CHANGE = 1;
/**
- * Event type constant (bit mask) indicating an after-the-fact
- * report of creations, deletions, and modifications
- * to one or more Java element(s) expressed as a hierarchical
- * java element delta as returned by getDelta.
- *
+ * Event type constant (bit mask) indicating an after-the-fact report of
+ * creations, deletions, and modifications to one or more Java element(s)
+ * expressed as a hierarchical java element delta as returned by
+ * getDelta.
+ *
* Note: this notification occurs during the corresponding PRE_AUTO_BUILD
- * resource change notification. The delta, which is notified here, only contains
- * information relative to the previous JavaModel operations (in other words,
- * it ignores the possible resources which have changed outside Java operations).
- * In particular, it is possible that the JavaModel be inconsistent with respect to
- * resources, which got modified outside JavaModel operations (it will only be
- * fully consistent once the POST_CHANGE notification has occurred).
+ * resource change notification. The delta, which is notified here, only
+ * contains information relative to the previous JavaModel operations (in
+ * other words, it ignores the possible resources which have changed outside
+ * Java operations). In particular, it is possible that the JavaModel be
+ * inconsistent with respect to resources, which got modified outside
+ * JavaModel operations (it will only be fully consistent once the
+ * POST_CHANGE notification has occurred).
*
* @see IJavaElementDelta
* @see org.eclipse.core.resources.IResourceChangeEvent
@@ -65,50 +66,51 @@ public class ElementChangedEvent extends EventObject {
public static final int PRE_AUTO_BUILD = 2;
/**
- * Event type constant (bit mask) indicating an after-the-fact
- * report of creations, deletions, and modifications
- * to one or more Java element(s) expressed as a hierarchical
- * java element delta as returned by getDelta.
- *
+ * Event type constant (bit mask) indicating an after-the-fact report of
+ * creations, deletions, and modifications to one or more Java element(s)
+ * expressed as a hierarchical java element delta as returned by
+ * getDelta.
+ *
* Note: this notification occurs as a result of a working copy reconcile
* operation.
- *
+ *
* @see IJavaElementDelta
* @see org.eclipse.core.resources.IResourceChangeEvent
* @see #getDelta()
* @since 2.0
*/
- public static final int POST_RECONCILE = 4;
+ public static final int POST_RECONCILE = 4;
+
/*
- * Event type indicating the nature of this event.
- * It can be a combination either:
- * - POST_CHANGE
- * - PRE_AUTO_BUILD
- * - POST_RECONCILE
+ * Event type indicating the nature of this event. It can be a combination
+ * either: - POST_CHANGE - PRE_AUTO_BUILD - POST_RECONCILE
*/
- private int type;
-
+ private int type;
+
/**
- * Creates an new element changed event (based on a IJavaElementDelta).
- *
- * @param delta the Java element delta.
+ * Creates an new element changed event (based on a
+ * IJavaElementDelta).
+ *
+ * @param delta
+ * the Java element delta.
*/
public ElementChangedEvent(IJavaElementDelta delta, int type) {
super(delta);
this.type = type;
}
+
/**
* Returns the delta describing the change.
- *
+ *
* @return the delta describing the change
*/
public IJavaElementDelta getDelta() {
return (IJavaElementDelta) source;
}
-
+
/**
* Returns the type of event being reported.
- *
+ *
* @return one of the event type constants
* @see #POST_CHANGE
* @see #PRE_AUTO_BUILD
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java
index 9182b7f..89cd25e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Flags.java
@@ -12,8 +12,6 @@ package net.sourceforge.phpdt.core;
import net.sourceforge.phpdt.internal.compiler.env.IConstants;
-
-
/**
* Utility class for decoding modifier flags in Java elements.
*
@@ -21,254 +19,373 @@ import net.sourceforge.phpdt.internal.compiler.env.IConstants;
* instantiated or subclassed by clients.
*
*
- * Note that the numeric values of these flags match the ones for class files
- * as described in the Java Virtual Machine Specification. The AST class
- * Modifier provides the same functionality as this class, only in
- * the net.sourceforge.phpdt.core.dom package.
+ * Note that the numeric values of these flags match the ones for class files as
+ * described in the Java Virtual Machine Specification. The AST class
+ * Modifier provides the same functionality as this class, only
+ * in the net.sourceforge.phpdt.core.dom package.
*
- *
+ *
* @see IMember#getFlags
*/
public final class Flags {
- /**
+ /**
* Constant representing the absence of any flag
+ *
* @since 3.0
*/
public static final int AccDefault = 0;
+
/**
- * Public access flag. See The Java Virtual Machine Specification for more details.
+ * Public access flag. See The Java Virtual Machine Specification for more
+ * details.
+ *
* @since 2.0
*/
public static final int AccPublic = IConstants.AccPublic;
+
/**
- * Private access flag. See The Java Virtual Machine Specification for more details.
+ * Private access flag. See The Java Virtual Machine Specification for more
+ * details.
+ *
* @since 2.0
*/
public static final int AccPrivate = IConstants.AccPrivate;
+
/**
- * Protected access flag. See The Java Virtual Machine Specification for more details.
+ * Protected access flag. See The Java Virtual Machine Specification for
+ * more details.
+ *
* @since 2.0
*/
public static final int AccProtected = IConstants.AccProtected;
+
/**
- * Static access flag. See The Java Virtual Machine Specification for more details.
+ * Static access flag. See The Java Virtual Machine Specification for more
+ * details.
+ *
* @since 2.0
*/
public static final int AccStatic = IConstants.AccStatic;
+
/**
- * Final access flag. See The Java Virtual Machine Specification for more details.
+ * Final access flag. See The Java Virtual Machine Specification for more
+ * details.
+ *
* @since 2.0
*/
public static final int AccFinal = IConstants.AccFinal;
+
/**
- * Synchronized access flag. See The Java Virtual Machine Specification for more details.
+ * Synchronized access flag. See The Java Virtual Machine Specification for
+ * more details.
+ *
* @since 2.0
*/
-// public static final int AccSynchronized = IConstants.AccSynchronized;
+ // public static final int AccSynchronized = IConstants.AccSynchronized;
/**
- * Volatile property flag. See The Java Virtual Machine Specification for more details.
+ * Volatile property flag. See The Java Virtual Machine Specification for
+ * more details.
+ *
* @since 2.0
*/
-// public static final int AccVolatile = IConstants.AccVolatile;
+ // public static final int AccVolatile = IConstants.AccVolatile;
/**
- * Transient property flag. See The Java Virtual Machine Specification for more details.
+ * Transient property flag. See The Java Virtual Machine Specification for
+ * more details.
+ *
* @since 2.0
*/
-// public static final int AccTransient = IConstants.AccTransient;
+ // public static final int AccTransient = IConstants.AccTransient;
/**
- * Native property flag. See The Java Virtual Machine Specification for more details.
+ * Native property flag. See The Java Virtual Machine Specification for more
+ * details.
+ *
* @since 2.0
*/
-// public static final int AccNative = IConstants.AccNative;
+ // public static final int AccNative = IConstants.AccNative;
/**
- * Interface property flag. See The Java Virtual Machine Specification for more details.
+ * Interface property flag. See The Java Virtual Machine Specification for
+ * more details.
+ *
* @since 2.0
*/
public static final int AccInterface = IConstants.AccInterface;
+
/**
- * Abstract property flag. See The Java Virtual Machine Specification for more details.
+ * Abstract property flag. See The Java Virtual Machine Specification for
+ * more details.
+ *
* @since 2.0
*/
public static final int AccAbstract = IConstants.AccAbstract;
+
/**
- * Strictfp property flag. See The Java Virtual Machine Specification for more details.
+ * Strictfp property flag. See The Java Virtual Machine Specification for
+ * more details.
+ *
* @since 2.0
*/
-// public static final int AccStrictfp = IConstants.AccStrictfp;
+ // public static final int AccStrictfp = IConstants.AccStrictfp;
/**
- * Super property flag. See The Java Virtual Machine Specification for more details.
+ * Super property flag. See The Java Virtual Machine Specification for more
+ * details.
+ *
* @since 2.0
*/
public static final int AccSuper = IConstants.AccSuper;
+
/**
- * Synthetic property flag. See The Java Virtual Machine Specification for more details.
+ * Synthetic property flag. See The Java Virtual Machine Specification for
+ * more details.
+ *
* @since 2.0
*/
-// public static final int AccSynthetic = IConstants.AccSynthetic;
+ // public static final int AccSynthetic = IConstants.AccSynthetic;
/**
- * Deprecated property flag. See The Java Virtual Machine Specification for more details.
+ * Deprecated property flag. See The Java Virtual Machine Specification for
+ * more details.
+ *
* @since 2.0
*/
public static final int AccDeprecated = IConstants.AccDeprecated;
-
+
/**
* Not instantiable.
*/
private Flags() {
}
+
/**
- * Returns whether the given integer includes the abstract modifier.
- *
- * @param flags the flags
- * @return true if the abstract modifier is included
+ * Returns whether the given integer includes the abstract
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the abstract modifier is
+ * included
*/
public static boolean isAbstract(int flags) {
return (flags & AccAbstract) != 0;
}
+
/**
- * Returns whether the given integer includes the indication that the
+ * Returns whether the given integer includes the indication that the
* element is deprecated (@deprecated tag in Javadoc comment).
- *
- * @param flags the flags
+ *
+ * @param flags
+ * the flags
* @return true if the element is marked as deprecated
*/
public static boolean isDeprecated(int flags) {
return (flags & AccDeprecated) != 0;
}
+
/**
- * Returns whether the given integer includes the final modifier.
- *
- * @param flags the flags
- * @return true if the final modifier is included
+ * Returns whether the given integer includes the final
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the final modifier is
+ * included
*/
public static boolean isFinal(int flags) {
return (flags & AccFinal) != 0;
}
+
/**
- * Returns whether the given integer includes the interface modifier.
- *
- * @param flags the flags
- * @return true if the interface modifier is included
+ * Returns whether the given integer includes the interface
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the interface modifier is
+ * included
* @since 2.0
*/
public static boolean isInterface(int flags) {
return (flags & AccInterface) != 0;
}
+
/**
- * Returns whether the given integer includes the native modifier.
- *
- * @param flags the flags
- * @return true if the native modifier is included
- */
-// public static boolean isNative(int flags) {
-// return (flags & AccNative) != 0;
-// }
+ * Returns whether the given integer includes the native
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the native modifier is
+ * included
+ */
+ // public static boolean isNative(int flags) {
+ // return (flags & AccNative) != 0;
+ // }
/**
- * Returns whether the given integer includes the private modifier.
- *
- * @param flags the flags
- * @return true if the private modifier is included
+ * Returns whether the given integer includes the private
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the private modifier is
+ * included
*/
public static boolean isPrivate(int flags) {
return (flags & AccPrivate) != 0;
}
+
/**
- * Returns whether the given integer includes the protected modifier.
- *
- * @param flags the flags
- * @return true if the protected modifier is included
+ * Returns whether the given integer includes the protected
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the protected modifier is
+ * included
*/
public static boolean isProtected(int flags) {
return (flags & AccProtected) != 0;
}
+
/**
- * Returns whether the given integer includes the public modifier.
- *
- * @param flags the flags
- * @return true if the public modifier is included
+ * Returns whether the given integer includes the public
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the public modifier is
+ * included
*/
public static boolean isPublic(int flags) {
return (flags & AccPublic) != 0;
}
+
/**
- * Returns whether the given integer includes the static modifier.
- *
- * @param flags the flags
- * @return true if the static modifier is included
+ * Returns whether the given integer includes the static
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the static modifier is
+ * included
*/
public static boolean isStatic(int flags) {
return (flags & AccStatic) != 0;
}
+
/**
- * Returns whether the given integer includes the strictfp modifier.
- *
- * @param flags the flags
- * @return true if the strictfp modifier is included
- */
-// public static boolean isStrictfp(int flags) {
-// return (flags & AccStrictfp) != 0;
-// }
+ * Returns whether the given integer includes the strictfp
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the strictfp modifier is
+ * included
+ */
+ // public static boolean isStrictfp(int flags) {
+ // return (flags & AccStrictfp) != 0;
+ // }
/**
- * Returns whether the given integer includes the synchronized modifier.
- *
- * @param flags the flags
- * @return true if the synchronized modifier is included
- */
-// public static boolean isSynchronized(int flags) {
-// return (flags & AccSynchronized) != 0;
-// }
+ * Returns whether the given integer includes the synchronized
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the synchronized modifier
+ * is included
+ */
+ // public static boolean isSynchronized(int flags) {
+ // return (flags & AccSynchronized) != 0;
+ // }
/**
- * Returns whether the given integer includes the indication that the
+ * Returns whether the given integer includes the indication that the
* element is synthetic.
- *
- * @param flags the flags
+ *
+ * @param flags
+ * the flags
* @return true if the element is marked synthetic
*/
-// public static boolean isSynthetic(int flags) {
-// return (flags & AccSynthetic) != 0;
-// }
+ // public static boolean isSynthetic(int flags) {
+ // return (flags & AccSynthetic) != 0;
+ // }
/**
- * Returns whether the given integer includes the transient modifier.
- *
- * @param flags the flags
- * @return true if the transient modifier is included
- */
-// public static boolean isTransient(int flags) {
-// return (flags & AccTransient) != 0;
-// }
+ * Returns whether the given integer includes the transient
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the transient modifier is
+ * included
+ */
+ // public static boolean isTransient(int flags) {
+ // return (flags & AccTransient) != 0;
+ // }
/**
- * Returns whether the given integer includes the volatile modifier.
- *
- * @param flags the flags
- * @return true if the volatile modifier is included
- */
-// public static boolean isVolatile(int flags) {
-// return (flags & AccVolatile) != 0;
-// }
+ * Returns whether the given integer includes the volatile
+ * modifier.
+ *
+ * @param flags
+ * the flags
+ * @return true if the volatile modifier is
+ * included
+ */
+ // public static boolean isVolatile(int flags) {
+ // return (flags & AccVolatile) != 0;
+ // }
/**
- * Returns a standard string describing the given modifier flags.
- * Only modifier flags are included in the output; the deprecated and
- * synthetic flags are ignored if set.
+ * Returns a standard string describing the given modifier flags. Only
+ * modifier flags are included in the output; the deprecated and synthetic
+ * flags are ignored if set.
*
* The flags are output in the following order:
+ *
*
+ *
* This is a compromise between the orders specified in sections 8.1.1,
* 8.3.1, 8.4.3, 8.8.3, 9.1.1, and 9.3 of The Java Language
- * Specification, Second Edition (JLS2).
- *
+ * Specification, Second Edition
+ * (JLS2).
+ *
*
+ *
*
- *
- * @param flags the flags
+ *
+ * @param flags
+ * the flags
* @return the standard string representation of the given flags
*/
public static String toString(int flags) {
@@ -282,20 +399,20 @@ public final class Flags {
sb.append("private "); //$NON-NLS-1$
if (isStatic(flags))
sb.append("static "); //$NON-NLS-1$
-// if (isAbstract(flags))
-// sb.append("abstract "); //$NON-NLS-1$
+ // if (isAbstract(flags))
+ // sb.append("abstract "); //$NON-NLS-1$
if (isFinal(flags))
sb.append("final "); //$NON-NLS-1$
-// if (isNative(flags))
-// sb.append("native "); //$NON-NLS-1$
-// if (isSynchronized(flags))
-// sb.append("synchronized "); //$NON-NLS-1$
-// if (isTransient(flags))
-// sb.append("transient "); //$NON-NLS-1$
-// if (isVolatile(flags))
-// sb.append("volatile "); //$NON-NLS-1$
-// if (isStrictfp(flags))
-// sb.append("strictfp "); //$NON-NLS-1$
+ // if (isNative(flags))
+ // sb.append("native "); //$NON-NLS-1$
+ // if (isSynchronized(flags))
+ // sb.append("synchronized "); //$NON-NLS-1$
+ // if (isTransient(flags))
+ // sb.append("transient "); //$NON-NLS-1$
+ // if (isVolatile(flags))
+ // sb.append("volatile "); //$NON-NLS-1$
+ // if (isStrictfp(flags))
+ // sb.append("strictfp "); //$NON-NLS-1$
int len = sb.length();
if (len == 0)
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBuffer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBuffer.java
index 0a84671..819eb7e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBuffer.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBuffer.java
@@ -14,250 +14,307 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
/**
- * A buffer contains the text contents of a resource. It is not language-specific.
- * The contents may be in the process of being edited, differing from the actual contents of the
- * underlying resource. A buffer has an owner, which is an IOpenable.
- * If a buffer does not have an underlying resource, saving the buffer has no effect.
- * Buffers can be read-only.
+ * A buffer contains the text contents of a resource. It is not
+ * language-specific. The contents may be in the process of being edited,
+ * differing from the actual contents of the underlying resource. A buffer has
+ * an owner, which is an IOpenable. If a buffer does not have an
+ * underlying resource, saving the buffer has no effect. Buffers can be
+ * read-only.
*
- * Note that java model operations that manipulate an IBuffer (for example,
- * IType.createMethod(...)) ensures that the same line delimiter
- * (either "\n" or "\r" or "\r\n") is
- * used across the whole buffer. Thus these operations may change the line delimiter(s)
- * included in the string to be append, or replaced.
- * However implementers of this interface should be aware that other clients of IBuffer
- * might not do such transformations beforehand.
+ * Note that java model operations that manipulate an IBuffer
+ * (for example, IType.createMethod(...)) ensures that the same
+ * line delimiter (either "\n" or "\r" or
+ * "\r\n") is used across the whole buffer. Thus these
+ * operations may change the line delimiter(s) included in the string to be
+ * append, or replaced. However implementers of this interface should be aware
+ * that other clients of IBuffer might not do such
+ * transformations beforehand.
*
* This interface may be implemented by clients.
*
*/
public interface IBuffer {
-
-/**
- * Adds the given listener for changes to this buffer.
- * Has no effect if an identical listener is already registered or if the buffer
- * is closed.
- *
- * @param listener the listener of buffer changes
- */
-public void addBufferChangedListener(IBufferChangedListener listener);
-/**
- * Appends the given character array to the contents of the buffer.
- * This buffer will now have unsaved changes.
- * Any client can append to the contents of the buffer, not just the owner of the buffer.
- * Reports a buffer changed event.
- *
- * Has no effect if this buffer is read-only.
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @param text the given character array to append to contents of the buffer
- */
-public void append(char[] text);
-/**
- * Appends the given string to the contents of the buffer.
- * This buffer will now have unsaved changes.
- * Any client can append to the contents of the buffer, not just the owner of the buffer.
- * Reports a buffer changed event.
- *
- * Has no effect if this buffer is read-only.
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @param text the String to append to the contents of the buffer
- */
-public void append(String text);
-/**
- * Closes the buffer. Any unsaved changes are lost. Reports a buffer changed event
- * with a 0 offset and a 0 length. When this event is fired, the buffer should already
- * be closed.
- *
- * Further operations on the buffer are not allowed, except for close. If an
- * attempt is made to close an already closed buffer, the second attempt has no effect.
- */
-public void close();
-/**
- * Returns the character at the given position in this buffer.
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @param position a zero-based source offset in this buffer
- * @return the character at the given position in this buffer
- */
-public char getChar(int position);
-/**
- * Returns the contents of this buffer as a character array, or null if
- * the buffer has not been initialized.
- *
- * Callers should make no assumption about whether the returned character array
- * is or is not the genuine article or a copy. In other words, if the client
- * wishes to change this array, they should make a copy. Likewise, if the
- * client wishes to hang on to the array in its current state, they should
- * make a copy.
- *
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @return the characters contained in this buffer
- */
-public char[] getCharacters();
-/**
- * Returns the contents of this buffer as a String. Like all strings,
- * the result is an immutable value object., It can also answer null if
- * the buffer has not been initialized.
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @return the contents of this buffer as a String
- */
-public String getContents();
-/**
- * Returns number of characters stored in this buffer.
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @return the number of characters in this buffer
- */
-public int getLength();
-/**
- * Returns the Java openable element owning of this buffer.
- *
- * @return the openable element owning this buffer
- */
-public IOpenable getOwner();
-/**
- * Returns the given range of text in this buffer.
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @param offset the zero-based starting offset
- * @param length the number of characters to retrieve
- * @return the given range of text in this buffer
- */
-public String getText(int offset, int length);
-/**
- * Returns the underlying resource for which this buffer was opened,
- * or null if this buffer was not opened on a resource.
- *
- * @return the underlying resource for this buffer, or null
- * if none.
- */
-public IResource getUnderlyingResource();
-/**
- * Returns whether this buffer has been modified since it
- * was opened or since it was last saved.
- * If a buffer does not have an underlying resource, this method always
- * returns true.
- *
- * @return a boolean indicating presence of unsaved changes (in
- * the absence of any underlying resource, it will always return true).
- */
-public boolean hasUnsavedChanges();
-/**
- * Returns whether this buffer has been closed.
- *
- * @return a boolean indicating whether this buffer is closed.
- */
-public boolean isClosed();
-/**
- * Returns whether this buffer is read-only.
- *
- * @return a boolean indicating whether this buffer is read-only
- */
-public boolean isReadOnly();
-/**
- * Removes the given listener from this buffer.
- * Has no affect if an identical listener is not registered or if the buffer is closed.
- *
- * @param listener the listener
- */
-public void removeBufferChangedListener(IBufferChangedListener listener);
-/**
- * Replaces the given range of characters in this buffer with the given text.
- * position and position + length must be in the range [0, getLength()].
- * length must not be negative.
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @param position the zero-based starting position of the affected text range in this buffer
- * @param length the length of the affected text range in this buffer
- * @param text the replacing text as a character array
- */
-public void replace(int position, int length, char[] text);
-/**
- * Replaces the given range of characters in this buffer with the given text.
- * position and position + length must be in the range [0, getLength()].
- * length must not be negative.
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @param position the zero-based starting position of the affected text range in this buffer
- * @param length the length of the affected text range in this buffer
- * @param text the replacing text as a String
- */
-public void replace(int position, int length, String text);
-/**
- * Saves the contents of this buffer to its underlying resource. If
- * successful, this buffer will have no unsaved changes.
- * The buffer is left open. Saving a buffer with no unsaved
- * changes has no effect - the underlying resource is not changed.
- * If the buffer does not have an underlying resource or is read-only, this
- * has no effect.
- *
- * The force parameter controls how this method deals with
- * cases where the workbench is not completely in sync with the local file system.
- * If false is specified, this method will only attempt
- * to overwrite a corresponding file in the local file system provided
- * it is in sync with the workbench. This option ensures there is no
- * unintended data loss; it is the recommended setting.
- * However, if true is specified, an attempt will be made
- * to write a corresponding file in the local file system,
- * overwriting any existing one if need be.
- * In either case, if this method succeeds, the resource will be marked
- * as being local (even if it wasn't before).
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @param progress the progress monitor to notify
- * @param force a boolean flag indicating how to deal with resource
- * inconsistencies.
- *
- * @exception JavaModelException if an error occurs writing the buffer
- * to the underlying resource
- *
- * @see org.eclipse.core.resources.IFile#setContents(java.io.InputStream, boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
-public void save(IProgressMonitor progress, boolean force) throws JavaModelException;
-/**
- * Sets the contents of this buffer to the given character array.
- * This buffer will now have unsaved changes.
- * Any client can set the contents of the buffer, not just the owner of the buffer.
- * Reports a buffer changed event.
- *
- * Equivalent to replace(0,getLength(),contents).
- *
- *
- * Has no effect if this buffer is read-only.
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @param contents the new contents of this buffer as a character array
- */
-public void setContents(char[] contents);
-/**
- * Sets the contents of this buffer to the given String.
- * This buffer will now have unsaved changes.
- * Any client can set the contents of the buffer, not just the owner of the buffer.
- * Reports a buffer changed event.
- *
- * Equivalent to replace(0,getLength(),contents).
- *
- *
- * Has no effect if this buffer is read-only.
- *
- * A RuntimeException might be thrown if the buffer is closed.
- *
- * @param contents the new contents of this buffer as a String
- */
-public void setContents(String contents);
+
+ /**
+ * Adds the given listener for changes to this buffer. Has no effect if an
+ * identical listener is already registered or if the buffer is closed.
+ *
+ * @param listener
+ * the listener of buffer changes
+ */
+ public void addBufferChangedListener(IBufferChangedListener listener);
+
+ /**
+ * Appends the given character array to the contents of the buffer. This
+ * buffer will now have unsaved changes. Any client can append to the
+ * contents of the buffer, not just the owner of the buffer. Reports a
+ * buffer changed event.
+ *
+ * Has no effect if this buffer is read-only.
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @param text
+ * the given character array to append to contents of the buffer
+ */
+ public void append(char[] text);
+
+ /**
+ * Appends the given string to the contents of the buffer. This buffer will
+ * now have unsaved changes. Any client can append to the contents of the
+ * buffer, not just the owner of the buffer. Reports a buffer changed event.
+ *
+ * Has no effect if this buffer is read-only.
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @param text
+ * the String to append to the contents of the
+ * buffer
+ */
+ public void append(String text);
+
+ /**
+ * Closes the buffer. Any unsaved changes are lost. Reports a buffer changed
+ * event with a 0 offset and a 0 length. When this event is fired, the
+ * buffer should already be closed.
+ *
+ * Further operations on the buffer are not allowed, except for close. If an
+ * attempt is made to close an already closed buffer, the second attempt has
+ * no effect.
+ */
+ public void close();
+
+ /**
+ * Returns the character at the given position in this buffer.
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @param position
+ * a zero-based source offset in this buffer
+ * @return the character at the given position in this buffer
+ */
+ public char getChar(int position);
+
+ /**
+ * Returns the contents of this buffer as a character array, or
+ * null if the buffer has not been initialized.
+ *
+ * Callers should make no assumption about whether the returned character
+ * array is or is not the genuine article or a copy. In other words, if the
+ * client wishes to change this array, they should make a copy. Likewise, if
+ * the client wishes to hang on to the array in its current state, they
+ * should make a copy.
+ *
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @return the characters contained in this buffer
+ */
+ public char[] getCharacters();
+
+ /**
+ * Returns the contents of this buffer as a String. Like all
+ * strings, the result is an immutable value object., It can also answer
+ * null if the buffer has not been initialized.
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @return the contents of this buffer as a String
+ */
+ public String getContents();
+
+ /**
+ * Returns number of characters stored in this buffer.
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @return the number of characters in this buffer
+ */
+ public int getLength();
+
+ /**
+ * Returns the Java openable element owning of this buffer.
+ *
+ * @return the openable element owning this buffer
+ */
+ public IOpenable getOwner();
+
+ /**
+ * Returns the given range of text in this buffer.
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @param offset
+ * the zero-based starting offset
+ * @param length
+ * the number of characters to retrieve
+ * @return the given range of text in this buffer
+ */
+ public String getText(int offset, int length);
+
+ /**
+ * Returns the underlying resource for which this buffer was opened, or
+ * null if this buffer was not opened on a resource.
+ *
+ * @return the underlying resource for this buffer, or null
+ * if none.
+ */
+ public IResource getUnderlyingResource();
+
+ /**
+ * Returns whether this buffer has been modified since it was opened or
+ * since it was last saved. If a buffer does not have an underlying
+ * resource, this method always returns true.
+ *
+ * @return a boolean indicating presence of unsaved changes
+ * (in the absence of any underlying resource, it will always return
+ * true).
+ */
+ public boolean hasUnsavedChanges();
+
+ /**
+ * Returns whether this buffer has been closed.
+ *
+ * @return a boolean indicating whether this buffer is
+ * closed.
+ */
+ public boolean isClosed();
+
+ /**
+ * Returns whether this buffer is read-only.
+ *
+ * @return a boolean indicating whether this buffer is
+ * read-only
+ */
+ public boolean isReadOnly();
+
+ /**
+ * Removes the given listener from this buffer. Has no affect if an
+ * identical listener is not registered or if the buffer is closed.
+ *
+ * @param listener
+ * the listener
+ */
+ public void removeBufferChangedListener(IBufferChangedListener listener);
+
+ /**
+ * Replaces the given range of characters in this buffer with the given
+ * text. position and position + length must
+ * be in the range [0, getLength()]. length must not be
+ * negative.
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @param position
+ * the zero-based starting position of the affected text range in
+ * this buffer
+ * @param length
+ * the length of the affected text range in this buffer
+ * @param text
+ * the replacing text as a character array
+ */
+ public void replace(int position, int length, char[] text);
+
+ /**
+ * Replaces the given range of characters in this buffer with the given
+ * text. position and position + length must
+ * be in the range [0, getLength()]. length must not be
+ * negative.
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @param position
+ * the zero-based starting position of the affected text range in
+ * this buffer
+ * @param length
+ * the length of the affected text range in this buffer
+ * @param text
+ * the replacing text as a String
+ */
+ public void replace(int position, int length, String text);
+
+ /**
+ * Saves the contents of this buffer to its underlying resource. If
+ * successful, this buffer will have no unsaved changes. The buffer is left
+ * open. Saving a buffer with no unsaved changes has no effect - the
+ * underlying resource is not changed. If the buffer does not have an
+ * underlying resource or is read-only, this has no effect.
+ *
+ * The force parameter controls how this method deals with
+ * cases where the workbench is not completely in sync with the local file
+ * system. If false is specified, this method will only
+ * attempt to overwrite a corresponding file in the local file system
+ * provided it is in sync with the workbench. This option ensures there is
+ * no unintended data loss; it is the recommended setting. However, if
+ * true is specified, an attempt will be made to write a
+ * corresponding file in the local file system, overwriting any existing one
+ * if need be. In either case, if this method succeeds, the resource will be
+ * marked as being local (even if it wasn't before).
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @param progress
+ * the progress monitor to notify
+ * @param force
+ * a boolean flag indicating how to deal with
+ * resource inconsistencies.
+ *
+ * @exception JavaModelException
+ * if an error occurs writing the buffer to the underlying
+ * resource
+ *
+ * @see org.eclipse.core.resources.IFile#setContents(java.io.InputStream,
+ * boolean, boolean, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void save(IProgressMonitor progress, boolean force)
+ throws JavaModelException;
+
+ /**
+ * Sets the contents of this buffer to the given character array. This
+ * buffer will now have unsaved changes. Any client can set the contents of
+ * the buffer, not just the owner of the buffer. Reports a buffer changed
+ * event.
+ *
+ * Equivalent to replace(0,getLength(),contents).
+ *
+ *
+ * Has no effect if this buffer is read-only.
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @param contents
+ * the new contents of this buffer as a character array
+ */
+ public void setContents(char[] contents);
+
+ /**
+ * Sets the contents of this buffer to the given String.
+ * This buffer will now have unsaved changes. Any client can set the
+ * contents of the buffer, not just the owner of the buffer. Reports a
+ * buffer changed event.
+ *
+ * Equivalent to replace(0,getLength(),contents).
+ *
+ *
+ * Has no effect if this buffer is read-only.
+ *
+ * A RuntimeException might be thrown if the buffer is
+ * closed.
+ *
+ * @param contents
+ * the new contents of this buffer as a String
+ */
+ public void setContents(String contents);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBufferChangedListener.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBufferChangedListener.java
index 791fcc9..87faf43 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBufferChangedListener.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBufferChangedListener.java
@@ -11,20 +11,21 @@
package net.sourceforge.phpdt.core;
/**
- * A listener, which gets notified when the contents of a specific buffer
- * have changed, or when the buffer is closed.
- * When a buffer is closed, the listener is notified after the buffer has been closed.
- * A listener is not notified when a buffer is saved.
+ * A listener, which gets notified when the contents of a specific buffer have
+ * changed, or when the buffer is closed. When a buffer is closed, the listener
+ * is notified after the buffer has been closed. A listener is not
+ * notified when a buffer is saved.
*
* This interface may be implemented by clients.
*
*/
public interface IBufferChangedListener {
- /**
+ /**
* Notifies that the given event has occurred.
- *
- * @param event the change event
+ *
+ * @param event
+ * the change event
*/
public void bufferChanged(BufferChangedEvent event);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBufferFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBufferFactory.java
index 15b61e6..d5fcc17 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBufferFactory.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IBufferFactory.java
@@ -15,19 +15,20 @@ package net.sourceforge.phpdt.core;
*
* This interface may be implemented by clients.
*
+ *
* @since 2.0
*/
public interface IBufferFactory {
/**
- * Creates a buffer for the given owner.
- * The new buffer will be initialized with the contents of the owner
- * if and only if it was not already initialized by the factory (a buffer is uninitialized if
- * its content is null).
+ * Creates a buffer for the given owner. The new buffer will be initialized
+ * with the contents of the owner if and only if it was not already
+ * initialized by the factory (a buffer is uninitialized if its content is
+ * null).
*
- * @param owner the owner of the buffer
+ * @param owner
+ * the owner of the buffer
* @see IBuffer
*/
IBuffer createBuffer(IOpenable owner);
}
-
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java
index 8d6e929..a9648aa 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IClasspathEntry.java
@@ -12,97 +12,108 @@ package net.sourceforge.phpdt.core;
import org.eclipse.core.runtime.IPath;
-/**
+/**
* An entry on a Java project classpath identifying one or more package fragment
- * roots. A classpath entry has a content kind (either source,
- * K_SOURCE, or binary, K_BINARY), which is inherited
- * by each package fragment root and package fragment associated with the entry.
+ * roots. A classpath entry has a content kind (either source,
+ * K_SOURCE, or binary, K_BINARY), which is
+ * inherited by each package fragment root and package fragment associated with
+ * the entry.
*
- * A classpath entry can refer to any of the following:
+ * A classpath entry can refer to any of the following:
+ *
*
- *
Source code in the current project. In this case, the entry identifies a
- * root folder in the current project containing package fragments and
- * .java source files. The root folder itself represents a default
- * package, subfolders represent package fragments, and .java files
- * represent compilation units. All compilation units will be compiled when
- * the project is built. The classpath entry must specify the
- * absolute path to the root folder. Entries of this kind are
- * associated with the CPE_SOURCE constant.
- * Source classpath entries can carry patterns to exclude selected files.
- * Excluded .java source files do not appear as compilation
- * units and are not compiled when the project is built.
- *
+ *
Source code in the current project. In this case, the entry identifies a
+ * root folder in the current project containing package fragments and
+ * .java source files. The root folder itself represents a
+ * default package, subfolders represent package fragments, and
+ * .java files represent compilation units. All compilation units
+ * will be compiled when the project is built. The classpath entry must specify
+ * the absolute path to the root folder. Entries of this kind are associated
+ * with the CPE_SOURCE constant. Source classpath entries can
+ * carry patterns to exclude selected files. Excluded .java
+ * source files do not appear as compilation units and are not compiled when the
+ * project is built.
*
- *
A binary library in the current project, in another project, or in the external
- * file system. In this case the entry identifies a JAR (or root folder) containing
- * package fragments and .class files. The classpath entry
- * must specify the absolute path to the JAR (or root folder), and in case it refers
- * to an external JAR, then there is no associated resource in the workbench. Entries
- * of this kind are associated with the CPE_LIBRARY constant.
+ *
A binary library in the current project, in another project, or in the
+ * external file system. In this case the entry identifies a JAR (or root
+ * folder) containing package fragments and .class files. The
+ * classpath entry must specify the absolute path to the JAR (or root folder),
+ * and in case it refers to an external JAR, then there is no associated
+ * resource in the workbench. Entries of this kind are associated with the
+ * CPE_LIBRARY constant.
*
- *
A required project. In this case the entry identifies another project in
- * the workspace. The required project is used as a binary library when compiling
- * (that is, the builder looks in the output location of the required project
- * for required .class files when building). When performing other
- * "development" operations - such as code assist, code resolve, type hierarchy
- * creation, etc. - the source code of the project is referred to. Thus, development
- * is performed against a required project's source code, and compilation is
- * performed against a required project's last built state. The
- * classpath entry must specify the absolute path to the
- * project. Entries of this kind are associated with the CPE_PROJECT
- * constant.
- * Note: referencing a required project with a classpath entry refers to the source
- * code or associated .class files located in its output location.
- * It will also automatically include any other libraries or projects that the required project's classpath
- * refers to, iff the corresponding classpath entries are tagged as being exported
- * (IClasspathEntry#isExported).
- * Unless exporting some classpath entries, classpaths are not chained by default -
- * each project must specify its own classpath in its entirety.
+ *
A required project. In this case the entry identifies another project in
+ * the workspace. The required project is used as a binary library when
+ * compiling (that is, the builder looks in the output location of the required
+ * project for required .class files when building). When
+ * performing other "development" operations - such as code assist, code
+ * resolve, type hierarchy creation, etc. - the source code of the project is
+ * referred to. Thus, development is performed against a required project's
+ * source code, and compilation is performed against a required project's last
+ * built state. The classpath entry must specify the absolute path to the
+ * project. Entries of this kind are associated with the
+ * CPE_PROJECT constant. Note: referencing a required project
+ * with a classpath entry refers to the source code or associated
+ * .class files located in its output location. It will also
+ * automatically include any other libraries or projects that the required
+ * project's classpath refers to, iff the corresponding classpath entries are
+ * tagged as being exported (IClasspathEntry#isExported).
+ * Unless exporting some classpath entries, classpaths are not chained by
+ * default - each project must specify its own classpath in its entirety.
*
- *
A path beginning in a classpath variable defined globally to the workspace.
- * Entries of this kind are associated with the CPE_VARIABLE constant.
- * Classpath variables are created using JavaCore#setClasspathVariable,
- * and gets resolved, to either a project or library entry, using
- * JavaCore#getResolvedClasspathVariable.
- * It is also possible to register an automatic initializer (ClasspathVariableInitializer),
- * which will be invoked through the extension point "net.sourceforge.phpdt.core.classpathVariableInitializer".
- * After resolution, a classpath variable entry may either correspond to a project or a library entry.
+ *
A path beginning in a classpath variable defined globally to the
+ * workspace. Entries of this kind are associated with the
+ * CPE_VARIABLE constant. Classpath variables are created using
+ * JavaCore#setClasspathVariable, and gets resolved, to either a
+ * project or library entry, using
+ * JavaCore#getResolvedClasspathVariable. It is also possible to
+ * register an automatic initializer (ClasspathVariableInitializer),
+ * which will be invoked through the extension point
+ * "net.sourceforge.phpdt.core.classpathVariableInitializer". After resolution,
+ * a classpath variable entry may either correspond to a project or a library
+ * entry.
*
- *
A named classpath container identified by its container path.
- * A classpath container provides a way to indirectly reference a set of classpath entries through
- * a classpath entry of kind CPE_CONTAINER. Typically, a classpath container can
- * be used to describe a complex library composed of multiple JARs, projects or classpath variables,
- * considering also that containers can be mapped differently on each project. Several projects can
- * reference the same generic container path, but have each of them actually bound to a different
- * container object.
- * The container path is a formed by a first ID segment followed with extra segments,
- * which can be used as additional hints for resolving this container reference. If no container was ever
- * recorded for this container path onto this project (using setClasspathContainer,
- * then a ClasspathContainerInitializer will be activated if any was registered for this
- * container ID onto the extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
- * A classpath container entry can be resolved explicitly using JavaCore#getClasspathContainer
- * and the resulting container entries can contain any non-container entry. In particular, it may contain variable
- * entries, which in turn needs to be resolved before being directly used.
- * Also note that the container resolution APIs include an IJavaProject argument, so as to allow the same
- * container path to be interpreted in different ways for different projects.
+ *
A named classpath container identified by its container path. A
+ * classpath container provides a way to indirectly reference a set of classpath
+ * entries through a classpath entry of kind CPE_CONTAINER.
+ * Typically, a classpath container can be used to describe a complex library
+ * composed of multiple JARs, projects or classpath variables, considering also
+ * that containers can be mapped differently on each project. Several projects
+ * can reference the same generic container path, but have each of them actually
+ * bound to a different container object. The container path is a formed by a
+ * first ID segment followed with extra segments, which can be used as
+ * additional hints for resolving this container reference. If no container was
+ * ever recorded for this container path onto this project (using
+ * setClasspathContainer, then a
+ * ClasspathContainerInitializer will be activated if any was
+ * registered for this container ID onto the extension point
+ * "net.sourceforge.phpdt.core.classpathContainerInitializer". A classpath
+ * container entry can be resolved explicitly using
+ * JavaCore#getClasspathContainer and the resulting container
+ * entries can contain any non-container entry. In particular, it may contain
+ * variable entries, which in turn needs to be resolved before being directly
+ * used.
+ * Also note that the container resolution APIs include an IJavaProject
+ * argument, so as to allow the same container path to be interpreted in
+ * different ways for different projects.
*
*
- * The result of IJavaProject#getResolvedClasspath will have all entries of type
- * CPE_VARIABLE and CPE_CONTAINER resolved to a set of
- * CPE_SOURCE, CPE_LIBRARY or CPE_PROJECT
- * classpath entries.
+ * The result of IJavaProject#getResolvedClasspath will have all
+ * entries of type CPE_VARIABLE and CPE_CONTAINER
+ * resolved to a set of CPE_SOURCE, CPE_LIBRARY
+ * or CPE_PROJECT classpath entries.
*
- * Any classpath entry other than a source folder (kind CPE_SOURCE) can
- * be marked as being exported. Exported entries are automatically contributed to
- * dependent projects, along with the project's default output folder, which is
- * implicitly exported, and any auxiliary output folders specified on source
- * classpath entries. The project's output folder(s) are always listed first,
- * followed by the any exported entries.
+ * Any classpath entry other than a source folder (kind CPE_SOURCE)
+ * can be marked as being exported. Exported entries are automatically
+ * contributed to dependent projects, along with the project's default output
+ * folder, which is implicitly exported, and any auxiliary output folders
+ * specified on source classpath entries. The project's output folder(s) are
+ * always listed first, followed by the any exported entries.
*
- * This interface is not intended to be implemented by clients.
- * Classpath entries can be created via methods on JavaCore.
+ * This interface is not intended to be implemented by clients. Classpath
+ * entries can be created via methods on JavaCore.
*
- *
+ *
* @see JavaCore#newLibraryEntry
* @see JavaCore#newProjectEntry
* @see JavaCore#newSourceEntry
@@ -114,67 +125,67 @@ import org.eclipse.core.runtime.IPath;
public interface IClasspathEntry {
/**
- * Entry kind constant describing a classpath entry identifying a
- * library. A library is a folder or JAR containing package
- * fragments consisting of pre-compiled binaries.
+ * Entry kind constant describing a classpath entry identifying a library. A
+ * library is a folder or JAR containing package fragments consisting of
+ * pre-compiled binaries.
*/
int CPE_LIBRARY = 1;
/**
- * Entry kind constant describing a classpath entry identifying a
- * required project.
+ * Entry kind constant describing a classpath entry identifying a required
+ * project.
*/
int CPE_PROJECT = 2;
/**
- * Entry kind constant describing a classpath entry identifying a
- * folder containing package fragments with source code
- * to be compiled.
+ * Entry kind constant describing a classpath entry identifying a folder
+ * containing package fragments with source code to be compiled.
*/
int CPE_SOURCE = 3;
/**
- * Entry kind constant describing a classpath entry defined using
- * a path that begins with a classpath variable reference.
+ * Entry kind constant describing a classpath entry defined using a path
+ * that begins with a classpath variable reference.
*/
int CPE_VARIABLE = 4;
/**
- * Entry kind constant describing a classpath entry representing
- * a name classpath container.
+ * Entry kind constant describing a classpath entry representing a name
+ * classpath container.
*
* @since 2.0
*/
int CPE_CONTAINER = 5;
/**
- * Returns the kind of files found in the package fragments identified by this
- * classpath entry.
- *
+ * Returns the kind of files found in the package fragments identified by
+ * this classpath entry.
+ *
* @return IPackageFragmentRoot.K_SOURCE for files containing
- * source code, and IPackageFragmentRoot.K_BINARY for binary
- * class files.
- * There is no specified value for an entry denoting a variable (CPE_VARIABLE)
- * or a classpath container (CPE_CONTAINER).
+ * source code, and IPackageFragmentRoot.K_BINARY for
+ * binary class files. There is no specified value for an entry
+ * denoting a variable (CPE_VARIABLE) or a
+ * classpath container (CPE_CONTAINER).
*/
int getContentKind();
/**
* Returns the kind of this classpath entry.
- *
+ *
* @return one of:
- *
- *
CPE_SOURCE - this entry describes a source root in
- its project
- *
CPE_LIBRARY - this entry describes a folder or JAR
- containing binaries
- *
CPE_PROJECT - this entry describes another project
- *
- *
CPE_VARIABLE - this entry describes a project or library
- * indirectly via a classpath variable in the first segment of the path
- * *
+ *
+ *
CPE_SOURCE - this entry describes a source
+ * root in its project
+ *
CPE_LIBRARY - this entry describes a folder
+ * or JAR containing binaries
+ *
CPE_PROJECT - this entry describes another
+ * project
+ *
+ *
CPE_VARIABLE - this entry describes a project or
+ * library indirectly via a classpath variable in the first segment of the
+ * path *
*
CPE_CONTAINER - this entry describes set of entries
- * referenced indirectly via a classpath container
+ * referenced indirectly via a classpath container
*
*/
int getEntryKind();
@@ -186,9 +197,9 @@ public interface IClasspathEntry {
* Exclusion patterns allow specified portions of the resource tree rooted
* at this source entry's path to be filtered out. If no exclusion patterns
* are specified, this source entry includes all relevent files. Each path
- * specified must be a relative path, and will be interpreted relative
- * to this source entry's path. File patterns are case-sensitive. A file
- * matched by one or more of these patterns is excluded from the
+ * specified must be a relative path, and will be interpreted relative to
+ * this source entry's path. File patterns are case-sensitive. A file
+ * matched by one or more of these patterns is excluded from the
* corresponding package fragment root.
*
*
@@ -197,66 +208,61 @@ public interface IClasspathEntry {
*
*
* The pattern mechanism is similar to Ant's. Each pattern is represented as
- * a relative path. The path segments can be regular file or folder names or simple patterns
- * involving standard wildcard characters.
+ * a relative path. The path segments can be regular file or folder names or
+ * simple patterns involving standard wildcard characters.
*
*
- * '*' matches 0 or more characters within a segment. So
- * *.java matches .java, a.java
- * and Foo.java, but not Foo.properties
- * (does not end with .java).
+ * '*' matches 0 or more characters within a segment. So *.java
+ * matches .java, a.java and
+ * Foo.java, but not Foo.properties (does not
+ * end with .java).
*
*
- * '?' matches 1 character within a segment. So ?.java
- * matches a.java, A.java,
- * but not .java or xyz.java (neither have
- * just one character before .java).
+ * '?' matches 1 character within a segment. So ?.java
+ * matches a.java, A.java, but not
+ * .java or xyz.java (neither have just one
+ * character before .java).
*
*
* Combinations of *'s and ?'s are allowed.
*
*
- * The special pattern '**' matches zero or more segments. A path
- * like tests/ that ends in a trailing separator is interpreted
- * as tests/**, and would match all files under the
- * the folder named tests.
+ * The special pattern '**' matches zero or more segments. A path like
+ * tests/ that ends in a trailing separator is interpreted as
+ * tests/**, and would match all files under the the
+ * folder named tests.
*
*
* Examples:
*
- *
- * tests/** (or simply tests/)
- * matches all files under a root folder
- * named tests. This includes tests/Foo.java
- * and tests/com/example/Foo.java, but not
+ *
tests/** (or simply tests/)
+ * matches all files under a root folder named tests. This
+ * includes tests/Foo.java and
+ * tests/com/example/Foo.java, but not
* com/example/tests/Foo.java (not under a root folder named
- * tests).
- *
- *
- * tests/* matches all files directly below a root
- * folder named tests. This includes tests/Foo.java
- * and tests/FooHelp.java
- * but not tests/com/example/Foo.java (not directly under
- * a folder named tests) or
- * com/Foo.java (not under a folder named tests).
- *
- *
- * **/tests/** matches all files under any
- * folder named tests. This includes tests/Foo.java,
- * com/examples/tests/Foo.java, and
- * com/examples/tests/unit/Foo.java, but not
+ * tests).
+ *
tests/* matches all files directly below a root
+ * folder named tests. This includes
+ * tests/Foo.java and tests/FooHelp.java but
+ * not tests/com/example/Foo.java (not directly under a
+ * folder named tests) or com/Foo.java (not
+ * under a folder named tests).
+ *
**/tests/** matches all files under
+ * any folder named tests. This includes
+ * tests/Foo.java, com/examples/tests/Foo.java,
+ * and com/examples/tests/unit/Foo.java, but not
* com/example/Foo.java (not under a folder named
- * tests).
- *
+ * tests).
*
*
*
- * @return the possibly empty list of resource exclusion patterns
- * associated with this source entry, and null for other
- * kinds of classpath entries
+ * @return the possibly empty list of resource exclusion patterns associated
+ * with this source entry, and null for other kinds
+ * of classpath entries
* @since 2.1
*/
IPath[] getExclusionPatterns();
+
/**
* Returns the set of patterns used to explicitly define resources to be
* included with this source entry.
@@ -282,75 +288,74 @@ public interface IClasspathEntry {
*
* Examples:
*
- *
- * The inclusion pattern src/** by itself includes all
- * files under a root folder named src.
- *
- *
- * The inclusion patterns src/** and
+ *
The inclusion pattern src/** by itself
+ * includes all files under a root folder named src.
+ *
The inclusion patterns src/** and
* tests/** includes all files under the root folders
- * named src and tests.
- *
- *
- * The inclusion pattern src/** together with the
- * exclusion pattern src/**/Foo.java includes all
- * files under a root folder named src except for ones
- * named Foo.java.
- *
+ * named src and tests.
+ *
The inclusion pattern src/** together with
+ * the exclusion pattern src/**/Foo.java includes all
+ * files under a root folder named src except for ones named
+ * Foo.java.
*
*
*
- * @return the possibly empty list of resource inclusion patterns
- * associated with this source entry, and null for other
- * kinds of classpath entries
+ * @return the possibly empty list of resource inclusion patterns associated
+ * with this source entry, and null for other kinds
+ * of classpath entries
* @since 3.0
*/
IPath[] getInclusionPatterns();
-
+
/**
- * Returns the full path to the specific location where the builder writes
- * .class files generated for this source entry
- * (entry kind CPE_SOURCE).
+ * Returns the full path to the specific location where the builder writes
+ * .class files generated for this source entry (entry kind
+ * CPE_SOURCE).
+ *
+ * Source entries can optionally be associated with a specific output
+ * location. If none is provided, the source entry will be implicitly
+ * associated with its project default output location (see
+ * IJavaProject#getOutputLocation).
+ *
*
- * Source entries can optionally be associated with a specific output location.
- * If none is provided, the source entry will be implicitly associated with its project
- * default output location (see IJavaProject#getOutputLocation).
- *
- * NOTE: A specific output location cannot coincidate with another source/library entry.
+ * NOTE: A specific output location cannot coincidate with another
+ * source/library entry.
*
*
- * @return the full path to the specific location where the builder writes
- * .class files for this source entry, or null
- * if using default output folder
+ * @return the full path to the specific location where the builder writes
+ * .class files for this source entry, or
+ * null if using default output folder
* @since 2.1
*/
IPath getOutputLocation();
-
+
/**
* Returns the path of this classpath entry.
- *
- * The meaning of the path of a classpath entry depends on its entry kind:
- *
Source code in the current project (CPE_SOURCE) -
- * The path associated with this entry is the absolute path to the root folder.
- *
A binary library in the current project (CPE_LIBRARY) - the path
- * associated with this entry is the absolute path to the JAR (or root folder), and
- * in case it refers to an external JAR, then there is no associated resource in
- * the workbench.
- *
A required project (CPE_PROJECT) - the path of the entry denotes the
- * path to the corresponding project resource.
- *
A variable entry (CPE_VARIABLE) - the first segment of the path
- * is the name of a classpath variable. If this classpath variable
- * is bound to the path P, the path of the corresponding classpath entry
- * is computed by appending to P the segments of the returned
- * path without the variable.
- *
A container entry (CPE_CONTAINER) - the path of the entry
- * is the name of the classpath container, which can be bound indirectly to a set of classpath
- * entries after resolution. The containerPath is a formed by a first ID segment followed with
- * extra segments that can be used as additional hints for resolving this container
- * reference (also see IClasspathContainer).
- *
+ *
+ * The meaning of the path of a classpath entry depends on its entry kind:
+ *
+ *
Source code in the current project (CPE_SOURCE) -
+ * The path associated with this entry is the absolute path to the root
+ * folder.
+ *
A binary library in the current project (CPE_LIBRARY) -
+ * the path associated with this entry is the absolute path to the JAR (or
+ * root folder), and in case it refers to an external JAR, then there is no
+ * associated resource in the workbench.
+ *
A required project (CPE_PROJECT) - the path of the
+ * entry denotes the path to the corresponding project resource.
+ *
A variable entry (CPE_VARIABLE) - the first segment
+ * of the path is the name of a classpath variable. If this classpath
+ * variable is bound to the path P, the path of the corresponding
+ * classpath entry is computed by appending to P the segments of
+ * the returned path without the variable.
+ *
A container entry (CPE_CONTAINER) - the path of the
+ * entry is the name of the classpath container, which can be bound
+ * indirectly to a set of classpath entries after resolution. The
+ * containerPath is a formed by a first ID segment followed with extra
+ * segments that can be used as additional hints for resolving this
+ * container reference (also see IClasspathContainer).
*
- *
+ *
* @return the path of this classpath entry
*/
IPath getPath();
@@ -361,59 +366,67 @@ public interface IClasspathEntry {
* source attachment.
*
* Only library and variable classpath entries may have source attachments.
- * For library classpath entries, the result path (if present) locates a source
- * archive or folder. This archive or folder can be located in a project of the
- * workspace or outside thr workspace. For variable classpath entries, the
- * result path (if present) has an analogous form and meaning as the
- * variable path, namely the first segment is the name of a classpath variable.
+ * For library classpath entries, the result path (if present) locates a
+ * source archive or folder. This archive or folder can be located in a
+ * project of the workspace or outside thr workspace. For variable classpath
+ * entries, the result path (if present) has an analogous form and meaning
+ * as the variable path, namely the first segment is the name of a classpath
+ * variable.
*
- *
- * @return the path to the source archive or folder, or null if none
+ *
+ * @return the path to the source archive or folder, or null
+ * if none
*/
IPath getSourceAttachmentPath();
/**
- * Returns the path within the source archive or folder where package fragments
- * are located. An empty path indicates that packages are located at
- * the root of the source archive or folder. Returns a non-null value
- * if and only if getSourceAttachmentPath returns
- * a non-null value.
- *
- * @return the path within the source archive or folder, or null if
- * not applicable
+ * Returns the path within the source archive or folder where package
+ * fragments are located. An empty path indicates that packages are located
+ * at the root of the source archive or folder. Returns a non-null
+ * value if and only if getSourceAttachmentPath returns a
+ * non-null value.
+ *
+ * @return the path within the source archive or folder, or
+ * null if not applicable
*/
IPath getSourceAttachmentRootPath();
-
+
/**
- * Returns whether this entry is exported to dependent projects.
- * Always returns false for source entries (kind
+ * Returns whether this entry is exported to dependent projects. Always
+ * returns false for source entries (kind
* CPE_SOURCE), which cannot be exported.
*
- * @return true if exported, and false otherwise
+ * @return true if exported, and false
+ * otherwise
* @since 2.0
*/
boolean isExported();
-
+
/**
- * This is a helper method, which returns the resolved classpath entry denoted
- * by an entry (if it is a variable entry). It is obtained by resolving the variable
- * reference in the first segment. Returns null if unable to resolve using
- * the following algorithm:
+ * This is a helper method, which returns the resolved classpath entry
+ * denoted by an entry (if it is a variable entry). It is obtained by
+ * resolving the variable reference in the first segment. Returns null
+ * if unable to resolve using the following algorithm:
*
*
if variable segment cannot be resolved, returns null
- *
finds a project, JAR or binary folder in the workspace at the resolved path location
- *
if none finds an external JAR file or folder outside the workspace at the resolved path location
+ *
finds a project, JAR or binary folder in the workspace at the
+ * resolved path location
+ *
if none finds an external JAR file or folder outside the workspace
+ * at the resolved path location
*
if none returns null
*
*
- * Variable source attachment is also resolved and recorded in the resulting classpath entry.
+ * Variable source attachment is also resolved and recorded in the resulting
+ * classpath entry.
*
+ *
* @return the resolved library or project classpath entry, or null
- * if the given path could not be resolved to a classpath entry
- *
- * Note that this deprecated API doesn't handle CPE_CONTAINER entries.
+ * if the given path could not be resolved to a classpath entry
+ *
+ * Note that this deprecated API doesn't handle CPE_CONTAINER
+ * entries.
*
* @deprecated - use JavaCore.getResolvedClasspathEntry(...)
*/
- IClasspathEntry getResolvedEntry();
+ IClasspathEntry getResolvedEntry();
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeAssist.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeAssist.java
index a0d7654..624ad4d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeAssist.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeAssist.java
@@ -20,104 +20,138 @@ package net.sourceforge.phpdt.core;
public interface ICodeAssist {
/**
- * Performs code completion at the given offset position in this compilation unit,
- * reporting results to the given completion requestor. The offset
- * is the 0-based index of the character, after which code assist is desired.
- * An offset of -1 indicates to code assist at the beginning of this
- * compilation unit.
- *
- * @param offset the given offset position
- * @param requestor the given completion requestor
- *
- * @exception JavaModelException if code assist could not be performed. Reasons include:
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
The position specified is < -1 or is greater than this compilation unit's
- * source length (INDEX_OUT_OF_BOUNDS)
- *
- *
- * @exception IllegalArgumentException if requestor is null
+ * Performs code completion at the given offset position in this compilation
+ * unit, reporting results to the given completion requestor. The
+ * offset is the 0-based index of the character, after which
+ * code assist is desired. An offset of -1 indicates to code
+ * assist at the beginning of this compilation unit.
+ *
+ * @param offset
+ * the given offset position
+ * @param requestor
+ * the given completion requestor
+ *
+ * @exception JavaModelException
+ * if code assist could not be performed. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
The position specified is < -1 or is greater than
+ * this compilation unit's source length
+ * (INDEX_OUT_OF_BOUNDS)
+ *
+ *
+ * @exception IllegalArgumentException
+ * if requestor is null
* @deprecated Use {@link #codeComplete(int, ICompletionRequestor)} instead.
*/
void codeComplete(int offset, ICodeCompletionRequestor requestor)
- throws JavaModelException;
+ throws JavaModelException;
+
/**
- * Performs code completion at the given offset position in this compilation unit,
- * reporting results to the given completion requestor. The offset
- * is the 0-based index of the character, after which code assist is desired.
- * An offset of -1 indicates to code assist at the beginning of this
- * compilation unit.
- *
- * @param offset the given offset position
- * @param requestor the given completion requestor
- * @exception JavaModelException if code assist could not be performed. Reasons include:
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
The position specified is < -1 or is greater than this compilation unit's
- * source length (INDEX_OUT_OF_BOUNDS)
- *
- *
- * @exception IllegalArgumentException if requestor is null
+ * Performs code completion at the given offset position in this compilation
+ * unit, reporting results to the given completion requestor. The
+ * offset is the 0-based index of the character, after which
+ * code assist is desired. An offset of -1 indicates to code
+ * assist at the beginning of this compilation unit.
+ *
+ * @param offset
+ * the given offset position
+ * @param requestor
+ * the given completion requestor
+ * @exception JavaModelException
+ * if code assist could not be performed. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
The position specified is < -1 or is greater than
+ * this compilation unit's source length
+ * (INDEX_OUT_OF_BOUNDS)
+ *
+ *
+ * @exception IllegalArgumentException
+ * if requestor is null
* @since 2.0
- */
- // TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link #codeComplete(int, CompletionRequestor)} instead.
+ */
+ // TODO (jerome - once CompletionRequestor is working) @ deprecated Use
+ // {@link #codeComplete(int, CompletionRequestor)} instead.
void codeComplete(int offset, ICompletionRequestor requestor)
- throws JavaModelException;
-
+ throws JavaModelException;
+
/**
* DO NOT USE: This API element was added in anticipation of J2SE
* 1.5 support, which is planned for the next release of Eclipse after 3.0.
* It is currently unimplemented, and the API may change slightly before
* reaching its final form.
*
- * Performs code completion at the given offset position in this compilation unit,
- * reporting results to the given completion requestor. The offset
- * is the 0-based index of the character, after which code assist is desired.
- * An offset of -1 indicates to code assist at the beginning of this
- * compilation unit.
+ * Performs code completion at the given offset position in this compilation
+ * unit, reporting results to the given completion requestor. The
+ * offset is the 0-based index of the character, after which
+ * code assist is desired. An offset of -1 indicates to code
+ * assist at the beginning of this compilation unit.
*
- *
- * @param offset the given offset position
- * @param requestor the given completion requestor
- * @exception JavaModelException if code assist could not be performed. Reasons include:
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
The position specified is < -1 or is greater than this compilation unit's
- * source length (INDEX_OUT_OF_BOUNDS)
- *
- *
- * @exception IllegalArgumentException if requestor is null
+ *
+ * @param offset
+ * the given offset position
+ * @param requestor
+ * the given completion requestor
+ * @exception JavaModelException
+ * if code assist could not be performed. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
The position specified is < -1 or is greater than
+ * this compilation unit's source length
+ * (INDEX_OUT_OF_BOUNDS)
+ *
+ *
+ * @exception IllegalArgumentException
+ * if requestor is null
* @since 3.0
- */
+ */
void codeComplete(int offset, CompletionRequestor requestor)
- throws JavaModelException;
-
+ throws JavaModelException;
+
/**
- * Performs code completion at the given offset position in this compilation unit,
- * reporting results to the given completion requestor. The offset
- * is the 0-based index of the character, after which code assist is desired.
- * An offset of -1 indicates to code assist at the beginning of this
- * compilation unit.
- * It considers types in the working copies with the given owner first. In other words,
- * the owner's working copies will take precedence over their original compilation units
- * in the workspace.
+ * Performs code completion at the given offset position in this compilation
+ * unit, reporting results to the given completion requestor. The
+ * offset is the 0-based index of the character, after which
+ * code assist is desired. An offset of -1 indicates to code
+ * assist at the beginning of this compilation unit. It considers types in
+ * the working copies with the given owner first. In other words, the
+ * owner's working copies will take precedence over their original
+ * compilation units in the workspace.
*
- * Note that if a working copy is empty, it will be as if the original compilation
- * unit had been deleted.
+ * Note that if a working copy is empty, it will be as if the original
+ * compilation unit had been deleted.
*
- *
- * @param offset the given offset position
- * @param requestor the given completion requestor
- * @param owner the owner of working copies that take precedence over their original compilation units
- * @exception JavaModelException if code assist could not be performed. Reasons include:
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
The position specified is < -1 or is greater than this compilation unit's
- * source length (INDEX_OUT_OF_BOUNDS)
- *
- *
- * @exception IllegalArgumentException if requestor is null
+ *
+ * @param offset
+ * the given offset position
+ * @param requestor
+ * the given completion requestor
+ * @param owner
+ * the owner of working copies that take precedence over their
+ * original compilation units
+ * @exception JavaModelException
+ * if code assist could not be performed. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
The position specified is < -1 or is greater than
+ * this compilation unit's source length
+ * (INDEX_OUT_OF_BOUNDS)
+ *
+ *
+ * @exception IllegalArgumentException
+ * if requestor is null
* @since 3.0
*/
- // TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link #codeComplete(int, CompletionRequestor, WorkingCopyOwner)} instead.
- void codeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner owner)
- throws JavaModelException;
+ // TODO (jerome - once CompletionRequestor is working) @ deprecated Use
+ // {@link #codeComplete(int, CompletionRequestor, WorkingCopyOwner)}
+ // instead.
+ void codeComplete(int offset, ICompletionRequestor requestor,
+ WorkingCopyOwner owner) throws JavaModelException;
/**
* DO NOT USE: This API element was added in anticipation of J2SE
@@ -125,74 +159,96 @@ public interface ICodeAssist {
* It is currently unimplemented, and the API may change slightly before
* reaching its final form.
*
- * Performs code completion at the given offset position in this compilation unit,
- * reporting results to the given completion requestor. The offset
- * is the 0-based index of the character, after which code assist is desired.
- * An offset of -1 indicates to code assist at the beginning of this
- * compilation unit.
- * It considers types in the working copies with the given owner first. In other words,
- * the owner's working copies will take precedence over their original compilation units
- * in the workspace.
+ * Performs code completion at the given offset position in this compilation
+ * unit, reporting results to the given completion requestor. The
+ * offset is the 0-based index of the character, after which
+ * code assist is desired. An offset of -1 indicates to code
+ * assist at the beginning of this compilation unit. It considers types in
+ * the working copies with the given owner first. In other words, the
+ * owner's working copies will take precedence over their original
+ * compilation units in the workspace.
*
- * Note that if a working copy is empty, it will be as if the original compilation
- * unit had been deleted.
+ * Note that if a working copy is empty, it will be as if the original
+ * compilation unit had been deleted.
*
- *
- * @param offset the given offset position
- * @param requestor the given completion requestor
- * @param owner the owner of working copies that take precedence over their original compilation units
- * @exception JavaModelException if code assist could not be performed. Reasons include:
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
The position specified is < -1 or is greater than this compilation unit's
- * source length (INDEX_OUT_OF_BOUNDS)
- *
- *
- * @exception IllegalArgumentException if requestor is null
+ *
+ * @param offset
+ * the given offset position
+ * @param requestor
+ * the given completion requestor
+ * @param owner
+ * the owner of working copies that take precedence over their
+ * original compilation units
+ * @exception JavaModelException
+ * if code assist could not be performed. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
The position specified is < -1 or is greater than
+ * this compilation unit's source length
+ * (INDEX_OUT_OF_BOUNDS)
+ *
+ *
+ * @exception IllegalArgumentException
+ * if requestor is null
* @since 3.0
*/
- void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner owner)
- throws JavaModelException;
+ void codeComplete(int offset, CompletionRequestor requestor,
+ WorkingCopyOwner owner) throws JavaModelException;
/**
- * Returns the Java elements correspondiing to the given selected text in this compilation unit.
- * The offset is the 0-based index of the first selected character.
- * The length is the number of selected characters.
+ * Returns the Java elements correspondiing to the given selected text in
+ * this compilation unit. The offset is the 0-based index of
+ * the first selected character. The length is the number of
+ * selected characters.
*
- * @param offset the given offset position
- * @param length the number of selected characters
+ * @param offset
+ * the given offset position
+ * @param length
+ * the number of selected characters
* @return the Java elements correspondiing to the given selected text
- *
- * @exception JavaModelException if code resolve could not be performed. Reasons include:
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
The range specified is not within this element's
- * source range (INDEX_OUT_OF_BOUNDS)
- *
- *
+ *
+ * @exception JavaModelException
+ * if code resolve could not be performed. Reasons include:
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
The range specified is not within this element's
+ * source range (INDEX_OUT_OF_BOUNDS)
+ *
+ *
*/
IJavaElement[] codeSelect(int offset, int length) throws JavaModelException;
+
/**
- * Returns the Java elements correspondiing to the given selected text in this compilation unit.
- * The offset is the 0-based index of the first selected character.
- * The length is the number of selected characters.
- * It considers types in the working copies with the given owner first. In other words,
- * the owner's working copies will take precedence over their original compilation units
- * in the workspace.
+ * Returns the Java elements correspondiing to the given selected text in
+ * this compilation unit. The offset is the 0-based index of
+ * the first selected character. The length is the number of
+ * selected characters. It considers types in the working copies with the
+ * given owner first. In other words, the owner's working copies will take
+ * precedence over their original compilation units in the workspace.
*
- * Note that if a working copy is empty, it will be as if the original compilation
- * unit had been deleted.
+ * Note that if a working copy is empty, it will be as if the original
+ * compilation unit had been deleted.
*
*
- * @param offset the given offset position
- * @param length the number of selected characters
- * @param owner the owner of working copies that take precedence over their original compilation units
+ * @param offset
+ * the given offset position
+ * @param length
+ * the number of selected characters
+ * @param owner
+ * the owner of working copies that take precedence over their
+ * original compilation units
* @return the Java elements correspondiing to the given selected text
- *
- * @exception JavaModelException if code resolve could not be performed. Reasons include:
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
The range specified is not within this element's
- * source range (INDEX_OUT_OF_BOUNDS)
- *
+ *
+ * @exception JavaModelException
+ * if code resolve could not be performed. Reasons include:
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
The range specified is not within this element's
+ * source range (INDEX_OUT_OF_BOUNDS)
+ *
* @since 3.0
*/
- IJavaElement[] codeSelect(int offset, int length, WorkingCopyOwner owner) throws JavaModelException;
+ IJavaElement[] codeSelect(int offset, int length, WorkingCopyOwner owner)
+ throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeCompletionRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeCompletionRequestor.java
index 26a923f..ba7d375 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeCompletionRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeCompletionRequestor.java
@@ -13,251 +13,301 @@ package net.sourceforge.phpdt.core;
import org.eclipse.core.resources.IMarker;
/**
- * A completion requestor accepts results as they are computed and is aware
- * of source positions to complete the various different results.
+ * A completion requestor accepts results as they are computed and is aware of
+ * source positions to complete the various different results.
*
* This interface may be implemented by clients.
*
- *
+ *
* @see ICodeAssist
* @deprecated Use {@link CompletionRequestor} instead.
*/
public interface ICodeCompletionRequestor {
-/**
- * Code assist notification of a class completion.
- *
- * @param packageName Declaring package name of the class.
- * @param className Name of the class.
- * @param completionName The completion for the class.
- * Can include ';' for imported classes.
- * @param modifiers The modifiers of the class.
- * @param completionStart The start position of insertion of the name of the class.
- * @param completionEnd The end position of insertion of the name of the class.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptClass(
- char[] packageName,
- char[] className,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd);
-/**
- * Code assist notification of a compilation error detected during completion.
- * @param marker Only problems which are categorized as errors are notified to the requestor,
- * warnings are silently ignored.
- * In case an error got signaled, no other completions might be available,
- * therefore the problem message should be presented to the user.
- * The source positions of the problem are related to the source where it was
- * detected (might be in another compilation unit, if it was indirectly requested
- * during the code assist process).
- * Note: the problem knows its originating file name.
- */
-void acceptError(IMarker marker);
-/**
- * Code assist notification of a field completion.
- *
- * @param declaringTypePackageName Name of the package in which the type that contains this field is declared.
- *
- * @param declaringTypeName Name of the type declaring this new field.
- *
- * @param name Name of the field.
- *
- * @param typePackageName Name of the package in which the type of this field is declared.
- *
- * @param typeName Name of the type of this field.
- *
- * @param completionName The completion for the field.
- *
- * @param modifiers The modifiers of this field.
- *
- * @param completionStart The start position of insertion of the name of this field.
- *
- * @param completionEnd The end position of insertion of the name of this field.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Base types are in the form "int" or "boolean".
- * Array types are in the qualified form "M[]" or "int[]".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptField(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] name,
- char[] typePackageName,
- char[] typeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd);
-/**
- * Code assist notification of an interface completion.
- *
- * @param packageName Declaring package name of the interface.
- * @param interfaceName Name of the interface.
- * @param completionName The completion for the interface.
- * Can include ';' for imported interfaces.
- * @param modifiers The modifiers of the interface.
- * @param completionStart The start position of insertion of the name of the interface.
- * @param completionEnd The end position of insertion of the name of the interface.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptInterface(
- char[] packageName,
- char[] interfaceName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd);
-/**
- * Code assist notification of a keyword completion.
- *
- * @param keywordName The keyword source.
- * @param completionStart The start position of insertion of the name of this keyword.
- * @param completionEnd The end position of insertion of the name of this keyword.
- */
-void acceptKeyword(char[] keywordName, int completionStart, int completionEnd);
-/**
- * Code assist notification of a label completion.
- *
- * @param labelName The label source.
- * @param completionStart The start position of insertion of the name of this label.
- * @param completionEnd The end position of insertion of the name of this label.
- */
-void acceptLabel(char[] labelName, int completionStart, int completionEnd);
-/**
- * Code assist notification of a local variable completion.
- *
- * @param name Name of the new local variable.
- *
- * @param typePackageName Name of the package in which the type of this new local variable is declared.
- *
- * @param typeName Name of the type of this new local variable.
- *
- * @param modifiers The modifiers of this new local variable.
- *
- * @param completionStart The start position of insertion of the name of this new local variable.
- *
- * @param completionEnd The end position of insertion of the name of this new local variable.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Base types are in the form "int" or "boolean".
- * Array types are in the qualified form "M[]" or "int[]".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptLocalVariable(
- char[] name,
- char[] typePackageName,
- char[] typeName,
- int modifiers,
- int completionStart,
- int completionEnd);
-/**
- * Code assist notification of a method completion.
- *
- * @param declaringTypePackageName Name of the package in which the type that contains this new method is declared.
- *
- * @param declaringTypeName Name of the type declaring this new method.
- *
- * @param selector Name of the new method.
- *
- * @param parameterPackageNames Names of the packages in which the parameter types are declared.
- * Should contain as many elements as parameterTypeNames.
- *
- * @param parameterTypeNames Names of the parameters types.
- * Should contain as many elements as parameterPackageNames.
- *
- * @param returnTypePackageName Name of the package in which the return type is declared.
- *
- * @param returnTypeName Name of the return type of this new method, should be null for a constructor.
- *
- * @param completionName The completion for the method.
- * Can include zero, one or two brackets. If the closing bracket is included, then the cursor should be placed before it.
- *
- * @param modifiers The modifiers of this new method.
- *
- * @param completionStart The start position of insertion of the name of this new method.
- *
- * @param completionEnd The end position of insertion of the name of this new method.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Base types are in the form "int" or "boolean".
- * Array types are in the qualified form "M[]" or "int[]".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- *
- * NOTE: parameter names can be retrieved from the source model after the user selects a specific method.
- */
-void acceptMethod(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] selector,
- char[][] parameterPackageNames,
- char[][] parameterTypeNames,
- char[] returnTypePackageName,
- char[] returnTypeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd);
-/**
- * Code assist notification of a modifier completion.
- *
- * @param modifierName The new modifier.
- * @param completionStart The start position of insertion of the name of this new modifier.
- * @param completionEnd The end position of insertion of the name of this new modifier.
- */
-void acceptModifier(char[] modifierName, int completionStart, int completionEnd);
-/**
- * Code assist notification of a package completion.
- *
- * @param packageName The package name.
- * @param completionName The completion for the package.
- * Can include '.*;' for imports.
- * @param completionStart The start position of insertion of the name of this new package.
- * @param completionEnd The end position of insertion of the name of this new package.
- *
- * NOTE - All package names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * The default package is represented by an empty array.
- */
-void acceptPackage(
- char[] packageName,
- char[] completionName,
- int completionStart,
- int completionEnd);
-/**
- * Code assist notification of a type completion.
- *
- * @param packageName Declaring package name of the type.
- * @param typeName Name of the type.
- * @param completionName The completion for the type.
- * Can include ';' for imported types.
- * @param completionStart The start position of insertion of the name of the type.
- * @param completionEnd The end position of insertion of the name of the type.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptType(
- char[] packageName,
- char[] typeName,
- char[] completionName,
- int completionStart,
- int completionEnd);
+ /**
+ * Code assist notification of a class completion.
+ *
+ * @param packageName
+ * Declaring package name of the class.
+ * @param className
+ * Name of the class.
+ * @param completionName
+ * The completion for the class. Can include ';' for imported
+ * classes.
+ * @param modifiers
+ * The modifiers of the class.
+ * @param completionStart
+ * The start position of insertion of the name of the class.
+ * @param completionEnd
+ * The end position of insertion of the name of the class.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Nested type names are in the
+ * qualified form "A.M". The default package is represented by an empty
+ * array.
+ */
+ void acceptClass(char[] packageName, char[] className,
+ char[] completionName, int modifiers, int completionStart,
+ int completionEnd);
+
+ /**
+ * Code assist notification of a compilation error detected during
+ * completion.
+ *
+ * @param marker
+ * Only problems which are categorized as errors are notified to
+ * the requestor, warnings are silently ignored. In case an error
+ * got signaled, no other completions might be available,
+ * therefore the problem message should be presented to the user.
+ * The source positions of the problem are related to the source
+ * where it was detected (might be in another compilation unit,
+ * if it was indirectly requested during the code assist
+ * process). Note: the problem knows its originating file name.
+ */
+ void acceptError(IMarker marker);
+
+ /**
+ * Code assist notification of a field completion.
+ *
+ * @param declaringTypePackageName
+ * Name of the package in which the type that contains this field
+ * is declared.
+ *
+ * @param declaringTypeName
+ * Name of the type declaring this new field.
+ *
+ * @param name
+ * Name of the field.
+ *
+ * @param typePackageName
+ * Name of the package in which the type of this field is
+ * declared.
+ *
+ * @param typeName
+ * Name of the type of this field.
+ *
+ * @param completionName
+ * The completion for the field.
+ *
+ * @param modifiers
+ * The modifiers of this field.
+ *
+ * @param completionStart
+ * The start position of insertion of the name of this field.
+ *
+ * @param completionEnd
+ * The end position of insertion of the name of this field.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Base types are in the form "int"
+ * or "boolean". Array types are in the qualified form "M[]" or "int[]".
+ * Nested type names are in the qualified form "A.M". The default package is
+ * represented by an empty array.
+ */
+ void acceptField(char[] declaringTypePackageName, char[] declaringTypeName,
+ char[] name, char[] typePackageName, char[] typeName,
+ char[] completionName, int modifiers, int completionStart,
+ int completionEnd);
+
+ /**
+ * Code assist notification of an interface completion.
+ *
+ * @param packageName
+ * Declaring package name of the interface.
+ * @param interfaceName
+ * Name of the interface.
+ * @param completionName
+ * The completion for the interface. Can include ';' for imported
+ * interfaces.
+ * @param modifiers
+ * The modifiers of the interface.
+ * @param completionStart
+ * The start position of insertion of the name of the interface.
+ * @param completionEnd
+ * The end position of insertion of the name of the interface.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Nested type names are in the
+ * qualified form "A.M". The default package is represented by an empty
+ * array.
+ */
+ void acceptInterface(char[] packageName, char[] interfaceName,
+ char[] completionName, int modifiers, int completionStart,
+ int completionEnd);
+
+ /**
+ * Code assist notification of a keyword completion.
+ *
+ * @param keywordName
+ * The keyword source.
+ * @param completionStart
+ * The start position of insertion of the name of this keyword.
+ * @param completionEnd
+ * The end position of insertion of the name of this keyword.
+ */
+ void acceptKeyword(char[] keywordName, int completionStart,
+ int completionEnd);
+
+ /**
+ * Code assist notification of a label completion.
+ *
+ * @param labelName
+ * The label source.
+ * @param completionStart
+ * The start position of insertion of the name of this label.
+ * @param completionEnd
+ * The end position of insertion of the name of this label.
+ */
+ void acceptLabel(char[] labelName, int completionStart, int completionEnd);
+
+ /**
+ * Code assist notification of a local variable completion.
+ *
+ * @param name
+ * Name of the new local variable.
+ *
+ * @param typePackageName
+ * Name of the package in which the type of this new local
+ * variable is declared.
+ *
+ * @param typeName
+ * Name of the type of this new local variable.
+ *
+ * @param modifiers
+ * The modifiers of this new local variable.
+ *
+ * @param completionStart
+ * The start position of insertion of the name of this new local
+ * variable.
+ *
+ * @param completionEnd
+ * The end position of insertion of the name of this new local
+ * variable.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Base types are in the form "int"
+ * or "boolean". Array types are in the qualified form "M[]" or "int[]".
+ * Nested type names are in the qualified form "A.M". The default package is
+ * represented by an empty array.
+ */
+ void acceptLocalVariable(char[] name, char[] typePackageName,
+ char[] typeName, int modifiers, int completionStart,
+ int completionEnd);
+
+ /**
+ * Code assist notification of a method completion.
+ *
+ * @param declaringTypePackageName
+ * Name of the package in which the type that contains this new
+ * method is declared.
+ *
+ * @param declaringTypeName
+ * Name of the type declaring this new method.
+ *
+ * @param selector
+ * Name of the new method.
+ *
+ * @param parameterPackageNames
+ * Names of the packages in which the parameter types are
+ * declared. Should contain as many elements as
+ * parameterTypeNames.
+ *
+ * @param parameterTypeNames
+ * Names of the parameters types. Should contain as many elements
+ * as parameterPackageNames.
+ *
+ * @param returnTypePackageName
+ * Name of the package in which the return type is declared.
+ *
+ * @param returnTypeName
+ * Name of the return type of this new method, should be
+ * null for a constructor.
+ *
+ * @param completionName
+ * The completion for the method. Can include zero, one or two
+ * brackets. If the closing bracket is included, then the cursor
+ * should be placed before it.
+ *
+ * @param modifiers
+ * The modifiers of this new method.
+ *
+ * @param completionStart
+ * The start position of insertion of the name of this new
+ * method.
+ *
+ * @param completionEnd
+ * The end position of insertion of the name of this new method.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Base types are in the form "int"
+ * or "boolean". Array types are in the qualified form "M[]" or "int[]".
+ * Nested type names are in the qualified form "A.M". The default package is
+ * represented by an empty array.
+ *
+ * NOTE: parameter names can be retrieved from the source model after the
+ * user selects a specific method.
+ */
+ void acceptMethod(char[] declaringTypePackageName,
+ char[] declaringTypeName, char[] selector,
+ char[][] parameterPackageNames, char[][] parameterTypeNames,
+ char[] returnTypePackageName, char[] returnTypeName,
+ char[] completionName, int modifiers, int completionStart,
+ int completionEnd);
+
+ /**
+ * Code assist notification of a modifier completion.
+ *
+ * @param modifierName
+ * The new modifier.
+ * @param completionStart
+ * The start position of insertion of the name of this new
+ * modifier.
+ * @param completionEnd
+ * The end position of insertion of the name of this new
+ * modifier.
+ */
+ void acceptModifier(char[] modifierName, int completionStart,
+ int completionEnd);
+
+ /**
+ * Code assist notification of a package completion.
+ *
+ * @param packageName
+ * The package name.
+ * @param completionName
+ * The completion for the package. Can include '.*;' for imports.
+ * @param completionStart
+ * The start position of insertion of the name of this new
+ * package.
+ * @param completionEnd
+ * The end position of insertion of the name of this new package.
+ *
+ * NOTE - All package names are presented in their readable form: Package
+ * names are in the form "a.b.c". The default package is represented by an
+ * empty array.
+ */
+ void acceptPackage(char[] packageName, char[] completionName,
+ int completionStart, int completionEnd);
+
+ /**
+ * Code assist notification of a type completion.
+ *
+ * @param packageName
+ * Declaring package name of the type.
+ * @param typeName
+ * Name of the type.
+ * @param completionName
+ * The completion for the type. Can include ';' for imported
+ * types.
+ * @param completionStart
+ * The start position of insertion of the name of the type.
+ * @param completionEnd
+ * The end position of insertion of the name of the type.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Nested type names are in the
+ * qualified form "A.M". The default package is represented by an empty
+ * array.
+ */
+ void acceptType(char[] packageName, char[] typeName, char[] completionName,
+ int completionStart, int completionEnd);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeFormatter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeFormatter.java
index d960dc3..f9c08f9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeFormatter.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICodeFormatter.java
@@ -13,9 +13,10 @@ package net.sourceforge.phpdt.core;
import java.util.Map;
/**
- * Specification for a generic source code formatter. Client plug-ins can contribute
- * an implementation for an ICodeFormatter, through the extension point "org.phpeclipse.phpdt.core.codeFormatter".
- * In case none is found, a default formatter can be provided through the ToolFactory.
+ * Specification for a generic source code formatter. Client plug-ins can
+ * contribute an implementation for an ICodeFormatter, through the extension
+ * point "org.phpeclipse.phpdt.core.codeFormatter". In case none is found, a
+ * default formatter can be provided through the ToolFactory.
*
* @see ToolFactory#createCodeFormatter()
* @see ToolFactory#createDefaultCodeFormatter(Map options)
@@ -23,23 +24,29 @@ import java.util.Map;
*/
public interface ICodeFormatter {
- /**
- * Formats the String sourceString,
- * and returns a string containing the formatted version.
+ /**
+ * Formats the String sourceString, and returns a string
+ * containing the formatted version.
*
- * @param string the string to format
- * @param indentationLevel the initial indentation level, used
- * to shift left/right the entire source fragment. An initial indentation
- * level of zero has no effect.
- * @param positions an array of positions to map. These are
- * character-based source positions inside the original source,
- * for which corresponding positions in the formatted source will
- * be computed (so as to relocate elements associated with the original
- * source). It updates the positions array with updated positions.
- * If set to null, then no positions are mapped.
- * @param lineSeparator the line separator to use in formatted source,
- * if set to null, then the platform default one will be used.
+ * @param string
+ * the string to format
+ * @param indentationLevel
+ * the initial indentation level, used to shift left/right the
+ * entire source fragment. An initial indentation level of zero
+ * has no effect.
+ * @param positions
+ * an array of positions to map. These are character-based source
+ * positions inside the original source, for which corresponding
+ * positions in the formatted source will be computed (so as to
+ * relocate elements associated with the original source). It
+ * updates the positions array with updated positions. If set to
+ * null, then no positions are mapped.
+ * @param lineSeparator
+ * the line separator to use in formatted source, if set to
+ * null, then the platform default one will be
+ * used.
* @return the formatted output string.
*/
- String format(String string, int indentationLevel, int[] positions, String lineSeparator);
+ String format(String string, int indentationLevel, int[] positions,
+ String lineSeparator);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java
index df9ee27..52a777c 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java
@@ -12,306 +12,394 @@ package net.sourceforge.phpdt.core;
import org.eclipse.core.runtime.IProgressMonitor;
-
-
/**
- * Represents an entire Java compilation unit (.java source file).
- * Compilation unit elements need to be opened before they can be navigated or manipulated.
- * The children are of type IPackageDeclaration,
- * IImportContainer, and IType,
- * and appear in the order in which they are declared in the source.
- * If a .java file cannot be parsed, its structure remains unknown.
- * Use IJavaElement.isStructureKnown to determine whether this is
- * the case.
+ * Represents an entire Java compilation unit (.java source
+ * file). Compilation unit elements need to be opened before they can be
+ * navigated or manipulated. The children are of type
+ * IPackageDeclaration, IImportContainer, and
+ * IType, and appear in the order in which they are declared in
+ * the source. If a .java file cannot be parsed, its structure
+ * remains unknown. Use IJavaElement.isStructureKnown to
+ * determine whether this is the case.
*
* This interface is not intended to be implemented by clients.
*
- */
-public interface ICompilationUnit extends IJavaElement, ISourceReference, IParent, IOpenable, IWorkingCopy, ISourceManipulation {
-//extends IJavaElement, ISourceReference, IParent, IOpenable, IWorkingCopy, ISourceManipulation, ICodeAssist {
+ */
+public interface ICompilationUnit extends IJavaElement, ISourceReference,
+ IParent, IOpenable, IWorkingCopy, ISourceManipulation {
+ // extends IJavaElement, ISourceReference, IParent, IOpenable, IWorkingCopy,
+ // ISourceManipulation, ICodeAssist {
/**
* Constant indicating that a reconcile operation should not return an AST.
+ *
* @since 3.0
*/
public static final int NO_AST = 0;
/**
- * Changes this compilation unit handle into a working copy. A new IBuffer is
- * created using this compilation unit handle's owner. Uses the primary owner is none was
- * specified when this compilation unit handle was created.
+ * Changes this compilation unit handle into a working copy. A new
+ * IBuffer is created using this compilation unit handle's
+ * owner. Uses the primary owner is none was specified when this compilation
+ * unit handle was created.
*
- * When switching to working copy mode, problems are reported to given
+ * When switching to working copy mode, problems are reported to given
* IProblemRequestor.
*
*
- * Once in working copy mode, changes to this compilation unit or its children are done in memory.
- * Only the new buffer is affected. Using commitWorkingCopy(boolean, IProgressMonitor)
- * will bring the underlying resource in sync with this compilation unit.
+ * Once in working copy mode, changes to this compilation unit or its
+ * children are done in memory. Only the new buffer is affected. Using
+ * commitWorkingCopy(boolean, IProgressMonitor) will bring
+ * the underlying resource in sync with this compilation unit.
*
*
- * If this compilation unit was already in working copy mode, an internal counter is incremented and no
- * other action is taken on this compilation unit. To bring this compilation unit back into the original mode
- * (where it reflects the underlying resource), discardWorkingCopy must be call as many
- * times as becomeWorkingCopy.
+ * If this compilation unit was already in working copy mode, an internal
+ * counter is incremented and no other action is taken on this compilation
+ * unit. To bring this compilation unit back into the original mode (where
+ * it reflects the underlying resource), discardWorkingCopy
+ * must be call as many times as becomeWorkingCopy.
*
*
- * @param problemRequestor a requestor which will get notified of problems detected during
- * reconciling as they are discovered. The requestor can be set to null indicating
- * that the client is not interested in problems.
- * @param monitor a progress monitor used to report progress while opening this compilation unit
- * or null if no progress should be reported
- * @throws JavaModelException if this compilation unit could not become a working copy.
+ * @param problemRequestor
+ * a requestor which will get notified of problems detected
+ * during reconciling as they are discovered. The requestor can
+ * be set to null indicating that the client is
+ * not interested in problems.
+ * @param monitor
+ * a progress monitor used to report progress while opening this
+ * compilation unit or null if no progress should
+ * be reported
+ * @throws JavaModelException
+ * if this compilation unit could not become a working copy.
* @see #discardWorkingCopy()
* @since 3.0
*/
- void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException;
+ void becomeWorkingCopy(IProblemRequestor problemRequestor,
+ IProgressMonitor monitor) throws JavaModelException;
+
/**
* Commits the contents of this working copy to its underlying resource.
- *
- *
It is possible that the contents of the original resource have changed
- * since this working copy was created, in which case there is an update conflict.
- * The value of the force parameter effects the resolution of
- * such a conflict:
- *
true - in this case the contents of this working copy are applied to
- * the underlying resource even though this working copy was created before
- * a subsequent change in the resource
- *
false - in this case a JavaModelException is thrown
- *
+ *
*
- * Since 2.1, a working copy can be created on a not-yet existing compilation
- * unit. In particular, such a working copy can then be committed in order to create
- * the corresponding compilation unit.
- *
- * @param force a flag to handle the cases when the contents of the original resource have changed
- * since this working copy was created
- * @param monitor the given progress monitor
- * @throws JavaModelException if this working copy could not commit. Reasons include:
+ * It is possible that the contents of the original resource have changed
+ * since this working copy was created, in which case there is an update
+ * conflict. The value of the force parameter effects the
+ * resolution of such a conflict:
*
- *
A CoreException occurred while updating an underlying resource
- *
This element is not a working copy (INVALID_ELEMENT_TYPES)
- *
A update conflict (described above) (UPDATE_CONFLICT)
+ *
true - in this case the contents of this working copy
+ * are applied to the underlying resource even though this working copy was
+ * created before a subsequent change in the resource
+ *
false - in this case a
+ * JavaModelException is thrown
*
+ *
+ * Since 2.1, a working copy can be created on a not-yet existing
+ * compilation unit. In particular, such a working copy can then be
+ * committed in order to create the corresponding compilation unit.
+ *
+ *
+ * @param force
+ * a flag to handle the cases when the contents of the original
+ * resource have changed since this working copy was created
+ * @param monitor
+ * the given progress monitor
+ * @throws JavaModelException
+ * if this working copy could not commit. Reasons include:
+ *
+ *
A CoreException occurred while updating
+ * an underlying resource
+ *
This element is not a working copy
+ * (INVALID_ELEMENT_TYPES)
+ *
A update conflict (described above) (UPDATE_CONFLICT)
+ *
* @since 3.0
*/
- void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws JavaModelException;
+ void commitWorkingCopy(boolean force, IProgressMonitor monitor)
+ throws JavaModelException;
+
/**
- * Changes this compilation unit in working copy mode back to its original mode.
+ * Changes this compilation unit in working copy mode back to its original
+ * mode.
*
* This has no effect if this compilation unit was not in working copy mode.
*
*
* If becomeWorkingCopy was called several times on this
- * compilation unit, discardWorkingCopy must be called as
+ * compilation unit, discardWorkingCopy must be called as
* many times before it switches back to the original mode.
*
*
- * @throws JavaModelException if this working copy could not return in its original mode.
+ * @throws JavaModelException
+ * if this working copy could not return in its original mode.
* @see #becomeWorkingCopy(IProblemRequestor, IProgressMonitor)
* @since 3.0
*/
void discardWorkingCopy() throws JavaModelException;
-/**
- * Creates and returns an import declaration in this compilation unit
- * with the given name.
- *
- * Optionally, the new element can be positioned before the specified
- * sibling. If no sibling is specified, the element will be inserted
- * as the last import declaration in this compilation unit.
- *
- * If the compilation unit already includes the specified import declaration,
- * the import is not generated (it does not generate duplicates).
- * Note that it is valid to specify both a single-type import and an on-demand import
- * for the same package, for example "java.io.File" and
- * "java.io.*", in which case both are preserved since the semantics
- * of this are not the same as just importing "java.io.*".
- * Importing "java.lang.*", or the package in which the compilation unit
- * is defined, are not treated as special cases. If they are specified, they are
- * included in the result.
- *
- * @param name the name of the import declaration to add as defined by JLS2 7.5. (For example: "java.io.File" or
- * "java.awt.*")
- * @param sibling the existing element which the import declaration will be inserted immediately before (if
- * null , then this import will be inserted as the last import declaration.
- * @param monitor the progress monitor to notify
- * @return the newly inserted import declaration (or the previously existing one in case attempting to create a duplicate)
- *
- * @exception JavaModelException if the element could not be created. Reasons include:
- *
- *
This Java element does not exist or the specified sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
The specified sibling is not a child of this compilation unit (INVALID_SIBLING)
- *
The name is not a valid import name (INVALID_NAME)
- *
- */
-//IImportDeclaration createImport(String name, IJavaElement sibling, IProgressMonitor monitor) throws JavaModelException;
-/**
- * Creates and returns a package declaration in this compilation unit
- * with the given package name.
- *
- *
If the compilation unit already includes the specified package declaration,
- * it is not generated (it does not generate duplicates).
- *
- * @param name the name of the package declaration to add as defined by JLS2 7.4. (For example, "java.lang")
- * @param monitor the progress monitor to notify
- * @return the newly inserted package declaration (or the previously existing one in case attempting to create a duplicate)
- *
- * @exception JavaModelException if the element could not be created. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
The name is not a valid package name (INVALID_NAME)
- *
- */
-// IPackageDeclaration createPackageDeclaration(String name, IProgressMonitor monitor) throws JavaModelException;
-/**
- * Creates and returns a type in this compilation unit with the
- * given contents. If this compilation unit does not exist, one
- * will be created with an appropriate package declaration.
- *
- * Optionally, the new type can be positioned before the specified
- * sibling. If sibling is null, the type will be appended
- * to the end of this compilation unit.
- *
- *
It is possible that a type with the same name already exists in this compilation unit.
- * The value of the force parameter effects the resolution of
- * such a conflict:
- *
true - in this case the type is created with the new contents
- *
false - in this case a JavaModelException is thrown
- *
- *
- * @param contents the source contents of the type declaration to add.
- * @param sibling the existing element which the type will be inserted immediately before (if
- * null , then this type will be inserted as the last type declaration.
- * @param force a boolean flag indicating how to deal with duplicates
- * @param monitor the progress monitor to notify
- * @return the newly inserted type
- *
- * @exception JavaModelException if the element could not be created. Reasons include:
- *
- *
The specified sibling element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
The specified sibling is not a child of this compilation unit (INVALID_SIBLING)
- *
The contents could not be recognized as a type declaration (INVALID_CONTENTS)
- *
There was a naming collision with an existing type (NAME_COLLISION)
- *
- */
-//IType createType(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor) throws JavaModelException;
-/**
- * Returns all types declared in this compilation unit in the order
- * in which they appear in the source.
- * This includes all top-level types and nested member types.
- * It does NOT include local types (types defined in methods).
- *
- * @return the array of top-level and member types defined in a compilation unit, in declaration order.
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- */
-IType[] getAllTypes() throws JavaModelException;
-/**
- * Returns the smallest element within this compilation unit that
- * includes the given source position (that is, a method, field, etc.), or
- * null if there is no element other than the compilation
- * unit itself at the given position, or if the given position is not
- * within the source range of this compilation unit.
- *
- * @param position a source position inside the compilation unit
- * @return the innermost Java element enclosing a given source position or null
- * if none (excluding the compilation unit).
- * @exception JavaModelException if the compilation unit does not exist or if an
- * exception occurs while accessing its corresponding resource
- */
-IJavaElement getElementAt(int position) throws JavaModelException;
-/**
- * Returns the first import declaration in this compilation unit with the given name.
- * This is a handle-only method. The import declaration may or may not exist. This
- * is a convenience method - imports can also be accessed from a compilation unit's
- * import container.
- *
- * @param name the name of the import to find as defined by JLS2 7.5. (For example: "java.io.File"
- * or "java.awt.*")
- * @return a handle onto the corresponding import declaration. The import declaration may or may not exist.
- */
-IImportDeclaration getImport(String name) ;
-/**
- * Returns the import declarations in this compilation unit
- * in the order in which they appear in the source. This is
- * a convenience method - import declarations can also be
- * accessed from a compilation unit's import container.
- *
- * @return the import declarations in this compilation unit
- * @throws JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- */
-IImportDeclaration[] getImports() throws JavaModelException;
-/**
- * Returns the import container for this compilation unit.
- * This is a handle-only method. The import container may or
- * may not exist. The import container can used to access the
- * imports.
- * @return a handle onto the corresponding import container. The
- * import contain may or may not exist.
- */
-IImportContainer getImportContainer();
-/**
- * Returns the import declarations in this compilation unit
- * in the order in which they appear in the source. This is
- * a convenience method - import declarations can also be
- * accessed from a compilation unit's import container.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- */
-//IImportDeclaration[] getImports() throws JavaModelException;
-/**
- * Returns the first package declaration in this compilation unit with the given package name
- * (there normally is at most one package declaration).
- * This is a handle-only method. The package declaration may or may not exist.
- *
- * @param name the name of the package declaration as defined by JLS2 7.4. (For example, "java.lang")
- */
-IPackageDeclaration getPackageDeclaration(String name);
-/**
- * Returns the package declarations in this compilation unit
- * in the order in which they appear in the source.
- * There normally is at most one package declaration.
- *
- * @return an array of package declaration (normally of size one)
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- */
-IPackageDeclaration[] getPackageDeclarations() throws JavaModelException;
-/**
- * Returns the primary compilation unit (whose owner is the primary owner)
- * this working copy was created from, or this compilation unit if this a primary
- * compilation unit.
- *
- * Note that the returned primary compilation unit can be in working copy mode.
- *
- *
- * @return the primary compilation unit this working copy was created from,
- * or this compilation unit if it is primary
- * @since 3.0
- */
-ICompilationUnit getPrimary();
-/**
- * Returns the top-level type declared in this compilation unit with the given simple type name.
- * The type name has to be a valid compilation unit name.
- * This is a handle-only method. The type may or may not exist.
- *
- * @param name the simple name of the requested type in the compilation unit
- * @return a handle onto the corresponding type. The type may or may not exist.
- * @see JavaConventions#validateCompilationUnitName(String name)
- */
-IType getType(String name);
-/**
- * Returns the top-level types declared in this compilation unit
- * in the order in which they appear in the source.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- */
-IType[] getTypes() throws JavaModelException;
+
+ /**
+ * Creates and returns an import declaration in this compilation unit with
+ * the given name.
+ *
+ * Optionally, the new element can be positioned before the specified
+ * sibling. If no sibling is specified, the element will be inserted as the
+ * last import declaration in this compilation unit.
+ *
+ * If the compilation unit already includes the specified import
+ * declaration, the import is not generated (it does not generate
+ * duplicates). Note that it is valid to specify both a single-type import
+ * and an on-demand import for the same package, for example
+ * "java.io.File" and "java.io.*", in which
+ * case both are preserved since the semantics of this are not the same as
+ * just importing "java.io.*". Importing
+ * "java.lang.*", or the package in which the compilation
+ * unit is defined, are not treated as special cases. If they are specified,
+ * they are included in the result.
+ *
+ * @param name
+ * the name of the import declaration to add as defined by JLS2
+ * 7.5. (For example: "java.io.File" or
+ * "java.awt.*")
+ * @param sibling
+ * the existing element which the import declaration will be
+ * inserted immediately before (if null , then
+ * this import will be inserted as the last import declaration.
+ * @param monitor
+ * the progress monitor to notify
+ * @return the newly inserted import declaration (or the previously existing
+ * one in case attempting to create a duplicate)
+ *
+ * @exception JavaModelException
+ * if the element could not be created. Reasons include:
+ *
+ *
This Java element does not exist or the specified
+ * sibling does not exist (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
The specified sibling is not a child of this
+ * compilation unit (INVALID_SIBLING)
+ *
The name is not a valid import name (INVALID_NAME)
+ *
+ */
+ // IImportDeclaration createImport(String name, IJavaElement sibling,
+ // IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Creates and returns a package declaration in this compilation unit with
+ * the given package name.
+ *
+ *
+ * If the compilation unit already includes the specified package
+ * declaration, it is not generated (it does not generate duplicates).
+ *
+ * @param name
+ * the name of the package declaration to add as defined by JLS2
+ * 7.4. (For example, "java.lang")
+ * @param monitor
+ * the progress monitor to notify
+ * @return the newly inserted package declaration (or the previously
+ * existing one in case attempting to create a duplicate)
+ *
+ * @exception JavaModelException
+ * if the element could not be created. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
The name is not a valid package name (INVALID_NAME)
+ *
+ */
+ // IPackageDeclaration createPackageDeclaration(String name,
+ // IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Creates and returns a type in this compilation unit with the given
+ * contents. If this compilation unit does not exist, one will be created
+ * with an appropriate package declaration.
+ *
+ * Optionally, the new type can be positioned before the specified sibling.
+ * If sibling is null, the type will be
+ * appended to the end of this compilation unit.
+ *
+ *
+ * It is possible that a type with the same name already exists in this
+ * compilation unit. The value of the force parameter effects
+ * the resolution of such a conflict:
+ *
+ *
true - in this case the type is created with the new
+ * contents
+ *
false - in this case a
+ * JavaModelException is thrown
+ *
+ *
+ * @param contents
+ * the source contents of the type declaration to add.
+ * @param sibling
+ * the existing element which the type will be inserted
+ * immediately before (if null , then this type
+ * will be inserted as the last type declaration.
+ * @param force
+ * a boolean flag indicating how to deal with
+ * duplicates
+ * @param monitor
+ * the progress monitor to notify
+ * @return the newly inserted type
+ *
+ * @exception JavaModelException
+ * if the element could not be created. Reasons include:
+ *
+ *
The specified sibling element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
The specified sibling is not a child of this
+ * compilation unit (INVALID_SIBLING)
+ *
The contents could not be recognized as a type
+ * declaration (INVALID_CONTENTS)
+ *
There was a naming collision with an existing type
+ * (NAME_COLLISION)
+ *
+ */
+ // IType createType(String contents, IJavaElement sibling, boolean force,
+ // IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Returns all types declared in this compilation unit in the order in which
+ * they appear in the source. This includes all top-level types and nested
+ * member types. It does NOT include local types (types defined in methods).
+ *
+ * @return the array of top-level and member types defined in a compilation
+ * unit, in declaration order.
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ */
+ IType[] getAllTypes() throws JavaModelException;
+
+ /**
+ * Returns the smallest element within this compilation unit that includes
+ * the given source position (that is, a method, field, etc.), or
+ * null if there is no element other than the compilation
+ * unit itself at the given position, or if the given position is not within
+ * the source range of this compilation unit.
+ *
+ * @param position
+ * a source position inside the compilation unit
+ * @return the innermost Java element enclosing a given source position or
+ * null if none (excluding the compilation unit).
+ * @exception JavaModelException
+ * if the compilation unit does not exist or if an exception
+ * occurs while accessing its corresponding resource
+ */
+ IJavaElement getElementAt(int position) throws JavaModelException;
+
+ /**
+ * Returns the first import declaration in this compilation unit with the
+ * given name. This is a handle-only method. The import declaration may or
+ * may not exist. This is a convenience method - imports can also be
+ * accessed from a compilation unit's import container.
+ *
+ * @param name
+ * the name of the import to find as defined by JLS2 7.5. (For
+ * example: "java.io.File" or
+ * "java.awt.*")
+ * @return a handle onto the corresponding import declaration. The import
+ * declaration may or may not exist.
+ */
+ IImportDeclaration getImport(String name);
+
+ /**
+ * Returns the import declarations in this compilation unit in the order in
+ * which they appear in the source. This is a convenience method - import
+ * declarations can also be accessed from a compilation unit's import
+ * container.
+ *
+ * @return the import declarations in this compilation unit
+ * @throws JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ */
+ IImportDeclaration[] getImports() throws JavaModelException;
+
+ /**
+ * Returns the import container for this compilation unit. This is a
+ * handle-only method. The import container may or may not exist. The import
+ * container can used to access the imports.
+ *
+ * @return a handle onto the corresponding import container. The import
+ * contain may or may not exist.
+ */
+ IImportContainer getImportContainer();
+
+ /**
+ * Returns the import declarations in this compilation unit in the order in
+ * which they appear in the source. This is a convenience method - import
+ * declarations can also be accessed from a compilation unit's import
+ * container.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ */
+ // IImportDeclaration[] getImports() throws JavaModelException;
+ /**
+ * Returns the first package declaration in this compilation unit with the
+ * given package name (there normally is at most one package declaration).
+ * This is a handle-only method. The package declaration may or may not
+ * exist.
+ *
+ * @param name
+ * the name of the package declaration as defined by JLS2 7.4.
+ * (For example, "java.lang")
+ */
+ IPackageDeclaration getPackageDeclaration(String name);
+
+ /**
+ * Returns the package declarations in this compilation unit in the order in
+ * which they appear in the source. There normally is at most one package
+ * declaration.
+ *
+ * @return an array of package declaration (normally of size one)
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ */
+ IPackageDeclaration[] getPackageDeclarations() throws JavaModelException;
+
+ /**
+ * Returns the primary compilation unit (whose owner is the primary owner)
+ * this working copy was created from, or this compilation unit if this a
+ * primary compilation unit.
+ *
+ * Note that the returned primary compilation unit can be in working copy
+ * mode.
+ *
+ *
+ * @return the primary compilation unit this working copy was created from,
+ * or this compilation unit if it is primary
+ * @since 3.0
+ */
+ ICompilationUnit getPrimary();
+
+ /**
+ * Returns the top-level type declared in this compilation unit with the
+ * given simple type name. The type name has to be a valid compilation unit
+ * name. This is a handle-only method. The type may or may not exist.
+ *
+ * @param name
+ * the simple name of the requested type in the compilation unit
+ * @return a handle onto the corresponding type. The type may or may not
+ * exist.
+ * @see JavaConventions#validateCompilationUnitName(String name)
+ */
+ IType getType(String name);
+
+ /**
+ * Returns the top-level types declared in this compilation unit in the
+ * order in which they appear in the source.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ */
+ IType[] getTypes() throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompletionRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompletionRequestor.java
index acbb1c9..62602d6 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompletionRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompletionRequestor.java
@@ -13,393 +13,485 @@ package net.sourceforge.phpdt.core;
import net.sourceforge.phpdt.core.compiler.IProblem;
/**
- * A completion requestor accepts results as they are computed and is aware
- * of source positions to complete the various different results.
+ * A completion requestor accepts results as they are computed and is aware of
+ * source positions to complete the various different results.
*
* This interface may be implemented by clients.
*
- *
+ *
* @see ICodeAssist
* @since 2.0
*/
public interface ICompletionRequestor {
-/**
- * Code assist notification of an anonymous type declaration completion.
- * @param superTypePackageName Name of the package that contains the super type of this
- * new anonymous type declaration .
- *
- * @param superTypeName Name of the super type of this new anonymous type declaration.
- *
- * @param parameterPackageNames Names of the packages in which the parameter types are declared.
- * Should contain as many elements as parameterTypeNames.
- *
- * @param parameterTypeNames Names of the parameters types.
- * Should contain as many elements as parameterPackageNames.
- *
- * @param completionName The completion for the anonymous type declaration.
- * Can include zero, one or two brackets. If the closing bracket is included,
- * then the cursor should be placed before it.
- *
- * @param modifiers The modifiers of the constructor.
- *
- * @param completionStart The start position of insertion of the name of this new anonymous type declaration.
- *
- * @param completionEnd The end position of insertion of the name of this new anonymous type declaration.
- *
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Base types are in the form "int" or "boolean".
- * Array types are in the qualified form "M[]" or "int[]".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- *
- * NOTE: parameter names can be retrieved from the source model after the user selects a specific method.
- */
-void acceptAnonymousType(
- char[] superTypePackageName,
- char[] superTypeName,
- char[][] parameterPackageNames,
- char[][] parameterTypeNames,
- char[][] parameterNames,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance);
-/**
- * Code assist notification of a class completion.
- *
- * @param packageName Declaring package name of the class.
- * @param className Name of the class.
- * @param completionName The completion for the class. Can include ';' for imported classes.
- * @param modifiers The modifiers of the class.
- * @param completionStart The start position of insertion of the name of the class.
- * @param completionEnd The end position of insertion of the name of the class.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptClass(
- char[] packageName,
- char[] className,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance);
-/**
- * Code assist notification of a compilation error detected during completion.
- * @param error Only problems which are categorized as non-syntax errors are notified to the
- * requestor, warnings are silently ignored.
- * In case an error got signalled, no other completions might be available,
- * therefore the problem message should be presented to the user.
- * The source positions of the problem are related to the source where it was
- * detected (might be in another compilation unit, if it was indirectly requested
- * during the code assist process).
- * Note: the problem knows its originating file name.
- */
-void acceptError(IProblem error);
-/**
- * Code assist notification of a field completion.
- *
- * @param declaringTypePackageName Name of the package in which the type that contains this field is declared.
- * @param declaringTypeName Name of the type declaring this new field.
- * @param name Name of the field.
- * @param typePackageName Name of the package in which the type of this field is declared.
- * @param typeName Name of the type of this field.
- * @param completionName The completion for the field.
- * @param modifiers The modifiers of this field.
- * @param completionStart The start position of insertion of the name of this field.
- * @param completionEnd The end position of insertion of the name of this field.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Base types are in the form "int" or "boolean".
- * Array types are in the qualified form "M[]" or "int[]".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptField(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] name,
- char[] typePackageName,
- char[] typeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance);
-/**
- * Code assist notification of an interface completion.
- *
- * @param packageName Declaring package name of the interface.
- * @param className Name of the interface.
- * @param completionName The completion for the interface. Can include ';' for imported interfaces.
- * @param modifiers The modifiers of the interface.
- * @param completionStart The start position of insertion of the name of the interface.
- * @param completionEnd The end position of insertion of the name of the interface.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptInterface(
- char[] packageName,
- char[] interfaceName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance);
-/**
- * Code assist notification of a keyword completion.
- * @param keywordName The keyword source.
- * @param completionStart The start position of insertion of the name of this keyword.
- * @param completionEnd The end position of insertion of the name of this keyword.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- */
-void acceptKeyword(char[] keywordName, int completionStart, int completionEnd, int relevance);
-/**
- * Code assist notification of a label completion.
- *
- * @param labelName The label source.
- * @param completionStart The start position of insertion of the name of this label.
- * @param completionEnd The end position of insertion of the name of this label.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- */
-void acceptLabel(char[] labelName, int completionStart, int completionEnd, int relevance);
-/**
- * Code assist notification of a local variable completion.
- *
- * @param name Name of the new local variable.
- * @param typePackageName Name of the package in which the type of this new local variable is declared.
- * @param typeName Name of the type of this new local variable.
- * @param modifiers The modifiers of this new local variable.
- * @param completionStart The start position of insertion of the name of this new local variable.
- * @param completionEnd The end position of insertion of the name of this new local variable.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Base types are in the form "int" or "boolean".
- * Array types are in the qualified form "M[]" or "int[]".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptLocalVariable(
- char[] name,
- char[] typePackageName,
- char[] typeName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance);
-/**
- * Code assist notification of a method completion.
- *
- * @param declaringTypePackageName Name of the package in which the type that contains this new method is declared.
- * @param declaringTypeName Name of the type declaring this new method.
- * @param selector Name of the new method.
- * @param parameterPackageNames Names of the packages in which the parameter types are declared.
- * Should contain as many elements as parameterTypeNames.
- * @param parameterTypeNames Names of the parameters types.
- * Should contain as many elements as parameterPackageNames.
- * @param returnTypePackageName Name of the package in which the return type is declared.
- * @param returnTypeName Name of the return type of this new method, should be null for a constructor.
- * @param completionName The completion for the method. Can include zero, one or two brackets. If the closing bracket is included, then the cursor should be placed before it.
- * @param modifiers The modifiers of this new method.
- * @param completionStart The start position of insertion of the name of this new method.
- * @param completionEnd The end position of insertion of the name of this new method.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Base types are in the form "int" or "boolean".
- * Array types are in the qualified form "M[]" or "int[]".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- *
- * NOTE: parameter names can be retrieved from the source model after the user selects a specific method.
- */
-void acceptMethod(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] selector,
- char[][] parameterPackageNames,
- char[][] parameterTypeNames,
- char[][] parameterNames,
- char[] returnTypePackageName,
- char[] returnTypeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance);
+ /**
+ * Code assist notification of an anonymous type declaration completion.
+ *
+ * @param superTypePackageName
+ * Name of the package that contains the super type of this new
+ * anonymous type declaration .
+ *
+ * @param superTypeName
+ * Name of the super type of this new anonymous type declaration.
+ *
+ * @param parameterPackageNames
+ * Names of the packages in which the parameter types are
+ * declared. Should contain as many elements as
+ * parameterTypeNames.
+ *
+ * @param parameterTypeNames
+ * Names of the parameters types. Should contain as many elements
+ * as parameterPackageNames.
+ *
+ * @param completionName
+ * The completion for the anonymous type declaration. Can include
+ * zero, one or two brackets. If the closing bracket is included,
+ * then the cursor should be placed before it.
+ *
+ * @param modifiers
+ * The modifiers of the constructor.
+ *
+ * @param completionStart
+ * The start position of insertion of the name of this new
+ * anonymous type declaration.
+ *
+ * @param completionEnd
+ * The end position of insertion of the name of this new
+ * anonymous type declaration.
+ *
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Base types are in the form "int"
+ * or "boolean". Array types are in the qualified form "M[]" or "int[]".
+ * Nested type names are in the qualified form "A.M". The default package is
+ * represented by an empty array.
+ *
+ * NOTE: parameter names can be retrieved from the source model after the
+ * user selects a specific method.
+ */
+ void acceptAnonymousType(char[] superTypePackageName, char[] superTypeName,
+ char[][] parameterPackageNames, char[][] parameterTypeNames,
+ char[][] parameterNames, char[] completionName, int modifiers,
+ int completionStart, int completionEnd, int relevance);
-/**
- * Code assist notification of a method completion.
- *
- * @param declaringTypePackageName Name of the package in which the type that contains this new method is declared.
- * @param declaringTypeName Name of the type declaring this new method.
- * @param selector Name of the new method.
- * @param parameterPackageNames Names of the packages in which the parameter types are declared.
- * Should contain as many elements as parameterTypeNames.
- * @param parameterTypeNames Names of the parameters types.
- * Should contain as many elements as parameterPackageNames.
- * @param returnTypePackageName Name of the package in which the return type is declared.
- * @param returnTypeName Name of the return type of this new method, should be null for a constructor.
- * @param completionName The completion for the method. Can include zero, one or two brackets. If the closing bracket is included, then the cursor should be placed before it.
- * @param modifiers The modifiers of this new method.
- * @param completionStart The start position of insertion of the name of this new method.
- * @param completionEnd The end position of insertion of the name of this new method.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Base types are in the form "int" or "boolean".
- * Array types are in the qualified form "M[]" or "int[]".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- *
- * NOTE: parameter names can be retrieved from the source model after the user selects a specific method.
- */
-void acceptMethodDeclaration(
- char[] declaringTypePackageName,
- char[] declaringTypeName,
- char[] selector,
- char[][] parameterPackageNames,
- char[][] parameterTypeNames,
- char[][] parameterNames,
- char[] returnTypePackageName,
- char[] returnTypeName,
- char[] completionName,
- int modifiers,
- int completionStart,
- int completionEnd,
- int relevance);
-/**
- * Code assist notification of a modifier completion.
- *
- * @param modifierName The new modifier.
- * @param completionStart The start position of insertion of the name of this new modifier.
- * @param completionEnd The end position of insertion of the name of this new modifier.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- */
-void acceptModifier(char[] modifierName, int completionStart, int completionEnd, int relevance);
-/**
- * Code assist notification of a package completion.
- *
- * @param packageName The package name.
- * @param completionName The completion for the package. Can include '.*;' for imports.
- * @param completionStart The start position of insertion of the name of this new package.
- * @param completionEnd The end position of insertion of the name of this new package.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- *
- * NOTE - All package names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * The default package is represented by an empty array.
- */
-void acceptPackage(
- char[] packageName,
- char[] completionName,
- int completionStart,
- int completionEnd,
- int relevance);
-/**
- * Code assist notification of a type completion.
- *
- * @param packageName Declaring package name of the type.
- * @param typeName Name of the type.
- * @param completionName The completion for the type. Can include ';' for imported types.
- * @param completionStart The start position of insertion of the name of the type.
- * @param completionEnd The end position of insertion of the name of the type.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptType(
- char[] packageName,
- char[] typeName,
- char[] completionName,
- int completionStart,
- int completionEnd,
- int relevance);
-
-/**
- * Code assist notification of a variable name completion.
- *
- * @param typePackageName Name of the package in which the type of this variable is declared.
- * @param typeName Name of the type of this variable.
- * @param name Name of the variable.
- * @param completionName The completion for the variable.
- * @param completionStart The start position of insertion of the name of this variable.
- * @param completionEnd The end position of insertion of the name of this variable.
- * @param relevance The relevance of the completion proposal
- * It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
- * This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
- * value is higher.
- *
- * NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Base types are in the form "int" or "boolean".
- * Array types are in the qualified form "M[]" or "int[]".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
- */
-void acceptVariableName(
- char[] typePackageName,
- char[] typeName,
- char[] name,
- char[] completionName,
- int completionStart,
- int completionEnd,
- int relevance);
+ /**
+ * Code assist notification of a class completion.
+ *
+ * @param packageName
+ * Declaring package name of the class.
+ * @param className
+ * Name of the class.
+ * @param completionName
+ * The completion for the class. Can include ';' for imported
+ * classes.
+ * @param modifiers
+ * The modifiers of the class.
+ * @param completionStart
+ * The start position of insertion of the name of the class.
+ * @param completionEnd
+ * The end position of insertion of the name of the class.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Nested type names are in the
+ * qualified form "A.M". The default package is represented by an empty
+ * array.
+ */
+ void acceptClass(char[] packageName, char[] className,
+ char[] completionName, int modifiers, int completionStart,
+ int completionEnd, int relevance);
+
+ /**
+ * Code assist notification of a compilation error detected during
+ * completion.
+ *
+ * @param error
+ * Only problems which are categorized as non-syntax errors are
+ * notified to the requestor, warnings are silently ignored. In
+ * case an error got signalled, no other completions might be
+ * available, therefore the problem message should be presented
+ * to the user. The source positions of the problem are related
+ * to the source where it was detected (might be in another
+ * compilation unit, if it was indirectly requested during the
+ * code assist process). Note: the problem knows its originating
+ * file name.
+ */
+ void acceptError(IProblem error);
+
+ /**
+ * Code assist notification of a field completion.
+ *
+ * @param declaringTypePackageName
+ * Name of the package in which the type that contains this field
+ * is declared.
+ * @param declaringTypeName
+ * Name of the type declaring this new field.
+ * @param name
+ * Name of the field.
+ * @param typePackageName
+ * Name of the package in which the type of this field is
+ * declared.
+ * @param typeName
+ * Name of the type of this field.
+ * @param completionName
+ * The completion for the field.
+ * @param modifiers
+ * The modifiers of this field.
+ * @param completionStart
+ * The start position of insertion of the name of this field.
+ * @param completionEnd
+ * The end position of insertion of the name of this field.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Base types are in the form "int"
+ * or "boolean". Array types are in the qualified form "M[]" or "int[]".
+ * Nested type names are in the qualified form "A.M". The default package is
+ * represented by an empty array.
+ */
+ void acceptField(char[] declaringTypePackageName, char[] declaringTypeName,
+ char[] name, char[] typePackageName, char[] typeName,
+ char[] completionName, int modifiers, int completionStart,
+ int completionEnd, int relevance);
+
+ /**
+ * Code assist notification of an interface completion.
+ *
+ * @param packageName
+ * Declaring package name of the interface.
+ * @param className
+ * Name of the interface.
+ * @param completionName
+ * The completion for the interface. Can include ';' for imported
+ * interfaces.
+ * @param modifiers
+ * The modifiers of the interface.
+ * @param completionStart
+ * The start position of insertion of the name of the interface.
+ * @param completionEnd
+ * The end position of insertion of the name of the interface.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Nested type names are in the
+ * qualified form "A.M". The default package is represented by an empty
+ * array.
+ */
+ void acceptInterface(char[] packageName, char[] interfaceName,
+ char[] completionName, int modifiers, int completionStart,
+ int completionEnd, int relevance);
+
+ /**
+ * Code assist notification of a keyword completion.
+ *
+ * @param keywordName
+ * The keyword source.
+ * @param completionStart
+ * The start position of insertion of the name of this keyword.
+ * @param completionEnd
+ * The end position of insertion of the name of this keyword.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ */
+ void acceptKeyword(char[] keywordName, int completionStart,
+ int completionEnd, int relevance);
+
+ /**
+ * Code assist notification of a label completion.
+ *
+ * @param labelName
+ * The label source.
+ * @param completionStart
+ * The start position of insertion of the name of this label.
+ * @param completionEnd
+ * The end position of insertion of the name of this label.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ */
+ void acceptLabel(char[] labelName, int completionStart, int completionEnd,
+ int relevance);
+
+ /**
+ * Code assist notification of a local variable completion.
+ *
+ * @param name
+ * Name of the new local variable.
+ * @param typePackageName
+ * Name of the package in which the type of this new local
+ * variable is declared.
+ * @param typeName
+ * Name of the type of this new local variable.
+ * @param modifiers
+ * The modifiers of this new local variable.
+ * @param completionStart
+ * The start position of insertion of the name of this new local
+ * variable.
+ * @param completionEnd
+ * The end position of insertion of the name of this new local
+ * variable.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Base types are in the form "int"
+ * or "boolean". Array types are in the qualified form "M[]" or "int[]".
+ * Nested type names are in the qualified form "A.M". The default package is
+ * represented by an empty array.
+ */
+ void acceptLocalVariable(char[] name, char[] typePackageName,
+ char[] typeName, int modifiers, int completionStart,
+ int completionEnd, int relevance);
+
+ /**
+ * Code assist notification of a method completion.
+ *
+ * @param declaringTypePackageName
+ * Name of the package in which the type that contains this new
+ * method is declared.
+ * @param declaringTypeName
+ * Name of the type declaring this new method.
+ * @param selector
+ * Name of the new method.
+ * @param parameterPackageNames
+ * Names of the packages in which the parameter types are
+ * declared. Should contain as many elements as
+ * parameterTypeNames.
+ * @param parameterTypeNames
+ * Names of the parameters types. Should contain as many elements
+ * as parameterPackageNames.
+ * @param returnTypePackageName
+ * Name of the package in which the return type is declared.
+ * @param returnTypeName
+ * Name of the return type of this new method, should be
+ * null for a constructor.
+ * @param completionName
+ * The completion for the method. Can include zero, one or two
+ * brackets. If the closing bracket is included, then the cursor
+ * should be placed before it.
+ * @param modifiers
+ * The modifiers of this new method.
+ * @param completionStart
+ * The start position of insertion of the name of this new
+ * method.
+ * @param completionEnd
+ * The end position of insertion of the name of this new method.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Base types are in the form "int"
+ * or "boolean". Array types are in the qualified form "M[]" or "int[]".
+ * Nested type names are in the qualified form "A.M". The default package is
+ * represented by an empty array.
+ *
+ * NOTE: parameter names can be retrieved from the source model after the
+ * user selects a specific method.
+ */
+ void acceptMethod(char[] declaringTypePackageName,
+ char[] declaringTypeName, char[] selector,
+ char[][] parameterPackageNames, char[][] parameterTypeNames,
+ char[][] parameterNames, char[] returnTypePackageName,
+ char[] returnTypeName, char[] completionName, int modifiers,
+ int completionStart, int completionEnd, int relevance);
+
+ /**
+ * Code assist notification of a method completion.
+ *
+ * @param declaringTypePackageName
+ * Name of the package in which the type that contains this new
+ * method is declared.
+ * @param declaringTypeName
+ * Name of the type declaring this new method.
+ * @param selector
+ * Name of the new method.
+ * @param parameterPackageNames
+ * Names of the packages in which the parameter types are
+ * declared. Should contain as many elements as
+ * parameterTypeNames.
+ * @param parameterTypeNames
+ * Names of the parameters types. Should contain as many elements
+ * as parameterPackageNames.
+ * @param returnTypePackageName
+ * Name of the package in which the return type is declared.
+ * @param returnTypeName
+ * Name of the return type of this new method, should be
+ * null for a constructor.
+ * @param completionName
+ * The completion for the method. Can include zero, one or two
+ * brackets. If the closing bracket is included, then the cursor
+ * should be placed before it.
+ * @param modifiers
+ * The modifiers of this new method.
+ * @param completionStart
+ * The start position of insertion of the name of this new
+ * method.
+ * @param completionEnd
+ * The end position of insertion of the name of this new method.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Base types are in the form "int"
+ * or "boolean". Array types are in the qualified form "M[]" or "int[]".
+ * Nested type names are in the qualified form "A.M". The default package is
+ * represented by an empty array.
+ *
+ * NOTE: parameter names can be retrieved from the source model after the
+ * user selects a specific method.
+ */
+ void acceptMethodDeclaration(char[] declaringTypePackageName,
+ char[] declaringTypeName, char[] selector,
+ char[][] parameterPackageNames, char[][] parameterTypeNames,
+ char[][] parameterNames, char[] returnTypePackageName,
+ char[] returnTypeName, char[] completionName, int modifiers,
+ int completionStart, int completionEnd, int relevance);
+
+ /**
+ * Code assist notification of a modifier completion.
+ *
+ * @param modifierName
+ * The new modifier.
+ * @param completionStart
+ * The start position of insertion of the name of this new
+ * modifier.
+ * @param completionEnd
+ * The end position of insertion of the name of this new
+ * modifier.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ */
+ void acceptModifier(char[] modifierName, int completionStart,
+ int completionEnd, int relevance);
+
+ /**
+ * Code assist notification of a package completion.
+ *
+ * @param packageName
+ * The package name.
+ * @param completionName
+ * The completion for the package. Can include '.*;' for imports.
+ * @param completionStart
+ * The start position of insertion of the name of this new
+ * package.
+ * @param completionEnd
+ * The end position of insertion of the name of this new package.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ *
+ * NOTE - All package names are presented in their readable form: Package
+ * names are in the form "a.b.c". The default package is represented by an
+ * empty array.
+ */
+ void acceptPackage(char[] packageName, char[] completionName,
+ int completionStart, int completionEnd, int relevance);
+
+ /**
+ * Code assist notification of a type completion.
+ *
+ * @param packageName
+ * Declaring package name of the type.
+ * @param typeName
+ * Name of the type.
+ * @param completionName
+ * The completion for the type. Can include ';' for imported
+ * types.
+ * @param completionStart
+ * The start position of insertion of the name of the type.
+ * @param completionEnd
+ * The end position of insertion of the name of the type.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Nested type names are in the
+ * qualified form "A.M". The default package is represented by an empty
+ * array.
+ */
+ void acceptType(char[] packageName, char[] typeName, char[] completionName,
+ int completionStart, int completionEnd, int relevance);
+
+ /**
+ * Code assist notification of a variable name completion.
+ *
+ * @param typePackageName
+ * Name of the package in which the type of this variable is
+ * declared.
+ * @param typeName
+ * Name of the type of this variable.
+ * @param name
+ * Name of the variable.
+ * @param completionName
+ * The completion for the variable.
+ * @param completionStart
+ * The start position of insertion of the name of this variable.
+ * @param completionEnd
+ * The end position of insertion of the name of this variable.
+ * @param relevance
+ * The relevance of the completion proposal It is a positive
+ * integer which are used for determine if this proposal is more
+ * relevant than another proposal. This value can only be used
+ * for compare relevance. A proposal is more relevant than
+ * another if his relevance value is higher.
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c". Base types are in the form "int"
+ * or "boolean". Array types are in the qualified form "M[]" or "int[]".
+ * Nested type names are in the qualified form "A.M". The default package is
+ * represented by an empty array.
+ */
+ void acceptVariableName(char[] typePackageName, char[] typeName,
+ char[] name, char[] completionName, int completionStart,
+ int completionEnd, int relevance);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IElementChangedListener.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IElementChangedListener.java
index 19a3ab8..2778128 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IElementChangedListener.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IElementChangedListener.java
@@ -18,12 +18,14 @@ package net.sourceforge.phpdt.core;
*
*/
public interface IElementChangedListener {
-
-/**
- * Notifies that one or more attributes of one or more Java elements have changed.
- * The specific details of the change are described by the given event.
- *
- * @param event the change event
- */
-public void elementChanged(ElementChangedEvent event);
+
+ /**
+ * Notifies that one or more attributes of one or more Java elements have
+ * changed. The specific details of the change are described by the given
+ * event.
+ *
+ * @param event
+ * the change event
+ */
+ public void elementChanged(ElementChangedEvent event);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IField.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IField.java
index 10aba92..ebfaf25 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IField.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IField.java
@@ -17,31 +17,36 @@ package net.sourceforge.phpdt.core;
*
*/
public interface IField extends IMember {
-/**
- * Returns the constant value associated with this field
- * or null if this field has none.
- * Returns either a subclass of Number, or a String,
- * depending on the type of the field.
- * For example, if the field is of type short, this returns
- * a Short.
- *
- * @return the constant value associated with this field or null if this field has none.
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- */
-public Object getConstant() throws JavaModelException;
-/**
- * Returns the simple name of this field.
- * @return the simple name of this field.
- */
-String getElementName();
-/**
- * Returns the type signature of this field.
- *
- * @see Signature
- * @return the type signature of this field.
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- */
-String getTypeSignature() throws JavaModelException;
+ /**
+ * Returns the constant value associated with this field or
+ * null if this field has none. Returns either a subclass of
+ * Number, or a String, depending on the
+ * type of the field. For example, if the field is of type
+ * short, this returns a Short.
+ *
+ * @return the constant value associated with this field or
+ * null if this field has none.
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ */
+ public Object getConstant() throws JavaModelException;
+
+ /**
+ * Returns the simple name of this field.
+ *
+ * @return the simple name of this field.
+ */
+ String getElementName();
+
+ /**
+ * Returns the type signature of this field.
+ *
+ * @see Signature
+ * @return the type signature of this field.
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ */
+ String getTypeSignature() throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportContainer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportContainer.java
index f7e3095..956af01 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportContainer.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportContainer.java
@@ -11,21 +11,25 @@
package net.sourceforge.phpdt.core;
/**
- * Represents an import container is a child of a Java compilation unit that contains
- * all (and only) the import declarations. If a compilation unit has no import
- * declarations, no import container will be present.
+ * Represents an import container is a child of a Java compilation unit that
+ * contains all (and only) the import declarations. If a compilation unit has no
+ * import declarations, no import container will be present.
*
* This interface is not intended to be implemented by clients.
*
*/
-public interface IImportContainer extends IJavaElement, IParent, ISourceReference {
-/**
- * Returns the first import declaration in this import container with the given name.
- * This is a handle-only method. The import declaration may or may not exist.
- *
- * @param name the given name
- *
- * @return the first import declaration in this import container with the given name
- */
-IImportDeclaration getImport(String name);
+public interface IImportContainer extends IJavaElement, IParent,
+ ISourceReference {
+ /**
+ * Returns the first import declaration in this import container with the
+ * given name. This is a handle-only method. The import declaration may or
+ * may not exist.
+ *
+ * @param name
+ * the given name
+ *
+ * @return the first import declaration in this import container with the
+ * given name
+ */
+ IImportDeclaration getImport(String name);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java
index 812bc64..90e8150 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IImportDeclaration.java
@@ -11,42 +11,46 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
-
/**
* Represents an import declaration in Java compilation unit.
*
* This interface is not intended to be implemented by clients.
*
*/
-public interface IImportDeclaration extends IJavaElement, ISourceReference, ISourceManipulation {
-/**
- * Returns the name that has been imported.
- * For an on-demand import, this includes the trailing ".*".
- * For example, for the statement "import java.util.*",
- * this returns "java.util.*".
- * For the statement "import java.util.Hashtable",
- * this returns "java.util.Hashtable".
- *
- * @return the name that has been imported
- */
-String getElementName();
-/**
- * Returns the modifier flags for this import. The flags can be examined using class
- * Flags. Only the static flag is meaningful for import declarations.
- *
- * @return the modifier flags for this import
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @see Flags
- * @since 3.0
- */
-int getFlags() throws JavaModelException;
+public interface IImportDeclaration extends IJavaElement, ISourceReference,
+ ISourceManipulation {
+ /**
+ * Returns the name that has been imported. For an on-demand import, this
+ * includes the trailing ".*". For example, for the
+ * statement "import java.util.*", this returns
+ * "java.util.*". For the statement
+ * "import java.util.Hashtable", this returns
+ * "java.util.Hashtable".
+ *
+ * @return the name that has been imported
+ */
+ String getElementName();
-/**
- * Returns whether the import is on-demand. An import is on-demand if it ends
- * with ".*".
- * @return true if the import is on-demand, false otherwise
- */
-boolean isOnDemand();
+ /**
+ * Returns the modifier flags for this import. The flags can be examined
+ * using class Flags. Only the static flag is meaningful for
+ * import declarations.
+ *
+ * @return the modifier flags for this import
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @see Flags
+ * @since 3.0
+ */
+ int getFlags() throws JavaModelException;
+
+ /**
+ * Returns whether the import is on-demand. An import is on-demand if it
+ * ends with ".*".
+ *
+ * @return true if the import is on-demand, false otherwise
+ */
+ boolean isOnDemand();
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java
index cea7b63..679a580 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElement.java
@@ -16,14 +16,15 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
/**
- * Common protocol for all elements provided by the Java model.
- * Java model elements are exposed to clients as handles to the actual underlying element.
+ * Common protocol for all elements provided by the Java model. Java model
+ * elements are exposed to clients as handles to the actual underlying element.
* The Java model may hand out any number of handles for each element. Handles
- * that refer to the same element are guaranteed to be equal, but not necessarily identical.
+ * that refer to the same element are guaranteed to be equal, but not
+ * necessarily identical.
*
- * Methods annotated as "handle-only" do not require underlying elements to exist.
- * Methods that require underlying elements to exist throw
- * a JavaModelException when an underlying element is missing.
+ * Methods annotated as "handle-only" do not require underlying elements to
+ * exist. Methods that require underlying elements to exist throw a
+ * JavaModelException when an underlying element is missing.
* JavaModelException.isDoesNotExist can be used to recognize
* this common special case.
*
@@ -34,89 +35,94 @@ import org.eclipse.core.runtime.jobs.ISchedulingRule;
public interface IJavaElement extends IAdaptable {
/**
- * Constant representing a Java model (workspace level object).
- * A Java element with this type can be safely cast to IJavaModel.
+ * Constant representing a Java model (workspace level object). A Java
+ * element with this type can be safely cast to IJavaModel.
*/
int JAVA_MODEL = 1;
/**
- * Constant representing a Java project.
- * A Java element with this type can be safely cast to IJavaProject.
+ * Constant representing a Java project. A Java element with this type can
+ * be safely cast to IJavaProject.
*/
int JAVA_PROJECT = 2;
/**
- * Constant representing a package fragment root.
- * A Java element with this type can be safely cast to IPackageFragmentRoot.
+ * Constant representing a package fragment root. A Java element with this
+ * type can be safely cast to IPackageFragmentRoot.
*/
int PACKAGE_FRAGMENT_ROOT = 3;
/**
- * Constant representing a package fragment.
- * A Java element with this type can be safely cast to IPackageFragment.
+ * Constant representing a package fragment. A Java element with this type
+ * can be safely cast to IPackageFragment.
*/
int PACKAGE_FRAGMENT = 4;
/**
- * Constant representing a Java compilation unit.
- * A Java element with this type can be safely cast to ICompilationUnit.
+ * Constant representing a Java compilation unit. A Java element with this
+ * type can be safely cast to ICompilationUnit.
*/
int COMPILATION_UNIT = 5;
/**
- * Constant representing a class file.
- * A Java element with this type can be safely cast to IClassFile.
+ * Constant representing a class file. A Java element with this type can be
+ * safely cast to IClassFile.
*/
int CLASS_FILE = 6;
/**
- * Constant representing a type (a class or interface).
- * A Java element with this type can be safely cast to IType.
+ * Constant representing a type (a class or interface). A Java element with
+ * this type can be safely cast to IType.
*/
int TYPE = 7;
/**
- * Constant representing a field.
- * A Java element with this type can be safely cast to IField.
+ * Constant representing a field. A Java element with this type can be
+ * safely cast to IField.
*/
int FIELD = 8;
/**
- * Constant representing a method or constructor.
- * A Java element with this type can be safely cast to IMethod.
+ * Constant representing a method or constructor. A Java element with this
+ * type can be safely cast to IMethod.
*/
int METHOD = 9;
/**
- * Constant representing a stand-alone instance or class initializer.
- * A Java element with this type can be safely cast to IInitializer.
+ * Constant representing a stand-alone instance or class initializer. A Java
+ * element with this type can be safely cast to IInitializer.
*/
int INITIALIZER = 10;
/**
- * Constant representing a package declaration within a compilation unit.
- * A Java element with this type can be safely cast to IPackageDeclaration.
+ * Constant representing a package declaration within a compilation unit. A
+ * Java element with this type can be safely cast to
+ * IPackageDeclaration.
*/
int PACKAGE_DECLARATION = 11;
/**
* Constant representing all import declarations within a compilation unit.
- * A Java element with this type can be safely cast to IImportContainer.
+ * A Java element with this type can be safely cast to
+ * IImportContainer.
*/
int IMPORT_CONTAINER = 12;
/**
- * Constant representing an import declaration within a compilation unit.
- * A Java element with this type can be safely cast to IImportDeclaration.
+ * Constant representing an import declaration within a compilation unit. A
+ * Java element with this type can be safely cast to
+ * IImportDeclaration.
*/
int IMPORT_DECLARATION = 13;
/**
- * Constant representing a local variable declaration.
- * A Java element with this type can be safely cast to ILocalVariable.
+ * Constant representing a local variable declaration. A Java element with
+ * this type can be safely cast to ILocalVariable.
+ *
* @since 3.0
*/
int LOCAL_VARIABLE = 14;
+
/**
* Returns whether this Java element exists in the model.
*
@@ -125,205 +131,211 @@ public interface IJavaElement extends IAdaptable {
* said to "exist", and this method returns true. For Java
* elements that are not working copies, it is always the case that if the
* element exists, then its parent also exists (provided it has one) and
- * includes the element as one of its children. It is therefore possible
- * to navigated to any existing Java element from the root of the Java model
+ * includes the element as one of its children. It is therefore possible to
+ * navigated to any existing Java element from the root of the Java model
* along a chain of existing Java elements. On the other hand, working
* copies are said to exist until they are destroyed (with
* IWorkingCopy.destroy). Unlike regular Java elements, a
* working copy never shows up among the children of its parent element
* (which may or may not exist).
*
- *
+ *
* @return true if this element exists in the Java model, and
- * false if this element does not exist
+ * false if this element does not exist
*/
boolean exists();
-
+
/**
* Returns the first ancestor of this Java element that has the given type.
- * Returns null if no such an ancestor can be found.
- * This is a handle-only method.
+ * Returns null if no such an ancestor can be found. This is
+ * a handle-only method.
*
- * @param ancestorType the given type
- * @return the first ancestor of this Java element that has the given type, null if no such an ancestor can be found
+ * @param ancestorType
+ * the given type
+ * @return the first ancestor of this Java element that has the given type,
+ * null if no such an ancestor can be found
* @since 2.0
*/
IJavaElement getAncestor(int ancestorType);
/**
- * Returns the resource that corresponds directly to this element,
- * or null if there is no resource that corresponds to
- * this element.
+ * Returns the resource that corresponds directly to this element, or
+ * null if there is no resource that corresponds to this
+ * element.
*
- * For example, the corresponding resource for an ICompilationUnit
- * is its underlying IFile. The corresponding resource for
- * an IPackageFragment that is not contained in an archive
- * is its underlying IFolder. An IPackageFragment
- * contained in an archive has no corresponding resource. Similarly, there
- * are no corresponding resources for IMethods,
- * IFields, etc.
+ * For example, the corresponding resource for an
+ * ICompilationUnit is its underlying IFile.
+ * The corresponding resource for an IPackageFragment that is
+ * not contained in an archive is its underlying IFolder. An
+ * IPackageFragment contained in an archive has no
+ * corresponding resource. Similarly, there are no corresponding resources
+ * for IMethods, IFields, etc.
*
- *
+ *
* @return the corresponding resource, or null if none
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
*/
IResource getCorrespondingResource() throws JavaModelException;
/**
* Returns the name of this element. This is a handle-only method.
- *
+ *
* @return the element name
*/
String getElementName();
/**
- * Returns this element's kind encoded as an integer.
- * This is a handle-only method.
- *
+ * Returns this element's kind encoded as an integer. This is a handle-only
+ * method.
+ *
* @return the kind of element; one of the constants declared in
- * IJavaElement
+ * IJavaElement
* @see IJavaElement
*/
int getElementType();
/**
- * Returns a string representation of this element handle. The format of
- * the string is not specified; however, the identifier is stable across
- * workspace sessions, and can be used to recreate this handle via the
+ * Returns a string representation of this element handle. The format of the
+ * string is not specified; however, the identifier is stable across
+ * workspace sessions, and can be used to recreate this handle via the
* JavaCore.create(String) method.
- *
+ *
* @return the string handle identifier
* @see JavaCore#create(java.lang.String)
*/
String getHandleIdentifier();
/**
- * Returns the Java model.
- * This is a handle-only method.
- *
+ * Returns the Java model. This is a handle-only method.
+ *
* @return the Java model
*/
- IJavaModel getJavaModel();
+ IJavaModel getJavaModel();
/**
- * Returns the Java project this element is contained in,
- * or null if this element is not contained in any Java project
- * (for instance, the IJavaModel is not contained in any Java
- * project).
- * This is a handle-only method.
- *
- * @return the containing Java project, or null if this element is
- * not contained in a Java project
+ * Returns the Java project this element is contained in, or
+ * null if this element is not contained in any Java project
+ * (for instance, the IJavaModel is not contained in any Java
+ * project). This is a handle-only method.
+ *
+ * @return the containing Java project, or null if this
+ * element is not contained in a Java project
*/
IJavaProject getJavaProject();
/**
- * Returns the first openable parent. If this element is openable, the element
- * itself is returned. Returns null if this element doesn't have
- * an openable parent.
- * This is a handle-only method.
+ * Returns the first openable parent. If this element is openable, the
+ * element itself is returned. Returns null if this element
+ * doesn't have an openable parent. This is a handle-only method.
*
- * @return the first openable parent or null if this element doesn't have
- * an openable parent.
+ * @return the first openable parent or null if this element
+ * doesn't have an openable parent.
* @since 2.0
*/
IOpenable getOpenable();
/**
- * Returns the element directly containing this element,
- * or null if this element has no parent.
- * This is a handle-only method.
- *
- * @return the parent element, or null if this element has no parent
+ * Returns the element directly containing this element, or
+ * null if this element has no parent. This is a handle-only
+ * method.
+ *
+ * @return the parent element, or null if this element has no
+ * parent
*/
IJavaElement getParent();
/**
- * Returns the path to the innermost resource enclosing this element.
- * If this element is not included in an external archive,
- * the path returned is the full, absolute path to the underlying resource,
- * relative to the workbench.
- * If this element is included in an external archive,
- * the path returned is the absolute path to the archive in the file system.
- * This is a handle-only method.
+ * Returns the path to the innermost resource enclosing this element. If
+ * this element is not included in an external archive, the path returned is
+ * the full, absolute path to the underlying resource, relative to the
+ * workbench. If this element is included in an external archive, the path
+ * returned is the absolute path to the archive in the file system. This is
+ * a handle-only method.
*
* @return the path to the innermost resource enclosing this element
* @since 2.0
*/
IPath getPath();
+
/**
- * Returns the primary element (whose compilation unit is the primary compilation unit)
- * this working copy element was created from, or this element if it is a descendant of a
- * primary compilation unit or if it is not a descendant of a working copy (e.g. it is a
- * binary member).
- * The returned element may or may not exist.
+ * Returns the primary element (whose compilation unit is the primary
+ * compilation unit) this working copy element was created from, or this
+ * element if it is a descendant of a primary compilation unit or if it is
+ * not a descendant of a working copy (e.g. it is a binary member). The
+ * returned element may or may not exist.
*
- * @return the primary element this working copy element was created from, or this
- * element.
+ * @return the primary element this working copy element was created from,
+ * or this element.
* @since 3.0
*/
IJavaElement getPrimaryElement();
+
/**
- * Returns the innermost resource enclosing this element.
- * If this element is included in an archive and this archive is not external,
- * this is the underlying resource corresponding to the archive.
- * If this element is included in an external archive, null
- * is returned.
- * If this element is a working copy, null is returned.
- * This is a handle-only method.
+ * Returns the innermost resource enclosing this element. If this element is
+ * included in an archive and this archive is not external, this is the
+ * underlying resource corresponding to the archive. If this element is
+ * included in an external archive, null is returned. If this
+ * element is a working copy, null is returned. This is a
+ * handle-only method.
*
- * @return the innermost resource enclosing this element, null if this
- * element is a working copy or is included in an external archive
+ * @return the innermost resource enclosing this element, null
+ * if this element is a working copy or is included in an external
+ * archive
* @since 2.0
*/
IResource getResource();
+
/**
- * Returns the scheduling rule associated with this Java element.
- * This is a handle-only method.
+ * Returns the scheduling rule associated with this Java element. This is a
+ * handle-only method.
*
* @return the scheduling rule associated with this Java element
* @since 3.0
*/
ISchedulingRule getSchedulingRule();
+
/**
- * Returns the smallest underlying resource that contains
- * this element, or null if this element is not contained
- * in a resource.
- *
+ * Returns the smallest underlying resource that contains this element, or
+ * null if this element is not contained in a resource.
+ *
* @return the underlying resource, or null if none
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its underlying resource
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its underlying resource
*/
IResource getUnderlyingResource() throws JavaModelException;
/**
* Returns whether this Java element is read-only. An element is read-only
- * if its structure cannot be modified by the java model.
+ * if its structure cannot be modified by the java model.
*
* Note this is different from IResource.isReadOnly(). For example, .jar
- * files are read-only as the java model doesn't know how to add/remove
+ * files are read-only as the java model doesn't know how to add/remove
* elements in this file, but the underlying IFile can be writable.
*
* This is a handle-only method.
- *
+ *
* @return true if this element is read-only
*/
boolean isReadOnly();
/**
- * Returns whether the structure of this element is known. For example, for a
- * compilation unit that could not be parsed, false is returned.
- * If the structure of an element is unknown, navigations will return reasonable
- * defaults. For example, getChildren will return an empty collection.
+ * Returns whether the structure of this element is known. For example, for
+ * a compilation unit that could not be parsed, false is
+ * returned. If the structure of an element is unknown, navigations will
+ * return reasonable defaults. For example, getChildren will
+ * return an empty collection.
*
- * Note: This does not imply anything about consistency with the
- * underlying resource/buffer contents.
+ * Note: This does not imply anything about consistency with the underlying
+ * resource/buffer contents.
*
- *
+ *
* @return true if the structure of this element is known
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
*/
boolean isStructureKnown() throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java
index 61f2ce9..c506cd8 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaElementDelta.java
@@ -14,89 +14,107 @@ import org.eclipse.core.resources.IResourceDelta;
/**
* A Java element delta describes changes in Java element between two discrete
- * points in time. Given a delta, clients can access the element that has
+ * points in time. Given a delta, clients can access the element that has
* changed, and any children that have changed.
*
- * Deltas have a different status depending on the kind of change they represent.
- * The list below summarizes each status (as returned by getKind)
- * and its meaning (see individual constants for a more detailled description):
+ * Deltas have a different status depending on the kind of change they
+ * represent. The list below summarizes each status (as returned by
+ * getKind) and its meaning (see individual constants for a more
+ * detailled description):
*
- *
ADDED - The element described by the delta has been added.
- *
REMOVED - The element described by the delta has been removed.
- *
CHANGED - The element described by the delta has been changed in some way.
- * Specification of the type of change is provided by getFlags which returns the following values:
+ *
ADDED - The element described by the delta has been
+ * added.
+ *
REMOVED - The element described by the delta has been
+ * removed.
+ *
CHANGED - The element described by the delta has been
+ * changed in some way. Specification of the type of change is provided by
+ * getFlags which returns the following values:
*
- *
F_ADDED_TO_CLASSPATH - A classpath entry corresponding to the element
- * has been added to the project's classpath. This flag is only valid if the element is an
- * IPackageFragmentRoot.
+ *
F_ADDED_TO_CLASSPATH - A classpath entry corresponding to
+ * the element has been added to the project's classpath. This flag is only
+ * valid if the element is an IPackageFragmentRoot.
*
F_ARCHIVE_CONTENT_CHANGED - The contents of an archive
- * has changed in some way. This flag is only valid if the element is an IPackageFragmentRoot
- * which is an archive.
- *
F_CHILDREN - A child of the element has changed in some way. This flag
- * is only valid if the element is an IParent.
- *
F_CLASSPATH_REORDER - A classpath entry corresponding to the element
- * has changed position in the project's classpath. This flag is only valid if the element is an
- * IPackageFragmentRoot.
- *
F_CLOSED - The underlying IProject
- * has been closed. This flag is only valid if the element is an IJavaProject.
- *
F_CONTENT - The contents of the element have been altered. This flag
- * is only valid for elements which correspond to files.
- *
F_FINE_GRAINED - The delta is a fine-grained delta, that is, an analysis down
- * to the members level was done to determine if there were structural changes to members of the element.
- *
F_MODIFIERS - The modifiers on the element have changed in some way.
- * This flag is only valid if the element is an IMember.
- *
F_OPENED - The underlying IProject
- * has been opened. This flag is only valid if the element is an IJavaProject.
- *
F_REMOVED_FROM_CLASSPATH - A classpath entry corresponding to the element
- * has been removed from the project's classpath. This flag is only valid if the element is an
+ * has changed in some way. This flag is only valid if the element is an
+ * IPackageFragmentRoot which is an archive.
+ *
F_CHILDREN - A child of the element has changed in some
+ * way. This flag is only valid if the element is an IParent.
+ *
F_CLASSPATH_REORDER - A classpath entry corresponding to
+ * the element has changed position in the project's classpath. This flag is
+ * only valid if the element is an IPackageFragmentRoot.
+ *
F_CLOSED - The underlying IProject has
+ * been closed. This flag is only valid if the element is an
+ * IJavaProject.
+ *
F_CONTENT - The contents of the element have been
+ * altered. This flag is only valid for elements which correspond to files.
+ *
F_FINE_GRAINED - The delta is a fine-grained delta, that
+ * is, an analysis down to the members level was done to determine if there were
+ * structural changes to members of the element.
+ *
F_MODIFIERS - The modifiers on the element have changed
+ * in some way. This flag is only valid if the element is an
+ * IMember.
+ *
F_OPENED - The underlying IProject has
+ * been opened. This flag is only valid if the element is an
+ * IJavaProject.
+ *
F_REMOVED_FROM_CLASSPATH - A classpath entry
+ * corresponding to the element has been removed from the project's classpath.
+ * This flag is only valid if the element is an
* IPackageFragmentRoot.
- *
F_SOURCEATTACHED - The source attachment path or the source attachment root path
- * of a classpath entry corresponding to the element was added. This flag is only valid if the element is an
+ *
F_SOURCEATTACHED - The source attachment path or the
+ * source attachment root path of a classpath entry corresponding to the element
+ * was added. This flag is only valid if the element is an
* IPackageFragmentRoot.
- *
F_SOURCEDETACHED - The source attachment path or the source attachment root path
- * of a classpath entry corresponding to the element was removed. This flag is only valid if the element is an
+ *
F_SOURCEDETACHED - The source attachment path or the
+ * source attachment root path of a classpath entry corresponding to the element
+ * was removed. This flag is only valid if the element is an
* IPackageFragmentRoot.
- *
F_SUPER_TYPES - One of the supertypes of an IType has changed
.
+ *
F_SUPER_TYPES - One of the supertypes of an
+ * IType has changed
.
*
*
*
*
*
- * Move operations are indicated by other change flags, layered on top
- * of the change flags described above. If element A is moved to become B,
- * the delta for the change in A will have status REMOVED,
- * with change flag F_MOVED_TO. In this case,
- * getMovedToElement on delta A will return the handle for B.
- * The delta for B will have status ADDED, with change flag
- * F_MOVED_FROM, and getMovedFromElement on delta
- * B will return the handle for A. (Note, the handle to A in this case represents
- * an element that no longer exists).
+ * Move operations are indicated by other change flags, layered on top of the
+ * change flags described above. If element A is moved to become B, the delta
+ * for the change in A will have status REMOVED, with change
+ * flag F_MOVED_TO. In this case, getMovedToElement
+ * on delta A will return the handle for B. The delta for B will have status
+ * ADDED, with change flag F_MOVED_FROM, and
+ * getMovedFromElement on delta B will return the handle for A.
+ * (Note, the handle to A in this case represents an element that no longer
+ * exists).
*
*
- * Note that the move change flags only describe the changes to a single element, they
- * do not imply anything about the parent or children of the element.
+ * Note that the move change flags only describe the changes to a single
+ * element, they do not imply anything about the parent or children of the
+ * element.
*
*
- * The F_ADDED_TO_CLASSPATH, F_REMOVED_FROM_CLASSPATH and
- * F_CLASSPATH_REORDER flags are triggered by changes to a project's classpath. They do not mean that
- * the underlying resource was added, removed or changed. For example, if a project P already contains a folder src, then
- * adding a classpath entry with the 'P/src' path to the project's classpath will result in an IJavaElementDelta
- * with the F_ADDED_TO_CLASSPATH flag for the IPackageFragmentRoot P/src.
- * On the contrary, if a resource is physically added, removed or changed and this resource corresponds to a classpath
- * entry of the project, then an IJavaElementDelta with the ADDED,
+ * The F_ADDED_TO_CLASSPATH,
+ * F_REMOVED_FROM_CLASSPATH and F_CLASSPATH_REORDER
+ * flags are triggered by changes to a project's classpath. They do not mean
+ * that the underlying resource was added, removed or changed. For example, if a
+ * project P already contains a folder src, then adding a classpath entry with
+ * the 'P/src' path to the project's classpath will result in an
+ * IJavaElementDelta with the F_ADDED_TO_CLASSPATH
+ * flag for the IPackageFragmentRoot P/src. On the contrary, if a
+ * resource is physically added, removed or changed and this resource
+ * corresponds to a classpath entry of the project, then an
+ * IJavaElementDelta with the ADDED,
* REMOVED, or CHANGED kind will be fired.
*
*
- * Note that when a source attachment path or a source attachment root path is changed, then the flags of the delta contain
- * both F_SOURCEATTACHED and F_SOURCEDETTACHED.
+ * Note that when a source attachment path or a source attachment root path is
+ * changed, then the flags of the delta contain both
+ * F_SOURCEATTACHED and F_SOURCEDETTACHED.
*
*
- * No assumptions should be made on whether the java element delta tree is rooted at the IJavaModel
- * level or not.
+ * No assumptions should be made on whether the java element delta tree is
+ * rooted at the IJavaModel level or not.
*
*
- * IJavaElementDelta object are not valid outside the dynamic scope
- * of the notification.
+ * IJavaElementDelta object are not valid outside the dynamic
+ * scope of the notification.
*
*
* This interface is not intended to be implemented by clients.
@@ -105,226 +123,251 @@ import org.eclipse.core.resources.IResourceDelta;
public interface IJavaElementDelta {
/**
- * Status constant indicating that the element has been added.
- * Note that an added java element delta has no children, as they are all implicitely added.
+ * Status constant indicating that the element has been added. Note that an
+ * added java element delta has no children, as they are all implicitely
+ * added.
*/
public int ADDED = 1;
/**
- * Status constant indicating that the element has been removed.
- * Note that a removed java element delta has no children, as they are all implicitely removed.
+ * Status constant indicating that the element has been removed. Note that a
+ * removed java element delta has no children, as they are all implicitely
+ * removed.
*/
public int REMOVED = 2;
/**
- * Status constant indicating that the element has been changed,
- * as described by the change flags.
+ * Status constant indicating that the element has been changed, as
+ * described by the change flags.
*
* @see #getFlags
*/
public int CHANGED = 4;
/**
- * Change flag indicating that the content of the element has changed.
- * This flag is only valid for elements which correspond to files.
+ * Change flag indicating that the content of the element has changed. This
+ * flag is only valid for elements which correspond to files.
*/
public int F_CONTENT = 0x0001;
/**
* Change flag indicating that the modifiers of the element have changed.
- * This flag is only valid if the element is an IMember.
+ * This flag is only valid if the element is an IMember.
*/
public int F_MODIFIERS = 0x0002;
/**
- * Change flag indicating that there are changes to the children of the element.
- * This flag is only valid if the element is an IParent.
+ * Change flag indicating that there are changes to the children of the
+ * element. This flag is only valid if the element is an
+ * IParent.
*/
public int F_CHILDREN = 0x0008;
/**
* Change flag indicating that the element was moved from another location.
- * The location of the old element can be retrieved using getMovedFromElement.
+ * The location of the old element can be retrieved using
+ * getMovedFromElement.
*/
public int F_MOVED_FROM = 0x0010;
/**
* Change flag indicating that the element was moved to another location.
- * The location of the new element can be retrieved using getMovedToElement.
+ * The location of the new element can be retrieved using
+ * getMovedToElement.
*/
public int F_MOVED_TO = 0x0020;
/**
- * Change flag indicating that a classpath entry corresponding to the element has been added to the project's classpath.
- * This flag is only valid if the element is an IPackageFragmentRoot.
+ * Change flag indicating that a classpath entry corresponding to the
+ * element has been added to the project's classpath. This flag is only
+ * valid if the element is an IPackageFragmentRoot.
*/
public int F_ADDED_TO_CLASSPATH = 0x0040;
/**
- * Change flag indicating that a classpath entry corresponding to the element has been removed from the project's
- * classpath. This flag is only valid if the element is an IPackageFragmentRoot.
+ * Change flag indicating that a classpath entry corresponding to the
+ * element has been removed from the project's classpath. This flag is only
+ * valid if the element is an IPackageFragmentRoot.
*/
public int F_REMOVED_FROM_CLASSPATH = 0x0080;
/**
- * Change flag indicating that a classpath entry corresponding to the element has changed position in the project's
- * classpath. This flag is only valid if the element is an IPackageFragmentRoot.
+ * Change flag indicating that a classpath entry corresponding to the
+ * element has changed position in the project's classpath. This flag is
+ * only valid if the element is an IPackageFragmentRoot.
+ *
* @deprecated Use F_REORDER instead.
*/
public int F_CLASSPATH_REORDER = 0x0100;
+
/**
- * Change flag indicating that the element has changed position relatively to its siblings.
- * If the element is an IPackageFragmentRoot, a classpath entry corresponding
- * to the element has changed position in the project's classpath.
+ * Change flag indicating that the element has changed position relatively
+ * to its siblings. If the element is an IPackageFragmentRoot,
+ * a classpath entry corresponding to the element has changed position in
+ * the project's classpath.
*
* @since 2.1
*/
public int F_REORDER = 0x0100;
/**
- * Change flag indicating that the underlying IProject has been
- * opened. This flag is only valid if the element is an IJavaProject.
+ * Change flag indicating that the underlying IProject has
+ * been opened. This flag is only valid if the element is an
+ * IJavaProject.
*/
public int F_OPENED = 0x0200;
/**
- * Change flag indicating that the underlying IProject has been
- * closed. This flag is only valid if the element is an IJavaProject.
+ * Change flag indicating that the underlying IProject has
+ * been closed. This flag is only valid if the element is an
+ * IJavaProject.
*/
public int F_CLOSED = 0x0400;
/**
- * Change flag indicating that one of the supertypes of an IType
- * has changed.
+ * Change flag indicating that one of the supertypes of an
+ * IType has changed.
*/
public int F_SUPER_TYPES = 0x0800;
/**
- * Change flag indicating that the source attachment path or the source attachment root path of a classpath entry
- * corresponding to the element was added. This flag is only valid if the element is an
+ * Change flag indicating that the source attachment path or the source
+ * attachment root path of a classpath entry corresponding to the element
+ * was added. This flag is only valid if the element is an
* IPackageFragmentRoot.
*/
- public int F_SOURCEATTACHED = 0x1000;
+ public int F_SOURCEATTACHED = 0x1000;
/**
- * Change flag indicating that the source attachment path or the source attachment root path of a classpath entry
- * corresponding to the element was removed. This flag is only valid if the element is an
+ * Change flag indicating that the source attachment path or the source
+ * attachment root path of a classpath entry corresponding to the element
+ * was removed. This flag is only valid if the element is an
* IPackageFragmentRoot.
*/
- public int F_SOURCEDETACHED = 0x2000;
-
+ public int F_SOURCEDETACHED = 0x2000;
+
/**
- * Change flag indicating that this is a fine-grained delta, that is, an analysis down
- * to the members level was done to determine if there were structural changes to
- * members.
+ * Change flag indicating that this is a fine-grained delta, that is, an
+ * analysis down to the members level was done to determine if there were
+ * structural changes to members.
*
- * Clients can use this flag to find out if a compilation unit
- * that have a F_CONTENT change should assume that there are
- * no finer grained changes (F_FINE_GRAINED is set) or if
- * finer grained changes were not considered (F_FINE_GRAINED
- * is not set).
- *
- * @since 2.0
+ * Clients can use this flag to find out if a compilation unit that have a
+ * F_CONTENT change should assume that there are no finer
+ * grained changes (F_FINE_GRAINED is set) or if finer
+ * grained changes were not considered (F_FINE_GRAINED is
+ * not set).
+ *
+ * @since 2.0
*/
public int F_FINE_GRAINED = 0x4000;
/**
- * Change flag indicating that the element's archive content on the classpath has changed.
- * This flag is only valid if the element is an IPackageFragmentRoot
- * which is an archive.
+ * Change flag indicating that the element's archive content on the
+ * classpath has changed. This flag is only valid if the element is an
+ * IPackageFragmentRoot which is an archive.
*
* @see IPackageFragmentRoot#isArchive
* @since 2.0
*/
public int F_ARCHIVE_CONTENT_CHANGED = 0x8000;
+
/**
- * Change flag indicating that a compilation unit has become a primary working copy, or that a
- * primary working copy has reverted to a compilation unit.
- * This flag is only valid if the element is an ICompilationUnit.
+ * Change flag indicating that a compilation unit has become a primary
+ * working copy, or that a primary working copy has reverted to a
+ * compilation unit. This flag is only valid if the element is an
+ * ICompilationUnit.
*
* @since 3.0
*/
public int F_PRIMARY_WORKING_COPY = 0x10000;
-
+
/**
- * Change flag indicating that the raw classpath (or the output folder) of a project has changed.
- * This flag is only valid if the element is an IJavaProject.
- *
+ * Change flag indicating that the raw classpath (or the output folder) of a
+ * project has changed. This flag is only valid if the element is an
+ * IJavaProject.
+ *
* @since 3.0
*/
public int F_CLASSPATH_CHANGED = 0x20000;
/**
- * Change flag indicating that the resource of a primary compilation unit has changed.
- * This flag is only valid if the element is a primary ICompilationUnit.
+ * Change flag indicating that the resource of a primary compilation unit
+ * has changed. This flag is only valid if the element is a primary
+ * ICompilationUnit.
*
* @since 3.0
*/
public int F_PRIMARY_RESOURCE = 0x40000;
+
/**
* Returns deltas for the children that have been added.
+ *
* @return deltas for the children that have been added
*/
public IJavaElementDelta[] getAddedChildren();
/**
* Returns deltas for the affected (added, removed, or changed) children.
+ *
* @return deltas for the affected (added, removed, or changed) children
*/
public IJavaElementDelta[] getAffectedChildren();
/**
* Returns deltas for the children which have changed.
+ *
* @return deltas for the children which have changed
*/
public IJavaElementDelta[] getChangedChildren();
/**
* Returns the element that this delta describes a change to.
+ *
* @return the element that this delta describes a change to
*/
public IJavaElement getElement();
/**
- * Returns flags that describe how an element has changed.
- * Such flags should be tested using the & operand. For example:
+ * Returns flags that describe how an element has changed. Such flags should
+ * be tested using the & operand. For example:
+ *
*
- * if ((delta.getFlags() & IJavaElementDelta.F_CONTENT) != 0) {
+ * if ((delta.getFlags() & IJavaElementDelta.F_CONTENT) != 0) {
* // the delta indicates a content change
* }
*
- *
+ *
* @return flags that describe how an element has changed
*/
public int getFlags();
/**
- * Returns the kind of this delta - one of ADDED, REMOVED,
- * or CHANGED.
+ * Returns the kind of this delta - one of ADDED,
+ * REMOVED, or CHANGED.
*
* @return the kind of this delta
*/
public int getKind();
/**
- * Returns an element describing this element before it was moved
- * to its current location, or null if the
- * F_MOVED_FROM change flag is not set.
+ * Returns an element describing this element before it was moved to its
+ * current location, or null if the F_MOVED_FROM
+ * change flag is not set.
*
- * @return an element describing this element before it was moved
- * to its current location, or null if the
- * F_MOVED_FROM change flag is not set
+ * @return an element describing this element before it was moved to its
+ * current location, or null if the
+ * F_MOVED_FROM change flag is not set
*/
public IJavaElement getMovedFromElement();
/**
- * Returns an element describing this element in its new location,
- * or null if the F_MOVED_TO change
- * flag is not set.
+ * Returns an element describing this element in its new location, or
+ * null if the F_MOVED_TO change flag is not
+ * set.
*
- * @return an element describing this element in its new location,
- * or null if the F_MOVED_TO change
- * flag is not set
+ * @return an element describing this element in its new location, or
+ * null if the F_MOVED_TO change flag
+ * is not set
*/
public IJavaElement getMovedToElement();
@@ -338,11 +381,11 @@ public interface IJavaElementDelta {
/**
* Returns the collection of resource deltas.
*
- * Note that resource deltas, like Java element deltas, are generally only valid
- * for the dynamic scope of an event notification. Clients must not hang on to
- * these objects.
+ * Note that resource deltas, like Java element deltas, are generally only
+ * valid for the dynamic scope of an event notification. Clients must not
+ * hang on to these objects.
*
- *
+ *
* @return the underlying resource deltas, or null if none
*/
public IResourceDelta[] getResourceDeltas();
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModel.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModel.java
index f8cf1d8..b19805f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModel.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModel.java
@@ -15,242 +15,318 @@ import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.IProgressMonitor;
/**
- * Represent the root Java element corresponding to the workspace.
- * Since there is only one such root element, it is commonly referred to as
- * the Java model element.
- * The Java model element needs to be opened before it can be navigated or manipulated.
- * The Java model element has no parent (it is the root of the Java element
- * hierarchy). Its children are IJavaProjects.
+ * Represent the root Java element corresponding to the workspace. Since there
+ * is only one such root element, it is commonly referred to as the
+ * Java model element. The Java model element needs to be opened before it can
+ * be navigated or manipulated. The Java model element has no parent (it is the
+ * root of the Java element hierarchy). Its children are
+ * IJavaProjects.
*
- * This interface provides methods for performing copy, move, rename, and
- * delete operations on multiple Java elements.
+ * This interface provides methods for performing copy, move, rename, and delete
+ * operations on multiple Java elements.
*
*
- * This interface is not intended to be implemented by clients. An instance
- * of one of these handles can be created via
+ * This interface is not intended to be implemented by clients. An instance of
+ * one of these handles can be created via
* JavaCore.create(workspace.getRoot()).
*
- *
+ *
* @see JavaCore#create(org.eclipse.core.resources.IWorkspaceRoot)
*/
public interface IJavaModel extends IJavaElement, IOpenable, IParent {
-/**
- * Returns whether this Java model contains an IJavaElement whose
- * resource is the given resource or a non-Java resource which is the given resource.
- *
- * Note: no existency check is performed on the argument resource. If it is not accessible
- * (see IResource.isAccessible()) yet but would be located in Java model
- * range, then it will return true.
- *
- * If the resource is accessible, it can be reached by navigating the Java model down using the
- * getChildren() and/or getNonJavaResources() methods.
- *
- * @param resource the resource to check
- * @return true if the resource is accessible through the Java model
- * @since 2.1
- */
-boolean contains(IResource resource);
-/**
- * Copies the given elements to the specified container(s).
- * If one container is specified, all elements are copied to that
- * container. If more than one container is specified, the number of
- * elements and containers must match, and each element is copied to
- * its associated container.
- *
- * Optionally, each copy can positioned before a sibling
- * element. If null is specified for a given sibling, the copy
- * is inserted as the last child of its associated container.
- *
- *
- * Optionally, each copy can be renamed. If
- * null is specified for the new name, the copy
- * is not renamed.
- *
- *
- * Optionally, any existing child in the destination container with
- * the same name can be replaced by specifying true for
- * force. Otherwise an exception is thrown in the event that a name
- * collision occurs.
- *
- *
- * @param elements the elements to copy
- * @param containers the container, or list of containers
- * @param siblings the list of siblings element any of which may be
- * null; or null
- * @param renamings the list of new names any of which may be
- * null; or null
- * @param replace true if any existing child in a target container
- * with the target name should be replaced, and false to throw an
- * exception in the event of a name collision
- * @param monitor a progress monitor
- * @exception JavaModelException if an element could not be copied. Reasons include:
- *
- *
There is no element to process (NO_ELEMENTS_TO_PROCESS). The given elements is null or empty
- *
A specified element, container, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
A container is of an incompatible type (INVALID_DESTINATION)
- *
A sibling is not a child of it associated container (INVALID_SIBLING)
- *
A new name is invalid (INVALID_NAME)
- *
A child in its associated container already exists with the same
- * name and replace has been specified as false (NAME_COLLISION)
- *
A container or element is read-only (READ_ONLY)
- *
- */
-void copy(IJavaElement[] elements, IJavaElement[] containers, IJavaElement[] siblings, String[] renamings, boolean replace, IProgressMonitor monitor) throws JavaModelException;
-/**
- * Deletes the given elements, forcing the operation if necessary and specified.
- *
- * @param elements the elements to delete
- * @param force a flag controlling whether underlying resources that are not
- * in sync with the local file system will be tolerated
- * @param monitor a progress monitor
- * @exception JavaModelException if an element could not be deleted. Reasons include:
- *
- *
There is no element to process (NO_ELEMENTS_TO_PROCESS). The given elements is null or empty
- *
A specified element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
An element is read-only (READ_ONLY)
- *
- */
-void delete(IJavaElement[] elements, boolean force, IProgressMonitor monitor) throws JavaModelException;
-/**
- * Returns the Java project with the given name. This is a handle-only method.
- * The project may or may not exist.
- *
- * @return the Java project with the given name
- */
- IJavaProject getJavaProject(String name);
-/**
- * Returns the Java projects in this Java model, or an empty array if there
- * are none.
- *
- * @return the Java projects in this Java model, or an empty array if there
- * are none
- * @exception JavaModelException if this request fails.
- */
- IJavaProject[] getJavaProjects() throws JavaModelException;
-/**
- * Returns an array of non-Java resources (that is, non-Java projects) in
- * the workspace.
- *
- * Non-Java projects include all projects that are closed (even if they have the
- * Java nature).
- *
- *
- * @return an array of non-Java projects contained in the workspace.
- * @throws JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- * @since 2.1
- */
-//Object[] getNonJavaResources() throws JavaModelException;
-/**
- * Returns the workspace associated with this Java model.
- *
- * @return the workspace associated with this Java model
- */
-IWorkspace getWorkspace();
-/**
- * Moves the given elements to the specified container(s).
- * If one container is specified, all elements are moved to that
- * container. If more than one container is specified, the number of
- * elements and containers must match, and each element is moved to
- * its associated container.
- *
- * Optionally, each element can positioned before a sibling
- * element. If null is specified for sibling, the element
- * is inserted as the last child of its associated container.
- *
- *
- * Optionally, each element can be renamed. If
- * null is specified for the new name, the element
- * is not renamed.
- *
- *
- * Optionally, any existing child in the destination container with
- * the same name can be replaced by specifying true for
- * force. Otherwise an exception is thrown in the event that a name
- * collision occurs.
- *
- *
- * @param elements the elements to move
- * @param containers the container, or list of containers
- * @param siblings the list of siblings element any of which may be
- * null; or null
- * @param renamings the list of new names any of which may be
- * null; or null
- * @param replace true if any existing child in a target container
- * with the target name should be replaced, and false to throw an
- * exception in the event of a name collision
- * @param monitor a progress monitor
- * @exception JavaModelException if an element could not be moved. Reasons include:
- *
- *
There is no element to process (NO_ELEMENTS_TO_PROCESS). The given elements is null or empty
- *
A specified element, container, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
A container is of an incompatible type (INVALID_DESTINATION)
- *
A sibling is not a child of it associated container (INVALID_SIBLING)
- *
A new name is invalid (INVALID_NAME)
- *
A child in its associated container already exists with the same
- * name and replace has been specified as false (NAME_COLLISION)
- *
A container or element is read-only (READ_ONLY)
- *
- *
- * @exception IllegalArgumentException any element or container is null
- */
-void move(IJavaElement[] elements, IJavaElement[] containers, IJavaElement[] siblings, String[] renamings, boolean replace, IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Returns whether this Java model contains an IJavaElement
+ * whose resource is the given resource or a non-Java resource which is the
+ * given resource.
+ *
+ * Note: no existency check is performed on the argument resource. If it is
+ * not accessible (see IResource.isAccessible()) yet but
+ * would be located in Java model range, then it will return
+ * true.
+ *
+ *
+ * If the resource is accessible, it can be reached by navigating the Java
+ * model down using the getChildren() and/or
+ * getNonJavaResources() methods.
+ *
+ *
+ * @param resource
+ * the resource to check
+ * @return true if the resource is accessible through the Java model
+ * @since 2.1
+ */
+ boolean contains(IResource resource);
-/**
- * Triggers an update of the JavaModel with respect to the referenced external archives.
- * This operation will issue a JavaModel delta describing the discovered changes, in term
- * of Java element package fragment roots added, removed or changed.
- * Note that a collection of elements can be passed so as to narrow the set of archives
- * to refresh (passing null along is equivalent to refreshing the entire mode).
- * The elements can be:
- *
- *
package fragment roots corresponding to external archives
- *
Java projects, which referenced external archives will be refreshed
- *
Java model, all referenced external archives will be refreshed.
- *
- *
In case an archive is used by multiple projects, the delta issued will account for
- * all of them. This means that even if a project was not part of the elements scope, it
- * may still be notified of changes if it is referencing a library comprised in the scope.
- *
- * @param elementsScope - a collection of elements defining the scope of the refresh
- * @param monitor - a progress monitor used to report progress
- * @exception JavaModelException in one of the corresponding situation:
- *
- *
an exception occurs while accessing project resources
- *
- *
- * @see IJavaElementDelta
- * @since 2.0
- */
-//void refreshExternalArchives(IJavaElement[] elementsScope, IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Copies the given elements to the specified container(s). If one container
+ * is specified, all elements are copied to that container. If more than one
+ * container is specified, the number of elements and containers must match,
+ * and each element is copied to its associated container.
+ *
+ * Optionally, each copy can positioned before a sibling element. If
+ * null is specified for a given sibling, the copy is
+ * inserted as the last child of its associated container.
+ *
+ *
+ * Optionally, each copy can be renamed. If null is specified
+ * for the new name, the copy is not renamed.
+ *
+ *
+ * Optionally, any existing child in the destination container with the same
+ * name can be replaced by specifying true for force.
+ * Otherwise an exception is thrown in the event that a name collision
+ * occurs.
+ *
+ *
+ * @param elements
+ * the elements to copy
+ * @param containers
+ * the container, or list of containers
+ * @param siblings
+ * the list of siblings element any of which may be
+ * null; or null
+ * @param renamings
+ * the list of new names any of which may be null;
+ * or null
+ * @param replace
+ * true if any existing child in a target
+ * container with the target name should be replaced, and
+ * false to throw an exception in the event of a
+ * name collision
+ * @param monitor
+ * a progress monitor
+ * @exception JavaModelException
+ * if an element could not be copied. Reasons include:
+ *
+ *
There is no element to process
+ * (NO_ELEMENTS_TO_PROCESS). The given elements is null or
+ * empty
+ *
A specified element, container, or sibling does not
+ * exist (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
A container is of an incompatible type (INVALID_DESTINATION)
+ *
A sibling is not a child of it associated container (INVALID_SIBLING)
+ *
A new name is invalid (INVALID_NAME)
+ *
A child in its associated container already exists
+ * with the same name and replace has been
+ * specified as false (NAME_COLLISION)
+ *
A container or element is read-only (READ_ONLY)
+ *
+ *
+ */
+ void copy(IJavaElement[] elements, IJavaElement[] containers,
+ IJavaElement[] siblings, String[] renamings, boolean replace,
+ IProgressMonitor monitor) throws JavaModelException;
-/**
- * Renames the given elements as specified.
- * If one container is specified, all elements are renamed within that
- * container. If more than one container is specified, the number of
- * elements and containers must match, and each element is renamed within
- * its associated container.
- *
- * @param elements the elements to rename
- * @param destinations the container, or list of containers
- * @param names the list of new names
- * @param replace true if an existing child in a target container
- * with the target name should be replaced, and false to throw an
- * exception in the event of a name collision
- * @param monitor a progress monitor
- * @exception JavaModelException if an element could not be renamed. Reasons include:
- *
- *
There is no element to process (NO_ELEMENTS_TO_PROCESS). The given elements is null or empty
- *
A specified element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
A new name is invalid (INVALID_NAME)
- *
A child already exists with the same name and replace has been specified as false (NAME_COLLISION)
- *
An element is read-only (READ_ONLY)
- *
- */
-void rename(IJavaElement[] elements, IJavaElement[] destinations, String[] names, boolean replace, IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Deletes the given elements, forcing the operation if necessary and
+ * specified.
+ *
+ * @param elements
+ * the elements to delete
+ * @param force
+ * a flag controlling whether underlying resources that are not
+ * in sync with the local file system will be tolerated
+ * @param monitor
+ * a progress monitor
+ * @exception JavaModelException
+ * if an element could not be deleted. Reasons include:
+ *
+ *
There is no element to process
+ * (NO_ELEMENTS_TO_PROCESS). The given elements is null or
+ * empty
+ *
A specified element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
An element is read-only (READ_ONLY)
+ *
+ *
+ */
+ void delete(IJavaElement[] elements, boolean force, IProgressMonitor monitor)
+ throws JavaModelException;
+
+ /**
+ * Returns the Java project with the given name. This is a handle-only
+ * method. The project may or may not exist.
+ *
+ * @return the Java project with the given name
+ */
+ IJavaProject getJavaProject(String name);
+
+ /**
+ * Returns the Java projects in this Java model, or an empty array if there
+ * are none.
+ *
+ * @return the Java projects in this Java model, or an empty array if there
+ * are none
+ * @exception JavaModelException
+ * if this request fails.
+ */
+ IJavaProject[] getJavaProjects() throws JavaModelException;
+
+ /**
+ * Returns an array of non-Java resources (that is, non-Java projects) in
+ * the workspace.
+ *
+ * Non-Java projects include all projects that are closed (even if they have
+ * the Java nature).
+ *
+ *
+ * @return an array of non-Java projects contained in the workspace.
+ * @throws JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ * @since 2.1
+ */
+ // Object[] getNonJavaResources() throws JavaModelException;
+ /**
+ * Returns the workspace associated with this Java model.
+ *
+ * @return the workspace associated with this Java model
+ */
+ IWorkspace getWorkspace();
+
+ /**
+ * Moves the given elements to the specified container(s). If one container
+ * is specified, all elements are moved to that container. If more than one
+ * container is specified, the number of elements and containers must match,
+ * and each element is moved to its associated container.
+ *
+ * Optionally, each element can positioned before a sibling element. If
+ * null is specified for sibling, the element is inserted as
+ * the last child of its associated container.
+ *
+ *
+ * Optionally, each element can be renamed. If null is
+ * specified for the new name, the element is not renamed.
+ *
+ *
+ * Optionally, any existing child in the destination container with the same
+ * name can be replaced by specifying true for force.
+ * Otherwise an exception is thrown in the event that a name collision
+ * occurs.
+ *
+ *
+ * @param elements
+ * the elements to move
+ * @param containers
+ * the container, or list of containers
+ * @param siblings
+ * the list of siblings element any of which may be
+ * null; or null
+ * @param renamings
+ * the list of new names any of which may be null;
+ * or null
+ * @param replace
+ * true if any existing child in a target
+ * container with the target name should be replaced, and
+ * false to throw an exception in the event of a
+ * name collision
+ * @param monitor
+ * a progress monitor
+ * @exception JavaModelException
+ * if an element could not be moved. Reasons include:
+ *
+ *
There is no element to process
+ * (NO_ELEMENTS_TO_PROCESS). The given elements is null or
+ * empty
+ *
A specified element, container, or sibling does not
+ * exist (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
A container is of an incompatible type (INVALID_DESTINATION)
+ *
A sibling is not a child of it associated container (INVALID_SIBLING)
+ *
A new name is invalid (INVALID_NAME)
+ *
A child in its associated container already exists
+ * with the same name and replace has been
+ * specified as false (NAME_COLLISION)
+ *
A container or element is read-only (READ_ONLY)
+ *
+ *
+ *
+ * @exception IllegalArgumentException
+ * any element or container is null
+ */
+ void move(IJavaElement[] elements, IJavaElement[] containers,
+ IJavaElement[] siblings, String[] renamings, boolean replace,
+ IProgressMonitor monitor) throws JavaModelException;
+
+ /**
+ * Triggers an update of the JavaModel with respect to the referenced
+ * external archives. This operation will issue a JavaModel delta describing
+ * the discovered changes, in term of Java element package fragment roots
+ * added, removed or changed. Note that a collection of elements can be
+ * passed so as to narrow the set of archives to refresh (passing
+ * null along is equivalent to refreshing the entire mode).
+ * The elements can be:
+ *
+ *
package fragment roots corresponding to external archives
+ *
Java projects, which referenced external archives will be refreshed
+ *
Java model, all referenced external archives will be refreshed.
+ *
+ *
+ * In case an archive is used by multiple projects, the delta issued will
+ * account for all of them. This means that even if a project was not part
+ * of the elements scope, it may still be notified of changes if it is
+ * referencing a library comprised in the scope.
+ *
+ *
+ * @param elementsScope -
+ * a collection of elements defining the scope of the refresh
+ * @param monitor -
+ * a progress monitor used to report progress
+ * @exception JavaModelException
+ * in one of the corresponding situation:
+ *
+ *
an exception occurs while accessing project resources
+ *
+ *
+ *
+ * @see IJavaElementDelta
+ * @since 2.0
+ */
+ // void refreshExternalArchives(IJavaElement[] elementsScope,
+ // IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Renames the given elements as specified. If one container is specified,
+ * all elements are renamed within that container. If more than one
+ * container is specified, the number of elements and containers must match,
+ * and each element is renamed within its associated container.
+ *
+ * @param elements
+ * the elements to rename
+ * @param destinations
+ * the container, or list of containers
+ * @param names
+ * the list of new names
+ * @param replace
+ * true if an existing child in a target container
+ * with the target name should be replaced, and
+ * false to throw an exception in the event of a
+ * name collision
+ * @param monitor
+ * a progress monitor
+ * @exception JavaModelException
+ * if an element could not be renamed. Reasons include:
+ *
+ *
There is no element to process
+ * (NO_ELEMENTS_TO_PROCESS). The given elements is null or
+ * empty
+ *
A specified element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
A new name is invalid (INVALID_NAME)
+ *
A child already exists with the same name and
+ * replace has been specified as
+ * false (NAME_COLLISION)
+ *
@@ -21,74 +20,81 @@ package net.sourceforge.phpdt.core;
public interface IJavaModelMarker {
/**
- * Java model problem marker type (value "net.sourceforge.phpdt.core.problem").
- * This can be used to recognize those markers in the workspace that flag problems
- * detected by the Java tooling during compilation.
+ * Java model problem marker type (value
+ * "net.sourceforge.phpdt.core.problem"). This can be used
+ * to recognize those markers in the workspace that flag problems detected
+ * by the Java tooling during compilation.
*/
- public static final String JAVA_MODEL_PROBLEM_MARKER = JavaCore.PLUGIN_ID + ".problem"; //$NON-NLS-1$
-
+ public static final String JAVA_MODEL_PROBLEM_MARKER = JavaCore.PLUGIN_ID
+ + ".problem"; //$NON-NLS-1$
/**
- * Java model transient problem marker type (value "net.sourceforge.phpdt.core.transient_problem").
- * This can be used to recognize those markers in the workspace that flag transient
- * problems detected by the Java tooling (such as a problem
- * detected by the outliner, or a problem detected during a code completion)
+ * Java model transient problem marker type (value
+ * "net.sourceforge.phpdt.core.transient_problem"). This can
+ * be used to recognize those markers in the workspace that flag transient
+ * problems detected by the Java tooling (such as a problem detected by the
+ * outliner, or a problem detected during a code completion)
*/
- public static final String TRANSIENT_PROBLEM = JavaCore.PLUGIN_ID + ".transient_problem"; //$NON-NLS-1$
+ public static final String TRANSIENT_PROBLEM = JavaCore.PLUGIN_ID
+ + ".transient_problem"; //$NON-NLS-1$
/**
- * Java model task marker type (value "net.sourceforge.phpdt.core.task").
- * This can be used to recognize task markers in the workspace that correspond to tasks
- * specified in Java source comments and detected during compilation (for example, 'TO-DO: ...').
- * Tasks are identified by a task tag, which can be customized through PHPCore
- * option "net.sourceforge.phpdt.core.compiler.taskTag".
+ * Java model task marker type (value
+ * "net.sourceforge.phpdt.core.task"). This can be used to
+ * recognize task markers in the workspace that correspond to tasks
+ * specified in Java source comments and detected during compilation (for
+ * example, 'TO-DO: ...'). Tasks are identified by a task tag, which can be
+ * customized through PHPCore option
+ * "net.sourceforge.phpdt.core.compiler.taskTag".
+ *
* @since 2.1
*/
public static final String TASK_MARKER = JavaCore.PLUGIN_ID + ".task"; //$NON-NLS-1$
-
- /**
- * Id marker attribute (value "arguments").
- * Arguments are concatenated into one String, prefixed with an argument count (followed with colon
- * separator) and separated with '#' characters. For example:
- * { "foo", "bar" } is encoded as "2:foo#bar",
- * { } is encoded as "0: "
+ /**
+ * Id marker attribute (value "arguments"). Arguments are
+ * concatenated into one String, prefixed with an argument count (followed
+ * with colon separator) and separated with '#' characters. For example: {
+ * "foo", "bar" } is encoded as "2:foo#bar", { } is encoded as "0: "
+ *
* @since 2.0
*/
- public static final String ARGUMENTS = "arguments"; //$NON-NLS-1$
-
- /**
+ public static final String ARGUMENTS = "arguments"; //$NON-NLS-1$
+
+ /**
* Id marker attribute (value "id").
*/
- public static final String ID = "id"; //$NON-NLS-1$
+ public static final String ID = "id"; //$NON-NLS-1$
- /**
- * Flags marker attribute (value "flags").
- * Reserved for future use.
+ /**
+ * Flags marker attribute (value "flags"). Reserved for
+ * future use.
*/
- public static final String FLAGS = "flags"; //$NON-NLS-1$
+ public static final String FLAGS = "flags"; //$NON-NLS-1$
- /**
+ /**
* Cycle detected marker attribute (value "cycleDetected").
- * Used only on buildpath problem markers.
- * The value of this attribute is either "true" or "false".
+ * Used only on buildpath problem markers. The value of this attribute is
+ * either "true" or "false".
*/
- public static final String CYCLE_DETECTED = "cycleDetected"; //$NON-NLS-1$
+ public static final String CYCLE_DETECTED = "cycleDetected"; //$NON-NLS-1$
/**
- * Build path problem marker type (value "net.sourceforge.phpdt.core.buildpath_problem").
- * This can be used to recognize those markers in the workspace that flag problems
+ * Build path problem marker type (value
+ * "net.sourceforge.phpdt.core.buildpath_problem"). This can
+ * be used to recognize those markers in the workspace that flag problems
* detected by the Java tooling during classpath setting.
*/
- public static final String BUILDPATH_PROBLEM_MARKER = JavaCore.PLUGIN_ID + ".buildpath_problem"; //$NON-NLS-1$
-
- /**
- * Classpath file format marker attribute (value "classpathFileFormat").
- * Used only on buildpath problem markers.
- * The value of this attribute is either "true" or "false".
+ public static final String BUILDPATH_PROBLEM_MARKER = JavaCore.PLUGIN_ID
+ + ".buildpath_problem"; //$NON-NLS-1$
+
+ /**
+ * Classpath file format marker attribute (value
+ * "classpathFileFormat"). Used only on buildpath problem
+ * markers. The value of this attribute is either "true" or "false".
*
* @since 2.0
*/
- public static final String CLASSPATH_FILE_FORMAT = "classpathFileFormat"; //$NON-NLS-1$
-
+ public static final String CLASSPATH_FILE_FORMAT = "classpathFileFormat"; //$NON-NLS-1$
+
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java
index 6f55b0c..2df29b4 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatus.java
@@ -14,9 +14,8 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
/**
- * Represents the outcome of an Java model operation. Status objects are
- * used inside JavaModelException objects to indicate what went
- * wrong.
+ * Represents the outcome of an Java model operation. Status objects are used
+ * inside JavaModelException objects to indicate what went wrong.
*
* Java model status object are distinguished by their plug-in id:
* getPlugin returns "net.sourceforge.phpdt.core".
@@ -24,61 +23,63 @@ import org.eclipse.core.runtime.IStatus;
* IJavaModelStatusConstants.
*
*
- * A Java model status may also carry additional information (that is, in
+ * A Java model status may also carry additional information (that is, in
* addition to the information defined in IStatus):
*
- *
elements - optional handles to Java elements associated with the failure
- *
string - optional string associated with the failure
+ *
elements - optional handles to Java elements associated with the failure
+ *
string - optional string associated with the failure
*
*
* This interface is not intended to be implemented by clients.
*
- *
+ *
* @see org.eclipse.core.runtime.IStatus
* @see IJavaModelStatusConstants
*/
public interface IJavaModelStatus extends IStatus {
-/**
- * Returns any Java elements associated with the failure (see specification
- * of the status code), or an empty array if no elements are related to this
- * particular status code.
- *
- * @return the list of Java element culprits
- * @see IJavaModelStatusConstants
- */
-public IJavaElement[] getElements();
+ /**
+ * Returns any Java elements associated with the failure (see specification
+ * of the status code), or an empty array if no elements are related to this
+ * particular status code.
+ *
+ * @return the list of Java element culprits
+ * @see IJavaModelStatusConstants
+ */
+ public IJavaElement[] getElements();
-/**
- * Returns the path associated with the failure (see specification
- * of the status code), or null if the failure is not
- * one of DEVICE_PATH, INVALID_PATH,
- * PATH_OUTSIDE_PROJECT, or RELATIVE_PATH.
- *
- * @return the path that caused the failure, or null if none
- * @see IJavaModelStatusConstants#DEVICE_PATH
- * @see IJavaModelStatusConstants#INVALID_PATH
- * @see IJavaModelStatusConstants#PATH_OUTSIDE_PROJECT
- * @see IJavaModelStatusConstants#RELATIVE_PATH
- */
-IPath getPath();
-/**
- * Returns the string associated with the failure (see specification
- * of the status code), or null if no string is related to this
- * particular status code.
- *
- * @return the string culprit, or null if none
- * @see IJavaModelStatusConstants
- * @deprecated Use IStatus#getMessage instead
- */
-String getString();
-/**
- * Returns whether this status indicates that a Java model element does not exist.
- * This convenience method is equivalent to
- * getCode() == IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST.
- *
- * @return true if the status code indicates that a Java model
- * element does not exist
- * @see IJavaModelStatusConstants#ELEMENT_DOES_NOT_EXIST
- */
-boolean isDoesNotExist();
+ /**
+ * Returns the path associated with the failure (see specification of the
+ * status code), or null if the failure is not one of
+ * DEVICE_PATH, INVALID_PATH,
+ * PATH_OUTSIDE_PROJECT, or RELATIVE_PATH.
+ *
+ * @return the path that caused the failure, or null if none
+ * @see IJavaModelStatusConstants#DEVICE_PATH
+ * @see IJavaModelStatusConstants#INVALID_PATH
+ * @see IJavaModelStatusConstants#PATH_OUTSIDE_PROJECT
+ * @see IJavaModelStatusConstants#RELATIVE_PATH
+ */
+ IPath getPath();
+
+ /**
+ * Returns the string associated with the failure (see specification of the
+ * status code), or null if no string is related to this
+ * particular status code.
+ *
+ * @return the string culprit, or null if none
+ * @see IJavaModelStatusConstants
+ * @deprecated Use IStatus#getMessage instead
+ */
+ String getString();
+
+ /**
+ * Returns whether this status indicates that a Java model element does not
+ * exist. This convenience method is equivalent to
+ * getCode() == IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST.
+ *
+ * @return true if the status code indicates that a Java
+ * model element does not exist
+ * @see IJavaModelStatusConstants#ELEMENT_DOES_NOT_EXIST
+ */
+ boolean isDoesNotExist();
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java
index f31517d..d4b11a0 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelStatusConstants.java
@@ -16,15 +16,15 @@ package net.sourceforge.phpdt.core;
* This interface declares constants only; it is not intended to be implemented
* or extended.
*
- *
+ *
* @see IJavaModelStatus
* @see org.eclipse.core.runtime.IStatus#getCode()
*/
public interface IJavaModelStatusConstants {
/**
- * Status constant indicating that a container path was resolved
- * to invalid entries (null or container).
+ * Status constant indicating that a container path was resolved to invalid
+ * entries (null or container).
*
* @since 2.0
*/
@@ -45,166 +45,160 @@ public interface IJavaModelStatusConstants {
/**
* Status constant indicating that a variable path was not resolvable
- * indicating either the referred variable is undefined, unbound or the resolved
- * variable path does not correspond to an existing file or folder.
+ * indicating either the referred variable is undefined, unbound or the
+ * resolved variable path does not correspond to an existing file or folder.
*/
public static final int CP_VARIABLE_PATH_UNBOUND = 965;
/**
- * Status constant indicating a core exception occurred.
- * Use getException to retrieve a CoreException.
+ * Status constant indicating a core exception occurred. Use
+ * getException to retrieve a CoreException.
*/
public static final int CORE_EXCEPTION = 966;
-
+
/**
- * Status constant indicating one or more of the elements
- * supplied are not of a valid type for the operation to
- * process.
- * The element(s) can be retrieved using getElements on the status object.
+ * Status constant indicating one or more of the elements supplied are not
+ * of a valid type for the operation to process. The element(s) can be
+ * retrieved using getElements on the status object.
*/
public static final int INVALID_ELEMENT_TYPES = 967;
/**
- * Status constant indicating that no elements were
- * provided to the operation for processing.
+ * Status constant indicating that no elements were provided to the
+ * operation for processing.
*/
public static final int NO_ELEMENTS_TO_PROCESS = 968;
/**
- * Status constant indicating that one or more elements
- * supplied do not exist.
- * The element(s) can be retrieved using getElements on the status object.
- *
+ * Status constant indicating that one or more elements supplied do not
+ * exist. The element(s) can be retrieved using getElements
+ * on the status object.
+ *
* @see IJavaModelStatus#isDoesNotExist
*/
public static final int ELEMENT_DOES_NOT_EXIST = 969;
/**
- * Status constant indicating that a null path was
- * supplied to the operation.
+ * Status constant indicating that a null path was supplied
+ * to the operation.
*/
public static final int NULL_PATH = 970;
-
+
/**
- * Status constant indicating that a path outside of the
- * project was supplied to the operation. The path can be retrieved using
+ * Status constant indicating that a path outside of the project was
+ * supplied to the operation. The path can be retrieved using
* getPath on the status object.
*/
public static final int PATH_OUTSIDE_PROJECT = 971;
-
+
/**
- * Status constant indicating that a relative path
- * was supplied to the operation when an absolute path is
- * required. The path can be retrieved using getPath on the
- * status object.
+ * Status constant indicating that a relative path was supplied to the
+ * operation when an absolute path is required. The path can be retrieved
+ * using getPath on the status object.
*/
public static final int RELATIVE_PATH = 972;
-
+
/**
- * Status constant indicating that a path specifying a device
- * was supplied to the operation when a path with no device is
- * required. The path can be retrieved using getPath on the
- * status object.
+ * Status constant indicating that a path specifying a device was supplied
+ * to the operation when a path with no device is required. The path can be
+ * retrieved using getPath on the status object.
*/
public static final int DEVICE_PATH = 973;
-
+
/**
- * Status constant indicating that a string
- * was supplied to the operation that was null.
+ * Status constant indicating that a string was supplied to the operation
+ * that was null.
*/
public static final int NULL_STRING = 974;
-
+
/**
- * Status constant indicating that the operation encountered
- * a read-only element.
- * The element(s) can be retrieved using getElements on the status object.
+ * Status constant indicating that the operation encountered a read-only
+ * element. The element(s) can be retrieved using getElements
+ * on the status object.
*/
public static final int READ_ONLY = 976;
-
+
/**
- * Status constant indicating that a naming collision would occur
- * if the operation proceeded.
+ * Status constant indicating that a naming collision would occur if the
+ * operation proceeded.
*/
public static final int NAME_COLLISION = 977;
-
+
/**
- * Status constant indicating that a destination provided for a copy/move/rename operation
- * is invalid.
- * The destination element can be retrieved using getElements on the status object.
+ * Status constant indicating that a destination provided for a
+ * copy/move/rename operation is invalid. The destination element can be
+ * retrieved using getElements on the status object.
*/
public static final int INVALID_DESTINATION = 978;
-
+
/**
- * Status constant indicating that a path provided to an operation
- * is invalid. The path can be retrieved using getPath on the
+ * Status constant indicating that a path provided to an operation is
+ * invalid. The path can be retrieved using getPath on the
* status object.
*/
public static final int INVALID_PATH = 979;
-
+
/**
* Status constant indicating the given source position is out of bounds.
*/
public static final int INDEX_OUT_OF_BOUNDS = 980;
-
+
/**
- * Status constant indicating there is an update conflict
- * for a working copy. The compilation unit on which the
- * working copy is based has changed since the working copy
- * was created.
+ * Status constant indicating there is an update conflict for a working
+ * copy. The compilation unit on which the working copy is based has changed
+ * since the working copy was created.
*/
public static final int UPDATE_CONFLICT = 981;
/**
- * Status constant indicating that null was specified
- * as a name argument.
+ * Status constant indicating that null was specified as a
+ * name argument.
*/
public static final int NULL_NAME = 982;
/**
- * Status constant indicating that a name provided is not syntactically correct.
- * The name can be retrieved from getString.
+ * Status constant indicating that a name provided is not syntactically
+ * correct. The name can be retrieved from getString.
*/
public static final int INVALID_NAME = 983;
/**
- * Status constant indicating that the specified contents
- * are not valid.
+ * Status constant indicating that the specified contents are not valid.
*/
public static final int INVALID_CONTENTS = 984;
/**
* Status constant indicating that an java.io.IOException
- * occurred.
+ * occurred.
*/
public static final int IO_EXCEPTION = 985;
/**
- * Status constant indicating that a DOMException
- * occurred.
+ * Status constant indicating that a DOMException occurred.
*/
public static final int DOM_EXCEPTION = 986;
/**
* Status constant indicating that a TargetException
- * occurred.
+ * occurred.
*/
public static final int TARGET_EXCEPTION = 987;
/**
- * Status constant indicating that the Java builder
- * could not be initialized.
+ * Status constant indicating that the Java builder could not be
+ * initialized.
*/
public static final int BUILDER_INITIALIZATION_ERROR = 990;
/**
- * Status constant indicating that the Java builder's last built state
- * could not be serialized or deserialized.
+ * Status constant indicating that the Java builder's last built state could
+ * not be serialized or deserialized.
*/
public static final int BUILDER_SERIALIZATION_ERROR = 991;
/**
- * Status constant indicating that an error was encountered while
- * trying to evaluate a code snippet, or other item.
+ * Status constant indicating that an error was encountered while trying to
+ * evaluate a code snippet, or other item.
*/
public static final int EVALUATION_ERROR = 992;
@@ -214,59 +208,65 @@ public interface IJavaModelStatusConstants {
public static final int INVALID_SIBLING = 993;
/**
- * Status indicating that a Java element could not be created because
- * the underlying resource is invalid.
+ * Status indicating that a Java element could not be created because the
+ * underlying resource is invalid.
+ *
* @see JavaCore
*/
- public static final int INVALID_RESOURCE = 995;
+ public static final int INVALID_RESOURCE = 995;
/**
- * Status indicating that a Java element could not be created because
- * the underlying resource is not of an appropriate type.
+ * Status indicating that a Java element could not be created because the
+ * underlying resource is not of an appropriate type.
+ *
* @see JavaCore
*/
- public static final int INVALID_RESOURCE_TYPE = 996;
+ public static final int INVALID_RESOURCE_TYPE = 996;
/**
- * Status indicating that a Java element could not be created because
- * the project owning underlying resource does not have the Java nature.
+ * Status indicating that a Java element could not be created because the
+ * project owning underlying resource does not have the Java nature.
+ *
* @see JavaCore
*/
- public static final int INVALID_PROJECT = 997;
+ public static final int INVALID_PROJECT = 997;
+
+ /**
+ * Status indicating that the package declaration in a
+ * ICompilationUnit does not correspond to the
+ * IPackageFragment it belongs to. The getString
+ * method of the associated status object gives the name of the package in
+ * which the ICompilationUnit is declared.
+ */
+ public static final int INVALID_PACKAGE = 998;
+
+ /**
+ * Status indicating that the corresponding resource has no local contents
+ * yet. This might happen when attempting to use a resource before its
+ * contents has been made locally available.
+ */
+ public static final int NO_LOCAL_CONTENTS = 999;
/**
- * Status indicating that the package declaration in a ICompilationUnit
- * does not correspond to the IPackageFragment it belongs to.
- * The getString method of the associated status object
- * gives the name of the package in which the ICompilationUnit is
- * declared.
+ * Status indicating that a .classpath file is ill-formed, and thus cannot
+ * be read/written successfully.
+ *
+ * @since 2.1
*/
- public static final int INVALID_PACKAGE = 998;
+ public static final int INVALID_CLASSPATH_FILE_FORMAT = 1000;
/**
- * Status indicating that the corresponding resource has no local contents yet.
- * This might happen when attempting to use a resource before its contents
- * has been made locally available.
+ * Status indicating that a project is involved in a build path cycle.
+ *
+ * @since 2.1
*/
- public static final int NO_LOCAL_CONTENTS = 999;
-
- /**
- * Status indicating that a .classpath file is ill-formed, and thus cannot
- * be read/written successfully.
- * @since 2.1
- */
- public static final int INVALID_CLASSPATH_FILE_FORMAT = 1000;
+ public static final int CLASSPATH_CYCLE = 1001;
- /**
- * Status indicating that a project is involved in a build path cycle.
- * @since 2.1
- */
- public static final int CLASSPATH_CYCLE = 1001;
-
/**
- * Status constant indicating that an exclusion pattern got specified
- * on a classpath source entry, though it was explicitely disabled
- * according to its project preference settings.
+ * Status constant indicating that an exclusion pattern got specified on a
+ * classpath source entry, though it was explicitely disabled according to
+ * its project preference settings.
+ *
* @see net.sourceforge.phpdt.core.IJavaProject#getOptions(boolean)
* @since 2.1
*/
@@ -274,16 +274,18 @@ public interface IJavaModelStatusConstants {
/**
* Status constant indicating that a specific output location got associated
- * with a source entry, though it was explicitely disabled according to its project
- * preference settings.
+ * with a source entry, though it was explicitely disabled according to its
+ * project preference settings.
+ *
* @see net.sourceforge.phpdt.core.IJavaProject#getOptions(boolean)
* @since 2.1
*/
public static final int DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS = 1003;
-
+
/**
* Status constant indicating that a compiler failure occurred.
+ *
* @since 3.0
*/
- public static final int COMPILER_FAILURE = 1005;
+ public static final int COMPILER_FAILURE = 1005;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaProject.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaProject.java
index 31ef9a2..4819bc7 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaProject.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaProject.java
@@ -21,34 +21,33 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-
/**
- * A Java project represents a view of a project resource in terms of Java
- * elements such as package fragments, types, methods and fields.
- * A project may contain several package roots, which contain package fragments.
- * A package root corresponds to an underlying folder or JAR.
+ * A Java project represents a view of a project resource in terms of Java
+ * elements such as package fragments, types, methods and fields. A project may
+ * contain several package roots, which contain package fragments. A package
+ * root corresponds to an underlying folder or JAR.
*
- * Each Java project has a classpath, defining which folders contain source code and
- * where required libraries are located. Each Java project also has an output location,
- * defining where the builder writes .class files. A project that
- * references packages in another project can access the packages by including
- * the required project in a classpath entry. The Java model will present the
- * source elements in the required project; when building, the compiler will use
- * the corresponding generated class files from the required project's output
- * location(s)). The classpath format is a sequence of classpath entries
- * describing the location and contents of package fragment roots.
+ * Each Java project has a classpath, defining which folders contain source code
+ * and where required libraries are located. Each Java project also has an
+ * output location, defining where the builder writes .class
+ * files. A project that references packages in another project can access the
+ * packages by including the required project in a classpath entry. The Java
+ * model will present the source elements in the required project; when
+ * building, the compiler will use the corresponding generated class files from
+ * the required project's output location(s)). The classpath format is a
+ * sequence of classpath entries describing the location and contents of package
+ * fragment roots.
*
- * Java project elements need to be opened before they can be navigated or manipulated.
- * The children of a Java project are the package fragment roots that are
- * defined by the classpath and contained in this project (in other words, it
- * does not include package fragment roots for other projects).
+ * Java project elements need to be opened before they can be navigated or
+ * manipulated. The children of a Java project are the package fragment roots
+ * that are defined by the classpath and contained in this project (in other
+ * words, it does not include package fragment roots for other projects).
*
*
- * This interface is not intended to be implemented by clients. An instance
- * of one of these handles can be created via
- * JavaCore.create(project).
+ * This interface is not intended to be implemented by clients. An instance of
+ * one of these handles can be created via JavaCore.create(project).
*
- *
+ *
* @see JavaCore#create(org.eclipse.core.resources.IProject)
* @see IClasspathEntry
*/
@@ -56,188 +55,214 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable {
/**
* Returns the IJavaElement corresponding to the given
- * classpath-relative path, or null if no such
+ * classpath-relative path, or null if no such
* IJavaElement is found. The result is one of an
* ICompilationUnit, IClassFile, or
- * IPackageFragment.
+ * IPackageFragment.
*
* When looking for a package fragment, there might be several potential
* matches; only one of them is returned.
- *
- *
For example, the path "java/lang/Object.java", would result in the
- * ICompilationUnit or IClassFile corresponding to
- * "java.lang.Object". The path "java/lang" would result in the
- * IPackageFragment for "java.lang".
- * @param path the given classpath-relative path
- * @exception JavaModelException if the given path is null
- * or absolute
+ *
+ *
+ * For example, the path "java/lang/Object.java", would result in the
+ * ICompilationUnit or IClassFile
+ * corresponding to "java.lang.Object". The path "java/lang" would result in
+ * the IPackageFragment for "java.lang".
+ *
+ * @param path
+ * the given classpath-relative path
+ * @exception JavaModelException
+ * if the given path is null or absolute
* @return the IJavaElement corresponding to the given
- * classpath-relative path, or null if no such
- * IJavaElement is found
+ * classpath-relative path, or null if no such
+ * IJavaElement is found
*/
IJavaElement findElement(IPath path) throws JavaModelException;
/**
* Returns the first existing package fragment on this project's classpath
- * whose path matches the given (absolute) path, or null if none
- * exist.
- * The path can be:
- * - internal to the workbench: "/Project/src"
- * - external to the workbench: "c:/jdk/classes.zip/java/lang"
- * @param path the given absolute path
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
+ * whose path matches the given (absolute) path, or null if
+ * none exist. The path can be: - internal to the workbench: "/Project/src" -
+ * external to the workbench: "c:/jdk/classes.zip/java/lang"
+ *
+ * @param path
+ * the given absolute path
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
* @return the first existing package fragment on this project's classpath
- * whose path matches the given (absolute) path, or null if none
- * exist
+ * whose path matches the given (absolute) path, or
+ * null if none exist
*/
-// IPackageFragment findPackageFragment(IPath path) throws JavaModelException;
-
+ // IPackageFragment findPackageFragment(IPath path) throws
+ // JavaModelException;
/**
* Returns the existing package fragment root on this project's classpath
* whose path matches the given (absolute) path, or null if
- * one does not exist.
- * The path can be:
- * - internal to the workbench: "/Compiler/src"
- * - external to the workbench: "c:/jdk/classes.zip"
- * @param path the given absolute path
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
+ * one does not exist. The path can be: - internal to the workbench:
+ * "/Compiler/src" - external to the workbench: "c:/jdk/classes.zip"
+ *
+ * @param path
+ * the given absolute path
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
* @return the existing package fragment root on this project's classpath
- * whose path matches the given (absolute) path, or null if
- * one does not exist
+ * whose path matches the given (absolute) path, or
+ * null if one does not exist
*/
IPackageFragmentRoot findPackageFragmentRoot(IPath path)
- throws JavaModelException;
+ throws JavaModelException;
+
/**
- * Returns the existing package fragment roots identified by the given entry.
- * Note that a classpath entry that refers to another project may
- * have more than one root (if that project has more than on root
- * containing source), and classpath entries within the current
- * project identify a single root.
+ * Returns the existing package fragment roots identified by the given
+ * entry. Note that a classpath entry that refers to another project may
+ * have more than one root (if that project has more than on root containing
+ * source), and classpath entries within the current project identify a
+ * single root.
*
* If the classpath entry denotes a variable, it will be resolved and return
* the roots of the target entry (empty if not resolvable).
*
- * If the classpath entry denotes a container, it will be resolved and return
- * the roots corresponding to the set of container entries (empty if not resolvable).
+ * If the classpath entry denotes a container, it will be resolved and
+ * return the roots corresponding to the set of container entries (empty if
+ * not resolvable).
*
- * @param entry the given entry
+ * @param entry
+ * the given entry
* @return the existing package fragment roots identified by the given entry
* @see IClasspathContainer
* @since 2.1
*/
IPackageFragmentRoot[] findPackageFragmentRoots(IClasspathEntry entry);
+
/**
- * Returns the first type found following this project's classpath
- * with the given fully qualified name or null if none is found.
- * The fully qualified name is a dot-separated name. For example,
- * a class B defined as a member type of a class A in package x.y should have a
- * the fully qualified name "x.y.A.B".
+ * Returns the first type found following this project's classpath with the
+ * given fully qualified name or null if none is found. The
+ * fully qualified name is a dot-separated name. For example, a class B
+ * defined as a member type of a class A in package x.y should have a the
+ * fully qualified name "x.y.A.B".
*
* Note that in order to be found, a type name (or its toplevel enclosing
- * type name) must match its corresponding compilation unit name. As a
+ * type name) must match its corresponding compilation unit name. As a
* consequence, secondary types cannot be found using this functionality.
- * Secondary types can however be explicitely accessed through their enclosing
- * unit or found by the SearchEngine.
- *
- * @param fullyQualifiedName the given fully qualified name
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- * @return the first type found following this project's classpath
- * with the given fully qualified name or null if none is found
+ * Secondary types can however be explicitely accessed through their
+ * enclosing unit or found by the SearchEngine.
+ *
+ * @param fullyQualifiedName
+ * the given fully qualified name
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ * @return the first type found following this project's classpath with the
+ * given fully qualified name or null if none is
+ * found
* @see IType#getFullyQualifiedName(char)
* @since 2.0
*/
-// IType findType(String fullyQualifiedName) throws JavaModelException;
+ // IType findType(String fullyQualifiedName) throws JavaModelException;
/**
- * Returns the first type found following this project's classpath
- * with the given package name and type qualified name
- * or null if none is found.
- * The package name is a dot-separated name.
- * The type qualified name is also a dot-separated name. For example,
- * a class B defined as a member type of a class A should have the
- * type qualified name "A.B".
+ * Returns the first type found following this project's classpath with the
+ * given package name and type qualified name or null if none
+ * is found. The package name is a dot-separated name. The type qualified
+ * name is also a dot-separated name. For example, a class B defined as a
+ * member type of a class A should have the type qualified name "A.B".
*
* Note that in order to be found, a type name (or its toplevel enclosing
- * type name) must match its corresponding compilation unit name. As a
+ * type name) must match its corresponding compilation unit name. As a
* consequence, secondary types cannot be found using this functionality.
- * Secondary types can however be explicitely accessed through their enclosing
- * unit or found by the SearchEngine.
- *
- * @param packageName the given package name
- * @param typeQualifiedName the given type qualified name
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- * @return the first type found following this project's classpath
- * with the given package name and type qualified name
- * or null if none is found
+ * Secondary types can however be explicitely accessed through their
+ * enclosing unit or found by the SearchEngine.
+ *
+ * @param packageName
+ * the given package name
+ * @param typeQualifiedName
+ * the given type qualified name
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ * @return the first type found following this project's classpath with the
+ * given package name and type qualified name or null
+ * if none is found
* @see IType#getTypeQualifiedName(char)
-
+ *
* @since 2.0
*/
-// IType findType(String packageName, String typeQualifiedName) throws JavaModelException;
-
+ // IType findType(String packageName, String typeQualifiedName) throws
+ // JavaModelException;
/**
- * Returns all of the existing package fragment roots that exist
- * on the classpath, in the order they are defined by the classpath.
- *
- * @return all of the existing package fragment roots that exist
- * on the classpath
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
+ * Returns all of the existing package fragment roots that exist on the
+ * classpath, in the order they are defined by the classpath.
+ *
+ * @return all of the existing package fragment roots that exist on the
+ * classpath
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
*/
- IPackageFragmentRoot[] getAllPackageFragmentRoots() throws JavaModelException;
+ IPackageFragmentRoot[] getAllPackageFragmentRoots()
+ throws JavaModelException;
/**
- * Returns an array of non-Java resources directly contained in this project.
- * It does not transitively answer non-Java resources contained in folders;
- * these would have to be explicitly iterated over.
+ * Returns an array of non-Java resources directly contained in this
+ * project. It does not transitively answer non-Java resources contained in
+ * folders; these would have to be explicitly iterated over.
*
* Non-Java resources includes other files and folders located in the
* project not accounted for by any of it source or binary package fragment
- * roots. If the project is a source folder itself, resources excluded from the
- * corresponding source classpath entry by one or more exclusion patterns
- * are considered non-Java resources and will appear in the result
+ * roots. If the project is a source folder itself, resources excluded from
+ * the corresponding source classpath entry by one or more exclusion
+ * patterns are considered non-Java resources and will appear in the result
* (possibly in a folder)
*
*
* @return an array of non-Java resources directly contained in this project
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
*/
-// Object[] getNonJavaResources() throws JavaModelException;
-
+ // Object[] getNonJavaResources() throws JavaModelException;
/**
- * Helper method for returning one option value only. Equivalent to (String)this.getOptions(inheritJavaCoreOptions).get(optionName)
- * Note that it may answer null if this option does not exist, or if there is no custom value for it.
+ * Helper method for returning one option value only. Equivalent to
+ * (String)this.getOptions(inheritJavaCoreOptions).get(optionName)
+ * Note that it may answer null if this option does not
+ * exist, or if there is no custom value for it.
*
- * For a complete description of the configurable options, see JavaCore#getDefaultOptions.
+ * For a complete description of the configurable options, see
+ * JavaCore#getDefaultOptions.
*
*
- * @param optionName the name of an option
- * @param inheritJavaCoreOptions - boolean indicating whether JavaCore options should be inherited as well
+ * @param optionName
+ * the name of an option
+ * @param inheritJavaCoreOptions -
+ * boolean indicating whether JavaCore options should be
+ * inherited as well
* @return the String value of a given option
* @see JavaCore#getDefaultOptions
* @since 2.1
*/
- String getOption(String optionName, boolean inheritJavaCoreOptions);
-
+ String getOption(String optionName, boolean inheritJavaCoreOptions);
+
/**
- * Returns the table of the current custom options for this project. Projects remember their custom options,
- * in other words, only the options different from the the JavaCore global options for the workspace.
- * A boolean argument allows to directly merge the project options with global ones from JavaCore.
+ * Returns the table of the current custom options for this project.
+ * Projects remember their custom options, in other words, only the options
+ * different from the the JavaCore global options for the workspace. A
+ * boolean argument allows to directly merge the project options with global
+ * ones from JavaCore.
*
- * For a complete description of the configurable options, see JavaCore#getDefaultOptions.
+ * For a complete description of the configurable options, see
+ * JavaCore#getDefaultOptions.
*
*
- * @param inheritJavaCoreOptions - boolean indicating whether JavaCore options should be inherited as well
- * @return table of current settings of all options
- * (key type: String; value type: String)
+ * @param inheritJavaCoreOptions -
+ * boolean indicating whether JavaCore options should be
+ * inherited as well
+ * @return table of current settings of all options (key type:
+ * String; value type: String)
* @see JavaCore#getDefaultOptions
* @since 2.1
*/
- Map getOptions(boolean inheritJavaCoreOptions);
+ Map getOptions(boolean inheritJavaCoreOptions);
/**
* Returns the default output location for this project as a workspace-
@@ -248,72 +273,79 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable {
* specify an output location for the generated class files (and copied
* resource files) corresponding to compilation units under that source
* folder. This makes it possible to arrange generated class files for
- * different source folders in different output folders, and not
- * necessarily the default output folder. This means that the generated
- * class files for the project may end up scattered across several folders,
- * rather than all in the default output folder (which is more standard).
+ * different source folders in different output folders, and not necessarily
+ * the default output folder. This means that the generated class files for
+ * the project may end up scattered across several folders, rather than all
+ * in the default output folder (which is more standard).
*
*
* @return the workspace-relative absolute path of the default output folder
- * @exception JavaModelException if this element does not exist
+ * @exception JavaModelException
+ * if this element does not exist
* @see #setOutputLocation
* @see IClasspathEntry#getOutputLocation
*/
IPath getOutputLocation() throws JavaModelException;
/**
- * Returns a package fragment root for the JAR at the specified file system path.
- * This is a handle-only method. The underlying java.io.File
- * may or may not exist. No resource is associated with this local JAR
- * package fragment root.
+ * Returns a package fragment root for the JAR at the specified file system
+ * path. This is a handle-only method. The underlying
+ * java.io.File may or may not exist. No resource is
+ * associated with this local JAR package fragment root.
*
- * @param jarPath the jars's file system path
- * @return a package fragment root for the JAR at the specified file system path
+ * @param jarPath
+ * the jars's file system path
+ * @return a package fragment root for the JAR at the specified file system
+ * path
*/
-// IPackageFragmentRoot getPackageFragmentRoot(String jarPath);
-
+ // IPackageFragmentRoot getPackageFragmentRoot(String jarPath);
/**
- * Returns a package fragment root for the given resource, which
- * must either be a folder representing the top of a package hierarchy,
- * or a .jar or .zip file.
- * This is a handle-only method. The underlying resource may or may not exist.
- *
- * @param resource the given resource
- * @return a package fragment root for the given resource, which
- * must either be a folder representing the top of a package hierarchy,
- * or a .jar or .zip file
+ * Returns a package fragment root for the given resource, which must either
+ * be a folder representing the top of a package hierarchy, or a
+ * .jar or .zip file. This is a handle-only
+ * method. The underlying resource may or may not exist.
+ *
+ * @param resource
+ * the given resource
+ * @return a package fragment root for the given resource, which must either
+ * be a folder representing the top of a package hierarchy, or a
+ * .jar or .zip file
*/
IPackageFragmentRoot getPackageFragmentRoot(IResource resource);
/**
- * Returns all of the package fragment roots contained in this
- * project, identified on this project's resolved classpath. The result
- * does not include package fragment roots in other projects referenced
- * on this project's classpath.
- *
- *
NOTE: This is equivalent to getChildren().
- *
- * @return all of the package fragment roots contained in this
- * project, identified on this project's resolved classpath
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
+ * Returns all of the package fragment roots contained in this project,
+ * identified on this project's resolved classpath. The result does not
+ * include package fragment roots in other projects referenced on this
+ * project's classpath.
+ *
+ *
+ * NOTE: This is equivalent to getChildren().
+ *
+ * @return all of the package fragment roots contained in this project,
+ * identified on this project's resolved classpath
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
*/
IPackageFragmentRoot[] getPackageFragmentRoots() throws JavaModelException;
/**
- * Returns the existing package fragment roots identified by the given entry.
- * Note that a classpath entry that refers to another project may
- * have more than one root (if that project has more than on root
- * containing source), and classpath entries within the current
- * project identify a single root.
+ * Returns the existing package fragment roots identified by the given
+ * entry. Note that a classpath entry that refers to another project may
+ * have more than one root (if that project has more than on root containing
+ * source), and classpath entries within the current project identify a
+ * single root.
*
* If the classpath entry denotes a variable, it will be resolved and return
* the roots of the target entry (empty if not resolvable).
*
- * If the classpath entry denotes a container, it will be resolved and return
- * the roots corresponding to the set of container entries (empty if not resolvable).
+ * If the classpath entry denotes a container, it will be resolved and
+ * return the roots corresponding to the set of container entries (empty if
+ * not resolvable).
*
- * @param entry the given entry
+ * @param entry
+ * the given entry
* @return the existing package fragment roots identified by the given entry
* @see IClasspathContainer
* @deprecated Use IJavaProject#findPackageFragmentRoots instead
@@ -321,44 +353,52 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable {
IPackageFragmentRoot[] getPackageFragmentRoots(IClasspathEntry entry);
/**
- * Returns all package fragments in all package fragment roots contained
- * in this project. This is a convenience method.
- *
+ * Returns all package fragments in all package fragment roots contained in
+ * this project. This is a convenience method.
+ *
* Note that the package fragment roots corresponds to the resolved
* classpath of the project.
- *
- * @return all package fragments in all package fragment roots contained
- * in this project
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
+ *
+ * @return all package fragments in all package fragment roots contained in
+ * this project
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
*/
IPackageFragment[] getPackageFragments() throws JavaModelException;
/**
- * Returns the IProject on which this IJavaProject
- * was created. This is handle-only method.
+ * Returns the IProject on which this
+ * IJavaProject was created. This is handle-only method.
*
- * @return the IProject on which this IJavaProject
- * was created
+ * @return the IProject on which this
+ * IJavaProject was created
*/
IProject getProject();
/**
- * Returns the raw classpath for the project, as a list of classpath entries. This corresponds to the exact set
- * of entries which were assigned using setRawClasspath, in particular such a classpath may contain
- * classpath variable entries. Classpath variable entries can be resolved individually (see JavaCore#getClasspathVariable),
- * or the full classpath can be resolved at once using the helper method getResolvedClasspath.
+ * Returns the raw classpath for the project, as a list of classpath
+ * entries. This corresponds to the exact set of entries which were assigned
+ * using setRawClasspath, in particular such a classpath may
+ * contain classpath variable entries. Classpath variable entries can be
+ * resolved individually (see JavaCore#getClasspathVariable),
+ * or the full classpath can be resolved at once using the helper method
+ * getResolvedClasspath.
*
- * A classpath variable provides an indirection level for better sharing a classpath. As an example, it allows
- * a classpath to no longer refer directly to external JARs located in some user specific location. The classpath
- * can simply refer to some variables defining the proper locations of these external JARs.
- *
- * Note that in case the project isn't yet opened, the classpath will directly be read from the associated .classpath file.
+ * A classpath variable provides an indirection level for better sharing a
+ * classpath. As an example, it allows a classpath to no longer refer
+ * directly to external JARs located in some user specific location. The
+ * classpath can simply refer to some variables defining the proper
+ * locations of these external JARs.
+ *
+ * Note that in case the project isn't yet opened, the classpath will
+ * directly be read from the associated .classpath file.
*
*
* @return the raw classpath for the project, as a list of classpath entries
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
* @see IClasspathEntry
*/
IClasspathEntry[] getRawClasspath() throws JavaModelException;
@@ -368,20 +408,21 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable {
* project. A project is required if it is in its classpath.
*
* The project names are returned in the order they appear on the classpath.
- *
+ *
* @return the names of the projects that are directly required by this
- * project in classpath order
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
+ * project in classpath order
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
*/
String[] getRequiredProjectNames() throws JavaModelException;
/**
* This is a helper method returning the resolved classpath for the project
- * as a list of simple (non-variable, non-container) classpath entries.
- * All classpath variable and classpath container entries in the project's
- * raw classpath will be replaced by the simple classpath entries they
- * resolve to.
+ * as a list of simple (non-variable, non-container) classpath entries. All
+ * classpath variable and classpath container entries in the project's raw
+ * classpath will be replaced by the simple classpath entries they resolve
+ * to.
*
* The resulting resolved classpath is accurate for the given point in time.
* If the project's raw classpath is later modified, or if classpath
@@ -389,122 +430,145 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable {
* Because of this, hanging on resolved classpath is not recommended.
*
*
- * @param ignoreUnresolvedEntry indicates how to handle unresolvable
- * variables and containers; true indicates that missing
- * variables and unresolvable classpath containers should be silently
- * ignored, and that the resulting list should consist only of the
- * entries that could be successfully resolved; false indicates
- * that a JavaModelException should be thrown for the first
- * unresolved variable or container
- * @return the resolved classpath for the project as a list of simple
- * classpath entries, where all classpath variable and container entries
- * have been resolved and substituted with their final target entries
- * @exception JavaModelException in one of the corresponding situation:
- *
- *
this element does not exist
- *
an exception occurs while accessing its corresponding resource
- *
a classpath variable or classpath container was not resolvable
- * and ignoreUnresolvedEntry is false.
- *
+ * @param ignoreUnresolvedEntry
+ * indicates how to handle unresolvable variables and containers;
+ * true indicates that missing variables and
+ * unresolvable classpath containers should be silently ignored,
+ * and that the resulting list should consist only of the entries
+ * that could be successfully resolved; false
+ * indicates that a JavaModelException should be
+ * thrown for the first unresolved variable or container
+ * @return the resolved classpath for the project as a list of simple
+ * classpath entries, where all classpath variable and container
+ * entries have been resolved and substituted with their final
+ * target entries
+ * @exception JavaModelException
+ * in one of the corresponding situation:
+ *
+ *
this element does not exist
+ *
an exception occurs while accessing its corresponding
+ * resource
+ *
a classpath variable or classpath container was not
+ * resolvable and ignoreUnresolvedEntry is
+ * false.
+ *
* @see IClasspathEntry
*/
IClasspathEntry[] getResolvedClasspath(boolean ignoreUnresolvedEntry)
- throws JavaModelException;
+ throws JavaModelException;
/**
- * Returns whether this project has been built at least once and thus whether it has a build state.
- * @return true if this project has been built at least once, false otherwise
+ * Returns whether this project has been built at least once and thus
+ * whether it has a build state.
+ *
+ * @return true if this project has been built at least once, false
+ * otherwise
*/
boolean hasBuildState();
/**
- * Returns whether setting this project's classpath to the given classpath entries
- * would result in a cycle.
- *
- * If the set of entries contains some variables, those are resolved in order to determine
- * cycles.
- *
- * @param entries the given classpath entries
- * @return true if the given classpath entries would result in a cycle, false otherwise
+ * Returns whether setting this project's classpath to the given classpath
+ * entries would result in a cycle.
+ *
+ * If the set of entries contains some variables, those are resolved in
+ * order to determine cycles.
+ *
+ * @param entries
+ * the given classpath entries
+ * @return true if the given classpath entries would result in a cycle,
+ * false otherwise
*/
boolean hasClasspathCycle(IClasspathEntry[] entries);
+
/**
- * Returns whether the given element is on the classpath of this project,
+ * Returns whether the given element is on the classpath of this project,
* that is, referenced from a classpath entry and not explicitly excluded
- * using an exclusion pattern.
+ * using an exclusion pattern.
*
- * @param element the given element
+ * @param element
+ * the given element
* @return true if the given element is on the classpath of
- * this project, false otherwise
+ * this project, false otherwise
* @see IClasspathEntry#getExclusionPatterns
* @since 2.0
*/
-// boolean isOnClasspath(IJavaElement element);
+ // boolean isOnClasspath(IJavaElement element);
/**
* Returns whether the given resource is on the classpath of this project,
* that is, referenced from a classpath entry and not explicitly excluded
* using an exclusion pattern.
*
- * @param element the given element
+ * @param element
+ * the given element
* @return true if the given resource is on the classpath of
- * this project, false otherwise
+ * this project, false otherwise
* @see IClasspathEntry#getExclusionPatterns
* @since 2.1
*/
-// boolean isOnClasspath(IResource resource);
-
+ // boolean isOnClasspath(IResource resource);
/**
* Creates a new evaluation context.
+ *
* @return a new evaluation context.
*/
-// IEvaluationContext newEvaluationContext();
-
+ // IEvaluationContext newEvaluationContext();
/**
- * Creates and returns a type hierarchy for all types in the given
- * region, considering subtypes within that region.
- *
- * @param monitor the given progress monitor
- * @param region the given region
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- * @exception IllegalArgumentException if region is null
- * @return a type hierarchy for all types in the given
- * region, considering subtypes within that region
+ * Creates and returns a type hierarchy for all types in the given region,
+ * considering subtypes within that region.
+ *
+ * @param monitor
+ * the given progress monitor
+ * @param region
+ * the given region
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ * @exception IllegalArgumentException
+ * if region is null
+ * @return a type hierarchy for all types in the given region, considering
+ * subtypes within that region
*/
-// ITypeHierarchy newTypeHierarchy(IRegion region, IProgressMonitor monitor)
-// throws JavaModelException;
-
+ // ITypeHierarchy newTypeHierarchy(IRegion region, IProgressMonitor monitor)
+ // throws JavaModelException;
/**
* Creates and returns a type hierarchy for the given type considering
* subtypes in the specified region.
*
- * @param monitor the given monitor
- * @param region the given region
- * @param type the given type
+ * @param monitor
+ * the given monitor
+ * @param region
+ * the given region
+ * @param type
+ * the given type
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
*
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- *
- * @exception IllegalArgumentException if type or region is null
- * @return a type hierarchy for the given type considering
- * subtypes in the specified region
+ * @exception IllegalArgumentException
+ * if type or region is null
+ * @return a type hierarchy for the given type considering subtypes in the
+ * specified region
*/
-// ITypeHierarchy newTypeHierarchy(
-// IType type,
-// IRegion region,
-// IProgressMonitor monitor)
-// throws JavaModelException;
-
+ // ITypeHierarchy newTypeHierarchy(
+ // IType type,
+ // IRegion region,
+ // IProgressMonitor monitor)
+ // throws JavaModelException;
/**
- * Sets the project custom options. All and only the options explicitly included in the given table
- * are remembered; all previous option settings are forgotten, including ones not explicitly
- * mentioned.
+ * Sets the project custom options. All and only the options explicitly
+ * included in the given table are remembered; all previous option settings
+ * are forgotten, including ones not explicitly mentioned.
*
- * For a complete description of the configurable options, see JavaCore#getDefaultOptions.
+ * For a complete description of the configurable options, see
+ * JavaCore#getDefaultOptions.
*
*
- * @param newOptions the new options (key type: String; value type: String),
- * or null to flush all custom options (clients will automatically get the global JavaCore options).
+ * @param newOptions
+ * the new options (key type: String; value type:
+ * String), or null to flush all
+ * custom options (clients will automatically get the global
+ * JavaCore options).
* @see JavaCore#getDefaultOptions
* @since 2.1
*/
@@ -525,62 +589,80 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable {
* rather than all in the default output folder (which is more standard).
*
*
- * @param path the workspace-relative absolute path of the default output
- * folder
- * @param monitor the progress monitor
- *
- * @exception JavaModelException if the classpath could not be set. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
The path refers to a location not contained in this project (PATH_OUTSIDE_PROJECT)
- *
The path is not an absolute path (RELATIVE_PATH)
- *
The path is nested inside a package fragment root of this project (INVALID_PATH)
- *
The output location is being modified during resource change event notification (CORE_EXCEPTION)
- *
+ * @param path
+ * the workspace-relative absolute path of the default output
+ * folder
+ * @param monitor
+ * the progress monitor
+ *
+ * @exception JavaModelException
+ * if the classpath could not be set. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
The path refers to a location not contained in this
+ * project (PATH_OUTSIDE_PROJECT)
+ *
The path is not an absolute path (RELATIVE_PATH)
+ *
The path is nested inside a package fragment root of
+ * this project (INVALID_PATH)
+ *
The output location is being modified during resource
+ * change event notification (CORE_EXCEPTION)
+ *
* @see #getOutputLocation
- * @see IClasspathEntry#getOutputLocation
+ * @see IClasspathEntry#getOutputLocation
*/
void setOutputLocation(IPath path, IProgressMonitor monitor)
- throws JavaModelException;
+ throws JavaModelException;
/**
- * Sets the classpath of this project using a list of classpath entries. In particular such a classpath may contain
- * classpath variable entries. Classpath variable entries can be resolved individually (see JavaCore#getClasspathVariable),
- * or the full classpath can be resolved at once using the helper method getResolvedClasspath.
+ * Sets the classpath of this project using a list of classpath entries. In
+ * particular such a classpath may contain classpath variable entries.
+ * Classpath variable entries can be resolved individually (see
+ * JavaCore#getClasspathVariable), or the full classpath can
+ * be resolved at once using the helper method
+ * getResolvedClasspath.
*
- * A classpath variable provides an indirection level for better sharing a classpath. As an example, it allows
- * a classpath to no longer refer directly to external JARs located in some user specific location. The classpath
- * can simply refer to some variables defining the proper locations of these external JARs.
+ * A classpath variable provides an indirection level for better sharing a
+ * classpath. As an example, it allows a classpath to no longer refer
+ * directly to external JARs located in some user specific location. The
+ * classpath can simply refer to some variables defining the proper
+ * locations of these external JARs.
*
- * Setting the classpath to null specifies a default classpath
- * (the project root). Setting the classpath to an empty array specifies an
- * empty classpath.
+ * Setting the classpath to null specifies a default
+ * classpath (the project root). Setting the classpath to an empty array
+ * specifies an empty classpath.
*
- * If a cycle is detected while setting this classpath, an error marker will be added
- * to the project closing the cycle.
- * To avoid this problem, use hasClasspathCycle(IClasspathEntry[] entries)
- * before setting the classpath.
- *
- * @param entries a list of classpath entries
- * @param monitor the given progress monitor
- * @exception JavaModelException if the classpath could not be set. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
The classpath is being modified during resource change event notification (CORE_EXCEPTION)
- *
The classpath failed the validation check as defined by JavaConventions#validateClasspath
- *
+ * If a cycle is detected while setting this classpath, an error marker will
+ * be added to the project closing the cycle. To avoid this problem, use
+ * hasClasspathCycle(IClasspathEntry[] entries) before
+ * setting the classpath.
+ *
+ * @param entries
+ * a list of classpath entries
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if the classpath could not be set. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
The classpath is being modified during resource
+ * change event notification (CORE_EXCEPTION)
+ *
The classpath failed the validation check as defined
+ * by JavaConventions#validateClasspath
+ *
* @see IClasspathEntry
*/
void setRawClasspath(IClasspathEntry[] entries, IProgressMonitor monitor)
- throws JavaModelException;
-
+ throws JavaModelException;
+
/**
* Sets the both the classpath of this project and its default output
* location at once. The classpath is defined using a list of classpath
* entries. In particular, such a classpath may contain classpath variable
* entries. Classpath variable entries can be resolved individually (see
- * JavaCore#getClasspathVariable), or the full classpath can be
- * resolved at once using the helper method
+ * JavaCore#getClasspathVariable), or the full classpath can
+ * be resolved at once using the helper method
* getResolvedClasspath.
*
* A classpath variable provides an indirection level for better sharing a
@@ -590,35 +672,45 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable {
* locations of these external JARs.
*
*
- * Setting the classpath to null specifies a default classpath
- * (the project root). Setting the classpath to an empty array specifies an
- * empty classpath.
+ * Setting the classpath to null specifies a default
+ * classpath (the project root). Setting the classpath to an empty array
+ * specifies an empty classpath.
*
*
* If a cycle is detected while setting this classpath, an error marker will
* be added to the project closing the cycle. To avoid this problem, use
- * hasClasspathCycle(IClasspathEntry[] entries) before setting
- * the classpath.
+ * hasClasspathCycle(IClasspathEntry[] entries) before
+ * setting the classpath.
*
*
- * @param entries a list of classpath entries
- * @param monitor the progress monitor
- * @param outputLocation the default output location
- * @exception JavaModelException if the classpath could not be set. Reasons
- * include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
Two or more entries specify source roots with the same or overlapping paths (NAME_COLLISION)
- *
A entry of kind CPE_PROJECT refers to this project (INVALID_PATH)
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
The output location path refers to a location not contained in this project (PATH_OUTSIDE_PROJECT)
- *
The output location path is not an absolute path (RELATIVE_PATH)
- *
The output location path is nested inside a package fragment root of this project (INVALID_PATH)
- *
The classpath is being modified during resource change event notification (CORE_EXCEPTION)
- *
+ * @param entries
+ * a list of classpath entries
+ * @param monitor
+ * the progress monitor
+ * @param outputLocation
+ * the default output location
+ * @exception JavaModelException
+ * if the classpath could not be set. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
Two or more entries specify source roots with the
+ * same or overlapping paths (NAME_COLLISION)
+ *
A entry of kind CPE_PROJECT refers to
+ * this project (INVALID_PATH)
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
The output location path refers to a location not
+ * contained in this project (PATH_OUTSIDE_PROJECT)
+ *
The output location path is not an absolute path (RELATIVE_PATH)
+ *
The output location path is nested inside a package
+ * fragment root of this project (INVALID_PATH)
+ *
The classpath is being modified during resource
+ * change event notification (CORE_EXCEPTION)
+ *
* @see IClasspathEntry
* @since 2.0
*/
- void setRawClasspath(IClasspathEntry[] entries, IPath outputLocation, IProgressMonitor monitor)
- throws JavaModelException;
+ void setRawClasspath(IClasspathEntry[] entries, IPath outputLocation,
+ IProgressMonitor monitor) throws JavaModelException;
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ILocalVariable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ILocalVariable.java
index 1c9f549..c652b41 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ILocalVariable.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ILocalVariable.java
@@ -12,16 +12,20 @@ package net.sourceforge.phpdt.core;
/**
* Represents a local variable declared in a method or an initializer.
- * ILocalVariable are pseudo-elements created as the result of a ICodeAssist.codeSelect(...)
- * operation. They are not part of the Java model (exists() returns whether the parent exists rather than
- * whether the local variable exists in the parent) and they are not included in the children of an IMethod
- * or an IInitializer.
+ * ILocalVariable are pseudo-elements created as the result of a
+ * ICodeAssist.codeSelect(...) operation. They are not part of
+ * the Java model (exists() returns whether the parent exists
+ * rather than whether the local variable exists in the parent) and they are not
+ * included in the children of an IMethod or an
+ * IInitializer.
+ *
+ * In particular such a pseudo-element should not be used as a handle. For
+ * example its name range won't be updated if the underlying source changes.
+ *
*
- * In particular such a pseudo-element should not be used as a handle. For example its name range won't be updated
- * if the underlying source changes.
- *
* This interface is not intended to be implemented by clients.
*
+ *
* @since 3.0
*/
public interface ILocalVariable extends IJavaElement, ISourceReference {
@@ -32,22 +36,22 @@ public interface ILocalVariable extends IJavaElement, ISourceReference {
* @return the name of this local variable.
*/
String getElementName();
-
+
/**
* Returns the source range of this local variable's name.
- *
+ *
* @return the source range of this local variable's name
*/
ISourceRange getNameRange();
-
+
/**
* Returns the type signature of this local variable.
*
- * The type signature may be either unresolved (for source types)
- * or resolved (for binary types), and either basic (for basic types)
- * or rich (for parameterized types). See {@link Signature} for details.
+ * The type signature may be either unresolved (for source types) or
+ * resolved (for binary types), and either basic (for basic types) or rich
+ * (for parameterized types). See {@link Signature} for details.
*
- *
+ *
* @return the type signature of this local variable.
* @see Signature
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java
index f1d5d47..034a789 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMember.java
@@ -10,91 +10,105 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
-
/**
- * Common protocol for Java elements that can be members of types.
- * This set consists of IType, IMethod,
+ * Common protocol for Java elements that can be members of types. This set
+ * consists of IType, IMethod,
* IField, and IInitializer.
*
* This interface is not intended to be implemented by clients.
*
*/
-public interface IMember extends IJavaElement , ISourceReference, ISourceManipulation, IParent {
-/**
- * Returns the class file in which this member is declared, or null
- * if this member is not declared in a class file (for example, a source type).
- * This is a handle-only method.
- *
- * @return the class file in which this member is declared, or null
- * if this member is not declared in a class file (for example, a source type)
- */
-//IClassFile getClassFile();
-/**
- * Returns the compilation unit in which this member is declared, or null
- * if this member is not declared in a compilation unit (for example, a binary type).
- * This is a handle-only method.
- *
- * @return the compilation unit in which this member is declared, or null
- * if this member is not declared in a compilation unit (for example, a binary type)
- */
-ICompilationUnit getCompilationUnit();
-/**
- * Returns the type in which this member is declared, or null
- * if this member is not declared in a type (for example, a top-level type).
- * This is a handle-only method.
- *
- * @return the type in which this member is declared, or null
- * if this member is not declared in a type (for example, a top-level type)
- */
- IType getDeclaringType();
-/**
- * Returns the modifier flags for this member. The flags can be examined using class
- * Flags.
- *
- * Note that only flags as indicated in the source are returned. Thus if an interface
- * defines a method void myMethod(); the flags don't include the
- * 'public' flag.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return the modifier flags for this member
- * @see Flags
- */
-int getFlags() throws JavaModelException;
-/**
- * Returns the source range of this member's simple name,
- * or null if this member does not have a name
- * (for example, an initializer), or if this member does not have
- * associated source code (for example, a binary type).
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return the source range of this member's simple name,
- * or null if this member does not have a name
- * (for example, an initializer), or if this member does not have
- * associated source code (for example, a binary type)
- */
-ISourceRange getNameRange() throws JavaModelException;
-/**
- * Returns the local or anonymous type declared in this source member with the given simple name and/or
- * with the specified position relative to the order they are defined in the source.
- * The name is empty if it is an anonymous type.
- * Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0).
- * This is a handle-only method. The type may or may not exist.
- * Throws a RuntimeException if this member is not a source member.
- *
- * @param name the given simple name
- * @param occurrenceCount the specified position
- * @return the type with the given name and/or with the specified position relative to the order they are defined in the source
- * @since 3.0
- */
-IType getType(String name, int occurrenceCount);
-/**
- * Returns whether this member is from a class file.
- * This is a handle-only method.
- *
- * @return true if from a class file, and false if
- * from a compilation unit
- */
-boolean isBinary();
+public interface IMember extends IJavaElement, ISourceReference,
+ ISourceManipulation, IParent {
+ /**
+ * Returns the class file in which this member is declared, or
+ * null if this member is not declared in a class file (for
+ * example, a source type). This is a handle-only method.
+ *
+ * @return the class file in which this member is declared, or
+ * null if this member is not declared in a class
+ * file (for example, a source type)
+ */
+ // IClassFile getClassFile();
+ /**
+ * Returns the compilation unit in which this member is declared, or
+ * null if this member is not declared in a compilation unit
+ * (for example, a binary type). This is a handle-only method.
+ *
+ * @return the compilation unit in which this member is declared, or
+ * null if this member is not declared in a
+ * compilation unit (for example, a binary type)
+ */
+ ICompilationUnit getCompilationUnit();
+
+ /**
+ * Returns the type in which this member is declared, or null
+ * if this member is not declared in a type (for example, a top-level type).
+ * This is a handle-only method.
+ *
+ * @return the type in which this member is declared, or null
+ * if this member is not declared in a type (for example, a
+ * top-level type)
+ */
+ IType getDeclaringType();
+
+ /**
+ * Returns the modifier flags for this member. The flags can be examined
+ * using class Flags.
+ *
+ * Note that only flags as indicated in the source are returned. Thus if an
+ * interface defines a method void myMethod(); the flags
+ * don't include the 'public' flag.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return the modifier flags for this member
+ * @see Flags
+ */
+ int getFlags() throws JavaModelException;
+
+ /**
+ * Returns the source range of this member's simple name, or
+ * null if this member does not have a name (for example, an
+ * initializer), or if this member does not have associated source code (for
+ * example, a binary type).
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return the source range of this member's simple name, or
+ * null if this member does not have a name (for
+ * example, an initializer), or if this member does not have
+ * associated source code (for example, a binary type)
+ */
+ ISourceRange getNameRange() throws JavaModelException;
+
+ /**
+ * Returns the local or anonymous type declared in this source member with
+ * the given simple name and/or with the specified position relative to the
+ * order they are defined in the source. The name is empty if it is an
+ * anonymous type. Numbering starts at 1 (thus the first occurrence is
+ * occurrence 1, not occurrence 0). This is a handle-only method. The type
+ * may or may not exist. Throws a RuntimeException if this
+ * member is not a source member.
+ *
+ * @param name
+ * the given simple name
+ * @param occurrenceCount
+ * the specified position
+ * @return the type with the given name and/or with the specified position
+ * relative to the order they are defined in the source
+ * @since 3.0
+ */
+ IType getType(String name, int occurrenceCount);
+
+ /**
+ * Returns whether this member is from a class file. This is a handle-only
+ * method.
+ *
+ * @return true if from a class file, and false
+ * if from a compilation unit
+ */
+ boolean isBinary();
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMethod.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMethod.java
index 651789a..e4d5800 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMethod.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IMethod.java
@@ -17,129 +17,158 @@ package net.sourceforge.phpdt.core;
*
*/
public interface IMethod extends IMember {
-/**
- * Returns the simple name of this method.
- * For a constructor, this returns the simple name of the declaring type.
- * Note: This holds whether the constructor appears in a source or binary type
- * (even though class files internally define constructor names to be "<init>").
- * For the class initialization methods in binary types, this returns
- * the special name "<clinit>".
- * This is a handle-only method.
- */
-String getElementName();
-/**
- * Returns the type signatures of the exceptions this method throws,
- * in the order declared in the source. Returns an empty array
- * if this method throws no exceptions.
- *
- *
For example, a source method declaring "throws IOException",
- * would return the array {"QIOException;"}.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return the type signatures of the exceptions this method throws,
- * in the order declared in the source, an empty array if this method throws no exceptions
- * @see Signature
- */
-String[] getExceptionTypes() throws JavaModelException;
-/**
- * Returns the number of parameters of this method.
- * This is a handle-only method.
- *
- * @return the number of parameters of this method
- */
-int getNumberOfParameters();
-/**
- * Returns the names of parameters in this method.
- * For binary types, these names are invented as "arg"+i, where i starts at 1
- * (even if source is associated with the binary).
- * Returns an empty array if this method has no parameters.
- *
- *
For example, a method declared as public void foo(String text, int length)
- * would return the array {"text","length"}.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return the names of parameters in this method, an empty array if this method has no parameters
- */
-String[] getParameterNames() throws JavaModelException;
-/**
- * Returns the type signatures for the parameters of this method.
- * Returns an empty array if this method has no parameters.
- * This is a handle-only method.
- *
- *
For example, a source method declared as public void foo(String text, int length)
- * would return the array {"QString;","I"}.
- *
- * @return the type signatures for the parameters of this method, an empty array if this method has no parameters
- * @see Signature
- */
-String[] getParameterTypes();
-/**
- * Returns the type signature of the return value of this method.
- * For constructors, this returns the signature for void.
- *
- *
For example, a source method declared as public String getName()
- * would return "QString;".
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return the type signature of the return value of this method, void for constructors
- * @see Signature
- */
-String getReturnType() throws JavaModelException;
-/**
- * Returns the signature of the method. This includes the signatures for the parameter
- * types and return type, but does not include the method name or exception types.
- *
- *
For example, a source method declared as public void foo(String text, int length)
- * would return "(QString;I)V".
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- *
- * @see Signature
- */
-String getSignature() throws JavaModelException;
-/**
- * Returns whether this method is a constructor.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- *
- * @return true if this method is a constructor, false otherwise
- */
-boolean isConstructor() throws JavaModelException;
-/**
- * Returns whether this method is a main method.
- * It is a main method if:
- *
- *
its name is equal to "main"
- *
its return type is void
- *
it is static and public
- *
it defines one parameter whose type's simple name is String[]
- *
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @since 2.0
- * @return true if this method is a main method, false otherwise
- */
-boolean isMainMethod() throws JavaModelException;
-/**
- * Returns whether this method is similar to the given method.
- * Two methods are similar if:
- *
- *
their element names are equal
- *
they have the same number of parameters
- *
the simple names of their parameter types are equal
- *
- * This is a handle-only method.
- *
- * @param method the given method
- * @return true if this method is similar to the given method.
- * @see Signature#getSimpleName
- * @since 2.0
- */
-boolean isSimilar(IMethod method);
+ /**
+ * Returns the simple name of this method. For a constructor, this returns
+ * the simple name of the declaring type. Note: This holds whether the
+ * constructor appears in a source or binary type (even though class files
+ * internally define constructor names to be "<init>").
+ * For the class initialization methods in binary types, this returns the
+ * special name "<clinit>". This is a handle-only
+ * method.
+ */
+ String getElementName();
+
+ /**
+ * Returns the type signatures of the exceptions this method throws, in the
+ * order declared in the source. Returns an empty array if this method
+ * throws no exceptions.
+ *
+ *
+ * For example, a source method declaring "throws IOException",
+ * would return the array {"QIOException;"}.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return the type signatures of the exceptions this method throws, in the
+ * order declared in the source, an empty array if this method
+ * throws no exceptions
+ * @see Signature
+ */
+ String[] getExceptionTypes() throws JavaModelException;
+
+ /**
+ * Returns the number of parameters of this method. This is a handle-only
+ * method.
+ *
+ * @return the number of parameters of this method
+ */
+ int getNumberOfParameters();
+
+ /**
+ * Returns the names of parameters in this method. For binary types, these
+ * names are invented as "arg"+i, where i starts at 1 (even if source is
+ * associated with the binary). Returns an empty array if this method has no
+ * parameters.
+ *
+ *
+ * For example, a method declared as
+ * public void foo(String text, int length) would return the
+ * array {"text","length"}.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return the names of parameters in this method, an empty array if this
+ * method has no parameters
+ */
+ String[] getParameterNames() throws JavaModelException;
+
+ /**
+ * Returns the type signatures for the parameters of this method. Returns an
+ * empty array if this method has no parameters. This is a handle-only
+ * method.
+ *
+ *
+ * For example, a source method declared as
+ * public void foo(String text, int length) would return the
+ * array {"QString;","I"}.
+ *
+ * @return the type signatures for the parameters of this method, an empty
+ * array if this method has no parameters
+ * @see Signature
+ */
+ String[] getParameterTypes();
+
+ /**
+ * Returns the type signature of the return value of this method. For
+ * constructors, this returns the signature for void.
+ *
+ *
+ * For example, a source method declared as
+ * public String getName() would return
+ * "QString;".
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return the type signature of the return value of this method, void for
+ * constructors
+ * @see Signature
+ */
+ String getReturnType() throws JavaModelException;
+
+ /**
+ * Returns the signature of the method. This includes the signatures for the
+ * parameter types and return type, but does not include the method name or
+ * exception types.
+ *
+ *
+ * For example, a source method declared as
+ * public void foo(String text, int length) would return
+ * "(QString;I)V".
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ *
+ * @see Signature
+ */
+ String getSignature() throws JavaModelException;
+
+ /**
+ * Returns whether this method is a constructor.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ *
+ * @return true if this method is a constructor, false otherwise
+ */
+ boolean isConstructor() throws JavaModelException;
+
+ /**
+ * Returns whether this method is a main method. It is a main method if:
+ *
+ *
its name is equal to "main"
+ *
its return type is void
+ *
it is static and public
+ *
it defines one parameter whose type's simple name is String[]
+ *
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @since 2.0
+ * @return true if this method is a main method, false otherwise
+ */
+ boolean isMainMethod() throws JavaModelException;
+
+ /**
+ * Returns whether this method is similar to the given method. Two methods
+ * are similar if:
+ *
+ *
their element names are equal
+ *
they have the same number of parameters
+ *
the simple names of their parameter types are equal
+ *
+ * This is a handle-only method.
+ *
+ * @param method
+ * the given method
+ * @return true if this method is similar to the given method.
+ * @see Signature#getSimpleName
+ * @since 2.0
+ */
+ boolean isSimilar(IMethod method);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IOpenable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IOpenable.java
index 9424f3a..aead99c 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IOpenable.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IOpenable.java
@@ -12,31 +12,30 @@ package net.sourceforge.phpdt.core;
import org.eclipse.core.runtime.IProgressMonitor;
-
/**
- * Common protocol for Java elements that must be opened before they can be
+ * Common protocol for Java elements that must be opened before they can be
* navigated or modified. Opening a textual element (such as a compilation unit)
- * involves opening a buffer on its contents. While open, any changes to the buffer
- * can be reflected in the element's structure;
- * see isConsistent and makeConsistent(IProgressMonitor).
+ * involves opening a buffer on its contents. While open, any changes to the
+ * buffer can be reflected in the element's structure; see
+ * isConsistent and makeConsistent(IProgressMonitor).
*
- * To reduce complexity in clients, elements are automatically opened
- * by the Java model as element properties are accessed. The Java model maintains
- * an LRU cache of open elements, and automatically closes elements as they
- * are swapped out of the cache to make room for other elements. Elements with
+ * To reduce complexity in clients, elements are automatically opened by the
+ * Java model as element properties are accessed. The Java model maintains an
+ * LRU cache of open elements, and automatically closes elements as they are
+ * swapped out of the cache to make room for other elements. Elements with
* unsaved changes are never removed from the cache, and thus, if the client
- * maintains many open elements with unsaved
- * changes, the LRU cache can grow in size (in this case the cache is not
- * bounded). However, as elements are saved, the cache will shrink back to its
- * original bounded size.
+ * maintains many open elements with unsaved changes, the LRU cache can grow in
+ * size (in this case the cache is not bounded). However, as elements are saved,
+ * the cache will shrink back to its original bounded size.
*
*
- * To open an element, all openable parent elements must be open.
- * The Java model automatically opens parent elements, as it automatically opens elements.
- * Opening an element may provide access to direct children and other descendants,
- * but does not automatically open any descendents which are themselves IOpenable.
- * For example, opening a compilation unit provides access to all its constituent elements,
- * but opening a package fragment does not open all compilation units in the package fragment.
+ * To open an element, all openable parent elements must be open. The Java model
+ * automatically opens parent elements, as it automatically opens elements.
+ * Opening an element may provide access to direct children and other
+ * descendants, but does not automatically open any descendents which are
+ * themselves IOpenable. For example, opening a compilation unit
+ * provides access to all its constituent elements, but opening a package
+ * fragment does not open all compilation units in the package fragment.
*
*
* This interface is not intended to be implemented by clients.
@@ -44,143 +43,176 @@ import org.eclipse.core.runtime.IProgressMonitor;
*/
public interface IOpenable {
-/**
- * Closes this element and its buffer (if any).
- * Closing an element which is not open has no effect.
- *
- *
Note: although close is exposed in the API, clients are
- * not expected to open and close elements - the Java model does this automatically
- * as elements are accessed.
- *
- * @exception JavaModelException if an error occurs closing this element
- */
-public void close() throws JavaModelException;
-/**
- * Returns the buffer opened for this element, or null
- * if this element does not have a buffer.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return the buffer opened for this element, or null
- * if this element does not have a buffer
- */
-public IBuffer getBuffer() throws JavaModelException;
-/**
- * Returns true if this element is open and:
- *
- *
its buffer has unsaved changes, or
- *
one of its descendants has unsaved changes, or
- *
a working copy has been created on one of this
- * element's children and has not yet destroyed
- *
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return true if this element is open and:
- *
- *
its buffer has unsaved changes, or
- *
one of its descendants has unsaved changes, or
- *
a working copy has been created on one of this
- * element's children and has not yet destroyed
- *
- */
-boolean hasUnsavedChanges() throws JavaModelException;
-/**
- * Returns whether the element is consistent with its underlying resource or buffer.
- * The element is consistent when opened, and is consistent if the underlying resource
- * or buffer has not been modified since it was last consistent.
- *
- *
NOTE: Child consistency is not considered. For example, a package fragment
- * responds true when it knows about all of its
- * compilation units present in its underlying folder. However, one or more of
- * the compilation units could be inconsistent.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return true if the element is consistent with its underlying resource or buffer, false otherwise.
- * @see IOpenable#makeConsistent
- */
-boolean isConsistent() throws JavaModelException;
-/**
- * Returns whether this openable is open. This is a handle-only method.
- * @return true if this openable is open, false otherwise
- */
-boolean isOpen();
-/**
- * Opens this element and all parent elements that are not already open.
- * For compilation units, a buffer is opened on the contents of the underlying resource.
- *
- *
Note: although open is exposed in the API, clients are
- * not expected to open and close elements - the Java model does this automatically
- * as elements are accessed.
- *
- * @param progress the given progress monitor
- * @exception JavaModelException if an error occurs accessing the contents
- * of its underlying resource. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
- */
-public void open(IProgressMonitor progress) throws JavaModelException;
-/**
- * Makes this element consistent with its underlying resource or buffer
- * by updating the element's structure and properties as necessary.
- *
- * @param progress the given progress monitor
- * @exception JavaModelException if the element is unable to access the contents
- * of its underlying resource. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
- * @see IOpenable#isConsistent
- */
-void makeConsistent(IProgressMonitor progress) throws JavaModelException;
-/**
- * Opens this element and all parent elements that are not already open.
- * For compilation units, a buffer is opened on the contents of the underlying resource.
- *
- *
Note: although open is exposed in the API, clients are
- * not expected to open and close elements - the Java model does this automatically
- * as elements are accessed.
- *
- * @param progress the given progress monitor
- * @exception JavaModelException if an error occurs accessing the contents
- * of its underlying resource. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
- */
-//public void open(IProgressMonitor progress) throws JavaModelException;
-/**
- * Saves any changes in this element's buffer to its underlying resource
- * via a workspace resource operation. This has no effect if the element has no underlying
- * buffer, or if there are no unsaved changed in the buffer.
- *
- * The force parameter controls how this method deals with
- * cases where the workbench is not completely in sync with the local file system.
- * If false is specified, this method will only attempt
- * to overwrite a corresponding file in the local file system provided
- * it is in sync with the workbench. This option ensures there is no
- * unintended data loss; it is the recommended setting.
- * However, if true is specified, an attempt will be made
- * to write a corresponding file in the local file system,
- * overwriting any existing one if need be.
- * In either case, if this method succeeds, the resource will be marked
- * as being local (even if it wasn't before).
- *
- * As a result of this operation, the element is consistent with its underlying
- * resource or buffer.
- *
- * @param progress the given progress monitor
- * @param force it controls how this method deals with
- * cases where the workbench is not completely in sync with the local file system
- * @exception JavaModelException if an error occurs accessing the contents
- * of its underlying resource. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
This Java element is read-only (READ_ONLY)
- *
- */
-public void save(IProgressMonitor progress, boolean force) throws JavaModelException;
+ /**
+ * Closes this element and its buffer (if any). Closing an element which is
+ * not open has no effect.
+ *
+ *
+ * Note: although close is exposed in the API, clients are
+ * not expected to open and close elements - the Java model does this
+ * automatically as elements are accessed.
+ *
+ * @exception JavaModelException
+ * if an error occurs closing this element
+ */
+ public void close() throws JavaModelException;
+
+ /**
+ * Returns the buffer opened for this element, or null if
+ * this element does not have a buffer.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return the buffer opened for this element, or null if
+ * this element does not have a buffer
+ */
+ public IBuffer getBuffer() throws JavaModelException;
+
+ /**
+ * Returns true if this element is open and:
+ *
+ *
its buffer has unsaved changes, or
+ *
one of its descendants has unsaved changes, or
+ *
a working copy has been created on one of this element's children
+ * and has not yet destroyed
+ *
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return true if this element is open and:
+ *
+ *
its buffer has unsaved changes, or
+ *
one of its descendants has unsaved changes, or
+ *
a working copy has been created on one of this element's
+ * children and has not yet destroyed
+ *
+ */
+ boolean hasUnsavedChanges() throws JavaModelException;
+
+ /**
+ * Returns whether the element is consistent with its underlying resource or
+ * buffer. The element is consistent when opened, and is consistent if the
+ * underlying resource or buffer has not been modified since it was last
+ * consistent.
+ *
+ *
+ * NOTE: Child consistency is not considered. For example, a package
+ * fragment responds true when it knows about all of its
+ * compilation units present in its underlying folder. However, one or more
+ * of the compilation units could be inconsistent.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return true if the element is consistent with its underlying resource or
+ * buffer, false otherwise.
+ * @see IOpenable#makeConsistent
+ */
+ boolean isConsistent() throws JavaModelException;
+
+ /**
+ * Returns whether this openable is open. This is a handle-only method.
+ *
+ * @return true if this openable is open, false otherwise
+ */
+ boolean isOpen();
+
+ /**
+ * Opens this element and all parent elements that are not already open. For
+ * compilation units, a buffer is opened on the contents of the underlying
+ * resource.
+ *
+ *
+ * Note: although open is exposed in the API, clients are not
+ * expected to open and close elements - the Java model does this
+ * automatically as elements are accessed.
+ *
+ * @param progress
+ * the given progress monitor
+ * @exception JavaModelException
+ * if an error occurs accessing the contents of its
+ * underlying resource. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
+ */
+ public void open(IProgressMonitor progress) throws JavaModelException;
+
+ /**
+ * Makes this element consistent with its underlying resource or buffer by
+ * updating the element's structure and properties as necessary.
+ *
+ * @param progress
+ * the given progress monitor
+ * @exception JavaModelException
+ * if the element is unable to access the contents of its
+ * underlying resource. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
+ * @see IOpenable#isConsistent
+ */
+ void makeConsistent(IProgressMonitor progress) throws JavaModelException;
+
+ /**
+ * Opens this element and all parent elements that are not already open. For
+ * compilation units, a buffer is opened on the contents of the underlying
+ * resource.
+ *
+ *
+ * Note: although open is exposed in the API, clients are not
+ * expected to open and close elements - the Java model does this
+ * automatically as elements are accessed.
+ *
+ * @param progress
+ * the given progress monitor
+ * @exception JavaModelException
+ * if an error occurs accessing the contents of its
+ * underlying resource. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
+ */
+ // public void open(IProgressMonitor progress) throws JavaModelException;
+ /**
+ * Saves any changes in this element's buffer to its underlying resource via
+ * a workspace resource operation. This has no effect if the element has no
+ * underlying buffer, or if there are no unsaved changed in the buffer.
+ *
+ * The force parameter controls how this method deals with
+ * cases where the workbench is not completely in sync with the local file
+ * system. If false is specified, this method will only
+ * attempt to overwrite a corresponding file in the local file system
+ * provided it is in sync with the workbench. This option ensures there is
+ * no unintended data loss; it is the recommended setting. However, if
+ * true is specified, an attempt will be made to write a
+ * corresponding file in the local file system, overwriting any existing one
+ * if need be. In either case, if this method succeeds, the resource will be
+ * marked as being local (even if it wasn't before).
+ *
+ * As a result of this operation, the element is consistent with its
+ * underlying resource or buffer.
+ *
+ * @param progress
+ * the given progress monitor
+ * @param force
+ * it controls how this method deals with cases where the
+ * workbench is not completely in sync with the local file system
+ * @exception JavaModelException
+ * if an error occurs accessing the contents of its
+ * underlying resource. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
This Java element is read-only (READ_ONLY)
+ *
+ */
+ public void save(IProgressMonitor progress, boolean force)
+ throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageDeclaration.java
index d96737b..292a59d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageDeclaration.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageDeclaration.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
-
/**
* Represents a package declaration in Java compilation unit.
*
*/
public interface IPackageDeclaration extends IJavaElement, ISourceReference {
-/**
- * Returns the name of the package the statement refers to.
- * This is a handle-only method.
- */
-String getElementName();
+ /**
+ * Returns the name of the package the statement refers to. This is a
+ * handle-only method.
+ */
+ String getElementName();
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java
index 117ee26..73bf9b8 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragment.java
@@ -13,155 +13,187 @@ package net.sourceforge.phpdt.core;
import org.eclipse.core.runtime.IProgressMonitor;
/**
- * A package fragment is a portion of the workspace corresponding to an entire package,
- * or to a portion thereof. The distinction between a package fragment and a package
- * is that a package with some name is the union of all package fragments in the class path
- * which have the same name.
+ * A package fragment is a portion of the workspace corresponding to an entire
+ * package, or to a portion thereof. The distinction between a package fragment
+ * and a package is that a package with some name is the union of all package
+ * fragments in the class path which have the same name.
*
- * Package fragments elements need to be opened before they can be navigated or manipulated.
- * The children are of type ICompilationUnit (representing a source file) or
- * IClassFile (representing a binary class file).
- * The children are listed in no particular order.
+ * Package fragments elements need to be opened before they can be navigated or
+ * manipulated. The children are of type ICompilationUnit
+ * (representing a source file) or IClassFile (representing a
+ * binary class file). The children are listed in no particular order.
*
*
* This interface is not intended to be implemented by clients.
*
- * The name of package fragment for the default package (value: the empty
+ * The name of package fragment for the default package (value: the empty
* string, "").
*
- */
+ */
public static final String DEFAULT_PACKAGE_NAME = ""; //$NON-NLS-1$
+
/**
* Returns whether this fragment contains at least one Java resource.
- * @return true if this fragment contains at least one Java resource, false otherwise
+ *
+ * @return true if this fragment contains at least one Java resource, false
+ * otherwise
*/
-// boolean containsJavaResources() throws JavaModelException;
+ // boolean containsJavaResources() throws JavaModelException;
/**
- * Creates and returns a compilation unit in this package fragment
- * with the specified name and contents. No verification is performed
- * on the contents.
- *
- *
It is possible that a compilation unit with the same name already exists in this
- * package fragment.
- * The value of the force parameter effects the resolution of
- * such a conflict:
- *
true - in this case the compilation is created with the new contents
- *
false - in this case a JavaModelException is thrown
- *
- *
- * @param contents the given contents
- * @param force specify how to handle conflict is the same name already exists
- * @param monitor the given progress monitor
- * @param name the given name
- * @exception JavaModelException if the element could not be created. Reasons include:
+ * Creates and returns a compilation unit in this package fragment with the
+ * specified name and contents. No verification is performed on the
+ * contents.
+ *
+ *
+ * It is possible that a compilation unit with the same name already exists
+ * in this package fragment. The value of the force parameter
+ * effects the resolution of such a conflict:
*
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while creating an underlying resource
- *
The name is not a valid compilation unit name (INVALID_NAME)
- *
The contents are null (INVALID_CONTENTS)
+ *
true - in this case the compilation is created with
+ * the new contents
+ *
false - in this case a
+ * JavaModelException is thrown
*
- * @return a compilation unit in this package fragment
- * with the specified name and contents
+ *
+ * @param contents
+ * the given contents
+ * @param force
+ * specify how to handle conflict is the same name already exists
+ * @param monitor
+ * the given progress monitor
+ * @param name
+ * the given name
+ * @exception JavaModelException
+ * if the element could not be created. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * creating an underlying resource
+ *
The name is not a valid compilation unit name
+ * (INVALID_NAME)
+ *
The contents are null
+ * (INVALID_CONTENTS)
+ *
+ * @return a compilation unit in this package fragment with the specified
+ * name and contents
*/
- ICompilationUnit createCompilationUnit(String name, String contents, boolean force, IProgressMonitor monitor) throws JavaModelException;
+ ICompilationUnit createCompilationUnit(String name, String contents,
+ boolean force, IProgressMonitor monitor) throws JavaModelException;
+
/**
- * Returns the class file with the specified name
- * in this package (for example, "Object.class").
- * The ".class" suffix is required.
- * This is a handle-only method. The class file may or may not be present.
- * @param name the given name
+ * Returns the class file with the specified name in this package (for
+ * example, "Object.class"). The ".class" suffix is
+ * required. This is a handle-only method. The class file may or may not be
+ * present.
+ *
+ * @param name
+ * the given name
* @return the class file with the specified name in this package
*/
-// IClassFile getClassFile(String name);
+ // IClassFile getClassFile(String name);
/**
* Returns all of the class files in this package fragment.
- *
- *
Note: it is possible that a package fragment contains only
- * compilation units (in other words, its kind is K_SOURCE), in
- * which case this method returns an empty collection.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ *
+ *
+ * Note: it is possible that a package fragment contains only compilation
+ * units (in other words, its kind is K_SOURCE), in which
+ * case this method returns an empty collection.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return all of the class files in this package fragment
*/
-// IClassFile[] getClassFiles() throws JavaModelException;
+ // IClassFile[] getClassFiles() throws JavaModelException;
/**
- * Returns the compilation unit with the specified name
- * in this package (for example, "Object.java").
- * The name has to be a valid compilation unit name.
- * This is a handle-only method. The compilation unit may or may not be present.
+ * Returns the compilation unit with the specified name in this package (for
+ * example, "Object.java"). The name has to be a valid
+ * compilation unit name. This is a handle-only method. The compilation unit
+ * may or may not be present.
+ *
* @see JavaConventions#validateCompilationUnitName
- * @param name the given name
+ * @param name
+ * the given name
* @return the compilation unit with the specified name in this package
*/
ICompilationUnit getCompilationUnit(String name);
+
/**
* Returns all of the compilation units in this package fragment.
- *
- *
Note: it is possible that a package fragment contains only
- * class files (in other words, its kind is K_BINARY), in which
- * case this method returns an empty collection.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ *
+ *
+ * Note: it is possible that a package fragment contains only class files
+ * (in other words, its kind is K_BINARY), in which case
+ * this method returns an empty collection.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return all of the compilation units in this package fragment
*/
ICompilationUnit[] getCompilationUnits() throws JavaModelException;
+
/**
* Returns the dot-separated package name of this fragment, for example
- * "java.lang", or "" (the empty string),
- * for the default package.
+ * "java.lang", or "" (the empty string), for
+ * the default package.
*
* @return the dot-separated package name of this fragment
*/
String getElementName();
+
/**
- * Returns this package fragment's root kind encoded as an integer.
- * A package fragment can contain .java source files,
- * or .class files. This is a convenience method.
- *
+ * Returns this package fragment's root kind encoded as an integer. A
+ * package fragment can contain .java source files, or
+ * .class files. This is a convenience method.
+ *
* @see IPackageFragmentRoot#K_SOURCE
* @see IPackageFragmentRoot#K_BINARY
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return this package fragment's root kind encoded as an integer
*/
int getKind() throws JavaModelException;
+
/**
- * Returns an array of non-Java resources contained in this package fragment.
+ * Returns an array of non-Java resources contained in this package
+ * fragment.
*
* Non-Java resources includes other files and folders located in the same
- * directory as the compilation units or class files for this package
+ * directory as the compilation units or class files for this package
* fragment. Source files excluded from this package by one or more
* exclusion patterns on the corresponding source classpath entry are
- * considered non-Java resources and will appear in the result
- * (possibly in a folder).
+ * considered non-Java resources and will appear in the result (possibly in
+ * a folder).
*
*
* @return an array of non-Java resources contained in this package fragment
* @see IClasspathEntry#getExclusionPatterns
*/
-// Object[] getNonJavaResources() throws JavaModelException;
+ // Object[] getNonJavaResources() throws JavaModelException;
/**
- * Returns whether this package fragment's name is
- * a prefix of other package fragments in this package fragment's
- * root.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return true if this package fragment's name is a prefix of other package fragments in this package fragment's root, false otherwise
+ * Returns whether this package fragment's name is a prefix of other package
+ * fragments in this package fragment's root.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return true if this package fragment's name is a prefix of other package
+ * fragments in this package fragment's root, false otherwise
*/
-// boolean hasSubpackages() throws JavaModelException;
+ // boolean hasSubpackages() throws JavaModelException;
/**
- * Returns whether this package fragment is a default package.
- * This is a handle-only method.
+ * Returns whether this package fragment is a default package. This is a
+ * handle-only method.
*
* @return true if this package fragment is a default package
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragmentRoot.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragmentRoot.java
index 9e9fb02..f96a997 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragmentRoot.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IPackageFragmentRoot.java
@@ -18,401 +18,462 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
-
/**
- * A package fragment root contains a set of package fragments.
- * It corresponds to an underlying resource which is either a folder,
- * JAR, or zip. In the case of a folder, all descendant folders represent
- * package fragments. For a given child folder representing a package fragment,
- * the corresponding package name is composed of the folder names between the folder
- * for this root and the child folder representing the package, separated by '.'.
- * In the case of a JAR or zip, the contents of the archive dictates
- * the set of package fragments in an analogous manner.
- * Package fragment roots need to be opened before they can be navigated or manipulated.
- * The children are of type IPackageFragment, and are in no particular order.
+ * A package fragment root contains a set of package fragments. It corresponds
+ * to an underlying resource which is either a folder, JAR, or zip. In the case
+ * of a folder, all descendant folders represent package fragments. For a given
+ * child folder representing a package fragment, the corresponding package name
+ * is composed of the folder names between the folder for this root and the
+ * child folder representing the package, separated by '.'. In the case of a JAR
+ * or zip, the contents of the archive dictates the set of package fragments in
+ * an analogous manner. Package fragment roots need to be opened before they can
+ * be navigated or manipulated. The children are of type
+ * IPackageFragment, and are in no particular order.
*
* This interface is not intended to be implemented by clients.
*
*/
-public interface IPackageFragmentRoot
- extends IParent, IJavaElement, IOpenable {
+public interface IPackageFragmentRoot extends IParent, IJavaElement, IOpenable {
/**
- * Kind constant for a source path root. Indicates this root
- * only contains source files.
+ * Kind constant for a source path root. Indicates this root only contains
+ * source files.
*/
int K_SOURCE = 1;
+
/**
- * Kind constant for a binary path root. Indicates this
- * root only contains binary files.
+ * Kind constant for a binary path root. Indicates this root only contains
+ * binary files.
*/
int K_BINARY = 2;
+
/**
* Empty root path
*/
String DEFAULT_PACKAGEROOT_PATH = ""; //$NON-NLS-1$
+
/**
- * Update model flag constant (bit mask value 1) indicating that the operation
- * is to not copy/move/delete the package fragment root resource.
+ * Update model flag constant (bit mask value 1) indicating that the
+ * operation is to not copy/move/delete the package fragment root resource.
+ *
* @since 2.1
*/
int NO_RESOURCE_MODIFICATION = 1;
+
/**
- * Update model flag constant (bit mask value 2) indicating that the operation
- * is to update the classpath of the originating project.
+ * Update model flag constant (bit mask value 2) indicating that the
+ * operation is to update the classpath of the originating project.
+ *
* @since 2.1
*/
int ORIGINATING_PROJECT_CLASSPATH = 2;
+
/**
- * Update model flag constant (bit mask value 4) indicating that the operation
- * is to update the classpath of all referring projects except the originating project.
+ * Update model flag constant (bit mask value 4) indicating that the
+ * operation is to update the classpath of all referring projects except the
+ * originating project.
+ *
* @since 2.1
*/
int OTHER_REFERRING_PROJECTS_CLASSPATH = 4;
+
/**
- * Update model flag constant (bit mask value 8) indicating that the operation
- * is to update the classpath of the destination project.
+ * Update model flag constant (bit mask value 8) indicating that the
+ * operation is to update the classpath of the destination project.
+ *
* @since 2.1
*/
- int DESTINATION_PROJECT_CLASSPATH = 8;
+ int DESTINATION_PROJECT_CLASSPATH = 8;
+
/**
- * Update model flag constant (bit mask value 16) indicating that the operation
- * is to replace the resource and the destination project's classpath entry.
+ * Update model flag constant (bit mask value 16) indicating that the
+ * operation is to replace the resource and the destination project's
+ * classpath entry.
+ *
* @since 2.1
*/
- int REPLACE = 16;
+ int REPLACE = 16;
+
/**
* Attaches the source archive identified by the given absolute path to this
- * binary package fragment root. rootPath specifies the location
- * of the root within the archive or folder (empty specifies the default root
- * and null specifies the root path should be detected).
- * Once a source archive or folder is attached to the package fragment root,
- * the getSource and getSourceRange
- * methods become operational for binary types/members.
- * To detach a source archive or folder from a package fragment root, specify
- * null as the source path.
- *
- * @param sourcePath the given absolute path to the source archive or folder
- * @param rootPath specifies the location of the root within the archive
- * (empty specifies the default root and null specifies
- * automatic detection of the root path)
- * @param monitor the given progress monitor
- * @exception JavaModelException if this operation fails. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating a server property
- *
This package fragment root is not of kind binary (INVALID_ELEMENT_TYPES)
- *
The path provided is not absolute (RELATIVE_PATH)
- *
+ * binary package fragment root. rootPath specifies the
+ * location of the root within the archive or folder (empty specifies the
+ * default root and null specifies the root path should be
+ * detected). Once a source archive or folder is attached to the package
+ * fragment root, the getSource and
+ * getSourceRange methods become operational for binary
+ * types/members. To detach a source archive or folder from a package
+ * fragment root, specify null as the source path.
+ *
+ * @param sourcePath
+ * the given absolute path to the source archive or folder
+ * @param rootPath
+ * specifies the location of the root within the archive (empty
+ * specifies the default root and null specifies
+ * automatic detection of the root path)
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if this operation fails. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating a server property
+ *
This package fragment root is not of kind binary
+ * (INVALID_ELEMENT_TYPES)
+ *
The path provided is not absolute (RELATIVE_PATH)
+ *
*/
-// void attachSource(IPath sourcePath, IPath rootPath, IProgressMonitor monitor)
-// throws JavaModelException;
-
+ // void attachSource(IPath sourcePath, IPath rootPath, IProgressMonitor
+ // monitor)
+ // throws JavaModelException;
/**
* Copies the resource of this package fragment root to the destination path
* as specified by IResource.copy(IPath, int, IProgressMonitor)
* but excluding nested source folders.
*
- * If NO_RESOURCE_MODIFICATION is specified in
- * updateModelFlags or if this package fragment root is external,
- * this operation doesn't copy the resource. updateResourceFlags
- * is then ignored.
- *
- * If DESTINATION_PROJECT_CLASSPATH is specified in
- * updateModelFlags, updates the classpath of the
- * destination's project (if it is a Java project). If a non-null
- * sibling is specified, a copy of this root's classpath entry is inserted before the
- * sibling on the destination project's raw classpath. If null is
- * specified, the classpath entry is added at the end of the raw classpath.
- *
+ * If NO_RESOURCE_MODIFICATION is specified in
+ * updateModelFlags or if this package fragment root is
+ * external, this operation doesn't copy the resource.
+ * updateResourceFlags is then ignored.
+ *
+ *
+ * If DESTINATION_PROJECT_CLASSPATH is specified in
+ * updateModelFlags, updates the classpath of the
+ * destination's project (if it is a Java project). If a non-null
+ * sibling is specified, a copy of this root's classpath entry is inserted
+ * before the sibling on the destination project's raw classpath. If
+ * null is specified, the classpath entry is added at the end
+ * of the raw classpath.
+ *
+ *
* If REPLACE is specified in updateModelFlags,
- * overwrites the resource at the destination path if any.
- * If the same classpath entry already exists on the destination project's raw
- * classpath, then the sibling is ignored and the new classpath entry replaces the
- * existing one.
- *
- * If no flags is specified in updateModelFlags (using
+ * overwrites the resource at the destination path if any. If the same
+ * classpath entry already exists on the destination project's raw
+ * classpath, then the sibling is ignored and the new classpath entry
+ * replaces the existing one.
+ *
+ *
+ * If no flags is specified in updateModelFlags (using
* IResource.NONE), the default behavior applies: the
- * resource is copied (if this package fragment root is not external) and the
- * classpath is not updated.
+ * resource is copied (if this package fragment root is not external) and
+ * the classpath is not updated.
*
*
- * @param destination the destination path
- * @param updateResourceFlags bit-wise or of update resource flag constants
- * (IResource.FORCE and IResource.SHALLOW)
- * @param updateModelFlags bit-wise or of update resource flag constants
- * (DESTINATION_PROJECT_CLASSPATH and
- * NO_RESOURCE_MODIFICATION)
- * @param sibling the classpath entry before which a copy of the classpath
- * entry should be inserted or null if the classpath entry should
- * be inserted at the end
- * @param monitor a progress monitor
+ * @param destination
+ * the destination path
+ * @param updateResourceFlags
+ * bit-wise or of update resource flag constants (IResource.FORCE
+ * and IResource.SHALLOW)
+ * @param updateModelFlags
+ * bit-wise or of update resource flag constants (DESTINATION_PROJECT_CLASSPATH
+ * and NO_RESOURCE_MODIFICATION)
+ * @param sibling
+ * the classpath entry before which a copy of the classpath entry
+ * should be inserted or null if the classpath
+ * entry should be inserted at the end
+ * @param monitor
+ * a progress monitor
*
- * @exception JavaModelException if this root could not be copied. Reasons
- * include:
- *
- *
This root does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while copying the
- * resource or updating a classpath
- *
- * The destination is not inside an existing project and updateModelFlags
- * has been specified as DESTINATION_PROJECT_CLASSPATH
- * (INVALID_DESTINATION)
- *
The sibling is not a classpath entry on the destination project's
- * raw classpath (INVALID_SIBLING)
- *
The same classpath entry already exists on the destination project's
- * classpath (NAME_COLLISION) and updateModelFlags
- * has not been specified as REPLACE
- *
+ * @exception JavaModelException
+ * if this root could not be copied. Reasons include:
+ *
+ *
This root does not exist (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while copying
+ * the resource or updating a classpath
+ *
The destination is not inside an existing project and
+ * updateModelFlags has been specified as
+ * DESTINATION_PROJECT_CLASSPATH
+ * (INVALID_DESTINATION)
+ *
The sibling is not a classpath entry on the
+ * destination project's raw classpath (INVALID_SIBLING)
+ *
The same classpath entry already exists on the
+ * destination project's classpath (NAME_COLLISION) and
+ * updateModelFlags has not been specified as
+ * REPLACE
+ *
* @see org.eclipse.core.resources.IResource#copy
* @since 2.1
*/
-// void copy(IPath destination, int updateResourceFlags, int updateModelFlags, IClasspathEntry sibling, IProgressMonitor monitor) throws JavaModelException;
+ // void copy(IPath destination, int updateResourceFlags, int
+ // updateModelFlags, IClasspathEntry sibling, IProgressMonitor monitor)
+ // throws JavaModelException;
/**
- * Creates and returns a package fragment in this root with the
- * given dot-separated package name. An empty string specifies the default package.
- * This has the side effect of creating all package
- * fragments that are a prefix of the new package fragment which
- * do not exist yet. If the package fragment already exists, this
- * has no effect.
- *
- * For a description of the force flag, see IFolder.create.
- *
- * @param name the given dot-separated package name
- * @param force a flag controlling how to deal with resources that
- * are not in sync with the local file system
- * @param monitor the given progress monitor
- * @exception JavaModelException if the element could not be created. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while creating an underlying resource
- *
This package fragment root is read only (READ_ONLY)
- *
The name is not a valid package name (INVALID_NAME)
- *
- * @return a package fragment in this root with the given dot-separated package name
+ * Creates and returns a package fragment in this root with the given
+ * dot-separated package name. An empty string specifies the default
+ * package. This has the side effect of creating all package fragments that
+ * are a prefix of the new package fragment which do not exist yet. If the
+ * package fragment already exists, this has no effect.
+ *
+ * For a description of the force flag, see
+ * IFolder.create.
+ *
+ * @param name
+ * the given dot-separated package name
+ * @param force
+ * a flag controlling how to deal with resources that are not in
+ * sync with the local file system
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if the element could not be created. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * creating an underlying resource
+ *
This package fragment root is read only (READ_ONLY)
+ *
The name is not a valid package name (INVALID_NAME)
+ *
+ * @return a package fragment in this root with the given dot-separated
+ * package name
* @see org.eclipse.core.resources.IFolder#create
*/
-// IPackageFragment createPackageFragment(
-// String name,
-// boolean force,
-// IProgressMonitor monitor)
-// throws JavaModelException;
+ // IPackageFragment createPackageFragment(
+ // String name,
+ // boolean force,
+ // IProgressMonitor monitor)
+ // throws JavaModelException;
/**
* Deletes the resource of this package fragment root as specified by
- * IResource.delete(int, IProgressMonitor) but excluding nested
- * source folders.
+ * IResource.delete(int, IProgressMonitor) but excluding
+ * nested source folders.
+ *
+ * If NO_RESOURCE_MODIFICATION is specified in
+ * updateModelFlags or if this package fragment root is
+ * external, this operation doesn't delete the resource.
+ * updateResourceFlags is then ignored.
+ *
*
- * If NO_RESOURCE_MODIFICATION is specified in
- * updateModelFlags or if this package fragment root is external,
- * this operation doesn't delete the resource. updateResourceFlags
- * is then ignored.
- *
- * If ORIGINATING_PROJECT_CLASSPATH is specified in
- * updateModelFlags, update the raw classpath of this package
- * fragment root's project by removing the corresponding classpath entry.
- *
- * If OTHER_REFERRING_PROJECTS_CLASSPATH is specified in
- * updateModelFlags, update the raw classpaths of all other Java
- * projects referring to this root's resource by removing the corresponding classpath
- * entries.
- *
- * If no flags is specified in updateModelFlags (using
+ * If ORIGINATING_PROJECT_CLASSPATH is specified in
+ * updateModelFlags, update the raw classpath of this
+ * package fragment root's project by removing the corresponding classpath
+ * entry.
+ *
+ *
+ * If OTHER_REFERRING_PROJECTS_CLASSPATH is specified in
+ * updateModelFlags, update the raw classpaths of all other
+ * Java projects referring to this root's resource by removing the
+ * corresponding classpath entries.
+ *
+ *
+ * If no flags is specified in updateModelFlags (using
* IResource.NONE), the default behavior applies: the
- * resource is deleted (if this package fragment root is not external) and no
- * classpaths are updated.
+ * resource is deleted (if this package fragment root is not external) and
+ * no classpaths are updated.
*
*
- * @param updateResourceFlags bit-wise or of update resource flag constants
- * (IResource.FORCE and IResource.KEEP_HISTORY)
- * @param updateModelFlags bit-wise or of update resource flag constants
- * (ORIGINATING_PROJECT_CLASSPATH,
- * OTHER_REFERRING_PROJECTS_CLASSPATH and
- * NO_RESOURCE_MODIFICATION)
- * @param monitor a progress monitor
+ * @param updateResourceFlags
+ * bit-wise or of update resource flag constants (IResource.FORCE
+ * and IResource.KEEP_HISTORY)
+ * @param updateModelFlags
+ * bit-wise or of update resource flag constants (ORIGINATING_PROJECT_CLASSPATH,
+ * OTHER_REFERRING_PROJECTS_CLASSPATH and
+ * NO_RESOURCE_MODIFICATION)
+ * @param monitor
+ * a progress monitor
*
- * @exception JavaModelException if this root could not be deleted. Reasons
- * include:
- *
- *
This root does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while deleting the resource
- * or updating a classpath
- *
- *
+ * @exception JavaModelException
+ * if this root could not be deleted. Reasons include:
+ *
+ *
This root does not exist (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * deleting the resource or updating a classpath
+ *
* @see org.eclipse.core.resources.IResource#delete
* @since 2.1
*/
-// void delete(int updateResourceFlags, int updateModelFlags, IProgressMonitor monitor) throws JavaModelException;
+ // void delete(int updateResourceFlags, int updateModelFlags,
+ // IProgressMonitor monitor) throws JavaModelException;
/**
- * Returns this package fragment root's kind encoded as an integer.
- * A package fragment root can contain .java source files,
- * or .class files, but not both.
- * If the underlying folder or archive contains other kinds of files, they are ignored.
- * In particular, .class files are ignored under a source package fragment root,
- * and .java files are ignored under a binary package fragment root.
- *
+ * Returns this package fragment root's kind encoded as an integer. A
+ * package fragment root can contain .java source files, or
+ * .class files, but not both. If the underlying folder or
+ * archive contains other kinds of files, they are ignored. In particular,
+ * .class files are ignored under a source package fragment
+ * root, and .java files are ignored under a binary package
+ * fragment root.
+ *
* @see IPackageFragmentRoot#K_SOURCE
* @see IPackageFragmentRoot#K_BINARY
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return this package fragment root's kind encoded as an integer
*/
int getKind() throws JavaModelException;
-
+
/**
- * Returns an array of non-Java resources contained in this package fragment root.
+ * Returns an array of non-Java resources contained in this package fragment
+ * root.
*
* Non-Java resources includes other files and folders located in the same
* directories as the compilation units or class files under this package
- * fragment root. Resources excluded from this package fragment root
- * by one or more exclusion patterns on the corresponding source classpath
- * entry are considered non-Java resources and will appear in the result
- * (possibly in a folder). Thus when a nested source folder is excluded, it will appear
- * in the non-Java resources of the outer folder.
+ * fragment root. Resources excluded from this package fragment root by one
+ * or more exclusion patterns on the corresponding source classpath entry
+ * are considered non-Java resources and will appear in the result (possibly
+ * in a folder). Thus when a nested source folder is excluded, it will
+ * appear in the non-Java resources of the outer folder.
*
- * @return an array of non-Java resources contained in this package fragment root
+ *
+ * @return an array of non-Java resources contained in this package fragment
+ * root
* @see IClasspathEntry#getExclusionPatterns
*/
-// Object[] getNonJavaResources() throws JavaModelException;
-
+ // Object[] getNonJavaResources() throws JavaModelException;
/**
- * Returns the package fragment with the given package name.
- * An empty string indicates the default package.
- * This is a handle-only operation. The package fragment
- * may or may not exist.
+ * Returns the package fragment with the given package name. An empty string
+ * indicates the default package. This is a handle-only operation. The
+ * package fragment may or may not exist.
*
- * @param packageName the given package name
+ * @param packageName
+ * the given package name
* @return the package fragment with the given package name
*/
IPackageFragment getPackageFragment(String packageName);
-
/**
* Returns the first raw classpath entry that corresponds to this package
- * fragment root.
- * A raw classpath entry corresponds to a package fragment root if once resolved
- * this entry's path is equal to the root's path.
+ * fragment root. A raw classpath entry corresponds to a package fragment
+ * root if once resolved this entry's path is equal to the root's path.
*
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return the first raw classpath entry that corresponds to this package fragment root
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return the first raw classpath entry that corresponds to this package
+ * fragment root
* @since 2.0
*/
-// IClasspathEntry getRawClasspathEntry() throws JavaModelException;
-
+ // IClasspathEntry getRawClasspathEntry() throws JavaModelException;
/**
- * Returns the absolute path to the source archive attached to
- * this package fragment root's binary archive.
- *
- * @return the absolute path to the corresponding source archive,
- * or null if this package fragment root's binary archive
- * has no corresponding source archive, or if this package fragment root
- * is not a binary archive
- * @exception JavaModelException if this operation fails
+ * Returns the absolute path to the source archive attached to this package
+ * fragment root's binary archive.
+ *
+ * @return the absolute path to the corresponding source archive, or
+ * null if this package fragment root's binary
+ * archive has no corresponding source archive, or if this package
+ * fragment root is not a binary archive
+ * @exception JavaModelException
+ * if this operation fails
*/
-// IPath getSourceAttachmentPath() throws JavaModelException;
-
+ // IPath getSourceAttachmentPath() throws JavaModelException;
/**
- * Returns the path within this package fragment root's source archive.
- * An empty path indicates that packages are located at the root of the
- * source archive.
- *
- * @return the path within the corresponding source archive,
- * or null if this package fragment root's binary archive
- * has no corresponding source archive, or if this package fragment root
- * is not a binary archive
- * @exception JavaModelException if this operation fails
+ * Returns the path within this package fragment root's source archive. An
+ * empty path indicates that packages are located at the root of the source
+ * archive.
+ *
+ * @return the path within the corresponding source archive, or
+ * null if this package fragment root's binary
+ * archive has no corresponding source archive, or if this package
+ * fragment root is not a binary archive
+ * @exception JavaModelException
+ * if this operation fails
*/
-// IPath getSourceAttachmentRootPath() throws JavaModelException;
-
+ // IPath getSourceAttachmentRootPath() throws JavaModelException;
/**
- * Returns whether this package fragment root's underlying
- * resource is a binary archive (a JAR or zip file).
+ * Returns whether this package fragment root's underlying resource is a
+ * binary archive (a JAR or zip file).
*
- * @return true if this package fragment root's underlying resource is a binary archive, false otherwise
+ * @return true if this package fragment root's underlying resource is a
+ * binary archive, false otherwise
*/
public boolean isArchive();
-
+
/**
- * Returns whether this package fragment root is external
- * to the workbench (that is, a local file), and has no
- * underlying resource.
+ * Returns whether this package fragment root is external to the workbench
+ * (that is, a local file), and has no underlying resource.
*
- * @return true if this package fragment root is external
- * to the workbench (that is, a local file), and has no
- * underlying resource, false otherwise
+ * @return true if this package fragment root is external to the workbench
+ * (that is, a local file), and has no underlying resource, false
+ * otherwise
*/
boolean isExternal();
-
+
/**
* Moves the resource of this package fragment root to the destination path
* as specified by IResource.move(IPath,int,IProgressMonitor)
* but excluding nested source folders.
*
- * If NO_RESOURCE_MODIFICATION is specified in
- * updateModelFlags or if this package fragment root is external,
- * this operation doesn't move the resource. updateResourceFlags
- * is then ignored.
- *
- * If DESTINATION_PROJECT_CLASSPATH is specified in
- * updateModelFlags, updates the classpath of the
- * destination's project (if it is a Java project). If a non-null
- * sibling is specified, a copy of this root's classpath entry is inserted before the
- * sibling on the destination project's raw classpath. If null is
- * specified, the classpath entry is added at the end of the raw classpath.
- *
- * If ORIGINATING_PROJECT_CLASSPATH is specified in
- * updateModelFlags, update the raw classpath of this package
- * fragment root's project by removing the corresponding classpath entry.
- *
- * If OTHER_REFERRING_PROJECTS_CLASSPATH is specified in
- * updateModelFlags, update the raw classpaths of all other Java
- * projects referring to this root's resource by removing the corresponding classpath
- * entries.
- *
+ * If NO_RESOURCE_MODIFICATION is specified in
+ * updateModelFlags or if this package fragment root is
+ * external, this operation doesn't move the resource.
+ * updateResourceFlags is then ignored.
+ *
+ *
+ * If DESTINATION_PROJECT_CLASSPATH is specified in
+ * updateModelFlags, updates the classpath of the
+ * destination's project (if it is a Java project). If a non-null
+ * sibling is specified, a copy of this root's classpath entry is inserted
+ * before the sibling on the destination project's raw classpath. If
+ * null is specified, the classpath entry is added at the end
+ * of the raw classpath.
+ *
+ *
+ * If ORIGINATING_PROJECT_CLASSPATH is specified in
+ * updateModelFlags, update the raw classpath of this
+ * package fragment root's project by removing the corresponding classpath
+ * entry.
+ *
+ *
+ * If OTHER_REFERRING_PROJECTS_CLASSPATH is specified in
+ * updateModelFlags, update the raw classpaths of all other
+ * Java projects referring to this root's resource by removing the
+ * corresponding classpath entries.
+ *
+ *
* If REPLACE is specified in updateModelFlags,
- * overwrites the resource at the destination path if any.
- * If the same classpath entry already exists on the destination project's raw
- * classpath, then the sibling is ignored and the new classpath entry replaces the
- * existing one.
- *
- * If no flags is specified in updateModelFlags (using
+ * overwrites the resource at the destination path if any. If the same
+ * classpath entry already exists on the destination project's raw
+ * classpath, then the sibling is ignored and the new classpath entry
+ * replaces the existing one.
+ *
+ *
+ * If no flags is specified in updateModelFlags (using
* IResource.NONE), the default behavior applies: the
* resource is moved (if this package fragment root is not external) and no
* classpaths are updated.
*
*
- * @param destination the destination path
- * @param updateFlags bit-wise or of update flag constants
- * (IResource.FORCE, IResource.KEEP_HISTORY
- * and IResource.SHALLOW)
- * @param updateModelFlags bit-wise or of update resource flag constants
- * (DESTINATION_PROJECT_CLASSPATH,
- * ORIGINATING_PROJECT_CLASSPATH,
- * OTHER_REFERRING_PROJECTS_CLASSPATH and
- * NO_RESOURCE_MODIFICATION)
- * @param sibling the classpath entry before which a copy of the classpath
- * entry should be inserted or null if the classpath entry should
- * be inserted at the end
- * @param monitor a progress monitor
+ * @param destination
+ * the destination path
+ * @param updateFlags
+ * bit-wise or of update flag constants (IResource.FORCE,
+ * IResource.KEEP_HISTORY and
+ * IResource.SHALLOW)
+ * @param updateModelFlags
+ * bit-wise or of update resource flag constants (DESTINATION_PROJECT_CLASSPATH,
+ * ORIGINATING_PROJECT_CLASSPATH,
+ * OTHER_REFERRING_PROJECTS_CLASSPATH and
+ * NO_RESOURCE_MODIFICATION)
+ * @param sibling
+ * the classpath entry before which a copy of the classpath entry
+ * should be inserted or null if the classpath
+ * entry should be inserted at the end
+ * @param monitor
+ * a progress monitor
*
- * @exception JavaModelException if this root could not be moved. Reasons
- * include:
- *
- *
This root does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while copying the
- * resource or updating a classpath
- *
- * The destination is not inside an existing project and updateModelFlags
- * has been specified as DESTINATION_PROJECT_CLASSPATH
- * (INVALID_DESTINATION)
- *
The sibling is not a classpath entry on the destination project's
- * raw classpath (INVALID_SIBLING)
- *
The same classpath entry already exists on the destination project's
- * classpath (NAME_COLLISION) and updateModelFlags
- * has not been specified as REPLACE
- *
+ * @exception JavaModelException
+ * if this root could not be moved. Reasons include:
+ *
+ *
This root does not exist (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while copying
+ * the resource or updating a classpath
+ *
The destination is not inside an existing project and
+ * updateModelFlags has been specified as
+ * DESTINATION_PROJECT_CLASSPATH
+ * (INVALID_DESTINATION)
+ *
The sibling is not a classpath entry on the
+ * destination project's raw classpath (INVALID_SIBLING)
+ *
The same classpath entry already exists on the
+ * destination project's classpath (NAME_COLLISION) and
+ * updateModelFlags has not been specified as
+ * REPLACE
+ *
* @see org.eclipse.core.resources.IResource#move
* @since 2.1
*/
-// void move(IPath destination, int updateResourceFlags, int updateModelFlags, IClasspathEntry sibling, IProgressMonitor monitor) throws JavaModelException;
+ // void move(IPath destination, int updateResourceFlags, int
+ // updateModelFlags, IClasspathEntry sibling, IProgressMonitor monitor)
+ // throws JavaModelException;
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IParent.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IParent.java
index f1571c5..6ee4aa3 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IParent.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IParent.java
@@ -17,24 +17,27 @@ package net.sourceforge.phpdt.core;
*
*/
public interface IParent {
-/**
- * Returns the immediate children of this element.
- * Unless otherwise specified by the implementing element,
- * the children are in no particular order.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- * @return the immediate children of this element
- */
-IJavaElement[] getChildren() throws JavaModelException;
-/**
- * Returns whether this element has one or more immediate children.
- * This is a convenience method, and may be more efficient than
- * testing whether getChildren is an empty array.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- * @return true if the immediate children of this element, false otherwise
- */
-boolean hasChildren() throws JavaModelException;
+ /**
+ * Returns the immediate children of this element. Unless otherwise
+ * specified by the implementing element, the children are in no particular
+ * order.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ * @return the immediate children of this element
+ */
+ IJavaElement[] getChildren() throws JavaModelException;
+
+ /**
+ * Returns whether this element has one or more immediate children. This is
+ * a convenience method, and may be more efficient than testing whether
+ * getChildren is an empty array.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ * @return true if the immediate children of this element, false otherwise
+ */
+ boolean hasChildren() throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IProblemRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IProblemRequestor.java
index 5f2e487..c77d5eb 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IProblemRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IProblemRequestor.java
@@ -12,39 +12,41 @@ package net.sourceforge.phpdt.core;
import net.sourceforge.phpdt.core.compiler.IProblem;
-
/**
- * A callback interface for receiving java problem as they are discovered
- * by some Java operation.
+ * A callback interface for receiving java problem as they are discovered by
+ * some Java operation.
*
* @see IProblem
* @since 2.0
*/
public interface IProblemRequestor {
-
+
/**
* Notification of a Java problem.
*
- * @param problem IProblem - The discovered Java problem.
- */
+ * @param problem
+ * IProblem - The discovered Java problem.
+ */
void acceptProblem(IProblem problem);
/**
* Notification sent before starting the problem detection process.
- * Typically, this would tell a problem collector to clear previously recorded problems.
+ * Typically, this would tell a problem collector to clear previously
+ * recorded problems.
*/
void beginReporting();
/**
* Notification sent after having completed problem detection process.
- * Typically, this would tell a problem collector that no more problems should be expected in this
- * iteration.
+ * Typically, this would tell a problem collector that no more problems
+ * should be expected in this iteration.
*/
void endReporting();
/**
- * Predicate allowing the problem requestor to signal whether or not it is currently
- * interested by problem reports. When answering false, problem will
+ * Predicate allowing the problem requestor to signal whether or not it is
+ * currently interested by problem reports. When answering
+ * false, problem will
* not be discovered any more until the next iteration.
*
* This predicate will be invoked once prior to each problem detection iteration.
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IRegion.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IRegion.java
index 6733054..b08700a 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IRegion.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IRegion.java
@@ -11,57 +11,64 @@
package net.sourceforge.phpdt.core;
/**
- * A Java model region describes a hierarchical set of elements.
- * Regions are often used to describe a set of elements to be considered
- * when performing operations; for example, the set of elements to be
- * considered during a search. A region may include elements from different
- * projects.
+ * A Java model region describes a hierarchical set of elements. Regions are
+ * often used to describe a set of elements to be considered when performing
+ * operations; for example, the set of elements to be considered during a
+ * search. A region may include elements from different projects.
*
- * When an element is included in a region, all of its children
- * are considered to be included. Children of an included element
- * cannot be selectively excluded.
+ * When an element is included in a region, all of its children are considered
+ * to be included. Children of an included element cannot be selectively
+ * excluded.
*
*
- * This interface is not intended to be implemented by clients.
- * Instances can be created via the JavaCore.newRegion.
+ * This interface is not intended to be implemented by clients. Instances can be
+ * created via the JavaCore.newRegion.
*
- *
+ *
* @see JavaCore#newRegion
*/
public interface IRegion {
/**
- * Adds the given element and all of its descendents to this region.
- * If the specified element is already included, or one of its
- * ancestors is already included, this has no effect. If the element
- * being added is an ancestor of an element already contained in this
- * region, the ancestor subsumes the descendent.
+ * Adds the given element and all of its descendents to this region. If the
+ * specified element is already included, or one of its ancestors is already
+ * included, this has no effect. If the element being added is an ancestor
+ * of an element already contained in this region, the ancestor subsumes the
+ * descendent.
*
- * @param element the given element
+ * @param element
+ * the given element
*/
void add(IJavaElement element);
+
/**
* Returns whether the given element is contained in this region.
*
- * @param element the given element
- * @return true if the given element is contained in this region, false otherwise
+ * @param element
+ * the given element
+ * @return true if the given element is contained in this region, false
+ * otherwise
*/
boolean contains(IJavaElement element);
+
/**
- * Returns the top level elements in this region.
- * All descendents of these elements are also included in this region.
+ * Returns the top level elements in this region. All descendents of these
+ * elements are also included in this region.
*
* @return the top level elements in this region
*/
IJavaElement[] getElements();
+
/**
* Removes the specified element from the region and returns
* true if successful, false if the remove
- * fails. If an ancestor of the given element is included, the
- * remove fails (in other words, it is not possible to selectively
- * exclude descendants of included ancestors).
+ * fails. If an ancestor of the given element is included, the remove fails
+ * (in other words, it is not possible to selectively exclude descendants of
+ * included ancestors).
*
- * @param element the given element
- * @return true if successful, false if the remove fails
+ * @param element
+ * the given element
+ * @return true if successful, false if the
+ * remove fails
*/
boolean remove(IJavaElement element);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceManipulation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceManipulation.java
index 554bbf9..2a7ebe6 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceManipulation.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceManipulation.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
-
/**
* Common protocol for Java elements that support source code manipulations such
* as copy, move, rename, and delete.
@@ -19,94 +18,138 @@ package net.sourceforge.phpdt.core;
*
*/
public interface ISourceManipulation {
-/**
- * Copies this element to the given container.
- *
- * @param container the container
- * @param sibling the sibling element before which the copy should be inserted,
- * or null if the copy should be inserted as the last child of
- * the container
- * @param rename the new name for the element, or null if the copy
- * retains the name of this element
- * @param replace true if any existing child in the container with
- * the target name should be replaced, and false to throw an
- * exception in the event of a name collision
- * @param monitor a progress monitor
- * @exception JavaModelException if this element could not be copied. Reasons include:
- *
- *
This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
The container is of an incompatible type (INVALID_DESTINATION)
- *
The sibling is not a child of the given container (INVALID_SIBLING)
- *
The new name is invalid (INVALID_NAME)
- *
A child in the container already exists with the same name (NAME_COLLISION)
- * and replace has been specified as false
- *
The container or this element is read-only (READ_ONLY)
- *
- *
- * @exception IllegalArgumentException if container is null
- */
-//void copy(IJavaElement container, IJavaElement sibling, String rename, boolean replace, IProgressMonitor monitor) throws JavaModelException;
-/**
- * Deletes this element, forcing if specified and necessary.
- *
- * @param force a flag controlling whether underlying resources that are not
- * in sync with the local file system will be tolerated (same as the force flag
- * in IResource operations).
- * @param monitor a progress monitor
- * @exception JavaModelException if this element could not be deleted. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource (CORE_EXCEPTION)
- *
This element is read-only (READ_ONLY)
- *
- */
-//void delete(boolean force, IProgressMonitor monitor) throws JavaModelException;
-/**
- * Moves this element to the given container.
- *
- * @param container the container
- * @param sibling the sibling element before which the element should be inserted,
- * or null if the element should be inserted as the last child of
- * the container
- * @param rename the new name for the element, or null if the
- * element retains its name
- * @param replace true if any existing child in the container with
- * the target name should be replaced, and false to throw an
- * exception in the event of a name collision
- * @param monitor a progress monitor
- * @exception JavaModelException if this element could not be moved. Reasons include:
- *
- *
This Java element, container element, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
The container is of an incompatible type (INVALID_DESTINATION)
- *
The sibling is not a child of the given container (INVALID_SIBLING)
- *
The new name is invalid (INVALID_NAME)
- *
A child in the container already exists with the same name (NAME_COLLISION)
- * and replace has been specified as false
- *
The container or this element is read-only (READ_ONLY)
- *
- *
- * @exception IllegalArgumentException if container is null
- */
-//void move(IJavaElement container, IJavaElement sibling, String rename, boolean replace, IProgressMonitor monitor) throws JavaModelException;
-/**
- * Renames this element to the given name.
- *
- * @param name the new name for the element
- * @param replace true if any existing element with the target name
- * should be replaced, and false to throw an exception in the
- * event of a name collision
- * @param monitor a progress monitor
- * @exception JavaModelException if this element could not be renamed. Reasons include:
- *
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
The new name is invalid (INVALID_NAME)
- *
A child in the container already exists with the same name (NAME_COLLISION)
- * and replace has been specified as false
- *
This element is read-only (READ_ONLY)
- *
- */
-//void rename(String name, boolean replace, IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Copies this element to the given container.
+ *
+ * @param container
+ * the container
+ * @param sibling
+ * the sibling element before which the copy should be inserted,
+ * or null if the copy should be inserted as the
+ * last child of the container
+ * @param rename
+ * the new name for the element, or null if the
+ * copy retains the name of this element
+ * @param replace
+ * true if any existing child in the container
+ * with the target name should be replaced, and
+ * false to throw an exception in the event of a
+ * name collision
+ * @param monitor
+ * a progress monitor
+ * @exception JavaModelException
+ * if this element could not be copied. Reasons include:
+ *
+ *
This Java element, container element, or sibling does
+ * not exist (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
The container is of an incompatible type
+ * (INVALID_DESTINATION)
+ *
The sibling is not a child of the given container
+ * (INVALID_SIBLING)
+ *
The new name is invalid (INVALID_NAME)
+ *
A child in the container already exists with the same
+ * name (NAME_COLLISION) and replace has been
+ * specified as false
+ *
The container or this element is read-only
+ * (READ_ONLY)
+ *
+ *
+ * @exception IllegalArgumentException
+ * if container is null
+ */
+ // void copy(IJavaElement container, IJavaElement sibling, String rename,
+ // boolean replace, IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Deletes this element, forcing if specified and necessary.
+ *
+ * @param force
+ * a flag controlling whether underlying resources that are not
+ * in sync with the local file system will be tolerated (same as
+ * the force flag in IResource operations).
+ * @param monitor
+ * a progress monitor
+ * @exception JavaModelException
+ * if this element could not be deleted. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource (CORE_EXCEPTION)
+ *
This element is read-only (READ_ONLY)
+ *
+ */
+ // void delete(boolean force, IProgressMonitor monitor) throws
+ // JavaModelException;
+ /**
+ * Moves this element to the given container.
+ *
+ * @param container
+ * the container
+ * @param sibling
+ * the sibling element before which the element should be
+ * inserted, or null if the element should be
+ * inserted as the last child of the container
+ * @param rename
+ * the new name for the element, or null if the
+ * element retains its name
+ * @param replace
+ * true if any existing child in the container
+ * with the target name should be replaced, and
+ * false to throw an exception in the event of a
+ * name collision
+ * @param monitor
+ * a progress monitor
+ * @exception JavaModelException
+ * if this element could not be moved. Reasons include:
+ *
+ *
This Java element, container element, or sibling does
+ * not exist (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
The container is of an incompatible type
+ * (INVALID_DESTINATION)
+ *
The sibling is not a child of the given container
+ * (INVALID_SIBLING)
+ *
The new name is invalid (INVALID_NAME)
+ *
A child in the container already exists with the same
+ * name (NAME_COLLISION) and replace has been
+ * specified as false
+ *
The container or this element is read-only
+ * (READ_ONLY)
+ *
+ *
+ * @exception IllegalArgumentException
+ * if container is null
+ */
+ // void move(IJavaElement container, IJavaElement sibling, String rename,
+ // boolean replace, IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Renames this element to the given name.
+ *
+ * @param name
+ * the new name for the element
+ * @param replace
+ * true if any existing element with the target
+ * name should be replaced, and false to throw an
+ * exception in the event of a name collision
+ * @param monitor
+ * a progress monitor
+ * @exception JavaModelException
+ * if this element could not be renamed. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
The new name is invalid (INVALID_NAME)
+ *
A child in the container already exists with the same
+ * name (NAME_COLLISION) and replace has been
+ * specified as false
+ *
This element is read-only (READ_ONLY)
+ *
+ */
+ // void rename(String name, boolean replace, IProgressMonitor monitor)
+ // throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceRange.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceRange.java
index 46ab0f6..302e6da 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceRange.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceRange.java
@@ -11,28 +11,31 @@
package net.sourceforge.phpdt.core;
/**
- * A source range defines an element's source coordinates relative to
- * its source buffer.
+ * A source range defines an element's source coordinates relative to its source
+ * buffer.
*
* This interface is not intended to be implemented by clients.
*
*/
public interface ISourceRange {
-/**
- * Returns the number of characters of the source code for this element,
- * relative to the source buffer in which this element is contained.
- *
- * @return the number of characters of the source code for this element,
- * relative to the source buffer in which this element is contained
- */
-int getLength();
-/**
- * Returns the 0-based index of the first character of the source code for this element,
- * relative to the source buffer in which this element is contained.
- *
- * @return the 0-based index of the first character of the source code for this element,
- * relative to the source buffer in which this element is contained
- */
-int getOffset();
+ /**
+ * Returns the number of characters of the source code for this element,
+ * relative to the source buffer in which this element is contained.
+ *
+ * @return the number of characters of the source code for this element,
+ * relative to the source buffer in which this element is contained
+ */
+ int getLength();
+
+ /**
+ * Returns the 0-based index of the first character of the source code for
+ * this element, relative to the source buffer in which this element is
+ * contained.
+ *
+ * @return the 0-based index of the first character of the source code for
+ * this element, relative to the source buffer in which this element
+ * is contained
+ */
+ int getOffset();
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceReference.java
index 6497066..d864a05 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceReference.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ISourceReference.java
@@ -11,63 +11,66 @@
package net.sourceforge.phpdt.core;
/**
- * Common protocol for Java elements that have associated source code.
- * This set consists of IClassFile, ICompilationUnit,
+ * Common protocol for Java elements that have associated source code. This set
+ * consists of IClassFile, ICompilationUnit,
* IPackageDeclaration, IImportDeclaration,
* IImportContainer, IType, IField,
* IMethod, and IInitializer.
*
*
* Note: For IClassFile, IType and other members
- * derived from a binary type, the implementation returns source iff the
- * element has attached source code.
+ * derived from a binary type, the implementation returns source iff the element
+ * has attached source code.
*
*
- * Source reference elements may be working copies if they were created from
- * a compilation unit that is a working copy.
+ * Source reference elements may be working copies if they were created from a
+ * compilation unit that is a working copy.
*
*
* This interface is not intended to be implemented by clients.
*
- *
+ *
* @see IPackageFragmentRoot#attachSource
*/
public interface ISourceReference {
-/**
- * Returns whether this element exists in the model.
- *
- * @return true if this element exists in the Java model
- * @since 2.0
- */
-boolean exists();
-
-/**
- * Returns the source code associated with this element.
- * This extracts the substring from the source buffer containing this source
- * element. This corresponds to the source range that would be returned by
- * getSourceRange.
- *
- * For class files, this returns the source of the entire compilation unit
- * associated with the class file (if there is one).
- *
- *
- * @return the source code, or null if this element has no
- * associated source code
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- */
-String getSource() throws JavaModelException;
-/**
- * Returns the source range associated with this element.
- *
- * For class files, this returns the range of the entire compilation unit
- * associated with the class file (if there is one).
- *
- *
- * @return the source range, or null if this element has no
- * associated source code
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource
- */
-ISourceRange getSourceRange() throws JavaModelException;
+ /**
+ * Returns whether this element exists in the model.
+ *
+ * @return true if this element exists in the Java model
+ * @since 2.0
+ */
+ boolean exists();
+
+ /**
+ * Returns the source code associated with this element. This extracts the
+ * substring from the source buffer containing this source element. This
+ * corresponds to the source range that would be returned by
+ * getSourceRange.
+ *
+ * For class files, this returns the source of the entire compilation unit
+ * associated with the class file (if there is one).
+ *
+ *
+ * @return the source code, or null if this element has no
+ * associated source code
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ */
+ String getSource() throws JavaModelException;
+
+ /**
+ * Returns the source range associated with this element.
+ *
+ * For class files, this returns the range of the entire compilation unit
+ * associated with the class file (if there is one).
+ *
+ *
+ * @return the source range, or null if this element has no
+ * associated source code
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource
+ */
+ ISourceRange getSourceRange() throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java
index ee57a1f..ddb4160 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IType.java
@@ -10,20 +10,19 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
-
-
/**
* Represents either a source type in a compilation unit (either a top-level
* type or a member type) or a binary type in a class file.
*
- * If a binary type cannot be parsed, its structure remains unknown.
- * Use IJavaElement.isStructureKnown to determine whether this
- * is the case.
+ * If a binary type cannot be parsed, its structure remains unknown. Use
+ * IJavaElement.isStructureKnown to determine whether this is the
+ * case.
*
*
- * The children are of type IMember, which includes IField,
- * IMethod, IInitializer and IType.
- * The children are listed in the order in which they appear in the source or class file.
+ * The children are of type IMember, which includes
+ * IField, IMethod, IInitializer
+ * and IType. The children are listed in the order in which they
+ * appear in the source or class file.
*
*
* This interface is not intended to be implemented by clients.
@@ -31,406 +30,480 @@ package net.sourceforge.phpdt.core;
*/
public interface IType extends IMember, IParent {
/**
- * Do code completion inside a code snippet in the context of the current type.
- *
- * If the type can access to his source code and the insertion position is valid,
- * then completion is performed against source. Otherwise the completion is performed
- * against type structure and given locals variables.
- *
- * @param snippet the code snippet
- * @param insertion the position with in source where the snippet
- * is inserted. This position must not be in comments.
- * A possible value is -1, if the position is not known.
- * @param position the position with in snippet where the user
- * is performing code assist.
- * @param localVariableTypesNames an array (possibly empty) of fully qualified
- * type names of local variables visible at the current scope
- * @param localVariableNames an array (possibly empty) of local variable names
- * that are visible at the current scope
- * @param localVariableModifiers an array (possible empty) of modifiers for
- * local variables
- * @param isStatic whether the current scope is in a static context
- * @param requestor the completion requestor
+ * Do code completion inside a code snippet in the context of the current
+ * type.
+ *
+ * If the type can access to his source code and the insertion position is
+ * valid, then completion is performed against source. Otherwise the
+ * completion is performed against type structure and given locals
+ * variables.
+ *
+ * @param snippet
+ * the code snippet
+ * @param insertion
+ * the position with in source where the snippet is inserted.
+ * This position must not be in comments. A possible value is -1,
+ * if the position is not known.
+ * @param position
+ * the position with in snippet where the user is performing code
+ * assist.
+ * @param localVariableTypesNames
+ * an array (possibly empty) of fully qualified type names of
+ * local variables visible at the current scope
+ * @param localVariableNames
+ * an array (possibly empty) of local variable names that are
+ * visible at the current scope
+ * @param localVariableModifiers
+ * an array (possible empty) of modifiers for local variables
+ * @param isStatic
+ * whether the current scope is in a static context
+ * @param requestor
+ * the completion requestor
* @since 2.0
*/
-// void codeComplete(
-// char[] snippet,
-// int insertion,
-// int position,
-// char[][] localVariableTypeNames,
-// char[][] localVariableNames,
-// int[] localVariableModifiers,
-// boolean isStatic,
-// ICompletionRequestor requestor)
-// throws JavaModelException;
-
- /**
- * Creates and returns a field in this type with the
- * given contents.
+ // void codeComplete(
+ // char[] snippet,
+ // int insertion,
+ // int position,
+ // char[][] localVariableTypeNames,
+ // char[][] localVariableNames,
+ // int[] localVariableModifiers,
+ // boolean isStatic,
+ // ICompletionRequestor requestor)
+ // throws JavaModelException;
+ /**
+ * Creates and returns a field in this type with the given contents.
*
* Optionally, the new element can be positioned before the specified
- * sibling. If no sibling is specified, the element will be inserted
- * as the last field declaration in this type.
- *
- *
It is possible that a field with the same name already exists in this type.
- * The value of the force parameter effects the resolution of
- * such a conflict:
- *
true - in this case the field is created with the new contents
- *
false - in this case a JavaModelException is thrown
- *
- *
- * @param contents the given contents
- * @param sibling the given sibling
- * @param force a flag in case the same name already exists in this type
- * @param monitor the given progress monitor
- * @exception JavaModelException if the element could not be created. Reasons include:
+ * sibling. If no sibling is specified, the element will be inserted as the
+ * last field declaration in this type.
+ *
+ *
+ *
+ * It is possible that a field with the same name already exists in this
+ * type. The value of the force parameter effects the
+ * resolution of such a conflict:
*
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
The specified sibling is not a child of this type (INVALID_SIBLING)
- *
The contents could not be recognized as a field declaration (INVALID_CONTENTS)
- *
This type is read-only (binary) (READ_ONLY)
- *
There was a naming collision with an existing field (NAME_COLLISION)
+ *
true - in this case the field is created with the new
+ * contents
+ *
false - in this case a
+ * JavaModelException is thrown
*
+ *
+ *
+ * @param contents
+ * the given contents
+ * @param sibling
+ * the given sibling
+ * @param force
+ * a flag in case the same name already exists in this type
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if the element could not be created. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
The specified sibling is not a child of this type
+ * (INVALID_SIBLING)
+ *
The contents could not be recognized as a field
+ * declaration (INVALID_CONTENTS)
+ *
This type is read-only (binary) (READ_ONLY)
+ *
There was a naming collision with an existing field
+ * (NAME_COLLISION)
+ *
* @return a field in this type with the given contents
*/
-// IField createField(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
-// throws JavaModelException;
-
+ // IField createField(String contents, IJavaElement sibling, boolean force,
+ // IProgressMonitor monitor)
+ // throws JavaModelException;
/**
- * Creates and returns a static initializer in this type with the
- * given contents.
+ * Creates and returns a static initializer in this type with the given
+ * contents.
*
* Optionally, the new element can be positioned before the specified
* sibling. If no sibling is specified, the new initializer is positioned
* after the last existing initializer declaration, or as the first member
- * in the type if there are no initializers.
- *
- * @param contents the given contents
- * @param sibling the given sibling
- * @param monitor the given progress monitor
- * @exception JavaModelException if the element could not be created. Reasons include:
- *
- *
This element does not exist
- *
A CoreException occurred while updating an underlying resource
- *
The specified sibling is not a child of this type (INVALID_SIBLING)
- *
The contents could not be recognized as an initializer declaration (INVALID_CONTENTS)
- *
This type is read-only (binary) (READ_ONLY)
- *
+ * in the type if there are no initializers.
+ *
+ *
+ * @param contents
+ * the given contents
+ * @param sibling
+ * the given sibling
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if the element could not be created. Reasons include:
+ *
+ *
This element does not exist
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
The specified sibling is not a child of this type
+ * (INVALID_SIBLING)
+ *
The contents could not be recognized as an
+ * initializer declaration (INVALID_CONTENTS)
+ *
This type is read-only (binary) (READ_ONLY)
+ *
* @return a static initializer in this type with the given contents
*/
-// IInitializer createInitializer(String contents, IJavaElement sibling, IProgressMonitor monitor)
-// throws JavaModelException;
-
+ // IInitializer createInitializer(String contents, IJavaElement sibling,
+ // IProgressMonitor monitor)
+ // throws JavaModelException;
/**
- * Creates and returns a method or constructor in this type with the
- * given contents.
+ * Creates and returns a method or constructor in this type with the given
+ * contents.
*
* Optionally, the new element can be positioned before the specified
- * sibling. If no sibling is specified, the element will be appended
- * to this type.
- *
- *
It is possible that a method with the same signature already exists in this type.
- * The value of the force parameter effects the resolution of
- * such a conflict:
- *
true - in this case the method is created with the new contents
- *
false - in this case a JavaModelException is thrown
- *
- *
- * @param contents the given contents
- * @param sibling the given sibling
- * @param force a flag in case the same name already exists in this type
- * @param monitor the given progress monitor
- * @exception JavaModelException if the element could not be created. Reasons include:
+ * sibling. If no sibling is specified, the element will be appended to this
+ * type.
+ *
+ *
+ * It is possible that a method with the same signature already exists in
+ * this type. The value of the force parameter effects the
+ * resolution of such a conflict:
*
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
The specified sibling is not a child of this type (INVALID_SIBLING)
- *
The contents could not be recognized as a method or constructor
- * declaration (INVALID_CONTENTS)
- *
This type is read-only (binary) (READ_ONLY)
- *
There was a naming collision with an existing method (NAME_COLLISION)
+ *
true - in this case the method is created with the
+ * new contents
+ *
false - in this case a
+ * JavaModelException is thrown
*
+ *
+ *
+ * @param contents
+ * the given contents
+ * @param sibling
+ * the given sibling
+ * @param force
+ * a flag in case the same name already exists in this type
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if the element could not be created. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
The specified sibling is not a child of this type
+ * (INVALID_SIBLING)
+ *
The contents could not be recognized as a method or
+ * constructor declaration (INVALID_CONTENTS)
+ *
This type is read-only (binary) (READ_ONLY)
+ *
There was a naming collision with an existing method
+ * (NAME_COLLISION)
+ *
* @return a method or constructor in this type with the given contents
*/
-// IMethod createMethod(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
-// throws JavaModelException;
-
+ // IMethod createMethod(String contents, IJavaElement sibling, boolean
+ // force, IProgressMonitor monitor)
+ // throws JavaModelException;
/**
- * Creates and returns a type in this type with the
- * given contents.
+ * Creates and returns a type in this type with the given contents.
*
- * Optionally, the new type can be positioned before the specified
- * sibling. If no sibling is specified, the type will be appended
- * to this type.
- *
- *
It is possible that a type with the same name already exists in this type.
- * The value of the force parameter effects the resolution of
- * such a conflict:
- *
true - in this case the type is created with the new contents
- *
false - in this case a JavaModelException is thrown
- *
- *
- * @param contents the given contents
- * @param sibling the given sibling
- * @param force a flag in case the same name already exists in this type
- * @param monitor the given progress monitor
- * @exception JavaModelException if the element could not be created. Reasons include:
+ * Optionally, the new type can be positioned before the specified sibling.
+ * If no sibling is specified, the type will be appended to this type.
+ *
+ *
+ * It is possible that a type with the same name already exists in this
+ * type. The value of the force parameter effects the
+ * resolution of such a conflict:
*
- *
This Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
A CoreException occurred while updating an underlying resource
- *
The specified sibling is not a child of this type (INVALID_SIBLING)
- *
The contents could not be recognized as a type declaration (INVALID_CONTENTS)
- *
This type is read-only (binary) (READ_ONLY)
- *
There was a naming collision with an existing field (NAME_COLLISION)
+ *
true - in this case the type is created with the new
+ * contents
+ *
false - in this case a
+ * JavaModelException is thrown
*
+ *
+ *
+ * @param contents
+ * the given contents
+ * @param sibling
+ * the given sibling
+ * @param force
+ * a flag in case the same name already exists in this type
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if the element could not be created. Reasons include:
+ *
+ *
This Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
The specified sibling is not a child of this type
+ * (INVALID_SIBLING)
+ *
The contents could not be recognized as a type
+ * declaration (INVALID_CONTENTS)
+ *
This type is read-only (binary) (READ_ONLY)
+ *
There was a naming collision with an existing field
+ * (NAME_COLLISION)
+ *
* @return a type in this type with the given contents
*/
-// IType createType(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
-// throws JavaModelException;
-
- /**
- * Finds the methods in this type that correspond to
- * the given method.
- * A method m1 corresponds to another method m2 if:
+ // IType createType(String contents, IJavaElement sibling, boolean force,
+ // IProgressMonitor monitor)
+ // throws JavaModelException;
+ /**
+ * Finds the methods in this type that correspond to the given method. A
+ * method m1 corresponds to another method m2 if:
*
*
m1 has the same element name as m2.
- *
m1 has the same number of arguments as m2 and
- * the simple names of the argument types must be equals.
+ *
m1 has the same number of arguments as m2 and the simple names of
+ * the argument types must be equals.
*
m1 exists.
*
- * @param method the given method
- * @return the found method or null if no such methods can be found.
*
- * @since 2.0
+ * @param method
+ * the given method
+ * @return the found method or null if no such methods can be
+ * found.
+ *
+ * @since 2.0
*/
IMethod[] findMethods(IMethod method);
-
+
/**
- * Returns the simple name of this type, unqualified by package or enclosing type.
- * This is a handle-only method.
+ * Returns the simple name of this type, unqualified by package or enclosing
+ * type. This is a handle-only method.
*
* @return the simple name of this type
*/
String getElementName();
-
+
/**
- * Returns the field with the specified name
- * in this type (for example, "bar").
- * This is a handle-only method. The field may or may not exist.
+ * Returns the field with the specified name in this type (for example,
+ * "bar"). This is a handle-only method. The field may or
+ * may not exist.
*
- * @param name the given name
+ * @param name
+ * the given name
* @return the field with the specified name in this type
*/
IField getField(String name);
-
- /**
- * Returns the fields declared by this type.
- * If this is a source type, the results are listed in the order
- * in which they appear in the source, otherwise, the results are
- * in no particular order. For binary types, this includes synthetic fields.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+
+ /**
+ * Returns the fields declared by this type. If this is a source type, the
+ * results are listed in the order in which they appear in the source,
+ * otherwise, the results are in no particular order. For binary types, this
+ * includes synthetic fields.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return the fields declared by this type
*/
IField[] getFields() throws JavaModelException;
-
+
/**
- * Returns the fully qualified name of this type,
- * including qualification for any containing types and packages.
- * This is the name of the package, followed by '.',
- * followed by the type-qualified name.
+ * Returns the fully qualified name of this type, including qualification
+ * for any containing types and packages. This is the name of the package,
+ * followed by '.', followed by the type-qualified name.
* This is a handle-only method.
- *
+ *
* @see IType#getTypeQualifiedName()
* @return the fully qualified name of this type
*/
String getFullyQualifiedName();
-
+
/**
- * Returns the fully qualified name of this type,
- * including qualification for any containing types and packages.
- * This is the name of the package, followed by '.',
- * followed by the type-qualified name using the enclosingTypeSeparator.
+ * Returns the fully qualified name of this type, including qualification
+ * for any containing types and packages. This is the name of the package,
+ * followed by '.', followed by the type-qualified name
+ * using the enclosingTypeSeparator.
*
* For example:
*
- *
the fully qualified name of a class B defined as a member of a class A in a compilation unit A.java
- * in a package x.y using the '.' separator is "x.y.A.B"
- *
the fully qualified name of a class B defined as a member of a class A in a compilation unit A.java
- * in a package x.y using the '$' separator is "x.y.A$B"
- *
the fully qualified name of a binary type whose class file is x/y/A$B.class
- * using the '.' separator is "x.y.A.B"
- *
the fully qualified name of a binary type whose class file is x/y/A$B.class
- * using the '$' separator is "x.y.A$B"
- *
the fully qualified name of an anonymous binary type whose class file is x/y/A$1.class
- * using the '.' separator is "x.y.A$1"
+ *
the fully qualified name of a class B defined as a member of a class
+ * A in a compilation unit A.java in a package x.y using the '.' separator
+ * is "x.y.A.B"
+ *
the fully qualified name of a class B defined as a member of a class
+ * A in a compilation unit A.java in a package x.y using the '$' separator
+ * is "x.y.A$B"
+ *
the fully qualified name of a binary type whose class file is
+ * x/y/A$B.class using the '.' separator is "x.y.A.B"
+ *
the fully qualified name of a binary type whose class file is
+ * x/y/A$B.class using the '$' separator is "x.y.A$B"
+ *
the fully qualified name of an anonymous binary type whose class
+ * file is x/y/A$1.class using the '.' separator is "x.y.A$1"
*
*
* This is a handle-only method.
- *
- * @param enclosingTypeSeparator the given enclosing type separator
- * @return the fully qualified name of this type, including qualification for any containing types and packages
+ *
+ * @param enclosingTypeSeparator
+ * the given enclosing type separator
+ * @return the fully qualified name of this type, including qualification
+ * for any containing types and packages
* @see IType#getTypeQualifiedName(char)
* @since 2.0
*/
String getFullyQualifiedName(char enclosingTypeSeparator);
-
- /**
- * Returns the initializer with the specified position relative to
- * the order they are defined in the source.
- * Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0).
- * This is a handle-only method. The initializer may or may not be present.
- *
- * @param occurrenceCount the specified position
- * @return the initializer with the specified position relative to the order they are defined in the source
- */
-// IInitializer getInitializer(int occurrenceCount);
-
- /**
- * Returns the initializers declared by this type.
- * For binary types this is an empty collection.
- * If this is a source type, the results are listed in the order
- * in which they appear in the source.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+
+ /**
+ * Returns the initializer with the specified position relative to the order
+ * they are defined in the source. Numbering starts at 1 (thus the first
+ * occurrence is occurrence 1, not occurrence 0). This is a handle-only
+ * method. The initializer may or may not be present.
+ *
+ * @param occurrenceCount
+ * the specified position
+ * @return the initializer with the specified position relative to the order
+ * they are defined in the source
+ */
+ // IInitializer getInitializer(int occurrenceCount);
+ /**
+ * Returns the initializers declared by this type. For binary types this is
+ * an empty collection. If this is a source type, the results are listed in
+ * the order in which they appear in the source.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return the initializers declared by this type
*/
-// IInitializer[] getInitializers() throws JavaModelException;
-
+ // IInitializer[] getInitializers() throws JavaModelException;
/**
- * Returns the method with the specified name and parameter types
- * in this type (for example, "foo", {"I", "QString;"}). To get the
- * handle for a constructor, the name specified must be the simple
- * name of the enclosing type.
- * This is a handle-only method. The method may or may not be present.
+ * Returns the method with the specified name and parameter types in this
+ * type (for example, "foo", {"I", "QString;"}). To get the
+ * handle for a constructor, the name specified must be the simple name of
+ * the enclosing type. This is a handle-only method. The method may or may
+ * not be present.
*
- * @param name the given name
- * @param parameterTypeSignatures the given parameter types
- * @return the method with the specified name and parameter types in this type
+ * @param name
+ * the given name
+ * @param parameterTypeSignatures
+ * the given parameter types
+ * @return the method with the specified name and parameter types in this
+ * type
*/
IMethod getMethod(String name, String[] parameterTypeSignatures);
-
- /**
- * Returns the methods and constructors declared by this type.
- * For binary types, this may include the special <clinit> method
- * and synthetic methods.
- * If this is a source type, the results are listed in the order
- * in which they appear in the source, otherwise, the results are
- * in no particular order.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+
+ /**
+ * Returns the methods and constructors declared by this type. For binary
+ * types, this may include the special <clinit> method
+ * and synthetic methods. If this is a source type, the results are listed
+ * in the order in which they appear in the source, otherwise, the results
+ * are in no particular order.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return the methods and constructors declared by this type
*/
IMethod[] getMethods() throws JavaModelException;
-
+
/**
- * Returns the package fragment in which this element is defined.
- * This is a handle-only method.
+ * Returns the package fragment in which this element is defined. This is a
+ * handle-only method.
*
* @return the package fragment in which this element is defined
*/
IPackageFragment getPackageFragment();
-
- /**
- * Returns the name of this type's superclass, or null
- * for source types that do not specify a superclass.
- * For interfaces, the superclass name is always "java.lang.Object".
- * For source types, the name as declared is returned, for binary types,
- * the resolved, qualified name is returned.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return the name of this type's superclass, or null for source types that do not specify a superclass
+
+ /**
+ * Returns the name of this type's superclass, or null for
+ * source types that do not specify a superclass. For interfaces, the
+ * superclass name is always "java.lang.Object". For source
+ * types, the name as declared is returned, for binary types, the resolved,
+ * qualified name is returned.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return the name of this type's superclass, or null for
+ * source types that do not specify a superclass
*/
String getSuperclassName() throws JavaModelException;
-
- /**
- * Returns the names of interfaces that this type implements or extends,
- * in the order in which they are listed in the source.
- * For classes, this gives the interfaces that this class implements.
- * For interfaces, this gives the interfaces that this interface extends.
- * An empty collection is returned if this type does not implement or
- * extend any interfaces. For source types, simple names are returned,
- * for binary types, qualified names are returned.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return the names of interfaces that this type implements or extends, in the order in which they are listed in the source,
- * an empty collection if none
+
+ /**
+ * Returns the names of interfaces that this type implements or extends, in
+ * the order in which they are listed in the source. For classes, this gives
+ * the interfaces that this class implements. For interfaces, this gives the
+ * interfaces that this interface extends. An empty collection is returned
+ * if this type does not implement or extend any interfaces. For source
+ * types, simple names are returned, for binary types, qualified names are
+ * returned.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return the names of interfaces that this type implements or extends, in
+ * the order in which they are listed in the source, an empty
+ * collection if none
*/
String[] getSuperInterfaceNames() throws JavaModelException;
-
+
/**
* Returns the member type declared in this type with the given simple name.
* This is a handle-only method. The type may or may not exist.
*
- * @param the given simple name
+ * @param the
+ * given simple name
* @return the member type declared in this type with the given simple name
*/
IType getType(String name);
-
- /**
- * Returns the type-qualified name of this type,
- * including qualification for any enclosing types,
- * but not including package qualification.
- * For source types, this consists of the simple names of
- * any enclosing types, separated by "$", followed by the simple name of this type.
- * For binary types, this is the name of the class file without the ".class" suffix.
- * This is a handle-only method.
+
+ /**
+ * Returns the type-qualified name of this type, including qualification for
+ * any enclosing types, but not including package qualification. For source
+ * types, this consists of the simple names of any enclosing types,
+ * separated by "$", followed by the simple name of this
+ * type. For binary types, this is the name of the class file without the
+ * ".class" suffix. This is a handle-only method.
*
* @return the type-qualified name of this type
*/
String getTypeQualifiedName();
-
+
/**
- * Returns the type-qualified name of this type,
- * including qualification for any enclosing types,
- * but not including package qualification.
- * This consists of the simple names of any enclosing types,
- * separated by the enclosingTypeSeparator,
- * followed by the simple name of this type.
+ * Returns the type-qualified name of this type, including qualification for
+ * any enclosing types, but not including package qualification. This
+ * consists of the simple names of any enclosing types, separated by the
+ * enclosingTypeSeparator, followed by the simple name of
+ * this type.
*
* For example:
*
- *
the type qualified name of a class B defined as a member of a class A
- * using the '.' separator is "A.B"
- *
the type qualified name of a class B defined as a member of a class A
- * using the '$' separator is "A$B"
- *
the type qualified name of a binary type whose class file is A$B.class
- * using the '.' separator is "A.B"
- *
the type qualified name of a binary type whose class file is A$B.class
- * using the '$' separator is "A$B"
- *
the type qualified name of an anonymous binary type whose class file is A$1.class
- * using the '.' separator is "A$1"
+ *
the type qualified name of a class B defined as a member of a class
+ * A using the '.' separator is "A.B"
+ *
the type qualified name of a class B defined as a member of a class
+ * A using the '$' separator is "A$B"
+ *
the type qualified name of a binary type whose class file is
+ * A$B.class using the '.' separator is "A.B"
+ *
the type qualified name of a binary type whose class file is
+ * A$B.class using the '$' separator is "A$B"
+ *
the type qualified name of an anonymous binary type whose class file
+ * is A$1.class using the '.' separator is "A$1"
*
- *
+ *
* This is a handle-only method.
*
- * @param enclosingTypeSeparator the specified enclosing type separator
+ * @param enclosingTypeSeparator
+ * the specified enclosing type separator
* @return the type-qualified name of this type
* @since 2.0
*/
String getTypeQualifiedName(char enclosingTypeSeparator);
-
+
/**
- * Returns the immediate member types declared by this type.
- * The results are listed in the order in which they appear in the source or class file.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ * Returns the immediate member types declared by this type. The results are
+ * listed in the order in which they appear in the source or class file.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return the immediate member types declared by this type
*/
IType[] getTypes() throws JavaModelException;
-
+
/**
* Returns whether this type represents an anonymous type.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return true if this type represents an anonymous type, false otherwise
* @since 2.0
*/
@@ -438,27 +511,30 @@ public interface IType extends IMember, IParent {
/**
* Returns whether this type represents a class.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return true if this type represents a class, false otherwise
*/
boolean isClass() throws JavaModelException;
-
+
/**
* Returns whether this type represents an interface.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return true if this type represents an interface, false otherwise
*/
boolean isInterface() throws JavaModelException;
-
+
/**
* Returns whether this type represents a local type.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return true if this type represents a local type, false otherwise
* @since 2.0
*/
@@ -466,16 +542,17 @@ public interface IType extends IMember, IParent {
/**
* Returns whether this type represents a member type.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @return true if this type represents a member type, false otherwise
* @since 2.0
*/
boolean isMember() throws JavaModelException;
/**
- * Loads a previously saved ITypeHierarchy from an input stream. A type hierarchy can
- * be stored using ITypeHierachy#store(OutputStream).
+ * Loads a previously saved ITypeHierarchy from an input stream. A type
+ * hierarchy can be stored using ITypeHierachy#store(OutputStream).
*
* Only hierarchies originally created by the following methods can be load:
*
*
*
- * @param input stream where hierarchy will be read
- * @param monitor the given progress monitor
+ * @param input
+ * stream where hierarchy will be read
+ * @param monitor
+ * the given progress monitor
* @return the stored hierarchy
- * @exception JavaModelException if the hierarchy could not be restored, reasons include:
- * - type is not the focus of the hierarchy or
- * - unable to read the input stream (wrong format, IOException during reading, ...)
+ * @exception JavaModelException
+ * if the hierarchy could not be restored, reasons include: -
+ * type is not the focus of the hierarchy or - unable to read
+ * the input stream (wrong format, IOException during
+ * reading, ...)
* @see ITypeHierarchy#store(OutputStream, IProgressMonitor)
* @since 2.1
*/
-// ITypeHierarchy loadTypeHierachy(InputStream input, IProgressMonitor monitor) throws JavaModelException;
- /**
- * Creates and returns a type hierarchy for this type containing
- * this type and all of its supertypes.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @param monitor the given progress monitor
- * @return a type hierarchy for this type containing this type and all of its supertypes
- */
-// ITypeHierarchy newSupertypeHierarchy(IProgressMonitor monitor) throws JavaModelException;
-
+ // ITypeHierarchy loadTypeHierachy(InputStream input, IProgressMonitor
+ // monitor) throws JavaModelException;
/**
- * Creates and returns a type hierarchy for this type containing
- * this type and all of its supertypes, considering types in the given
- * working copies. In other words, the list of working copies will take
- * precedence over their original compilation units in the workspace.
+ * Creates and returns a type hierarchy for this type containing this type
+ * and all of its supertypes.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @param monitor
+ * the given progress monitor
+ * @return a type hierarchy for this type containing this type and all of
+ * its supertypes
+ */
+ // ITypeHierarchy newSupertypeHierarchy(IProgressMonitor monitor) throws
+ // JavaModelException;
+ /**
+ * Creates and returns a type hierarchy for this type containing this type
+ * and all of its supertypes, considering types in the given working copies.
+ * In other words, the list of working copies will take precedence over
+ * their original compilation units in the workspace.
*
- * Note that passing an empty working copy will be as if the original compilation
- * unit had been deleted.
- *
- * @param workingCopies the working copies that take precedence over their original compilation units
- * @param monitor the given progress monitor
- * @return a type hierarchy for this type containing this type and all of its supertypes
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ * Note that passing an empty working copy will be as if the original
+ * compilation unit had been deleted.
+ *
+ * @param workingCopies
+ * the working copies that take precedence over their original
+ * compilation units
+ * @param monitor
+ * the given progress monitor
+ * @return a type hierarchy for this type containing this type and all of
+ * its supertypes
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @since 2.0
*/
-// ITypeHierarchy newSupertypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor)
-// throws JavaModelException;
-
- /**
- * Creates and returns a type hierarchy for this type containing
- * this type, all of its supertypes, and all its subtypes in the workspace.
- *
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @param monitor the given progress monitor
- * @return a type hierarchy for this type containing
- * this type, all of its supertypes, and all its subtypes in the workspace
- */
-// ITypeHierarchy newTypeHierarchy(IProgressMonitor monitor) throws JavaModelException;
-
- /**
- * Creates and returns a type hierarchy for this type containing
- * this type, all of its supertypes, and all its subtypes in the workspace,
- * considering types in the given working copies. In other words, the list of working
- * copies that will take precedence over their original compilation units in the workspace.
+ // ITypeHierarchy newSupertypeHierarchy(IWorkingCopy[] workingCopies,
+ // IProgressMonitor monitor)
+ // throws JavaModelException;
+ /**
+ * Creates and returns a type hierarchy for this type containing this type,
+ * all of its supertypes, and all its subtypes in the workspace.
+ *
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @param monitor
+ * the given progress monitor
+ * @return a type hierarchy for this type containing this type, all of its
+ * supertypes, and all its subtypes in the workspace
+ */
+ // ITypeHierarchy newTypeHierarchy(IProgressMonitor monitor) throws
+ // JavaModelException;
+ /**
+ * Creates and returns a type hierarchy for this type containing this type,
+ * all of its supertypes, and all its subtypes in the workspace, considering
+ * types in the given working copies. In other words, the list of working
+ * copies that will take precedence over their original compilation units in
+ * the workspace.
*
- * Note that passing an empty working copy will be as if the original compilation
- * unit had been deleted.
- *
- * @param workingCopies the working copies that take precedence over their original compilation units
- * @param monitor the given progress monitor
- * @return a type hierarchy for this type containing
- * this type, all of its supertypes, and all its subtypes in the workspace
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ * Note that passing an empty working copy will be as if the original
+ * compilation unit had been deleted.
+ *
+ * @param workingCopies
+ * the working copies that take precedence over their original
+ * compilation units
+ * @param monitor
+ * the given progress monitor
+ * @return a type hierarchy for this type containing this type, all of its
+ * supertypes, and all its subtypes in the workspace
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @since 2.0
*/
-// ITypeHierarchy newTypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException;
+ // ITypeHierarchy newTypeHierarchy(IWorkingCopy[] workingCopies,
+ // IProgressMonitor monitor) throws JavaModelException;
/**
- * Creates and returns a type hierarchy for this type containing
- * this type, all of its supertypes, and all its subtypes in the workspace,
- * considering types in the working copies with the given owner.
- * In other words, the owner's working copies will take
- * precedence over their original compilation units in the workspace.
+ * Creates and returns a type hierarchy for this type containing this type,
+ * all of its supertypes, and all its subtypes in the workspace, considering
+ * types in the working copies with the given owner. In other words, the
+ * owner's working copies will take precedence over their original
+ * compilation units in the workspace.
*
- * Note that if a working copy is empty, it will be as if the original compilation
- * unit had been deleted.
+ * Note that if a working copy is empty, it will be as if the original
+ * compilation unit had been deleted.
*
- *
- * @param owner the owner of working copies that take precedence over their original compilation units
- * @param monitor the given progress monitor
- * @return a type hierarchy for this type containing
- * this type, all of its supertypes, and all its subtypes in the workspace
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
+ *
+ * @param owner
+ * the owner of working copies that take precedence over their
+ * original compilation units
+ * @param monitor
+ * the given progress monitor
+ * @return a type hierarchy for this type containing this type, all of its
+ * supertypes, and all its subtypes in the workspace
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
* @since 3.0
*/
-// ITypeHierarchy newTypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException;
-
- /**
- * Creates and returns a type hierarchy for this type containing
- * this type, all of its supertypes, and all its subtypes
- * in the context of the given project.
- *
- * @param project the given project
- * @param monitor the given progress monitor
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @return a type hierarchy for this type containing
- * this type, all of its supertypes, and all its subtypes
- * in the context of the given project
- */
-// ITypeHierarchy newTypeHierarchy(IJavaProject project, IProgressMonitor monitor) throws JavaModelException;
-
- /**
- * Resolves the given type name within the context of this type (depending on the type hierarchy
- * and its imports). Multiple answers might be found in case there are ambiguous matches.
- *
- * Each matching type name is decomposed as an array of two strings, the first denoting the package
- * name (dot-separated) and the second being the type name.
- * Returns null if unable to find any matching type.
- *
+ // ITypeHierarchy newTypeHierarchy(WorkingCopyOwner owner, IProgressMonitor
+ // monitor) throws JavaModelException;
+ /**
+ * Creates and returns a type hierarchy for this type containing this type,
+ * all of its supertypes, and all its subtypes in the context of the given
+ * project.
+ *
+ * @param project
+ * the given project
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if this element does not exist or if an exception occurs
+ * while accessing its corresponding resource.
+ * @return a type hierarchy for this type containing this type, all of its
+ * supertypes, and all its subtypes in the context of the given
+ * project
+ */
+ // ITypeHierarchy newTypeHierarchy(IJavaProject project, IProgressMonitor
+ // monitor) throws JavaModelException;
+ /**
+ * Resolves the given type name within the context of this type (depending
+ * on the type hierarchy and its imports). Multiple answers might be found
+ * in case there are ambiguous matches.
+ *
+ * Each matching type name is decomposed as an array of two strings, the
+ * first denoting the package name (dot-separated) and the second being the
+ * type name. Returns null if unable to find any matching
+ * type.
+ *
* For example, resolution of "Object" would typically return
* {{"java.lang", "Object"}}.
*
- * @param typeName the given type name
- * @exception JavaModelException if code resolve could not be performed.
- * @return the resolved type names or null if unable to find any matching type
- */
-// String[][] resolveType(String typeName) throws JavaModelException;
+ * @param typeName
+ * the given type name
+ * @exception JavaModelException
+ * if code resolve could not be performed.
+ * @return the resolved type names or null if unable to find
+ * any matching type
+ */
+ // String[][] resolveType(String typeName) throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ITypeHierarchy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ITypeHierarchy.java
index 339fba1..60fcc76 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ITypeHierarchy.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ITypeHierarchy.java
@@ -18,286 +18,332 @@ import org.eclipse.core.runtime.IProgressMonitor;
* A type hierarchy provides navigations between a type and its resolved
* supertypes and subtypes for a specific type or for all types within a region.
* Supertypes may extend outside of the type hierarchy's region in which it was
- * created such that the root of the hierarchy is always included. For example, if a type
- * hierarchy is created for a java.io.File, and the region the hierarchy was
- * created in is the package fragment java.io, the supertype
- * java.lang.Object will still be included.
+ * created such that the root of the hierarchy is always included. For example,
+ * if a type hierarchy is created for a java.io.File, and the
+ * region the hierarchy was created in is the package fragment
+ * java.io, the supertype java.lang.Object will
+ * still be included.
*
- * A type hierarchy is static and can become stale. Although consistent when
- * created, it does not automatically track changes in the model.
- * As changes in the model potentially invalidate the hierarchy, change notifications
- * are sent to registered ITypeHierarchyChangedListeners. Listeners should
- * use the exists method to determine if the hierarchy has become completely
- * invalid (for example, when the type or project the hierarchy was created on
- * has been removed). To refresh a hierarchy, use the refresh method.
+ * A type hierarchy is static and can become stale. Although consistent when
+ * created, it does not automatically track changes in the model. As changes in
+ * the model potentially invalidate the hierarchy, change notifications are sent
+ * to registered ITypeHierarchyChangedListeners. Listeners
+ * should use the exists method to determine if the hierarchy has
+ * become completely invalid (for example, when the type or project the
+ * hierarchy was created on has been removed). To refresh a hierarchy, use the
+ * refresh method.
*
*
- * The type hierarchy may contain cycles due to malformed supertype declarations.
- * Most type hierarchy queries are oblivious to cycles; the getAll*
- * methods are implemented such that they are unaffected by cycles.
+ * The type hierarchy may contain cycles due to malformed supertype
+ * declarations. Most type hierarchy queries are oblivious to cycles; the
+ * getAll* methods are implemented such that they are unaffected
+ * by cycles.
*
*
* This interface is not intended to be implemented by clients.
*
*/
public interface ITypeHierarchy {
-/**
- * Adds the given listener for changes to this type hierarchy. Listeners are
- * notified when this type hierarchy changes and needs to be refreshed.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener
- */
-void addTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener);
-/**
- * Returns whether the given type is part of this hierarchy.
- *
- * @param type the given type
- * @return true if the given type is part of this hierarchy, false otherwise
- */
-boolean contains(IType type);
-/**
- * Returns whether the type and project this hierarchy was created on exist.
- * @return true if the type and project this hierarchy was created on exist, false otherwise
- */
-boolean exists();
-/**
- * Returns all classes in this type hierarchy's graph, in no particular
- * order. Any classes in the creation region which were not resolved to
- * have any subtypes or supertypes are not included in the result.
- *
- * @return all classes in this type hierarchy's graph
- */
-IType[] getAllClasses();
-/**
- * Returns all interfaces in this type hierarchy's graph, in no particular
- * order. Any interfaces in the creation region which were not resolved to
- * have any subtypes or supertypes are not included in the result.
- *
- * @return all interfaces in this type hierarchy's graph
- */
-IType[] getAllInterfaces();
-/**
- * Returns all resolved subtypes (direct and indirect) of the
- * given type, in no particular order, limited to the
- * types in this type hierarchy's graph. An empty array
- * is returned if there are no resolved subtypes for the
- * given type.
- *
- * @param type the given type
- * @return all resolved subtypes (direct and indirect) of the given type
- */
-IType[] getAllSubtypes(IType type);
-/**
- * Returns all resolved superclasses of the
- * given class, in bottom-up order. An empty array
- * is returned if there are no resolved superclasses for the
- * given class.
- *
- *
NOTE: once a type hierarchy has been created, it is more efficient to
- * query the hierarchy for superclasses than to query a class recursively up
- * the superclass chain. Querying an element performs a dynamic resolution,
- * whereas the hierarchy returns a pre-computed result.
- *
- * @param type the given type
- * @return all resolved superclasses of the given class, in bottom-up order, an empty
- * array if none.
- */
-IType[] getAllSuperclasses(IType type);
-/**
- * Returns all resolved superinterfaces (direct and indirect) of the given type.
- * If the given type is a class, this includes all superinterfaces of all superclasses.
- * An empty array is returned if there are no resolved superinterfaces for the
- * given type.
- *
- *
NOTE: once a type hierarchy has been created, it is more efficient to
- * query the hierarchy for superinterfaces than to query a type recursively.
- * Querying an element performs a dynamic resolution,
- * whereas the hierarchy returns a pre-computed result.
- *
- * @param type the given type
- * @return all resolved superinterfaces (direct and indirect) of the given type, an empty array if none
- */
-IType[] getAllSuperInterfaces(IType type);
-/**
- * Returns all resolved supertypes of the
- * given type, in bottom-up order. An empty array
- * is returned if there are no resolved supertypes for the
- * given type.
- *
- * Note that java.lang.Object is NOT considered to be a supertype
- * of any interface type.
- *
NOTE: once a type hierarchy has been created, it is more efficient to
- * query the hierarchy for supertypes than to query a type recursively up
- * the supertype chain. Querying an element performs a dynamic resolution,
- * whereas the hierarchy returns a pre-computed result.
- *
- * @param type the given type
- * @return all resolved supertypes of the given class, in bottom-up order, an empty array
- * if none
- */
-IType[] getAllSupertypes(IType type);
-/**
- * Returns all types in this type hierarchy's graph, in no particular
- * order. Any types in the creation region which were not resolved to
- * have any subtypes or supertypes are not included in the result.
- *
- * @return all types in this type hierarchy's grap
- */
-IType[] getAllTypes();
+ /**
+ * Adds the given listener for changes to this type hierarchy. Listeners are
+ * notified when this type hierarchy changes and needs to be refreshed. Has
+ * no effect if an identical listener is already registered.
+ *
+ * @param listener
+ * the listener
+ */
+ void addTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener);
-/**
- * Return the flags associated with the given type (would be equivalent to IMember.getFlags()),
- * or -1 if this information wasn't cached on the hierarchy during its computation.
- *
- * @param type the given type
- * @return the modifier flags for this member
- * @see Flags
- * @since 2.0
- */
-int getCachedFlags(IType type);
+ /**
+ * Returns whether the given type is part of this hierarchy.
+ *
+ * @param type
+ * the given type
+ * @return true if the given type is part of this hierarchy, false otherwise
+ */
+ boolean contains(IType type);
-/**
- * Returns all interfaces resolved to extend the given interface,
- * in no particular order, limited to the interfaces in this
- * hierarchy's graph.
- * Returns an empty collection if the given type is a class, or
- * if no interfaces were resolved to extend the given interface.
- *
- * @param type the given type
- * @return all interfaces resolved to extend the given interface limited to the interfaces in this
- * hierarchy's graph, an empty array if none.
- */
-IType[] getExtendingInterfaces(IType type);
-/**
- * Returns all classes resolved to implement the given interface,
- * in no particular order, limited to the classes in this type
- * hierarchy's graph. Returns an empty collection if the given type is a
- * class, or if no classes were resolved to implement the given
- * interface.
- *
- * @param type the given type
- * @return all classes resolved to implement the given interface limited to the classes in this type
- * hierarchy's graph, an empty array if none
- */
-IType[] getImplementingClasses(IType type);
-/**
- * Returns all classes in the graph which have no resolved superclass,
- * in no particular order.
- *
- * @return all classes in the graph which have no resolved superclass
- */
-IType[] getRootClasses();
-/**
- * Returns all interfaces in the graph which have no resolved superinterfaces,
- * in no particular order.
- *
- * @return all interfaces in the graph which have no resolved superinterfaces
- */
-IType[] getRootInterfaces();
-/**
- * Returns the direct resolved subclasses of the given class,
- * in no particular order, limited to the classes in this
- * type hierarchy's graph.
- * Returns an empty collection if the given type is an interface,
- * or if no classes were resolved to be subclasses of the given
- * class.
- *
- * @param type the given type
- * @return the direct resolved subclasses of the given class limited to the classes in this
- * type hierarchy's graph, an empty collection if none.
- */
-IType[] getSubclasses(IType type);
-/**
- * Returns the direct resolved subtypes of the given type,
- * in no particular order, limited to the types in this
- * type hierarchy's graph.
- * If the type is a class, this returns the resolved subclasses.
- * If the type is an interface, this returns both the classes which implement
- * the interface and the interfaces which extend it.
- *
- * @param type the given type
- * @return the direct resolved subtypes of the given type limited to the types in this
- * type hierarchy's graph
- */
-IType[] getSubtypes(IType type);
-/**
- * Returns the resolved superclass of the given class,
- * or null if the given class has no superclass,
- * the superclass could not be resolved, or if the given
- * type is an interface.
- *
- * @param type the given type
- * @return the resolved superclass of the given class,
- * or null if the given class has no superclass,
- * the superclass could not be resolved, or if the given
- * type is an interface
- */
-IType getSuperclass(IType type);
-/**
- * Returns the direct resolved interfaces that the given type implements or extends,
- * in no particular order, limited to the interfaces in this type
- * hierarchy's graph.
- * For classes, this gives the interfaces that the class implements.
- * For interfaces, this gives the interfaces that the interface extends.
- *
- * @param type the given type
- * @return the direct resolved interfaces that the given type implements or extends limited to the interfaces in this type
- * hierarchy's graph
- */
-IType[] getSuperInterfaces(IType type);
-/**
- * Returns the resolved supertypes of the given type,
- * in no particular order, limited to the types in this
- * type hierarchy's graph.
- * For classes, this returns its superclass and the interfaces that the class implements.
- * For interfaces, this returns the interfaces that the interface extends. As a consequence
- * java.lang.Object is NOT considered to be a supertype of any interface
- * type.
- *
- * @param type the given type
- * @return the resolved supertypes of the given type limited to the types in this
- * type hierarchy's graph
- */
-IType[] getSupertypes(IType type);
-/**
- * Returns the type this hierarchy was computed for.
- * Returns null if this hierarchy was computed for a region.
- *
- * @return the type this hierarchy was computed for
- */
-IType getType();
-/**
- * Re-computes the type hierarchy reporting progress.
- *
- * @param monitor the given progress monitor
- * @exception JavaModelException if unable to refresh the hierarchy
- */
-void refresh(IProgressMonitor monitor) throws JavaModelException;
-/**
- * Removes the given listener from this type hierarchy.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener the listener
- */
-void removeTypeHierarchyChangedListener(ITypeHierarchyChangedListener listener);
-/**
- * Stores the type hierarchy in an output stream. This stored hierarchy can be load by
- * IType#loadTypeHierachy(IJavaProject, InputStream, IProgressMonitor).
- * Listeners of this hierarchy are not stored.
- *
- * Only hierarchies created by the following methods can be store:
- *
- *
- *
- * @param outputStream output stream where the hierarchy will be stored
- * @param monitor the given progress monitor
- * @exception JavaModelException if unable to store the hierarchy in the ouput stream
- * @see IType#loadTypeHierachy(java.io.InputStream, IProgressMonitor)
- * @since 2.1
- */
-void store(OutputStream outputStream, IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Returns whether the type and project this hierarchy was created on exist.
+ *
+ * @return true if the type and project this hierarchy was created on exist,
+ * false otherwise
+ */
+ boolean exists();
+
+ /**
+ * Returns all classes in this type hierarchy's graph, in no particular
+ * order. Any classes in the creation region which were not resolved to have
+ * any subtypes or supertypes are not included in the result.
+ *
+ * @return all classes in this type hierarchy's graph
+ */
+ IType[] getAllClasses();
+
+ /**
+ * Returns all interfaces in this type hierarchy's graph, in no particular
+ * order. Any interfaces in the creation region which were not resolved to
+ * have any subtypes or supertypes are not included in the result.
+ *
+ * @return all interfaces in this type hierarchy's graph
+ */
+ IType[] getAllInterfaces();
+
+ /**
+ * Returns all resolved subtypes (direct and indirect) of the given type, in
+ * no particular order, limited to the types in this type hierarchy's graph.
+ * An empty array is returned if there are no resolved subtypes for the
+ * given type.
+ *
+ * @param type
+ * the given type
+ * @return all resolved subtypes (direct and indirect) of the given type
+ */
+ IType[] getAllSubtypes(IType type);
+
+ /**
+ * Returns all resolved superclasses of the given class, in bottom-up order.
+ * An empty array is returned if there are no resolved superclasses for the
+ * given class.
+ *
+ *
+ * NOTE: once a type hierarchy has been created, it is more efficient to
+ * query the hierarchy for superclasses than to query a class recursively up
+ * the superclass chain. Querying an element performs a dynamic resolution,
+ * whereas the hierarchy returns a pre-computed result.
+ *
+ * @param type
+ * the given type
+ * @return all resolved superclasses of the given class, in bottom-up order,
+ * an empty array if none.
+ */
+ IType[] getAllSuperclasses(IType type);
+
+ /**
+ * Returns all resolved superinterfaces (direct and indirect) of the given
+ * type. If the given type is a class, this includes all superinterfaces of
+ * all superclasses. An empty array is returned if there are no resolved
+ * superinterfaces for the given type.
+ *
+ *
+ * NOTE: once a type hierarchy has been created, it is more efficient to
+ * query the hierarchy for superinterfaces than to query a type recursively.
+ * Querying an element performs a dynamic resolution, whereas the hierarchy
+ * returns a pre-computed result.
+ *
+ * @param type
+ * the given type
+ * @return all resolved superinterfaces (direct and indirect) of the given
+ * type, an empty array if none
+ */
+ IType[] getAllSuperInterfaces(IType type);
+
+ /**
+ * Returns all resolved supertypes of the given type, in bottom-up order. An
+ * empty array is returned if there are no resolved supertypes for the given
+ * type.
+ *
+ * Note that java.lang.Object is NOT considered to be a
+ * supertype of any interface type.
+ *
+ *
+ * NOTE: once a type hierarchy has been created, it is more efficient to
+ * query the hierarchy for supertypes than to query a type recursively up
+ * the supertype chain. Querying an element performs a dynamic resolution,
+ * whereas the hierarchy returns a pre-computed result.
+ *
+ * @param type
+ * the given type
+ * @return all resolved supertypes of the given class, in bottom-up order,
+ * an empty array if none
+ */
+ IType[] getAllSupertypes(IType type);
+
+ /**
+ * Returns all types in this type hierarchy's graph, in no particular order.
+ * Any types in the creation region which were not resolved to have any
+ * subtypes or supertypes are not included in the result.
+ *
+ * @return all types in this type hierarchy's grap
+ */
+ IType[] getAllTypes();
+
+ /**
+ * Return the flags associated with the given type (would be equivalent to
+ * IMember.getFlags()), or -1 if this
+ * information wasn't cached on the hierarchy during its computation.
+ *
+ * @param type
+ * the given type
+ * @return the modifier flags for this member
+ * @see Flags
+ * @since 2.0
+ */
+ int getCachedFlags(IType type);
+
+ /**
+ * Returns all interfaces resolved to extend the given interface, in no
+ * particular order, limited to the interfaces in this hierarchy's graph.
+ * Returns an empty collection if the given type is a class, or if no
+ * interfaces were resolved to extend the given interface.
+ *
+ * @param type
+ * the given type
+ * @return all interfaces resolved to extend the given interface limited to
+ * the interfaces in this hierarchy's graph, an empty array if none.
+ */
+ IType[] getExtendingInterfaces(IType type);
+
+ /**
+ * Returns all classes resolved to implement the given interface, in no
+ * particular order, limited to the classes in this type hierarchy's graph.
+ * Returns an empty collection if the given type is a class, or if no
+ * classes were resolved to implement the given interface.
+ *
+ * @param type
+ * the given type
+ * @return all classes resolved to implement the given interface limited to
+ * the classes in this type hierarchy's graph, an empty array if
+ * none
+ */
+ IType[] getImplementingClasses(IType type);
+
+ /**
+ * Returns all classes in the graph which have no resolved superclass, in no
+ * particular order.
+ *
+ * @return all classes in the graph which have no resolved superclass
+ */
+ IType[] getRootClasses();
+
+ /**
+ * Returns all interfaces in the graph which have no resolved
+ * superinterfaces, in no particular order.
+ *
+ * @return all interfaces in the graph which have no resolved
+ * superinterfaces
+ */
+ IType[] getRootInterfaces();
+
+ /**
+ * Returns the direct resolved subclasses of the given class, in no
+ * particular order, limited to the classes in this type hierarchy's graph.
+ * Returns an empty collection if the given type is an interface, or if no
+ * classes were resolved to be subclasses of the given class.
+ *
+ * @param type
+ * the given type
+ * @return the direct resolved subclasses of the given class limited to the
+ * classes in this type hierarchy's graph, an empty collection if
+ * none.
+ */
+ IType[] getSubclasses(IType type);
+
+ /**
+ * Returns the direct resolved subtypes of the given type, in no particular
+ * order, limited to the types in this type hierarchy's graph. If the type
+ * is a class, this returns the resolved subclasses. If the type is an
+ * interface, this returns both the classes which implement the interface
+ * and the interfaces which extend it.
+ *
+ * @param type
+ * the given type
+ * @return the direct resolved subtypes of the given type limited to the
+ * types in this type hierarchy's graph
+ */
+ IType[] getSubtypes(IType type);
+
+ /**
+ * Returns the resolved superclass of the given class, or null
+ * if the given class has no superclass, the superclass could not be
+ * resolved, or if the given type is an interface.
+ *
+ * @param type
+ * the given type
+ * @return the resolved superclass of the given class, or null
+ * if the given class has no superclass, the superclass could not be
+ * resolved, or if the given type is an interface
+ */
+ IType getSuperclass(IType type);
+
+ /**
+ * Returns the direct resolved interfaces that the given type implements or
+ * extends, in no particular order, limited to the interfaces in this type
+ * hierarchy's graph. For classes, this gives the interfaces that the class
+ * implements. For interfaces, this gives the interfaces that the interface
+ * extends.
+ *
+ * @param type
+ * the given type
+ * @return the direct resolved interfaces that the given type implements or
+ * extends limited to the interfaces in this type hierarchy's graph
+ */
+ IType[] getSuperInterfaces(IType type);
+
+ /**
+ * Returns the resolved supertypes of the given type, in no particular
+ * order, limited to the types in this type hierarchy's graph. For classes,
+ * this returns its superclass and the interfaces that the class implements.
+ * For interfaces, this returns the interfaces that the interface extends.
+ * As a consequence java.lang.Object is NOT considered to be
+ * a supertype of any interface type.
+ *
+ * @param type
+ * the given type
+ * @return the resolved supertypes of the given type limited to the types in
+ * this type hierarchy's graph
+ */
+ IType[] getSupertypes(IType type);
+
+ /**
+ * Returns the type this hierarchy was computed for. Returns
+ * null if this hierarchy was computed for a region.
+ *
+ * @return the type this hierarchy was computed for
+ */
+ IType getType();
+
+ /**
+ * Re-computes the type hierarchy reporting progress.
+ *
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if unable to refresh the hierarchy
+ */
+ void refresh(IProgressMonitor monitor) throws JavaModelException;
+
+ /**
+ * Removes the given listener from this type hierarchy. Has no affect if an
+ * identical listener is not registered.
+ *
+ * @param listener
+ * the listener
+ */
+ void removeTypeHierarchyChangedListener(
+ ITypeHierarchyChangedListener listener);
+
+ /**
+ * Stores the type hierarchy in an output stream. This stored hierarchy can
+ * be load by IType#loadTypeHierachy(IJavaProject, InputStream,
+ * IProgressMonitor). Listeners of this hierarchy are not stored.
+ *
+ * Only hierarchies created by the following methods can be store:
+ *
+ *
+ *
+ * @param outputStream
+ * output stream where the hierarchy will be stored
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if unable to store the hierarchy in the ouput stream
+ * @see IType#loadTypeHierachy(java.io.InputStream, IProgressMonitor)
+ * @since 2.1
+ */
+ void store(OutputStream outputStream, IProgressMonitor monitor)
+ throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ITypeHierarchyChangedListener.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ITypeHierarchyChangedListener.java
index bb09b10..ace3148 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ITypeHierarchyChangedListener.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ITypeHierarchyChangedListener.java
@@ -20,10 +20,11 @@ package net.sourceforge.phpdt.core;
public interface ITypeHierarchyChangedListener {
/**
* Notifies that the given type hierarchy has changed in some way and should
- * be refreshed at some point to make it consistent with the current state of
- * the Java model.
+ * be refreshed at some point to make it consistent with the current state
+ * of the Java model.
*
- * @param typeHierarchy the given type hierarchy
+ * @param typeHierarchy
+ * the given type hierarchy
*/
void typeHierarchyChanged(ITypeHierarchy typeHierarchy);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IWorkingCopy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IWorkingCopy.java
index 72f4a48..e30ec1d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IWorkingCopy.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IWorkingCopy.java
@@ -19,340 +19,385 @@ import org.eclipse.core.runtime.IProgressMonitor;
*
* A working copy of a Java element acts just like a regular element (handle),
* except it is not attached to an underlying resource. A working copy is not
- * visible to the rest of the Java model. Changes in a working copy's
- * buffer are not realized in a resource. To bring the Java model up-to-date with a working
- * copy's contents, an explicit commit must be performed on the working copy.
- * Other operations performed on a working copy update the
- * contents of the working copy's buffer but do not commit the contents
- * of the working copy.
+ * visible to the rest of the Java model. Changes in a working copy's buffer are
+ * not realized in a resource. To bring the Java model up-to-date with a working
+ * copy's contents, an explicit commit must be performed on the working copy.
+ * Other operations performed on a working copy update the contents of the
+ * working copy's buffer but do not commit the contents of the working copy.
*
*
- * Note: The contents of a working copy is determined when a working
- * copy is created, based on the current content of the element the working
- * copy is created from. If a working copy is an IOpenable and is explicitly
- * closed, the working copy's buffer will be thrown away. However, clients should not
- * explicitly open and close working copies.
+ * Note: The contents of a working copy is determined when a working copy is
+ * created, based on the current content of the element the working copy is
+ * created from. If a working copy is an IOpenable and is
+ * explicitly closed, the working copy's buffer will be thrown away. However,
+ * clients should not explicitly open and close working copies.
*
*
- * The client that creates a working copy is responsible for
- * destroying the working copy. The Java model will never automatically
- * destroy or close a working copy. (Note that destroying a working copy
- * does not commit it to the model, it only frees up the memory occupied by
- * the element). After a working copy is destroyed, the working copy cannot
- * be accessed again. Non-handle methods will throw a
- * JavaModelException indicating the Java element does not exist.
+ * The client that creates a working copy is responsible for destroying the
+ * working copy. The Java model will never automatically destroy or close a
+ * working copy. (Note that destroying a working copy does not commit it to the
+ * model, it only frees up the memory occupied by the element). After a working
+ * copy is destroyed, the working copy cannot be accessed again. Non-handle
+ * methods will throw a JavaModelException indicating the Java
+ * element does not exist.
*
*
- * A working copy cannot be created from another working copy.
- * Calling getWorkingCopy on a working copy returns the receiver.
+ * A working copy cannot be created from another working copy. Calling
+ * getWorkingCopy on a working copy returns the receiver.
*
*
* This interface is not intended to be implemented by clients.
*
*/
public interface IWorkingCopy {
-
+
/**
- * Commits the contents of this working copy to its original element
- * and underlying resource, bringing the Java model up-to-date with
- * the current contents of the working copy.
- *
- *
It is possible that the contents of the original resource have changed
- * since this working copy was created, in which case there is an update conflict.
- * The value of the force parameter effects the resolution of
- * such a conflict:
- *
true - in this case the contents of this working copy are applied to
- * the underlying resource even though this working copy was created before
- * a subsequent change in the resource
- *
false - in this case a JavaModelException is thrown
- *
+ * Commits the contents of this working copy to its original element and
+ * underlying resource, bringing the Java model up-to-date with the current
+ * contents of the working copy.
+ *
*
- * Since 2.1, a working copy can be created on a not-yet existing compilation
- * unit. In particular, such a working copy can then be committed in order to create
- * the corresponding compilation unit.
- *
- * @param force a flag to handle the cases when the contents of the original resource have changed
- * since this working copy was created
- * @param monitor the given progress monitor
- * @exception JavaModelException if this working copy could not commit. Reasons include:
+ * It is possible that the contents of the original resource have changed
+ * since this working copy was created, in which case there is an update
+ * conflict. The value of the force parameter effects the
+ * resolution of such a conflict:
*
- *
A CoreException occurred while updating an underlying resource
- *
This element is not a working copy (INVALID_ELEMENT_TYPES)
- *
A update conflict (described above) (UPDATE_CONFLICT)
+ *
true - in this case the contents of this working copy
+ * are applied to the underlying resource even though this working copy was
+ * created before a subsequent change in the resource
+ *
false - in this case a
+ * JavaModelException is thrown
*
+ *
+ * Since 2.1, a working copy can be created on a not-yet existing
+ * compilation unit. In particular, such a working copy can then be
+ * committed in order to create the corresponding compilation unit.
+ *
+ *
+ * @param force
+ * a flag to handle the cases when the contents of the original
+ * resource have changed since this working copy was created
+ * @param monitor
+ * the given progress monitor
+ * @exception JavaModelException
+ * if this working copy could not commit. Reasons include:
+ *
+ *
A CoreException occurred while
+ * updating an underlying resource
+ *
This element is not a working copy
+ * (INVALID_ELEMENT_TYPES)
+ *
A update conflict (described above) (UPDATE_CONFLICT)
+ *
*/
- void commit(boolean force, IProgressMonitor monitor) throws JavaModelException;
-
+ void commit(boolean force, IProgressMonitor monitor)
+ throws JavaModelException;
+
/**
- * Destroys this working copy, closing its buffer and discarding
- * its structure. Subsequent attempts to access non-handle information
- * for this working copy will result in IJavaModelExceptions. Has
- * no effect if this element is not a working copy.
+ * Destroys this working copy, closing its buffer and discarding its
+ * structure. Subsequent attempts to access non-handle information for this
+ * working copy will result in IJavaModelExceptions. Has no
+ * effect if this element is not a working copy.
+ *
+ * If this working copy is shared, it is destroyed only when the number of
+ * calls to destroy() is the same as the number of calls to
+ *
+ * getSharedWorkingCopy(IProgressMonitor, IBufferFactory).
+ *
*
- * If this working copy is shared, it is destroyed only when the number of calls to
- * destroy() is the same as the number of calls to
- * getSharedWorkingCopy(IProgressMonitor, IBufferFactory).
- *
- * When it is destroyed, a REMOVED IJavaElementDelta is reported on this
+ * When it is destroyed, a REMOVED IJavaElementDelta is reported on this
* working copy.
*
*/
void destroy();
-
+
/**
- * Finds the shared working copy for this element, given a IBuffer factory.
- * If no working copy has been created for this element associated with this
- * buffer factory, returns null.
+ * Finds the shared working copy for this element, given a
+ * IBuffer factory. If no working copy has been created for
+ * this element associated with this buffer factory, returns
+ * null.
*
- * Users of this method must not destroy the resulting working copy.
+ * Users of this method must not destroy the resulting working copy.
*
- * @param bufferFactory the given IBuffer factory
- * @return the found shared working copy for this element, null if none
+ * @param bufferFactory
+ * the given IBuffer factory
+ * @return the found shared working copy for this element, null
+ * if none
* @see IBufferFactory
* @since 2.0
*/
IJavaElement findSharedWorkingCopy(IBufferFactory bufferFactory);
/**
- * Returns the original element the specified working copy element was created from,
- * or null if this is not a working copy element. This is a handle
- * only method, the returned element may or may not exist.
+ * Returns the original element the specified working copy element was
+ * created from, or null if this is not a working copy
+ * element. This is a handle only method, the returned element may or may
+ * not exist.
*
- * @return the original element the specified working copy element was created from,
- * or null if this is not a working copy element
+ * @return the original element the specified working copy element was
+ * created from, or null if this is not a working
+ * copy element
*/
IJavaElement getOriginal(IJavaElement workingCopyElement);
-
+
/**
- * Returns the original element this working copy was created from,
- * or null if this is not a working copy.
+ * Returns the original element this working copy was created from, or
+ * null if this is not a working copy.
*
- * @return the original element this working copy was created from,
- * or null if this is not a working copy
+ * @return the original element this working copy was created from, or
+ * null if this is not a working copy
*/
IJavaElement getOriginalElement();
-
- /**
- * Finds the elements in this compilation unit that correspond to
- * the given element.
- * An element A corresponds to an element B if:
+
+ /**
+ * Finds the elements in this compilation unit that correspond to the given
+ * element. An element A corresponds to an element B if:
*
*
A has the same element name as B.
- *
If A is a method, A must have the same number of arguments as
- * B and the simple names of the argument types must be equals.
+ *
If A is a method, A must have the same number of arguments as B and
+ * the simple names of the argument types must be equals.
*
The parent of A corresponds to the parent of B recursively up to
- * their respective compilation units.
+ * their respective compilation units.
*
A exists.
*
- * Returns null if no such java elements can be found
- * or if the given element is not included in a compilation unit.
+ * Returns null if no such java elements can be found or if
+ * the given element is not included in a compilation unit.
*
- * @param element the given element
- * @return the found elements in this compilation unit that correspond to the given element
- * @since 2.0
+ * @param element
+ * the given element
+ * @return the found elements in this compilation unit that correspond to
+ * the given element
+ * @since 2.0
*/
IJavaElement[] findElements(IJavaElement element);
-
+
/**
- * Finds the primary type of this compilation unit (that is, the type with the same name as the
- * compilation unit), or null if no such a type exists.
+ * Finds the primary type of this compilation unit (that is, the type with
+ * the same name as the compilation unit), or null if no such
+ * a type exists.
*
- * @return the found primary type of this compilation unit, or null if no such a type exists
+ * @return the found primary type of this compilation unit, or
+ * null if no such a type exists
* @since 2.0
*/
IType findPrimaryType();
-
+
/**
- * Returns a shared working copy on this element using the given factory to create
- * the buffer, or this element if this element is already a working copy.
- * This API can only answer an already existing working copy if it is based on the same
- * original compilation unit AND was using the same buffer factory (that is, as defined by Object.equals).
+ * Returns a shared working copy on this element using the given factory to
+ * create the buffer, or this element if this element is already a working
+ * copy. This API can only answer an already existing working copy if it is
+ * based on the same original compilation unit AND was using the same buffer
+ * factory (that is, as defined by Object.equals).
*
* The life time of a shared working copy is as follows:
*
- *
The first call to getSharedWorkingCopy(...) creates a new working copy for this
- * element
+ *
The first call to getSharedWorkingCopy(...) creates a
+ * new working copy for this element
*
Subsequent calls increment an internal counter.
*
A call to destroy() decrements the internal counter.
*
When this counter is 0, the working copy is destroyed.
*
* So users of this method must destroy exactly once the working copy.
*
- * Note that the buffer factory will be used for the life time of this working copy, that is if the
- * working copy is closed then reopened, this factory will be used.
- * The buffer will be automatically initialized with the original's compilation unit content
- * upon creation.
+ * Note that the buffer factory will be used for the life time of this
+ * working copy, that is if the working copy is closed then reopened, this
+ * factory will be used. The buffer will be automatically initialized with
+ * the original's compilation unit content upon creation.
*
- * When the shared working copy instance is created, an ADDED IJavaElementDelta is reported on this
- * working copy.
- *
- * @param monitor a progress monitor used to report progress while opening this compilation unit
- * or null if no progress should be reported
- * @param factory the factory that creates a buffer that is used to get the content of the working copy
- * or null if the internal factory should be used
- * @param problemRequestor a requestor which will get notified of problems detected during
- * reconciling as they are discovered. The requestor can be set to null indicating
- * that the client is not interested in problems.
- * @exception JavaModelException if the contents of this element can
- * not be determined.
- * @return a shared working copy on this element using the given factory to create
- * the buffer, or this element if this element is already a working copy
+ * When the shared working copy instance is created, an ADDED
+ * IJavaElementDelta is reported on this working copy.
+ *
+ * @param monitor
+ * a progress monitor used to report progress while opening this
+ * compilation unit or null if no progress should
+ * be reported
+ * @param factory
+ * the factory that creates a buffer that is used to get the
+ * content of the working copy or null if the
+ * internal factory should be used
+ * @param problemRequestor
+ * a requestor which will get notified of problems detected
+ * during reconciling as they are discovered. The requestor can
+ * be set to null indicating that the client is
+ * not interested in problems.
+ * @exception JavaModelException
+ * if the contents of this element can not be determined.
+ * @return a shared working copy on this element using the given factory to
+ * create the buffer, or this element if this element is already a
+ * working copy
* @see IBufferFactory
* @see IProblemRequestor
* @since 2.0
*/
- IJavaElement getSharedWorkingCopy(
- IProgressMonitor monitor,
- IBufferFactory factory,
- IProblemRequestor problemRequestor)
- throws JavaModelException;
-
+ IJavaElement getSharedWorkingCopy(IProgressMonitor monitor,
+ IBufferFactory factory, IProblemRequestor problemRequestor)
+ throws JavaModelException;
+
/**
- * Returns a new working copy of this element if this element is not
- * a working copy, or this element if this element is already a working copy.
+ * Returns a new working copy of this element if this element is not a
+ * working copy, or this element if this element is already a working copy.
*
- * Note: if intending to share a working copy amongst several clients, then
+ * Note: if intending to share a working copy amongst several clients, then
* #getSharedWorkingCopy should be used instead.
- *
- * When the working copy instance is created, an ADDED IJavaElementDelta is
+ *
+ *
+ * When the working copy instance is created, an ADDED IJavaElementDelta is
* reported on this working copy.
- *
- * Since 2.1, a working copy can be created on a not-yet existing compilation
- * unit. In particular, such a working copy can then be committed in order to create
- * the corresponding compilation unit.
*
- * @exception JavaModelException if the contents of this element can
- * not be determined.
- * @return a new working copy of this element if this element is not
- * a working copy, or this element if this element is already a working copy
+ *
+ * Since 2.1, a working copy can be created on a not-yet existing
+ * compilation unit. In particular, such a working copy can then be
+ * committed in order to create the corresponding compilation unit.
+ *
+ *
+ * @exception JavaModelException
+ * if the contents of this element can not be determined.
+ * @return a new working copy of this element if this element is not a
+ * working copy, or this element if this element is already a
+ * working copy
*/
IJavaElement getWorkingCopy() throws JavaModelException;
-
+
/**
- * Returns a new working copy of this element using the given factory to create
- * the buffer, or this element if this element is already a working copy.
- * Note that this factory will be used for the life time of this working copy, that is if the
- * working copy is closed then reopened, this factory will be reused.
- * The buffer will be automatically initialized with the original's compilation unit content
- * upon creation.
+ * Returns a new working copy of this element using the given factory to
+ * create the buffer, or this element if this element is already a working
+ * copy. Note that this factory will be used for the life time of this
+ * working copy, that is if the working copy is closed then reopened, this
+ * factory will be reused. The buffer will be automatically initialized with
+ * the original's compilation unit content upon creation.
*
- * Note: if intending to share a working copy amongst several clients, then
+ * Note: if intending to share a working copy amongst several clients, then
* #getSharedWorkingCopy should be used instead.
- *
- * When the working copy instance is created, an ADDED IJavaElementDelta is
+ *
+ *
+ * When the working copy instance is created, an ADDED IJavaElementDelta is
* reported on this working copy.
- *
- * Since 2.1, a working copy can be created on a not-yet existing compilation
- * unit. In particular, such a working copy can then be committed in order to create
- * the corresponding compilation unit.
*
- * @param monitor a progress monitor used to report progress while opening this compilation unit
- * or null if no progress should be reported
- * @param factory the factory that creates a buffer that is used to get the content of the working copy
- * or null if the internal factory should be used
- * @param problemRequestor a requestor which will get notified of problems detected during
- * reconciling as they are discovered. The requestor can be set to null indicating
- * that the client is not interested in problems.
- * @exception JavaModelException if the contents of this element can
- * not be determined.
- * @return a new working copy of this element using the given factory to create
- * the buffer, or this element if this element is already a working copy
+ *
+ * Since 2.1, a working copy can be created on a not-yet existing
+ * compilation unit. In particular, such a working copy can then be
+ * committed in order to create the corresponding compilation unit.
+ *
+ *
+ * @param monitor
+ * a progress monitor used to report progress while opening this
+ * compilation unit or null if no progress should
+ * be reported
+ * @param factory
+ * the factory that creates a buffer that is used to get the
+ * content of the working copy or null if the
+ * internal factory should be used
+ * @param problemRequestor
+ * a requestor which will get notified of problems detected
+ * during reconciling as they are discovered. The requestor can
+ * be set to null indicating that the client is
+ * not interested in problems.
+ * @exception JavaModelException
+ * if the contents of this element can not be determined.
+ * @return a new working copy of this element using the given factory to
+ * create the buffer, or this element if this element is already a
+ * working copy
* @since 2.0
*/
- IJavaElement getWorkingCopy(
- IProgressMonitor monitor,
- IBufferFactory factory,
- IProblemRequestor problemRequestor)
- throws JavaModelException;
-
+ IJavaElement getWorkingCopy(IProgressMonitor monitor,
+ IBufferFactory factory, IProblemRequestor problemRequestor)
+ throws JavaModelException;
+
/**
- * Returns whether this working copy's original element's content
- * has not changed since the inception of this working copy.
+ * Returns whether this working copy's original element's content has not
+ * changed since the inception of this working copy.
*
- * @return true if this working copy's original element's content
- * has not changed since the inception of this working copy, false otherwise
+ * @return true if this working copy's original element's content has not
+ * changed since the inception of this working copy, false otherwise
*/
boolean isBasedOn(IResource resource);
-
+
/**
* Returns whether this element is a working copy.
*
* @return true if this element is a working copy, false otherwise
*/
boolean isWorkingCopy();
-
+
/**
- * Reconciles the contents of this working copy.
- * It performs the reconciliation by locally caching the contents of
- * the working copy, updating the contents, then creating a delta
- * over the cached contents and the new contents, and finally firing
- * this delta.
+ * Reconciles the contents of this working copy. It performs the
+ * reconciliation by locally caching the contents of the working copy,
+ * updating the contents, then creating a delta over the cached contents and
+ * the new contents, and finally firing this delta.
*
* If the working copy hasn't changed, then no problem will be detected,
* this is equivalent to IWorkingCopy#reconcile(false, null).
*
* Compilation problems found in the new contents are notified through the
- * IProblemRequestor interface which was passed at
- * creation, and no longer as transient markers. Therefore this API will
- * return null.
+ * IProblemRequestor interface which was passed at creation,
+ * and no longer as transient markers. Therefore this API will return
+ * null.
*
- * Note: It has been assumed that added inner types should
- * not generate change deltas. The implementation has been
- * modified to reflect this assumption.
- *
- * @exception JavaModelException if the contents of the original element
- * cannot be accessed. Reasons include:
- *
- *
The original Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
+ * Note: It has been assumed that added inner types should not generate
+ * change deltas. The implementation has been modified to reflect this
+ * assumption.
+ *
+ * @exception JavaModelException
+ * if the contents of the original element cannot be
+ * accessed. Reasons include:
+ *
+ *
The original Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
* @return null
*/
IMarker[] reconcile() throws JavaModelException;
-
+
/**
- * Reconciles the contents of this working copy.
- * It performs the reconciliation by locally caching the contents of
- * the working copy, updating the contents, then creating a delta
- * over the cached contents and the new contents, and finally firing
- * this delta.
+ * Reconciles the contents of this working copy. It performs the
+ * reconciliation by locally caching the contents of the working copy,
+ * updating the contents, then creating a delta over the cached contents and
+ * the new contents, and finally firing this delta.
*
* The boolean argument allows to force problem detection even if the
* working copy is already consistent.
*
* Compilation problems found in the new contents are notified through the
- * IProblemRequestor interface which was passed at
- * creation, and no longer as transient markers. Therefore this API answers
- * nothing.
+ * IProblemRequestor interface which was passed at creation,
+ * and no longer as transient markers. Therefore this API answers nothing.
*
- * Note: It has been assumed that added inner types should
- * not generate change deltas. The implementation has been
- * modified to reflect this assumption.
- *
- * @param forceProblemDetection boolean indicating whether problem should be recomputed
- * even if the source hasn't changed.
- * @param monitor a progress monitor
- * @exception JavaModelException if the contents of the original element
- * cannot be accessed. Reasons include:
- *
- *
The original Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
+ * Note: It has been assumed that added inner types should not generate
+ * change deltas. The implementation has been modified to reflect this
+ * assumption.
+ *
+ * @param forceProblemDetection
+ * boolean indicating whether problem should be recomputed even
+ * if the source hasn't changed.
+ * @param monitor
+ * a progress monitor
+ * @exception JavaModelException
+ * if the contents of the original element cannot be
+ * accessed. Reasons include:
+ *
+ *
The original Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
* @since 2.0
*/
- void reconcile(boolean forceProblemDetection, IProgressMonitor monitor) throws JavaModelException;
+ void reconcile(boolean forceProblemDetection, IProgressMonitor monitor)
+ throws JavaModelException;
/**
* Restores the contents of this working copy to the current contents of
- * this working copy's original element. Has no effect if this element
- * is not a working copy.
- *
- *
Note: This is the inverse of committing the content of the
- * working copy to the original element with commit(boolean, IProgressMonitor).
- *
- * @exception JavaModelException if the contents of the original element
- * cannot be accessed. Reasons include:
- *
- *
The original Java element does not exist (ELEMENT_DOES_NOT_EXIST)
- *
+ * this working copy's original element. Has no effect if this element is
+ * not a working copy.
+ *
+ *
+ * Note: This is the inverse of committing the content of the working copy
+ * to the original element with
+ * commit(boolean, IProgressMonitor).
+ *
+ * @exception JavaModelException
+ * if the contents of the original element cannot be
+ * accessed. Reasons include:
+ *
+ *
The original Java element does not exist
+ * (ELEMENT_DOES_NOT_EXIST)
+ *
*/
void restore() throws JavaModelException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java
index 603da89..a8c48f2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaConventions.java
@@ -30,13 +30,14 @@ import org.eclipse.core.runtime.Status;
/**
* Provides methods for checking Java-specific conventions such as name syntax.
*
- * This class provides static methods and constants only; it is not intended to be
- * instantiated or subclassed by clients.
+ * This class provides static methods and constants only; it is not intended to
+ * be instantiated or subclassed by clients.
*
*/
public final class JavaConventions {
- private final static char DOT= '.';
+ private final static char DOT = '.';
+
private final static Scanner SCANNER = new Scanner();
private JavaConventions() {
@@ -44,36 +45,44 @@ public final class JavaConventions {
}
/**
- * Returns whether the given package fragment root paths are considered
- * to overlap.
+ * Returns whether the given package fragment root paths are considered to
+ * overlap.
*
* Two root paths overlap if one is a prefix of the other, or they point to
* the same location. However, a JAR is allowed to be nested in a root.
- *
- * @param rootPath1 the first root path
- * @param rootPath2 the second root path
- * @return true if the given package fragment root paths are considered to overlap, false otherwise
+ *
+ * @param rootPath1
+ * the first root path
+ * @param rootPath2
+ * the second root path
+ * @return true if the given package fragment root paths are considered to
+ * overlap, false otherwise
* @deprecated Overlapping roots are allowed in 2.1
*/
public static boolean isOverlappingRoots(IPath rootPath1, IPath rootPath2) {
if (rootPath1 == null || rootPath2 == null) {
return false;
}
-// String extension1 = rootPath1.getFileExtension();
-// String extension2 = rootPath2.getFileExtension();
-// if (extension1 != null && (extension1.equalsIgnoreCase(SuffixConstants.EXTENSION_JAR) || extension1.equalsIgnoreCase(SuffixConstants.EXTENSION_ZIP))) {
-// return false;
-// }
-// if (extension2 != null && (extension2.equalsIgnoreCase(SuffixConstants.EXTENSION_JAR) || extension2.equalsIgnoreCase(SuffixConstants.EXTENSION_ZIP))) {
-// return false;
-// }
- return rootPath1.isPrefixOf(rootPath2) || rootPath2.isPrefixOf(rootPath1);
+ // String extension1 = rootPath1.getFileExtension();
+ // String extension2 = rootPath2.getFileExtension();
+ // if (extension1 != null &&
+ // (extension1.equalsIgnoreCase(SuffixConstants.EXTENSION_JAR) ||
+ // extension1.equalsIgnoreCase(SuffixConstants.EXTENSION_ZIP))) {
+ // return false;
+ // }
+ // if (extension2 != null &&
+ // (extension2.equalsIgnoreCase(SuffixConstants.EXTENSION_JAR) ||
+ // extension2.equalsIgnoreCase(SuffixConstants.EXTENSION_ZIP))) {
+ // return false;
+ // }
+ return rootPath1.isPrefixOf(rootPath2)
+ || rootPath2.isPrefixOf(rootPath1);
}
/*
* Returns the current identifier extracted by the scanner (without unicode
- * escapes) from the given id.
- * Returns null if the id was not valid
+ * escapes) from the given id. Returns null if the id was not
+ * valid
*/
private static synchronized char[] scannedIdentifier(String id) {
if (id == null) {
@@ -92,49 +101,61 @@ public final class JavaConventions {
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
- int nextToken= SCANNER.getNextToken();
- if (token == ITerminalSymbols.TokenNameIdentifier
- && nextToken == ITerminalSymbols.TokenNameEOF
- && SCANNER.startPosition == SCANNER.source.length) { // to handle case where we had an ArrayIndexOutOfBoundsException
- // while reading the last token
+ int nextToken = SCANNER.getNextToken();
+ if (token == ITerminalSymbols.TokenNameIdentifier
+ && nextToken == ITerminalSymbols.TokenNameEOF
+ && SCANNER.startPosition == SCANNER.source.length) { // to
+ // handle
+ // case
+ // where
+ // we
+ // had
+ // an
+ // ArrayIndexOutOfBoundsException
+ // while reading the last token
return currentIdentifier;
} else {
return null;
}
- }
- catch (InvalidInputException e) {
+ } catch (InvalidInputException e) {
return null;
}
}
/**
- * Validate the given compilation unit name.
- * A compilation unit name must obey the following rules:
+ * Validate the given compilation unit name. A compilation unit name must
+ * obey the following rules:
*
*
it must not be null
*
it must include the ".java" suffix
*
its prefix must be a valid identifier
- *
it must not contain any characters or substrings that are not valid
- * on the file system on which workspace root is located.
+ *
it must not contain any characters or substrings that are not valid
+ * on the file system on which workspace root is located.
*
*
- * @param name the name of a compilation unit
- * @return a status object with code IStatus.OK if
- * the given name is valid as a compilation unit name, otherwise a status
- * object indicating what is wrong with the name
+ *
+ * @param name
+ * the name of a compilation unit
+ * @return a status object with code IStatus.OK if the given
+ * name is valid as a compilation unit name, otherwise a status
+ * object indicating what is wrong with the name
*/
public static IStatus validateCompilationUnitName(String name) {
if (name == null) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.nullName"), null); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.unit.nullName"), null); //$NON-NLS-1$
}
- if (!net.sourceforge.phpdt.internal.compiler.util.Util.isJavaFileName(name)) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"), null); //$NON-NLS-1$
+ if (!net.sourceforge.phpdt.internal.compiler.util.Util
+ .isJavaFileName(name)) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.unit.notJavaName"), null); //$NON-NLS-1$
}
String identifier;
int index;
index = name.lastIndexOf('.');
if (index == -1) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"), null); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.unit.notJavaName"), null); //$NON-NLS-1$
}
identifier = name.substring(0, index);
// JSR-175 metadata strongly recommends "package-info.java" as the
@@ -146,7 +167,8 @@ public final class JavaConventions {
return status;
}
}
- IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
+ IStatus status = ResourcesPlugin.getWorkspace().validateName(name,
+ IResource.FILE);
if (!status.isOK()) {
return status;
}
@@ -154,128 +176,145 @@ public final class JavaConventions {
}
/**
- * Validate the given .class file name.
- * A .class file name must obey the following rules:
+ * Validate the given .class file name. A .class file name must obey the
+ * following rules:
*
*
it must not be null
*
it must include the ".class" suffix
*
its prefix must be a valid identifier
- *
it must not contain any characters or substrings that are not valid
- * on the file system on which workspace root is located.
+ *
it must not contain any characters or substrings that are not valid
+ * on the file system on which workspace root is located.
*
*
- * @param name the name of a .class file
- * @return a status object with code IStatus.OK if
- * the given name is valid as a .class file name, otherwise a status
- * object indicating what is wrong with the name
+ *
+ * @param name
+ * the name of a .class file
+ * @return a status object with code IStatus.OK if the given
+ * name is valid as a .class file name, otherwise a status object
+ * indicating what is wrong with the name
* @since 2.0
*/
-// public static IStatus validateClassFileName(String name) {
-// if (name == null) {
-// return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.nullName"), null); //$NON-NLS-1$
-// }
-// if (!net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(name)) {
-// return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$
-// }
-// String identifier;
-// int index;
-// index = name.lastIndexOf('.');
-// if (index == -1) {
-// return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$
-// }
-// identifier = name.substring(0, index);
-// IStatus status = validateIdentifier(identifier);
-// if (!status.isOK()) {
-// return status;
-// }
-// status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
-// if (!status.isOK()) {
-// return status;
-// }
-// return JavaModelStatus.VERIFIED_OK;
-// }
-
+ // public static IStatus validateClassFileName(String name) {
+ // if (name == null) {
+ // return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1,
+ // Util.bind("convention.classFile.nullName"), null); //$NON-NLS-1$
+ // }
+ // if
+ // (!net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(name))
+ // {
+ // return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1,
+ // Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$
+ // }
+ // String identifier;
+ // int index;
+ // index = name.lastIndexOf('.');
+ // if (index == -1) {
+ // return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1,
+ // Util.bind("convention.classFile.notClassFileName"), null); //$NON-NLS-1$
+ // }
+ // identifier = name.substring(0, index);
+ // IStatus status = validateIdentifier(identifier);
+ // if (!status.isOK()) {
+ // return status;
+ // }
+ // status = ResourcesPlugin.getWorkspace().validateName(name,
+ // IResource.FILE);
+ // if (!status.isOK()) {
+ // return status;
+ // }
+ // return JavaModelStatus.VERIFIED_OK;
+ // }
/**
* Validate the given field name.
*
* Syntax of a field name corresponds to VariableDeclaratorId (JLS2 8.3).
* For example, "x".
- *
- * @param name the name of a field
- * @return a status object with code IStatus.OK if
- * the given name is valid as a field name, otherwise a status
- * object indicating what is wrong with the name
+ *
+ * @param name
+ * the name of a field
+ * @return a status object with code IStatus.OK if the given
+ * name is valid as a field name, otherwise a status object
+ * indicating what is wrong with the name
*/
public static IStatus validateFieldName(String name) {
return validateIdentifier(name);
}
/**
- * Validate the given Java identifier.
- * The identifier must not have the same spelling as a Java keyword,
- * boolean literal ("true", "false"), or null literal ("null").
- * See section 3.8 of the Java Language Specification, Second Edition (JLS2).
- * A valid identifier can act as a simple type name, method name or field name.
- *
- * @param id the Java identifier
- * @return a status object with code IStatus.OK if
- * the given identifier is a valid Java identifier, otherwise a status
- * object indicating what is wrong with the identifier
+ * Validate the given Java identifier. The identifier must not have the same
+ * spelling as a Java keyword, boolean literal ("true",
+ * "false"), or null literal ("null"). See
+ * section 3.8 of the Java Language Specification, Second Edition
+ * (JLS2). A valid identifier can act as a simple type name, method name or
+ * field name.
+ *
+ * @param id
+ * the Java identifier
+ * @return a status object with code IStatus.OK if the given
+ * identifier is a valid Java identifier, otherwise a status object
+ * indicating what is wrong with the identifier
*/
public static IStatus validateIdentifier(String id) {
if (scannedIdentifier(id) != null) {
return JavaModelStatus.VERIFIED_OK;
} else {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier", id), null); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind(
+ "convention.illegalIdentifier", id), null); //$NON-NLS-1$
}
}
/**
* Validate the given import declaration name.
*
- * The name of an import corresponds to a fully qualified type name
- * or an on-demand package name as defined by ImportDeclaration (JLS2 7.5).
- * For example, "java.util.*" or "java.util.Hashtable".
- *
- * @param name the import declaration
- * @return a status object with code IStatus.OK if
- * the given name is valid as an import declaration, otherwise a status
- * object indicating what is wrong with the name
+ * The name of an import corresponds to a fully qualified type name or an
+ * on-demand package name as defined by ImportDeclaration (JLS2 7.5). For
+ * example, "java.util.*" or
+ * "java.util.Hashtable".
+ *
+ * @param name
+ * the import declaration
+ * @return a status object with code IStatus.OK if the given
+ * name is valid as an import declaration, otherwise a status object
+ * indicating what is wrong with the name
*/
public static IStatus validateImportDeclaration(String name) {
if (name == null || name.length() == 0) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.import.nullImport"), null); //$NON-NLS-1$
- }
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.import.nullImport"), null); //$NON-NLS-1$
+ }
if (name.charAt(name.length() - 1) == '*') {
if (name.charAt(name.length() - 2) == '.') {
return validatePackageName(name.substring(0, name.length() - 2));
} else {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.import.unqualifiedImport"), null); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.import.unqualifiedImport"), null); //$NON-NLS-1$
}
}
return validatePackageName(name);
}
/**
- * Validate the given Java type name, either simple or qualified.
- * For example, "java.lang.Object", or "Object".
+ * Validate the given Java type name, either simple or qualified. For
+ * example, "java.lang.Object", or "Object".
*
- *
- * @param name the name of a type
- * @return a status object with code IStatus.OK if
- * the given name is valid as a Java type name,
- * a status with code IStatus.WARNING
- * indicating why the given name is discouraged,
- * otherwise a status object indicating what is wrong with
- * the name
+ *
+ * @param name
+ * the name of a type
+ * @return a status object with code IStatus.OK if the given
+ * name is valid as a Java type name, a status with code
+ * IStatus.WARNING indicating why the given name is
+ * discouraged, otherwise a status object indicating what is wrong
+ * with the name
*/
public static IStatus validateJavaTypeName(String name) {
if (name == null) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.nullName"), null); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.type.nullName"), null); //$NON-NLS-1$
}
String trimmed = name.trim();
if (!name.equals(trimmed)) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.nameWithBlanks"), null); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.type.nameWithBlanks"), null); //$NON-NLS-1$
}
int index = name.lastIndexOf('.');
char[] scannedID;
@@ -292,35 +331,40 @@ public final class JavaConventions {
String type = name.substring(index + 1).trim();
scannedID = scannedIdentifier(type);
}
-
+
if (scannedID != null) {
- IStatus status = ResourcesPlugin.getWorkspace().validateName(new String(scannedID), IResource.FILE);
+ IStatus status = ResourcesPlugin.getWorkspace().validateName(
+ new String(scannedID), IResource.FILE);
if (!status.isOK()) {
return status;
}
if (CharOperation.contains('$', scannedID)) {
- return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.dollarName"), null); //$NON-NLS-1$
+ return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.type.dollarName"), null); //$NON-NLS-1$
}
if ((scannedID.length > 0 && Character.isLowerCase(scannedID[0]))) {
- return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.lowercaseName"), null); //$NON-NLS-1$
+ return new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.type.lowercaseName"), null); //$NON-NLS-1$
}
return JavaModelStatus.VERIFIED_OK;
} else {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.type.invalidName", name), null); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind(
+ "convention.type.invalidName", name), null); //$NON-NLS-1$
}
}
/**
- * Validate the given method name.
- * The special names "<init>" and "<clinit>" are not valid.
+ * Validate the given method name. The special names "<init>" and
+ * "<clinit>" are not valid.
*
- * The syntax for a method name is defined by Identifier
- * of MethodDeclarator (JLS2 8.4). For example "println".
- *
- * @param name the name of a method
- * @return a status object with code IStatus.OK if
- * the given name is valid as a method name, otherwise a status
- * object indicating what is wrong with the name
+ * The syntax for a method name is defined by Identifier of MethodDeclarator
+ * (JLS2 8.4). For example "println".
+ *
+ * @param name
+ * the name of a method
+ * @return a status object with code IStatus.OK if the given
+ * name is valid as a method name, otherwise a status object
+ * indicating what is wrong with the name
*/
public static IStatus validateMethodName(String name) {
@@ -330,42 +374,51 @@ public final class JavaConventions {
/**
* Validate the given package name.
*
- * The syntax of a package name corresponds to PackageName as
- * defined by PackageDeclaration (JLS2 7.4). For example, "java.lang".
+ * The syntax of a package name corresponds to PackageName as defined by
+ * PackageDeclaration (JLS2 7.4). For example, "java.lang".
*
- * Note that the given name must be a non-empty package name (that is, attempting to
- * validate the default package will return an error status.)
- * Also it must not contain any characters or substrings that are not valid
+ * Note that the given name must be a non-empty package name (that is,
+ * attempting to validate the default package will return an error status.)
+ * Also it must not contain any characters or substrings that are not valid
* on the file system on which workspace root is located.
- *
- * @param name the name of a package
- * @return a status object with code IStatus.OK if
- * the given name is valid as a package name, otherwise a status
- * object indicating what is wrong with the name
+ *
+ * @param name
+ * the name of a package
+ * @return a status object with code IStatus.OK if the given
+ * name is valid as a package name, otherwise a status object
+ * indicating what is wrong with the name
*/
public static IStatus validatePackageName(String name) {
if (name == null) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.nullName"), null); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.package.nullName"), null); //$NON-NLS-1$
}
int length;
if ((length = name.length()) == 0) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.emptyName"), null); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.package.emptyName"), null); //$NON-NLS-1$
}
- if (name.charAt(0) == DOT || name.charAt(length-1) == DOT) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.dotName"), null); //$NON-NLS-1$
+ if (name.charAt(0) == DOT || name.charAt(length - 1) == DOT) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.package.dotName"), null); //$NON-NLS-1$
}
- if (CharOperation.isWhitespace(name.charAt(0)) || CharOperation.isWhitespace(name.charAt(name.length() - 1))) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.nameWithBlanks"), null); //$NON-NLS-1$
+ if (CharOperation.isWhitespace(name.charAt(0))
+ || CharOperation.isWhitespace(name.charAt(name.length() - 1))) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.package.nameWithBlanks"), null); //$NON-NLS-1$
}
int dot = 0;
- while (dot != -1 && dot < length-1) {
- if ((dot = name.indexOf(DOT, dot+1)) != -1 && dot < length-1 && name.charAt(dot+1) == DOT) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.consecutiveDotsName"), null); //$NON-NLS-1$
- }
+ while (dot != -1 && dot < length - 1) {
+ if ((dot = name.indexOf(DOT, dot + 1)) != -1 && dot < length - 1
+ && name.charAt(dot + 1) == DOT) {
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.package.consecutiveDotsName"), null); //$NON-NLS-1$
+ }
}
IWorkspace workspace = ResourcesPlugin.getWorkspace();
- StringTokenizer st = new StringTokenizer(name, new String(new char[] {DOT}));
+ StringTokenizer st = new StringTokenizer(name, new String(
+ new char[] { DOT }));
boolean firstToken = true;
IStatus warningStatus = null;
while (st.hasMoreTokens()) {
@@ -373,15 +426,20 @@ public final class JavaConventions {
typeName = typeName.trim(); // grammar allows spaces
char[] scannedID = scannedIdentifier(typeName);
if (scannedID == null) {
- return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.illegalIdentifier", typeName), null); //$NON-NLS-1$
+ return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util
+ .bind("convention.illegalIdentifier", typeName), null); //$NON-NLS-1$
}
- IStatus status = workspace.validateName(new String(scannedID), IResource.FOLDER);
+ IStatus status = workspace.validateName(new String(scannedID),
+ IResource.FOLDER);
if (!status.isOK()) {
return status;
}
- if (firstToken && scannedID.length > 0 && Character.isUpperCase(scannedID[0])) {
+ if (firstToken && scannedID.length > 0
+ && Character.isUpperCase(scannedID[0])) {
if (warningStatus == null) {
- warningStatus = new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, -1, Util.bind("convention.package.uppercaseName"), null); //$NON-NLS-1$
+ warningStatus = new Status(IStatus.WARNING,
+ JavaCore.PLUGIN_ID, -1,
+ Util.bind("convention.package.uppercaseName"), null); //$NON-NLS-1$
}
}
firstToken = false;
@@ -391,55 +449,84 @@ public final class JavaConventions {
}
return JavaModelStatus.VERIFIED_OK;
}
-
+
/**
- * Validate a given classpath and output location for a project, using the following rules:
+ * Validate a given classpath and output location for a project, using the
+ * following rules:
*
- *
Classpath entries cannot collide with each other; that is, all entry paths must be unique.
- *
The project output location path cannot be null, must be absolute and located inside the project.
- *
Specific output locations (specified on source entries) can be null, if not they must be located inside the project,
- *
A project entry cannot refer to itself directly (that is, a project cannot prerequisite itself).
- *
Classpath entries or output locations cannot coincidate or be nested in each other, except for the following scenarii listed below:
- *
A source folder can coincidate with its own output location, in which case this output can then contain library archives.
- * However, a specific output location cannot coincidate with any library or a distinct source folder than the one referring to it.
- *
A source/library folder can be nested in any source folder as long as the nested folder is excluded from the enclosing one.
- *
An output location can be nested in a source folder, if the source folder coincidates with the project itself, or if the output
- * location is excluded from the source folder.
- *
+ *
Classpath entries cannot collide with each other; that is, all entry
+ * paths must be unique.
+ *
The project output location path cannot be null, must be absolute
+ * and located inside the project.
+ *
Specific output locations (specified on source entries) can be null,
+ * if not they must be located inside the project,
+ *
A project entry cannot refer to itself directly (that is, a project
+ * cannot prerequisite itself).
+ *
Classpath entries or output locations cannot coincidate or be nested
+ * in each other, except for the following scenarii listed below:
+ *
+ *
A source folder can coincidate with its own output location, in
+ * which case this output can then contain library archives. However, a
+ * specific output location cannot coincidate with any library or a distinct
+ * source folder than the one referring to it.
+ *
A source/library folder can be nested in any source folder as long
+ * as the nested folder is excluded from the enclosing one.
+ *
An output location can be nested in a source folder, if the source
+ * folder coincidates with the project itself, or if the output location is
+ * excluded from the source folder.
+ *
*
*
- * Note that the classpath entries are not validated automatically. Only bound variables or containers are considered
- * in the checking process (this allows to perform a consistency check on a classpath which has references to
- * yet non existing projects, folders, ...).
- *
- * This validation is intended to anticipate classpath issues prior to assigning it to a project. In particular, it will automatically
- * be performed during the classpath setting operation (if validation fails, the classpath setting will not complete).
- *
- * @param javaProject the given java project
- * @param rawClasspath the given classpath
- * @param projectOutputLocation the given output location
- * @return a status object with code IStatus.OK if
- * the given classpath and output location are compatible, otherwise a status
- * object indicating what is wrong with the classpath or output location
+ * Note that the classpath entries are not validated automatically. Only
+ * bound variables or containers are considered in the checking process
+ * (this allows to perform a consistency check on a classpath which has
+ * references to yet non existing projects, folders, ...).
+ *
+ * This validation is intended to anticipate classpath issues prior to
+ * assigning it to a project. In particular, it will automatically be
+ * performed during the classpath setting operation (if validation fails,
+ * the classpath setting will not complete).
+ *
+ *
+ * @param javaProject
+ * the given java project
+ * @param rawClasspath
+ * the given classpath
+ * @param projectOutputLocation
+ * the given output location
+ * @return a status object with code IStatus.OK if the given
+ * classpath and output location are compatible, otherwise a status
+ * object indicating what is wrong with the classpath or output
+ * location
* @since 2.0
*/
- public static IJavaModelStatus validateClasspath(IJavaProject javaProject, IClasspathEntry[] rawClasspath, IPath projectOutputLocation) {
+ public static IJavaModelStatus validateClasspath(IJavaProject javaProject,
+ IClasspathEntry[] rawClasspath, IPath projectOutputLocation) {
- return ClasspathEntry.validateClasspath(javaProject, rawClasspath, projectOutputLocation);
+ return ClasspathEntry.validateClasspath(javaProject, rawClasspath,
+ projectOutputLocation);
}
-
+
/**
- * Returns a Java model status describing the problem related to this classpath entry if any,
- * a status object with code IStatus.OK if the entry is fine (that is, if the
- * given classpath entry denotes a valid element to be referenced onto a classpath).
+ * Returns a Java model status describing the problem related to this
+ * classpath entry if any, a status object with code IStatus.OK
+ * if the entry is fine (that is, if the given classpath entry denotes a
+ * valid element to be referenced onto a classpath).
*
- * @param project the given java project
- * @param entry the given classpath entry
- * @param checkSourceAttachment a flag to determine if source attachement should be checked
- * @return a java model status describing the problem related to this classpath entry if any, a status object with code IStatus.OK if the entry is fine
+ * @param project
+ * the given java project
+ * @param entry
+ * the given classpath entry
+ * @param checkSourceAttachment
+ * a flag to determine if source attachement should be checked
+ * @return a java model status describing the problem related to this
+ * classpath entry if any, a status object with code
+ * IStatus.OK if the entry is fine
* @since 2.0
*/
- public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment){
- return ClasspathEntry.validateClasspathEntry(project, entry, checkSourceAttachment, true/*recurse in container*/);
+ public static IJavaModelStatus validateClasspathEntry(IJavaProject project,
+ IClasspathEntry entry, boolean checkSourceAttachment) {
+ return ClasspathEntry.validateClasspathEntry(project, entry,
+ checkSourceAttachment, true/* recurse in container */);
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
index 3797518..47e6e39 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
@@ -38,12 +38,12 @@ import org.eclipse.core.runtime.Preferences;
public class JavaCore {
- // public static HashSet OptionNames = new HashSet(20);
+ // public static HashSet OptionNames = new HashSet(20);
/**
* The plug-in identifier of the Java core support (value
* "net.sourceforge.phpeclipse")
*/
- // public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.core";
+ // public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.core";
// //$NON-NLS-1$
public static final String PLUGIN_ID = PHPeclipsePlugin.PLUGIN_ID;
@@ -287,25 +287,24 @@ public class JavaCore {
* @see #getDefaultOptions
*/
public static final String COMPILER_PB_PHP_VAR_DEPRECATED = CompilerOptions.OPTION_PHPVarDeprecatedWarning; //$NON-NLS-1$
-
+
public static final String COMPILER_PB_PHP_KEYWORD = CompilerOptions.OPTION_PHPBadStyleKeywordWarning; //$NON-NLS-1$
-
+
public static final String COMPILER_PB_PHP_UPPERCASE_IDENTIFIER = CompilerOptions.OPTION_PHPBadStyleUppercaseIdentifierWarning; //$NON-NLS-1$
-
+
public static final String COMPILER_PB_PHP_FILE_NOT_EXIST = CompilerOptions.OPTION_PHPIncludeNotExistWarning; //$NON-NLS-1$
-
+
public static final String COMPILER_PB_UNINITIALIZED_LOCAL_VARIABLE = CompilerOptions.OPTION_UninitializedLocalVariableWarning; //$NON-NLS-1$
-
+
public static final String COMPILER_PB_UNREACHABLE_CODE = CompilerOptions.OPTION_CodeCannotBeReachedWarning; //$NON-NLS-1$
-
+
/**
* Possible configurable option ID.
*
* @see #getDefaultOptions
*/
-// public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID
-// + ".compiler.problem.unreachableCode"; //$NON-NLS-1$
-
+ // public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID
+ // + ".compiler.problem.unreachableCode"; //$NON-NLS-1$
/**
* Possible configurable option ID.
*
@@ -837,417 +836,417 @@ public class JavaCore {
* Note: more options might be added in further releases.
*
*
- *
- * RECOGNIZED OPTIONS:
- * COMPILER / Generating Local Variable Debug Attribute
- * When generated, this attribute will enable local variable names
- * to be displayed in debugger, only in place where variables are
- * definitely assigned (.class file is then bigger)
- * - option id: "org.phpeclipse.phpdt.core.compiler.debug.localVariable"
- * - possible values: { "generate", "do not generate" }
- * - default: "generate"
- *
- * COMPILER / Generating Line Number Debug Attribute
- * When generated, this attribute will enable source code highlighting in debugger
- * (.class file is then bigger).
- * - option id: "org.phpeclipse.phpdt.core.compiler.debug.lineNumber"
- * - possible values: { "generate", "do not generate" }
- * - default: "generate"
- *
- * COMPILER / Generating Source Debug Attribute
- * When generated, this attribute will enable the debugger to present the
- * corresponding source code.
- * - option id: "org.phpeclipse.phpdt.core.compiler.debug.sourceFile"
- * - possible values: { "generate", "do not generate" }
- * - default: "generate"
- *
- * COMPILER / Preserving Unused Local Variables
- * Unless requested to preserve unused local variables (i.e. never read), the
- * compiler will optimize them out, potentially altering debugging
- * - option id: "org.phpeclipse.phpdt.core.compiler.codegen.unusedLocal"
- * - possible values: { "preserve", "optimize out" }
- * - default: "preserve"
- *
- * COMPILER / Defining Target Java Platform
- * For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
- * Note that "1.4" target require to toggle compliance mode to "1.4" too.
- * - option id: "org.phpeclipse.phpdt.core.compiler.codegen.targetPlatform"
- * - possible values: { "1.1", "1.2", "1.3", "1.4" }
- * - default: "1.1"
- *
- * COMPILER / Reporting Unreachable Code
- * Unreachable code can optionally be reported as an error, warning or simply
- * ignored. The bytecode generation will always optimized it out.
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.unreachableCode"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "error"
- *
- * COMPILER / Reporting Invalid Import
- * An import statement that cannot be resolved might optionally be reported
- * as an error, as a warning or ignored.
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.invalidImport"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "error"
- *
- * COMPILER / Reporting Attempt to Override Package-Default Method
- * A package default method is not visible in a different package, and thus
- * cannot be overridden. When enabling this option, the compiler will signal
- * such scenarii either as an error or a warning.
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.overridingPackageDefaultMethod"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Method With Constructor Name
- * Naming a method with a constructor name is generally considered poor
- * style programming. When enabling this option, the compiler will signal such
- * scenarii either as an error or a warning.
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.methodWithConstructorName"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Deprecation
- * When enabled, the compiler will signal use of deprecated API either as an
- * error or a warning.
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.deprecation"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Deprecation Inside Deprecated Code
- * When enabled, the compiler will signal use of deprecated API inside deprecated code.
- * The severity of the problem is controlled with option "org.phpeclipse.phpdt.core.compiler.problem.deprecation".
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.deprecationInDeprecatedCode"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
- *
- * COMPILER / Reporting Hidden Catch Block
- * Locally to a try statement, some catch blocks may hide others , e.g.
- * try { throw new java.io.CharConversionException();
- * } catch (java.io.CharConversionException e) {
- * } catch (java.io.IOException e) {}.
- * When enabling this option, the compiler will issue an error or a warning for hidden
- * catch blocks corresponding to checked exceptions
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.hiddenCatchBlock"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Unused Local
- * When enabled, the compiler will issue an error or a warning for unused local
- * variables (i.e. variables never read from)
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.unusedLocal"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Unused Parameter
- * When enabled, the compiler will issue an error or a warning for unused method
- * parameters (i.e. parameters never read from)
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.unusedParameter"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Unused Import
- * When enabled, the compiler will issue an error or a warning for unused import
- * reference
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.unusedImport"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Synthetic Access Emulation
- * When enabled, the compiler will issue an error or a warning whenever it emulates
- * access to a non-accessible member of an enclosing type. Such access can have
- * performance implications.
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.syntheticAccessEmulation"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Non-Externalized String Literal
- * When enabled, the compiler will issue an error or a warning for non externalized
- * String literal (i.e. non tagged with //$NON-NLS-<n>$).
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.nonExternalizedStringLiteral"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Usage of 'assert' Identifier
- * When enabled, the compiler will issue an error or a warning whenever 'assert' is
- * used as an identifier (reserved keyword in 1.4)
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.assertIdentifier"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Usage of expression receiver on static invocation/field access
- * When enabled, the compiler will issue an error or a warning whenever a static field
- * or method is accessed with an expression receiver.
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.staticAccessReceiver"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Assignment with no effect
- * When enabled, the compiler will issue an error or a warning whenever an assignment
- * has no effect (e.g 'x = x').
- * - option id: "org.phpeclipse.phpdt.core.compiler.problem.noEffectAssignment"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Setting Source Compatibility Mode
- * Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
- * reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
- * level should be set to "1.4" and the compliance mode should be "1.4".
- * - option id: "org.phpeclipse.phpdt.core.compiler.source"
- * - possible values: { "1.3", "1.4" }
- * - default: "1.3"
- *
- * COMPILER / Setting Compliance Level
- * Select the compliance level for the compiler. In "1.3" mode, source and target settings
- * should not go beyond "1.3" level.
- * - option id: "org.phpeclipse.phpdt.core.compiler.compliance"
- * - possible values: { "1.3", "1.4" }
- * - default: "1.3"
- *
- * COMPILER / Maximum number of problems reported per compilation unit
- * Specify the maximum number of problems reported on each compilation unit.
- * - option id: "org.phpeclipse.phpdt.core.compiler.maxProblemPerUnit"
- * - possible values: "<n>" where <n> is zero or a positive integer (if zero then all problems are reported).
- * - default: "100"
- *
- * COMPILER / Define the Automatic Task Tags
- * When the tag is non empty, the compiler will issue a task marker whenever it encounters
- * one of the corresponding tag inside any comment in Java source code.
- * Generated task messages will include the tag, and range until the next line separator or comment ending, and will be trimmed.
- * - option id: "org.phpeclipse.phpdt.core.compiler.taskTags"
- * - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card
- * - default: ""
- * COMPILER / Define the Automatic Task Priorities
- * In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
- * of the task markers issued by the compiler.
- * If the default is specified, the priority of each task marker is "NORMAL".
- * - option id: "org.phpeclipse.phpdt.core.compiler.taskPriorities"
- * - possible values: { "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW"
- * - default: ""
- *
- * BUILDER / Specifying Filters for Resource Copying Control
- * Allow to specify some filters to control the resource copy process.
- * - option id: "org.phpeclipse.phpdt.core.builder.resourceCopyExclusionFilter"
- * - possible values: { "<name>[,<name>]* } where <name> is a file name pattern (* and ? wild-cards allowed)
- * or the name of a folder which ends with '/'
- * - default: ""
- *
- * BUILDER / Abort if Invalid Classpath
- * Allow to toggle the builder to abort if the classpath is invalid
- * - option id: "org.phpeclipse.phpdt.core.builder.invalidClasspath"
- * - possible values: { "abort", "ignore" }
- * - default: "ignore"
- *
- * BUILDER / Cleaning Output Folder(s)
- * Indicate whether the JavaBuilder is allowed to clean the output folders
- * when performing full build operations.
- * - option id: "org.phpeclipse.phpdt.core.builder.cleanOutputFolder"
- * - possible values: { "clean", "ignore" }
- * - default: "clean"
- *
- * JAVACORE / Computing Project Build Order
- * Indicate whether JavaCore should enforce the project build order to be based on
- * the classpath prerequisite chain. When requesting to compute, this takes over
- * the platform default order (based on project references).
- * - option id: "org.phpeclipse.phpdt.core.computeJavaBuildOrder"
- * - possible values: { "compute", "ignore" }
- * - default: "ignore"
- *
- * JAVACORE / Specify Default Source Encoding Format
- * Get the encoding format for compiled sources. This setting is read-only, it is equivalent
- * to 'ResourcesPlugin.getEncoding()'.
- * - option id: "org.phpeclipse.phpdt.core.encoding"
- * - possible values: { any of the supported encoding name}.
- * - default: <platform default>
- *
- * JAVACORE / Reporting Incomplete Classpath
- * An entry on the classpath doesn't exist or is not visible (e.g. a referenced project is closed).
- * - option id: "org.phpeclipse.phpdt.core.incompleteClasspath"
- * - possible values: { "error", "warning"}
- * - default: "error"
- *
- * JAVACORE / Reporting Classpath Cycle
- * A project is involved in a cycle.
- * - option id: "org.phpeclipse.phpdt.core.circularClasspath"
- * - possible values: { "error", "warning" }
- * - default: "error"
- *
- * FORMATTER / Inserting New Line Before Opening Brace
- * When Insert, a new line is inserted before an opening brace, otherwise nothing
- * is inserted
- * - option id: "org.phpeclipse.phpdt.core.formatter.newline.openingBrace"
- * - possible values: { "insert", "do not insert" }
- * - default: "do not insert"
*
- * FORMATTER / Inserting New Line Inside Control Statement
- * When Insert, a new line is inserted between } and following else, catch, finally
- * - option id: "org.phpeclipse.phpdt.core.formatter.newline.controlStatement"
- * - possible values: { "insert", "do not insert" }
- * - default: "do not insert"
+ * RECOGNIZED OPTIONS:
+ * COMPILER / Generating Local Variable Debug Attribute
+ * When generated, this attribute will enable local variable names
+ * to be displayed in debugger, only in place where variables are
+ * definitely assigned (.class file is then bigger)
+ * - option id: "org.phpeclipse.phpdt.core.compiler.debug.localVariable"
+ * - possible values: { "generate", "do not generate" }
+ * - default: "generate"
*
- * FORMATTER / Clearing Blank Lines
- * When Clear all, all blank lines are removed. When Preserve one, only one is kept
- * and all others removed.
- * - option id: "org.phpeclipse.phpdt.core.formatter.newline.clearAll"
- * - possible values: { "clear all", "preserve one" }
- * - default: "preserve one"
+ * COMPILER / Generating Line Number Debug Attribute
+ * When generated, this attribute will enable source code highlighting in debugger
+ * (.class file is then bigger).
+ * - option id: "org.phpeclipse.phpdt.core.compiler.debug.lineNumber"
+ * - possible values: { "generate", "do not generate" }
+ * - default: "generate"
+ *
+ * COMPILER / Generating Source Debug Attribute
+ * When generated, this attribute will enable the debugger to present the
+ * corresponding source code.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.debug.sourceFile"
+ * - possible values: { "generate", "do not generate" }
+ * - default: "generate"
+ *
+ * COMPILER / Preserving Unused Local Variables
+ * Unless requested to preserve unused local variables (i.e. never read), the
+ * compiler will optimize them out, potentially altering debugging
+ * - option id: "org.phpeclipse.phpdt.core.compiler.codegen.unusedLocal"
+ * - possible values: { "preserve", "optimize out" }
+ * - default: "preserve"
+ *
+ * COMPILER / Defining Target Java Platform
+ * For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
+ * Note that "1.4" target require to toggle compliance mode to "1.4" too.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.codegen.targetPlatform"
+ * - possible values: { "1.1", "1.2", "1.3", "1.4" }
+ * - default: "1.1"
*
- * FORMATTER / Inserting New Line Between Else/If
- * When Insert, a blank line is inserted between an else and an if when they are
- * contiguous. When choosing to not insert, else-if will be kept on the same
- * line when possible.
- * - option id: "org.phpeclipse.phpdt.core.formatter.newline.elseIf"
- * - possible values: { "insert", "do not insert" }
- * - default: "do not insert"
+ * COMPILER / Reporting Unreachable Code
+ * Unreachable code can optionally be reported as an error, warning or simply
+ * ignored. The bytecode generation will always optimized it out.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.unreachableCode"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "error"
*
- * FORMATTER / Inserting New Line In Empty Block
- * When insert, a line break is inserted between contiguous { and }, if } is not followed
- * by a keyword.
- * - option id: "org.phpeclipse.phpdt.core.formatter.newline.emptyBlock"
- * - possible values: { "insert", "do not insert" }
- * - default: "insert"
+ * COMPILER / Reporting Invalid Import
+ * An import statement that cannot be resolved might optionally be reported
+ * as an error, as a warning or ignored.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.invalidImport"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "error"
*
- * FORMATTER / Splitting Lines Exceeding Length
- * Enable splitting of long lines (exceeding the configurable length). Length of 0 will
- * disable line splitting
- * - option id: "org.phpeclipse.phpdt.core.formatter.lineSplit"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "80"
+ * COMPILER / Reporting Attempt to Override Package-Default Method
+ * A package default method is not visible in a different package, and thus
+ * cannot be overridden. When enabling this option, the compiler will signal
+ * such scenarii either as an error or a warning.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.overridingPackageDefaultMethod"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * FORMATTER / Compacting Assignment
- * Assignments can be formatted asymmetrically, e.g. 'int x= 2;', when Normal, a space
- * is inserted before the assignment operator
- * - option id: "org.phpeclipse.phpdt.core.formatter.style.assignment"
- * - possible values: { "compact", "normal" }
- * - default: "normal"
+ * COMPILER / Reporting Method With Constructor Name
+ * Naming a method with a constructor name is generally considered poor
+ * style programming. When enabling this option, the compiler will signal such
+ * scenarii either as an error or a warning.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.methodWithConstructorName"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * FORMATTER / Defining Indentation Character
- * Either choose to indent with tab characters or spaces
- * - option id: "org.phpeclipse.phpdt.core.formatter.tabulation.char"
- * - possible values: { "tab", "space" }
- * - default: "tab"
+ * COMPILER / Reporting Deprecation
+ * When enabled, the compiler will signal use of deprecated API either as an
+ * error or a warning.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.deprecation"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * FORMATTER / Defining Space Indentation Length
- * When using spaces, set the amount of space characters to use for each
- * indentation mark.
- * - option id: "org.phpeclipse.phpdt.core.formatter.tabulation.size"
- * - possible values: "<n>", where n is a positive integer
- * - default: "4"
+ * COMPILER / Reporting Deprecation Inside Deprecated Code
+ * When enabled, the compiler will signal use of deprecated API inside deprecated code.
+ * The severity of the problem is controlled with option "org.phpeclipse.phpdt.core.compiler.problem.deprecation".
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.deprecationInDeprecatedCode"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
*
- * CODEASSIST / Activate Visibility Sensitive Completion
- * When active, completion doesn't show that you can not see
- * (e.g. you can not see private methods of a super class).
- * - option id: "org.phpeclipse.phpdt.core.codeComplete.visibilityCheck"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
+ * COMPILER / Reporting Hidden Catch Block
+ * Locally to a try statement, some catch blocks may hide others , e.g.
+ * try { throw new java.io.CharConversionException();
+ * } catch (java.io.CharConversionException e) {
+ * } catch (java.io.IOException e) {}.
+ * When enabling this option, the compiler will issue an error or a warning for hidden
+ * catch blocks corresponding to checked exceptions
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.hiddenCatchBlock"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * CODEASSIST / Automatic Qualification of Implicit Members
- * When active, completion automatically qualifies completion on implicit
- * field references and message expressions.
- * - option id: "org.phpeclipse.phpdt.core.codeComplete.forceImplicitQualification"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
+ * COMPILER / Reporting Unused Local
+ * When enabled, the compiler will issue an error or a warning for unused local
+ * variables (i.e. variables never read from)
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.unusedLocal"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
*
- * CODEASSIST / Define the Prefixes for Field Name
- * When the prefixes is non empty, completion for field name will begin with
- * one of the proposed prefixes.
- * - option id: "org.phpeclipse.phpdt.core.codeComplete.fieldPrefixes"
- * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
- * - default: ""
+ * COMPILER / Reporting Unused Parameter
+ * When enabled, the compiler will issue an error or a warning for unused method
+ * parameters (i.e. parameters never read from)
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.unusedParameter"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
*
- * CODEASSIST / Define the Prefixes for Static Field Name
- * When the prefixes is non empty, completion for static field name will begin with
- * one of the proposed prefixes.
- * - option id: "org.phpeclipse.phpdt.core.codeComplete.staticFieldPrefixes"
- * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
- * - default: ""
+ * COMPILER / Reporting Unused Import
+ * When enabled, the compiler will issue an error or a warning for unused import
+ * reference
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.unusedImport"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * CODEASSIST / Define the Prefixes for Local Variable Name
- * When the prefixes is non empty, completion for local variable name will begin with
- * one of the proposed prefixes.
- * - option id: "org.phpeclipse.phpdt.core.codeComplete.localPrefixes"
- * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
- * - default: ""
+ * COMPILER / Reporting Synthetic Access Emulation
+ * When enabled, the compiler will issue an error or a warning whenever it emulates
+ * access to a non-accessible member of an enclosing type. Such access can have
+ * performance implications.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.syntheticAccessEmulation"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
*
- * CODEASSIST / Define the Prefixes for Argument Name
- * When the prefixes is non empty, completion for argument name will begin with
- * one of the proposed prefixes.
- * - option id: "org.phpeclipse.phpdt.core.codeComplete.argumentPrefixes"
- * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Suffixes for Field Name
- * When the suffixes is non empty, completion for field name will end with
- * one of the proposed suffixes.
- * - option id: "org.phpeclipse.phpdt.core.codeComplete.fieldSuffixes"
- * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Suffixes for Static Field Name
- * When the suffixes is non empty, completion for static field name will end with
- * one of the proposed suffixes.
- * - option id: "org.phpeclipse.phpdt.core.codeComplete.staticFieldSuffixes"
- * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Suffixes for Local Variable Name
- * When the suffixes is non empty, completion for local variable name will end with
- * one of the proposed suffixes.
- * - option id: "org.phpeclipse.phpdt.core.codeComplete.localSuffixes"
- * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Suffixes for Argument Name
- * When the suffixes is non empty, completion for argument name will end with
- * one of the proposed suffixes.
- * - option id: "org.phpeclipse.phpdt.core.codeComplete.argumentSuffixes"
- * - possible values: { "<suffix>[,<suffix>]*" } where <prefix> is a String without any wild-card
- * - default: ""
- * </pre>
- *
- * @return a mutable table containing the default settings of all known options
- * (key type:
+ * COMPILER / Reporting Non-Externalized String Literal
+ * When enabled, the compiler will issue an error or a warning for non externalized
+ * String literal (i.e. non tagged with //$NON-NLS-<n>$).
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.nonExternalizedStringLiteral"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
+ *
+ * COMPILER / Reporting Usage of 'assert' Identifier
+ * When enabled, the compiler will issue an error or a warning whenever 'assert' is
+ * used as an identifier (reserved keyword in 1.4)
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.assertIdentifier"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
+ *
+ * COMPILER / Reporting Usage of expression receiver on static invocation/field access
+ * When enabled, the compiler will issue an error or a warning whenever a static field
+ * or method is accessed with an expression receiver.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.staticAccessReceiver"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
+ *
+ * COMPILER / Reporting Assignment with no effect
+ * When enabled, the compiler will issue an error or a warning whenever an assignment
+ * has no effect (e.g 'x = x').
+ * - option id: "org.phpeclipse.phpdt.core.compiler.problem.noEffectAssignment"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
+ *
+ * COMPILER / Setting Source Compatibility Mode
+ * Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
+ * reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
+ * level should be set to "1.4" and the compliance mode should be "1.4".
+ * - option id: "org.phpeclipse.phpdt.core.compiler.source"
+ * - possible values: { "1.3", "1.4" }
+ * - default: "1.3"
+ *
+ * COMPILER / Setting Compliance Level
+ * Select the compliance level for the compiler. In "1.3" mode, source and target settings
+ * should not go beyond "1.3" level.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.compliance"
+ * - possible values: { "1.3", "1.4" }
+ * - default: "1.3"
+ *
+ * COMPILER / Maximum number of problems reported per compilation unit
+ * Specify the maximum number of problems reported on each compilation unit.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.maxProblemPerUnit"
+ * - possible values: "<n>" where <n> is zero or a positive integer (if zero then all problems are reported).
+ * - default: "100"
+ *
+ * COMPILER / Define the Automatic Task Tags
+ * When the tag is non empty, the compiler will issue a task marker whenever it encounters
+ * one of the corresponding tag inside any comment in Java source code.
+ * Generated task messages will include the tag, and range until the next line separator or comment ending, and will be trimmed.
+ * - option id: "org.phpeclipse.phpdt.core.compiler.taskTags"
+ * - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card
+ * - default: ""
+ * COMPILER / Define the Automatic Task Priorities
+ * In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
+ * of the task markers issued by the compiler.
+ * If the default is specified, the priority of each task marker is "NORMAL".
+ * - option id: "org.phpeclipse.phpdt.core.compiler.taskPriorities"
+ * - possible values: { "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW"
+ * - default: ""
+ *
+ * BUILDER / Specifying Filters for Resource Copying Control
+ * Allow to specify some filters to control the resource copy process.
+ * - option id: "org.phpeclipse.phpdt.core.builder.resourceCopyExclusionFilter"
+ * - possible values: { "<name>[,<name>]* } where <name> is a file name pattern (* and ? wild-cards allowed)
+ * or the name of a folder which ends with '/'
+ * - default: ""
+ *
+ * BUILDER / Abort if Invalid Classpath
+ * Allow to toggle the builder to abort if the classpath is invalid
+ * - option id: "org.phpeclipse.phpdt.core.builder.invalidClasspath"
+ * - possible values: { "abort", "ignore" }
+ * - default: "ignore"
+ *
+ * BUILDER / Cleaning Output Folder(s)
+ * Indicate whether the JavaBuilder is allowed to clean the output folders
+ * when performing full build operations.
+ * - option id: "org.phpeclipse.phpdt.core.builder.cleanOutputFolder"
+ * - possible values: { "clean", "ignore" }
+ * - default: "clean"
+ *
+ * JAVACORE / Computing Project Build Order
+ * Indicate whether JavaCore should enforce the project build order to be based on
+ * the classpath prerequisite chain. When requesting to compute, this takes over
+ * the platform default order (based on project references).
+ * - option id: "org.phpeclipse.phpdt.core.computeJavaBuildOrder"
+ * - possible values: { "compute", "ignore" }
+ * - default: "ignore"
+ *
+ * JAVACORE / Specify Default Source Encoding Format
+ * Get the encoding format for compiled sources. This setting is read-only, it is equivalent
+ * to 'ResourcesPlugin.getEncoding()'.
+ * - option id: "org.phpeclipse.phpdt.core.encoding"
+ * - possible values: { any of the supported encoding name}.
+ * - default: <platform default>
+ *
+ * JAVACORE / Reporting Incomplete Classpath
+ * An entry on the classpath doesn't exist or is not visible (e.g. a referenced project is closed).
+ * - option id: "org.phpeclipse.phpdt.core.incompleteClasspath"
+ * - possible values: { "error", "warning"}
+ * - default: "error"
+ *
+ * JAVACORE / Reporting Classpath Cycle
+ * A project is involved in a cycle.
+ * - option id: "org.phpeclipse.phpdt.core.circularClasspath"
+ * - possible values: { "error", "warning" }
+ * - default: "error"
+ *
+ * FORMATTER / Inserting New Line Before Opening Brace
+ * When Insert, a new line is inserted before an opening brace, otherwise nothing
+ * is inserted
+ * - option id: "org.phpeclipse.phpdt.core.formatter.newline.openingBrace"
+ * - possible values: { "insert", "do not insert" }
+ * - default: "do not insert"
+ *
+ * FORMATTER / Inserting New Line Inside Control Statement
+ * When Insert, a new line is inserted between } and following else, catch, finally
+ * - option id: "org.phpeclipse.phpdt.core.formatter.newline.controlStatement"
+ * - possible values: { "insert", "do not insert" }
+ * - default: "do not insert"
+ *
+ * FORMATTER / Clearing Blank Lines
+ * When Clear all, all blank lines are removed. When Preserve one, only one is kept
+ * and all others removed.
+ * - option id: "org.phpeclipse.phpdt.core.formatter.newline.clearAll"
+ * - possible values: { "clear all", "preserve one" }
+ * - default: "preserve one"
+ *
+ * FORMATTER / Inserting New Line Between Else/If
+ * When Insert, a blank line is inserted between an else and an if when they are
+ * contiguous. When choosing to not insert, else-if will be kept on the same
+ * line when possible.
+ * - option id: "org.phpeclipse.phpdt.core.formatter.newline.elseIf"
+ * - possible values: { "insert", "do not insert" }
+ * - default: "do not insert"
+ *
+ * FORMATTER / Inserting New Line In Empty Block
+ * When insert, a line break is inserted between contiguous { and }, if } is not followed
+ * by a keyword.
+ * - option id: "org.phpeclipse.phpdt.core.formatter.newline.emptyBlock"
+ * - possible values: { "insert", "do not insert" }
+ * - default: "insert"
+ *
+ * FORMATTER / Splitting Lines Exceeding Length
+ * Enable splitting of long lines (exceeding the configurable length). Length of 0 will
+ * disable line splitting
+ * - option id: "org.phpeclipse.phpdt.core.formatter.lineSplit"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "80"
+ *
+ * FORMATTER / Compacting Assignment
+ * Assignments can be formatted asymmetrically, e.g. 'int x= 2;', when Normal, a space
+ * is inserted before the assignment operator
+ * - option id: "org.phpeclipse.phpdt.core.formatter.style.assignment"
+ * - possible values: { "compact", "normal" }
+ * - default: "normal"
+ *
+ * FORMATTER / Defining Indentation Character
+ * Either choose to indent with tab characters or spaces
+ * - option id: "org.phpeclipse.phpdt.core.formatter.tabulation.char"
+ * - possible values: { "tab", "space" }
+ * - default: "tab"
+ *
+ * FORMATTER / Defining Space Indentation Length
+ * When using spaces, set the amount of space characters to use for each
+ * indentation mark.
+ * - option id: "org.phpeclipse.phpdt.core.formatter.tabulation.size"
+ * - possible values: "<n>", where n is a positive integer
+ * - default: "4"
+ *
+ * CODEASSIST / Activate Visibility Sensitive Completion
+ * When active, completion doesn't show that you can not see
+ * (e.g. you can not see private methods of a super class).
+ * - option id: "org.phpeclipse.phpdt.core.codeComplete.visibilityCheck"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
+ *
+ * CODEASSIST / Automatic Qualification of Implicit Members
+ * When active, completion automatically qualifies completion on implicit
+ * field references and message expressions.
+ * - option id: "org.phpeclipse.phpdt.core.codeComplete.forceImplicitQualification"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
+ *
+ * CODEASSIST / Define the Prefixes for Field Name
+ * When the prefixes is non empty, completion for field name will begin with
+ * one of the proposed prefixes.
+ * - option id: "org.phpeclipse.phpdt.core.codeComplete.fieldPrefixes"
+ * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Prefixes for Static Field Name
+ * When the prefixes is non empty, completion for static field name will begin with
+ * one of the proposed prefixes.
+ * - option id: "org.phpeclipse.phpdt.core.codeComplete.staticFieldPrefixes"
+ * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Prefixes for Local Variable Name
+ * When the prefixes is non empty, completion for local variable name will begin with
+ * one of the proposed prefixes.
+ * - option id: "org.phpeclipse.phpdt.core.codeComplete.localPrefixes"
+ * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Prefixes for Argument Name
+ * When the prefixes is non empty, completion for argument name will begin with
+ * one of the proposed prefixes.
+ * - option id: "org.phpeclipse.phpdt.core.codeComplete.argumentPrefixes"
+ * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Suffixes for Field Name
+ * When the suffixes is non empty, completion for field name will end with
+ * one of the proposed suffixes.
+ * - option id: "org.phpeclipse.phpdt.core.codeComplete.fieldSuffixes"
+ * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Suffixes for Static Field Name
+ * When the suffixes is non empty, completion for static field name will end with
+ * one of the proposed suffixes.
+ * - option id: "org.phpeclipse.phpdt.core.codeComplete.staticFieldSuffixes"
+ * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Suffixes for Local Variable Name
+ * When the suffixes is non empty, completion for local variable name will end with
+ * one of the proposed suffixes.
+ * - option id: "org.phpeclipse.phpdt.core.codeComplete.localSuffixes"
+ * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Suffixes for Argument Name
+ * When the suffixes is non empty, completion for argument name will end with
+ * one of the proposed suffixes.
+ * - option id: "org.phpeclipse.phpdt.core.codeComplete.argumentSuffixes"
+ * - possible values: { "<suffix>[,<suffix>]*" } where <prefix> is a String without any wild-card
+ * - default: ""
+ * </pre>
+ *
+ * @return a mutable table containing the default settings of all known options
+ * (key type:
*
* String
*
- * ; value type:
+ * ; value type:
*
* String
*
- * )
- * @see #setOptions
+ * )
+ * @see #setOptions
*
*/
- // public static Hashtable getDefaultOptions() {
+ // public static Hashtable getDefaultOptions() {
//
- // Hashtable defaultOptions = new Hashtable(10);
+ // Hashtable defaultOptions = new Hashtable(10);
//
- // // see #initializeDefaultPluginPreferences() for changing default
+ // // see #initializeDefaultPluginPreferences() for changing default
// settings
- // Preferences preferences = getPlugin().getPluginPreferences();
- // HashSet optionNames = OptionNames;
+ // Preferences preferences = getPlugin().getPluginPreferences();
+ // HashSet optionNames = OptionNames;
//
- // // get preferences set to their default
- // String[] defaultPropertyNames = preferences.defaultPropertyNames();
- // for (int i = 0; i < defaultPropertyNames.length; i++) {
- // String propertyName = defaultPropertyNames[i];
- // if (optionNames.contains(propertyName)) {
- // defaultOptions.put(propertyName,
+ // // get preferences set to their default
+ // String[] defaultPropertyNames = preferences.defaultPropertyNames();
+ // for (int i = 0; i < defaultPropertyNames.length; i++) {
+ // String propertyName = defaultPropertyNames[i];
+ // if (optionNames.contains(propertyName)) {
+ // defaultOptions.put(propertyName,
// preferences.getDefaultString(propertyName));
- // }
- // }
- // // get preferences not set to their default
- // String[] propertyNames = preferences.propertyNames();
- // for (int i = 0; i < propertyNames.length; i++) {
- // String propertyName = propertyNames[i];
- // if (optionNames.contains(propertyName)) {
- // defaultOptions.put(propertyName,
+ // }
+ // }
+ // // get preferences not set to their default
+ // String[] propertyNames = preferences.propertyNames();
+ // for (int i = 0; i < propertyNames.length; i++) {
+ // String propertyName = propertyNames[i];
+ // if (optionNames.contains(propertyName)) {
+ // defaultOptions.put(propertyName,
// preferences.getDefaultString(propertyName));
- // }
- // }
- // // get encoding through resource plugin
- // defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
+ // }
+ // }
+ // // get encoding through resource plugin
+ // defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
//
- // return defaultOptions;
- // }
+ // return defaultOptions;
+ // }
/**
* Helper method for returning one option value only. Equivalent to
* (String)JavaCore.getOptions().get(optionName) Note that it
@@ -1263,17 +1262,17 @@ public class JavaCore {
* @see JavaCore#getDefaultOptions
* @since 2.0
*/
- // public static String getOption(String optionName) {
+ // public static String getOption(String optionName) {
//
- // if (CORE_ENCODING.equals(optionName)) {
- // return ResourcesPlugin.getEncoding();
- // }
- // if (OptionNames.contains(optionName)) {
- // Preferences preferences = getPlugin().getPluginPreferences();
- // return preferences.getString(optionName).trim();
- // }
- // return null;
- // }
+ // if (CORE_ENCODING.equals(optionName)) {
+ // return ResourcesPlugin.getEncoding();
+ // }
+ // if (OptionNames.contains(optionName)) {
+ // Preferences preferences = getPlugin().getPluginPreferences();
+ // return preferences.getString(optionName).trim();
+ // }
+ // return null;
+ // }
/**
* Returns the table of the current options. Initially, all options have
* their default values, and this method returns a table that includes all
@@ -1287,38 +1286,38 @@ public class JavaCore {
* String; value type: String)
* @see JavaCore#getDefaultOptions
*/
- // public static Hashtable getOptions() {
+ // public static Hashtable getOptions() {
//
- // Hashtable options = new Hashtable(10);
+ // Hashtable options = new Hashtable(10);
//
- // // see #initializeDefaultPluginPreferences() for changing default
+ // // see #initializeDefaultPluginPreferences() for changing default
// settings
- // Plugin plugin = getPlugin();
- // if (plugin != null) {
- // Preferences preferences = getPlugin().getPluginPreferences();
- // HashSet optionNames = OptionNames;
+ // Plugin plugin = getPlugin();
+ // if (plugin != null) {
+ // Preferences preferences = getPlugin().getPluginPreferences();
+ // HashSet optionNames = OptionNames;
//
- // // get preferences set to their default
- // String[] defaultPropertyNames = preferences.defaultPropertyNames();
- // for (int i = 0; i < defaultPropertyNames.length; i++) {
- // String propertyName = defaultPropertyNames[i];
- // if (optionNames.contains(propertyName)) {
- // options.put(propertyName, preferences.getDefaultString(propertyName));
- // }
- // }
- // // get preferences not set to their default
- // String[] propertyNames = preferences.propertyNames();
- // for (int i = 0; i < propertyNames.length; i++) {
- // String propertyName = propertyNames[i];
- // if (optionNames.contains(propertyName)) {
- // options.put(propertyName, preferences.getString(propertyName).trim());
- // }
- // }
- // // get encoding through resource plugin
- // options.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
- // }
- // return options;
- // }
+ // // get preferences set to their default
+ // String[] defaultPropertyNames = preferences.defaultPropertyNames();
+ // for (int i = 0; i < defaultPropertyNames.length; i++) {
+ // String propertyName = defaultPropertyNames[i];
+ // if (optionNames.contains(propertyName)) {
+ // options.put(propertyName, preferences.getDefaultString(propertyName));
+ // }
+ // }
+ // // get preferences not set to their default
+ // String[] propertyNames = preferences.propertyNames();
+ // for (int i = 0; i < propertyNames.length; i++) {
+ // String propertyName = propertyNames[i];
+ // if (optionNames.contains(propertyName)) {
+ // options.put(propertyName, preferences.getString(propertyName).trim());
+ // }
+ // }
+ // // get encoding through resource plugin
+ // options.put(CORE_ENCODING, ResourcesPlugin.getEncoding());
+ // }
+ // return options;
+ // }
/**
* Sets the current table of options. All and only the options explicitly
* included in the given table are remembered; all previous option settings
@@ -1334,29 +1333,29 @@ public class JavaCore {
* options to their default values
* @see JavaCore#getDefaultOptions
*/
- // public static void setOptions(Hashtable newOptions) {
+ // public static void setOptions(Hashtable newOptions) {
//
- // // see #initializeDefaultPluginPreferences() for changing default
+ // // see #initializeDefaultPluginPreferences() for changing default
// settings
- // Preferences preferences = getPlugin().getPluginPreferences();
+ // Preferences preferences = getPlugin().getPluginPreferences();
//
- // if (newOptions == null) {
- // newOptions = getDefaultOptions();
- // }
- // Enumeration keys = newOptions.keys();
- // while (keys.hasMoreElements()) {
- // String key = (String) keys.nextElement();
- // if (!OptionNames.contains(key))
- // continue; // unrecognized option
- // if (key.equals(CORE_ENCODING))
- // continue; // skipped, contributed by resource prefs
- // String value = (String) newOptions.get(key);
- // preferences.setValue(key, value);
- // }
+ // if (newOptions == null) {
+ // newOptions = getDefaultOptions();
+ // }
+ // Enumeration keys = newOptions.keys();
+ // while (keys.hasMoreElements()) {
+ // String key = (String) keys.nextElement();
+ // if (!OptionNames.contains(key))
+ // continue; // unrecognized option
+ // if (key.equals(CORE_ENCODING))
+ // continue; // skipped, contributed by resource prefs
+ // String value = (String) newOptions.get(key);
+ // preferences.setValue(key, value);
+ // }
//
- // // persist options
- // getPlugin().savePluginPreferences();
- // }
+ // // persist options
+ // getPlugin().savePluginPreferences();
+ // }
public static IProject[] getPHPProjects() {
List phpProjectsList = new ArrayList();
IProject[] workspaceProjects = PHPeclipsePlugin.getWorkspace()
@@ -1372,16 +1371,16 @@ public class JavaCore {
return (IProject[]) phpProjectsList.toArray(phpProjects);
}
- // public static PHPProject getPHPProject(String name) {
- // IProject aProject =
+ // public static PHPProject getPHPProject(String name) {
+ // IProject aProject =
// PHPeclipsePlugin.getWorkspace().getRoot().getProject(name);
- // if (isPHPProject(aProject)) {
- // PHPProject thePHPProject = new PHPProject();
- // thePHPProject.setProject(aProject);
- // return thePHPProject;
- // }
- // return null;
- // }
+ // if (isPHPProject(aProject)) {
+ // PHPProject thePHPProject = new PHPProject();
+ // thePHPProject.setProject(aProject);
+ // return thePHPProject;
+ // }
+ // return null;
+ // }
public static boolean isPHPProject(IProject aProject) {
try {
@@ -1392,38 +1391,38 @@ public class JavaCore {
return false;
}
- // public static PHPFile create(IFile aFile) {
- // if (PHPFile.EXTENSION.equalsIgnoreCase(aFile.getFileExtension()))
- // return new PHPFile(aFile);
- // if (PHPFile.EXTENSION1.equalsIgnoreCase(aFile.getFileExtension()))
- // return new PHPFile(aFile);
- // if (PHPFile.EXTENSION2.equalsIgnoreCase(aFile.getFileExtension()))
- // return new PHPFile(aFile);
- // if (PHPFile.EXTENSION3.equalsIgnoreCase(aFile.getFileExtension()))
- // return new PHPFile(aFile);
- // if (PHPFile.EXTENSION4.equalsIgnoreCase(aFile.getFileExtension()))
- // return new PHPFile(aFile);
- // if (PHPFile.EXTENSION5.equalsIgnoreCase(aFile.getFileExtension()))
- // return new PHPFile(aFile);
+ // public static PHPFile create(IFile aFile) {
+ // if (PHPFile.EXTENSION.equalsIgnoreCase(aFile.getFileExtension()))
+ // return new PHPFile(aFile);
+ // if (PHPFile.EXTENSION1.equalsIgnoreCase(aFile.getFileExtension()))
+ // return new PHPFile(aFile);
+ // if (PHPFile.EXTENSION2.equalsIgnoreCase(aFile.getFileExtension()))
+ // return new PHPFile(aFile);
+ // if (PHPFile.EXTENSION3.equalsIgnoreCase(aFile.getFileExtension()))
+ // return new PHPFile(aFile);
+ // if (PHPFile.EXTENSION4.equalsIgnoreCase(aFile.getFileExtension()))
+ // return new PHPFile(aFile);
+ // if (PHPFile.EXTENSION5.equalsIgnoreCase(aFile.getFileExtension()))
+ // return new PHPFile(aFile);
//
- // return null;
- // }
+ // return null;
+ // }
- // public static PHPProject create(IProject aProject) {
+ // public static PHPProject create(IProject aProject) {
//
- // try {
- // if (aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) {
- // PHPProject project = new PHPProject();
- // project.setProject(aProject);
- // return project;
- // }
- // } catch (CoreException e) {
- // System.err.println("Exception occurred in PHPCore#create(IProject): " +
+ // try {
+ // if (aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) {
+ // PHPProject project = new PHPProject();
+ // project.setProject(aProject);
+ // return project;
+ // }
+ // } catch (CoreException e) {
+ // System.err.println("Exception occurred in PHPCore#create(IProject): " +
// e.toString());
- // }
+ // }
//
- // return null;
- // }
+ // return null;
+ // }
public static void addPHPNature(IProject project, IProgressMonitor monitor)
throws CoreException {
@@ -1476,10 +1475,10 @@ public class JavaCore {
* if the operation failed.
* @since 2.1
*/
- // public static void run(IWorkspaceRunnable action, IProgressMonitor
+ // public static void run(IWorkspaceRunnable action, IProgressMonitor
// monitor) throws CoreException {
- // run(action, ResourcesPlugin.getWorkspace().getRoot(), monitor);
- // }
+ // run(action, ResourcesPlugin.getWorkspace().getRoot(), monitor);
+ // }
/**
* Runs the given action as an atomic Java model operation.
*
@@ -1518,19 +1517,18 @@ public class JavaCore {
* if the operation failed.
* @since 3.0
*/
- // public static void run(IWorkspaceRunnable action, ISchedulingRule rule,
+ // public static void run(IWorkspaceRunnable action, ISchedulingRule rule,
// IProgressMonitor monitor) throws CoreException {
- // IWorkspace workspace = ResourcesPlugin.getWorkspace();
- // if (workspace.isTreeLocked()) {
- // new BatchOperation(action).run(monitor);
- // } else {
- // // use IWorkspace.run(...) to ensure that a build will be done in
+ // IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ // if (workspace.isTreeLocked()) {
+ // new BatchOperation(action).run(monitor);
+ // } else {
+ // // use IWorkspace.run(...) to ensure that a build will be done in
// autobuild mode
- // workspace.run(new BatchOperation(action), rule, IWorkspace.AVOID_UPDATE,
+ // workspace.run(new BatchOperation(action), rule, IWorkspace.AVOID_UPDATE,
// monitor);
- // }
- // }
-
+ // }
+ // }
/**
* Adds the given listener for changes to Java elements. Has no effect if an
* identical listener is already registered.
@@ -1598,27 +1596,32 @@ public class JavaCore {
*/
public static void addJavaElementMarkerAttributes(Map attributes,
IJavaElement element) {
- // if (element instanceof IMember)
- // element = ((IMember) element).getClassFile();
+ // if (element instanceof IMember)
+ // element = ((IMember) element).getClassFile();
if (attributes != null && element != null)
attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier());
}
/**
- * Adds the given listener for POST_CHANGE resource change events to the Java core.
- * The listener is guarantied to be notified of the POST_CHANGE resource change event before
- * the Java core starts processing the resource change event itself.
+ * Adds the given listener for POST_CHANGE resource change events to the
+ * Java core. The listener is guarantied to be notified of the POST_CHANGE
+ * resource change event before the Java core starts processing the resource
+ * change event itself.
*
* Has no effect if an identical listener is already registered.
*
*
- * @param listener the listener
+ * @param listener
+ * the listener
* @see #removePreProcessingResourceChangedListener(IResourceChangeListener)
* @since 3.0
*/
- public static void addPreProcessingResourceChangedListener(IResourceChangeListener listener) {
- JavaModelManager.getJavaModelManager().deltaState.addPreResourceChangedListener(listener);
+ public static void addPreProcessingResourceChangedListener(
+ IResourceChangeListener listener) {
+ JavaModelManager.getJavaModelManager().deltaState
+ .addPreResourceChangedListener(listener);
}
+
/**
* Configures the given marker for the given Java element. Used for markers,
* which denote a Java element rather than a resource.
@@ -1633,8 +1636,8 @@ public class JavaCore {
*/
public void configureJavaElementMarker(IMarker marker, IJavaElement element)
throws CoreException {
- // if (element instanceof IMember)
- // element = ((IMember) element).getClassFile();
+ // if (element instanceof IMember)
+ // element = ((IMember) element).getClassFile();
if (marker != null && element != null)
marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier());
}
@@ -1657,28 +1660,31 @@ public class JavaCore {
}
/**
- * Returns the Java model element corresponding to the given handle identifier
- * generated by IJavaElement.getHandleIdentifier(), or
- * null if unable to create the associated element.
- * If the returned Java element is an ICompilationUnit, its owner
- * is the given owner if such a working copy exists, otherwise the compilation unit
- * is a primary compilation unit.
- *
- * @param handleIdentifier the given handle identifier
- * @param owner the owner of the returned compilation unit, ignored if the returned
- * element is not a compilation unit
+ * Returns the Java model element corresponding to the given handle
+ * identifier generated by IJavaElement.getHandleIdentifier(),
+ * or null if unable to create the associated element. If the
+ * returned Java element is an ICompilationUnit, its owner
+ * is the given owner if such a working copy exists, otherwise the
+ * compilation unit is a primary compilation unit.
+ *
+ * @param handleIdentifier
+ * the given handle identifier
+ * @param owner
+ * the owner of the returned compilation unit, ignored if the
+ * returned element is not a compilation unit
* @return the Java element corresponding to the handle identifier
* @since 3.0
*/
- public static IJavaElement create(String handleIdentifier, WorkingCopyOwner owner) {
+ public static IJavaElement create(String handleIdentifier,
+ WorkingCopyOwner owner) {
if (handleIdentifier == null) {
return null;
}
MementoTokenizer memento = new MementoTokenizer(handleIdentifier);
JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
return model.getHandleFromMemento(memento, owner);
- }
-
+ }
+
/**
* Returns the Java element corresponding to the given file, or
* null if unable to associate the given file with a Java
@@ -1811,9 +1817,9 @@ public class JavaCore {
* @return a class file element for the given .class file, or
* null if unable to recognize the class file
*/
- //public static IClassFile createClassFileFrom(IFile file) {
- // return JavaModelManager.createClassFileFrom(file, null);
- //}
+ // public static IClassFile createClassFileFrom(IFile file) {
+ // return JavaModelManager.createClassFileFrom(file, null);
+ // }
/**
* Creates and returns a compilation unit element for the given
* .java file. Returns null if unable to
@@ -1839,10 +1845,10 @@ public class JavaCore {
* to create a JAR package fragment root. (for example, if the JAR
* file represents a non-Java resource)
*/
- //public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile
+ // public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile
// file) {
- // return JavaModelManager.createJarPackageFragmentRootFrom(file, null);
- //}
+ // return JavaModelManager.createJarPackageFragmentRootFrom(file, null);
+ // }
/**
* Answers the project specific value for a given classpath container. In
* case this container path could not be resolved, then will answer
@@ -1887,86 +1893,87 @@ public class JavaCore {
* IProgressMonitor)
* @since 2.0
*/
- //public static IClasspathContainer getClasspathContainer(final IPath
+ // public static IClasspathContainer getClasspathContainer(final IPath
// containerPath, final IJavaProject project) throws JavaModelException {
//
- // IClasspathContainer container = JavaModelManager.containerGet(project,
+ // IClasspathContainer container = JavaModelManager.containerGet(project,
// containerPath);
- // if (container == JavaModelManager.ContainerInitializationInProgress)
+ // if (container == JavaModelManager.ContainerInitializationInProgress)
// return null; // break cycle
//
- // if (container == null){
- // final ClasspathContainerInitializer initializer =
+ // if (container == null){
+ // final ClasspathContainerInitializer initializer =
// JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
- // if (initializer != null){
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.println("CPContainer INIT - triggering initialization of:
+ // if (initializer != null){
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.println("CPContainer INIT - triggering initialization of:
// ["+project.getElementName()+"] " + containerPath + " using initializer:
// "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
- // new Exception("FAKE exception for dumping current CPContainer
+ // new Exception("FAKE exception for dumping current CPContainer
// (["+project.getElementName()+"] "+ containerPath+ ")INIT invocation stack
// trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- // }
- // JavaModelManager.containerPut(project, containerPath,
+ // }
+ // JavaModelManager.containerPut(project, containerPath,
// JavaModelManager.ContainerInitializationInProgress); // avoid
// initialization cycles
- // boolean ok = false;
- // try {
- // // wrap initializer call with Safe runnable in case initializer would be
+ // boolean ok = false;
+ // try {
+ // // wrap initializer call with Safe runnable in case initializer would be
// causing some grief
- // Platform.run(new ISafeRunnable() {
- // public void handleException(Throwable exception) {
- // ProjectPrefUtil.log(exception, "Exception occurred in classpath container
+ // Platform.run(new ISafeRunnable() {
+ // public void handleException(Throwable exception) {
+ // ProjectPrefUtil.log(exception, "Exception occurred in classpath container
// initializer: "+initializer); //$NON-NLS-1$
- // }
- // public void run() throws Exception {
- // initializer.initialize(containerPath, project);
- // }
- // });
+ // }
+ // public void run() throws Exception {
+ // initializer.initialize(containerPath, project);
+ // }
+ // });
//
- // // retrieve value (if initialization was successful)
- // container = JavaModelManager.containerGet(project, containerPath);
- // if (container == JavaModelManager.ContainerInitializationInProgress)
+ // // retrieve value (if initialization was successful)
+ // container = JavaModelManager.containerGet(project, containerPath);
+ // if (container == JavaModelManager.ContainerInitializationInProgress)
// return null; // break cycle
- // ok = true;
- // } finally {
- // if (!ok) JavaModelManager.containerPut(project, containerPath, null); //
+ // ok = true;
+ // } finally {
+ // if (!ok) JavaModelManager.containerPut(project, containerPath, null); //
// flush cache
- // }
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.print("CPContainer INIT - after resolution:
+ // }
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.print("CPContainer INIT - after resolution:
// ["+project.getElementName()+"] " + containerPath + " --> ");
// //$NON-NLS-2$//$NON-NLS-1$//$NON-NLS-3$
- // if (container != null){
- // System.out.print("container: "+container.getDescription()+" {");
+ // if (container != null){
+ // System.out.print("container: "+container.getDescription()+" {");
// //$NON-NLS-2$//$NON-NLS-1$
- // IClasspathEntry[] entries = container.getClasspathEntries();
- // if (entries != null){
- // for (int i = 0; i < entries.length; i++){
- // if (i > 0) System.out.println(", ");//$NON-NLS-1$
- // System.out.println(entries[i]);
- // }
- // }
- // System.out.println("}");//$NON-NLS-1$
- // } else {
- // System.out.println("{unbound}");//$NON-NLS-1$
- // }
- // }
- // } else {
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.println("CPContainer INIT - no initializer found for:
+ // IClasspathEntry[] entries = container.getClasspathEntries();
+ // if (entries != null){
+ // for (int i = 0; i < entries.length; i++){
+ // if (i > 0) System.out.println(", ");//$NON-NLS-1$
+ // System.out.println(entries[i]);
+ // }
+ // }
+ // System.out.println("}");//$NON-NLS-1$
+ // } else {
+ // System.out.println("{unbound}");//$NON-NLS-1$
+ // }
+ // }
+ // } else {
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.println("CPContainer INIT - no initializer found for:
// "+project.getElementName()+"] " + containerPath); //$NON-NLS-1$
// //$NON-NLS-2$
- // }
- // }
- // }
- // return container;
- //}
+ // }
+ // }
+ // }
+ // return container;
+ // }
/**
* Helper method finding the classpath container initializer registered for
* a given classpath container ID or null if none was found
* while iterating over the contributions to extension point to the
- * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
+ * extension point
+ * "net.sourceforge.phpdt.core.classpathContainerInitializer".
*
* A containerID is the first segment of any container path, used to
* identify the registered container initializer.
@@ -1978,42 +1985,42 @@ public class JavaCore {
* container initializer or null if none was found.
* @since 2.1
*/
- //public static ClasspathContainerInitializer
+ // public static ClasspathContainerInitializer
// getClasspathContainerInitializer(String containerID){
//
- // Plugin jdtCorePlugin = JavaCore.getPlugin();
- // if (jdtCorePlugin == null) return null;
+ // Plugin jdtCorePlugin = JavaCore.getPlugin();
+ // if (jdtCorePlugin == null) return null;
//
- // IExtensionPoint extension =
+ // IExtensionPoint extension =
// jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID);
- // if (extension != null) {
- // IExtension[] extensions = extension.getExtensions();
- // for(int i = 0; i < extensions.length; i++){
- // IConfigurationElement [] configElements =
+ // if (extension != null) {
+ // IExtension[] extensions = extension.getExtensions();
+ // for(int i = 0; i < extensions.length; i++){
+ // IConfigurationElement [] configElements =
// extensions[i].getConfigurationElements();
- // for(int j = 0; j < configElements.length; j++){
- // String initializerID = configElements[j].getAttribute("id");
+ // for(int j = 0; j < configElements.length; j++){
+ // String initializerID = configElements[j].getAttribute("id");
// //$NON-NLS-1$
- // if (initializerID != null && initializerID.equals(containerID)){
- // if (JavaModelManager.CP_RESOLVE_VERBOSE) {
- // System.out.println("CPContainer INIT - found initializer: "+containerID
+ // if (initializerID != null && initializerID.equals(containerID)){
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE) {
+ // System.out.println("CPContainer INIT - found initializer: "+containerID
// +" --> " +
// configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
- // }
- // try {
- // Object execExt = configElements[j].createExecutableExtension("class");
+ // }
+ // try {
+ // Object execExt = configElements[j].createExecutableExtension("class");
// //$NON-NLS-1$
- // if (execExt instanceof ClasspathContainerInitializer){
- // return (ClasspathContainerInitializer)execExt;
- // }
- // } catch(CoreException e) {
- // }
- // }
- // }
- // }
- // }
- // return null;
- //}
+ // if (execExt instanceof ClasspathContainerInitializer){
+ // return (ClasspathContainerInitializer)execExt;
+ // }
+ // } catch(CoreException e) {
+ // }
+ // }
+ // }
+ // }
+ // }
+ // return null;
+ // }
/**
* Returns the path held in the given classpath variable. Returns null
*
if unable to bind.
@@ -2023,10 +2030,10 @@ public class JavaCore {
*
* Note that classpath variables can be contributed registered initializers
* for, using the extension point
- * "net.sourceforge.phpdt.core.classpathVariableInitializer". If an initializer is
- * registered for a variable, its persisted value will be ignored: its
- * initializer will thus get the opportunity to rebind the variable
- * differently on each session.
+ * "net.sourceforge.phpdt.core.classpathVariableInitializer". If an
+ * initializer is registered for a variable, its persisted value will be
+ * ignored: its initializer will thus get the opportunity to rebind the
+ * variable differently on each session.
*
* @param variableName
* the name of the classpath variable
@@ -2045,54 +2052,55 @@ public class JavaCore {
// even if persisted value exists, initializer is given priority, only
// if no initializer is found the persisted value is reused
- // final ClasspathVariableInitializer initializer =
+ // final ClasspathVariableInitializer initializer =
// PHPCore.getClasspathVariableInitializer(variableName);
- // if (initializer != null){
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.println("CPVariable INIT - triggering initialization of: "
+ // if (initializer != null){
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.println("CPVariable INIT - triggering initialization of: "
// + variableName+ " using initializer: "+ initializer); //$NON-NLS-1$
// //$NON-NLS-2$
- // new Exception("FAKE exception for dumping current CPVariable
+ // new Exception("FAKE exception for dumping current CPVariable
// ("+variableName+ ")INIT invocation stack trace").printStackTrace();
// //$NON-NLS-1$//$NON-NLS-2$
- // }
- // JavaModelManager.variablePut(variableName,
+ // }
+ // JavaModelManager.variablePut(variableName,
// JavaModelManager.VariableInitializationInProgress); // avoid
// initialization cycles
- // boolean ok = false;
- // try {
- // // wrap initializer call with Safe runnable in case initializer would
+ // boolean ok = false;
+ // try {
+ // // wrap initializer call with Safe runnable in case initializer would
// be causing some grief
- // Platform.run(new ISafeRunnable() {
- // public void handleException(Throwable exception) {
- // ProjectPrefUtil.log(exception, "Exception occurred in classpath variable
+ // Platform.run(new ISafeRunnable() {
+ // public void handleException(Throwable exception) {
+ // ProjectPrefUtil.log(exception, "Exception occurred in classpath
+ // variable
// initializer: "+initializer+" while initializing variable:
// "+variableName); //$NON-NLS-1$ //$NON-NLS-2$
- // }
- // public void run() throws Exception {
- // initializer.initialize(variableName);
- // }
- // });
- // variablePath = (IPath) JavaModelManager.variableGet(variableName); //
+ // }
+ // public void run() throws Exception {
+ // initializer.initialize(variableName);
+ // }
+ // });
+ // variablePath = (IPath) JavaModelManager.variableGet(variableName); //
// initializer should have performed side-effect
- // if (variablePath ==
+ // if (variablePath ==
// JavaModelManager.VariableInitializationInProgress) return null; //
// break cycle (initializer did not init or reentering call)
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.println("CPVariable INIT - after initialization: " +
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.println("CPVariable INIT - after initialization: " +
// variableName + " --> " + variablePath); //$NON-NLS-2$//$NON-NLS-1$
- // }
- // ok = true;
- // } finally {
- // if (!ok) JavaModelManager.variablePut(variableName, null); // flush
+ // }
+ // ok = true;
+ // } finally {
+ // if (!ok) JavaModelManager.variablePut(variableName, null); // flush
// cache
- // }
- // } else {
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.println("CPVariable INIT - no initializer found for: " +
+ // }
+ // } else {
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.println("CPVariable INIT - no initializer found for: " +
// variableName); //$NON-NLS-1$
- // }
- // }
+ // }
+ // }
return variablePath;
}
@@ -2100,7 +2108,8 @@ public class JavaCore {
* Helper method finding the classpath variable initializer registered for a
* given classpath variable name or null if none was found
* while iterating over the contributions to extension point to the
- * extension point "net.sourceforge.phpdt.core.classpathVariableInitializer".
+ * extension point
+ * "net.sourceforge.phpdt.core.classpathVariableInitializer".
*
*
* @param the
@@ -2116,34 +2125,34 @@ public class JavaCore {
if (jdtCorePlugin == null)
return null;
- // IExtensionPoint extension =
+ // IExtensionPoint extension =
// jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID);
- // if (extension != null) {
- // IExtension[] extensions = extension.getExtensions();
- // for(int i = 0; i < extensions.length; i++){
- // IConfigurationElement [] configElements =
+ // if (extension != null) {
+ // IExtension[] extensions = extension.getExtensions();
+ // for(int i = 0; i < extensions.length; i++){
+ // IConfigurationElement [] configElements =
// extensions[i].getConfigurationElements();
- // for(int j = 0; j < configElements.length; j++){
- // try {
- // String varAttribute = configElements[j].getAttribute("variable");
+ // for(int j = 0; j < configElements.length; j++){
+ // try {
+ // String varAttribute = configElements[j].getAttribute("variable");
// //$NON-NLS-1$
- // if (variable.equals(varAttribute)) {
- // if (JavaModelManager.CP_RESOLVE_VERBOSE) {
- // System.out.println("CPVariable INIT - found initializer: "+variable+"
+ // if (variable.equals(varAttribute)) {
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE) {
+ // System.out.println("CPVariable INIT - found initializer: "+variable+"
// --> " +
// configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
- // }
- // Object execExt =
+ // }
+ // Object execExt =
// configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
- // if (execExt instanceof ClasspathVariableInitializer){
- // return (ClasspathVariableInitializer)execExt;
- // }
- // }
- // } catch(CoreException e){
- // }
- // }
- // }
- // }
+ // if (execExt instanceof ClasspathVariableInitializer){
+ // return (ClasspathVariableInitializer)execExt;
+ // }
+ // }
+ // } catch(CoreException e){
+ // }
+ // }
+ // }
+ // }
return null;
}
@@ -2157,9 +2166,9 @@ public class JavaCore {
* @return the list of classpath variable names
* @see #setClasspathVariable
*/
- //public static String[] getClasspathVariableNames() {
- // return JavaModelManager.variableNames();
- //}
+ // public static String[] getClasspathVariableNames() {
+ // return JavaModelManager.variableNames();
+ // }
/**
* Returns a table of all known configurable options with their default
* values. These options allow to configure the behaviour of the underlying
@@ -2172,453 +2181,453 @@ public class JavaCore {
* Note: more options might be added in further releases.
*
*
- *
- * RECOGNIZED OPTIONS:
- * COMPILER / Generating Local Variable Debug Attribute
- * When generated, this attribute will enable local variable names
- * to be displayed in debugger, only in place where variables are
- * definitely assigned (.class file is then bigger)
- * - option id: "net.sourceforge.phpdt.core.compiler.debug.localVariable"
- * - possible values: { "generate", "do not generate" }
- * - default: "generate"
- *
- * COMPILER / Generating Line Number Debug Attribute
- * When generated, this attribute will enable source code highlighting in debugger
- * (.class file is then bigger).
- * - option id: "net.sourceforge.phpdt.core.compiler.debug.lineNumber"
- * - possible values: { "generate", "do not generate" }
- * - default: "generate"
- *
- * COMPILER / Generating Source Debug Attribute
- * When generated, this attribute will enable the debugger to present the
- * corresponding source code.
- * - option id: "net.sourceforge.phpdt.core.compiler.debug.sourceFile"
- * - possible values: { "generate", "do not generate" }
- * - default: "generate"
- *
- * COMPILER / Preserving Unused Local Variables
- * Unless requested to preserve unused local variables (that is, never read), the
- * compiler will optimize them out, potentially altering debugging
- * - option id: "net.sourceforge.phpdt.core.compiler.codegen.unusedLocal"
- * - possible values: { "preserve", "optimize out" }
- * - default: "preserve"
- *
- * COMPILER / Defining Target Java Platform
- * For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
- * Note that "1.4" target require to toggle compliance mode to "1.4" too.
- * - option id: "net.sourceforge.phpdt.core.compiler.codegen.targetPlatform"
- * - possible values: { "1.1", "1.2", "1.3", "1.4" }
- * - default: "1.1"
- *
- * COMPILER / Reporting Unreachable Code
- * Unreachable code can optionally be reported as an error, warning or simply
- * ignored. The bytecode generation will always optimized it out.
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.unreachableCode"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "error"
- *
- * COMPILER / Reporting Invalid Import
- * An import statement that cannot be resolved might optionally be reported
- * as an error, as a warning or ignored.
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.invalidImport"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "error"
- *
- * COMPILER / Reporting Attempt to Override Package-Default Method
- * A package default method is not visible in a different package, and thus
- * cannot be overridden. When enabling this option, the compiler will signal
- * such scenarii either as an error or a warning.
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.overridingPackageDefaultMethod"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Method With Constructor Name
- * Naming a method with a constructor name is generally considered poor
- * style programming. When enabling this option, the compiler will signal such
- * scenarii either as an error or a warning.
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.methodWithConstructorName"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Deprecation
- * When enabled, the compiler will signal use of deprecated API either as an
- * error or a warning.
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.deprecation"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Deprecation Inside Deprecated Code
- * When enabled, the compiler will signal use of deprecated API inside deprecated code.
- * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.deprecation".
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.deprecationInDeprecatedCode"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
- *
- * COMPILER / Reporting Hidden Catch Block
- * Locally to a try statement, some catch blocks may hide others . For example,
- * try { throw new java.io.CharConversionException();
- * } catch (java.io.CharConversionException e) {
- * } catch (java.io.IOException e) {}.
- * When enabling this option, the compiler will issue an error or a warning for hidden
- * catch blocks corresponding to checked exceptions
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.hiddenCatchBlock"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Unused Local
- * When enabled, the compiler will issue an error or a warning for unused local
- * variables (that is, variables never read from)
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedLocal"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Unused Parameter
- * When enabled, the compiler will issue an error or a warning for unused method
- * parameters (that is, parameters never read from)
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameter"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Unused Parameter if Implementing Abstract Method
- * When enabled, the compiler will signal unused parameters in abstract method implementations.
- * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.unusedParameter".
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
- *
- * COMPILER / Reporting Unused Parameter if Overriding Concrete Method
- * When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
- * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.unusedParameter".
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
- *
- * COMPILER / Reporting Unused Import
- * When enabled, the compiler will issue an error or a warning for unused import
- * reference
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedImport"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Unused Private Members
- * When enabled, the compiler will issue an error or a warning whenever a private
- * method or field is declared but never used within the same unit.
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedPrivateMember"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Synthetic Access Emulation
- * When enabled, the compiler will issue an error or a warning whenever it emulates
- * access to a non-accessible member of an enclosing type. Such access can have
- * performance implications.
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.syntheticAccessEmulation"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Non-Externalized String Literal
- * When enabled, the compiler will issue an error or a warning for non externalized
- * String literal (that is, not tagged with //$NON-NLS-<n>$).
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.nonExternalizedStringLiteral"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Usage of 'assert' Identifier
- * When enabled, the compiler will issue an error or a warning whenever 'assert' is
- * used as an identifier (reserved keyword in 1.4)
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.assertIdentifier"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Reporting Non-Static Reference to a Static Member
- * When enabled, the compiler will issue an error or a warning whenever a static field
- * or method is accessed with an expression receiver. A reference to a static member should
- * be qualified with a type name.
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.staticAccessReceiver"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Assignment with no Effect
- * When enabled, the compiler will issue an error or a warning whenever an assignment
- * has no effect (e.g 'x = x').
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.noEffectAssignment"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
- * When enabled, the compiler will issue an error or a warning whenever an interface
- * defines a method incompatible with a non-inherited Object method. Until this conflict
- * is resolved, such an interface cannot be implemented, For example,
- * interface I {
- * int clone();
- * }
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Reporting Usage of char[] Expressions in String Concatenations
- * When enabled, the compiler will issue an error or a warning whenever a char[] expression
- * is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
- * - option id: "net.sourceforge.phpdt.core.compiler.problem.noImplicitStringConversion"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "warning"
- *
- * COMPILER / Setting Source Compatibility Mode
- * Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
- * reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
- * level should be set to "1.4" and the compliance mode should be "1.4".
- * - option id: "net.sourceforge.phpdt.core.compiler.source"
- * - possible values: { "1.3", "1.4" }
- * - default: "1.3"
- *
- * COMPILER / Setting Compliance Level
- * Select the compliance level for the compiler. In "1.3" mode, source and target settings
- * should not go beyond "1.3" level.
- * - option id: "net.sourceforge.phpdt.core.compiler.compliance"
- * - possible values: { "1.3", "1.4" }
- * - default: "1.3"
- *
- * COMPILER / Maximum number of problems reported per compilation unit
- * Specify the maximum number of problems reported on each compilation unit.
- * - option id: "net.sourceforge.phpdt.core.compiler.maxProblemPerUnit"
- * - possible values: "<n>" where <n> is zero or a positive integer (if zero then all problems are reported).
- * - default: "100"
*
- * COMPILER / Define the Automatic Task Tags
- * When the tag list is not empty, the compiler will issue a task marker whenever it encounters
- * one of the corresponding tag inside any comment in Java source code.
- * Generated task messages will include the tag, and range until the next line separator or comment ending.
- * Note that tasks messages are trimmed.
- * - option id: "net.sourceforge.phpdt.core.compiler.taskTags"
- * - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces
- * - default: ""
+ * RECOGNIZED OPTIONS:
+ * COMPILER / Generating Local Variable Debug Attribute
+ * When generated, this attribute will enable local variable names
+ * to be displayed in debugger, only in place where variables are
+ * definitely assigned (.class file is then bigger)
+ * - option id: "net.sourceforge.phpdt.core.compiler.debug.localVariable"
+ * - possible values: { "generate", "do not generate" }
+ * - default: "generate"
*
- * COMPILER / Define the Automatic Task Priorities
- * In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
- * of the task markers issued by the compiler.
- * If the default is specified, the priority of each task marker is "NORMAL".
- * - option id: "net.sourceforge.phpdt.core.compiler.taskPriorities"
- * - possible values: { "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW"
- * - default: ""
- *
- * BUILDER / Specifying Filters for Resource Copying Control
- * Allow to specify some filters to control the resource copy process.
- * - option id: "net.sourceforge.phpdt.core.builder.resourceCopyExclusionFilter"
- * - possible values: { "<name>[,<name>]* } where <name> is a file name pattern (* and ? wild-cards allowed)
- * or the name of a folder which ends with '/'
- * - default: ""
+ * COMPILER / Generating Line Number Debug Attribute
+ * When generated, this attribute will enable source code highlighting in debugger
+ * (.class file is then bigger).
+ * - option id: "net.sourceforge.phpdt.core.compiler.debug.lineNumber"
+ * - possible values: { "generate", "do not generate" }
+ * - default: "generate"
+ *
+ * COMPILER / Generating Source Debug Attribute
+ * When generated, this attribute will enable the debugger to present the
+ * corresponding source code.
+ * - option id: "net.sourceforge.phpdt.core.compiler.debug.sourceFile"
+ * - possible values: { "generate", "do not generate" }
+ * - default: "generate"
+ *
+ * COMPILER / Preserving Unused Local Variables
+ * Unless requested to preserve unused local variables (that is, never read), the
+ * compiler will optimize them out, potentially altering debugging
+ * - option id: "net.sourceforge.phpdt.core.compiler.codegen.unusedLocal"
+ * - possible values: { "preserve", "optimize out" }
+ * - default: "preserve"
+ *
+ * COMPILER / Defining Target Java Platform
+ * For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
+ * Note that "1.4" target require to toggle compliance mode to "1.4" too.
+ * - option id: "net.sourceforge.phpdt.core.compiler.codegen.targetPlatform"
+ * - possible values: { "1.1", "1.2", "1.3", "1.4" }
+ * - default: "1.1"
*
- * BUILDER / Abort if Invalid Classpath
- * Allow to toggle the builder to abort if the classpath is invalid
- * - option id: "net.sourceforge.phpdt.core.builder.invalidClasspath"
- * - possible values: { "abort", "ignore" }
- * - default: "abort"
+ * COMPILER / Reporting Unreachable Code
+ * Unreachable code can optionally be reported as an error, warning or simply
+ * ignored. The bytecode generation will always optimized it out.
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unreachableCode"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "error"
*
- * BUILDER / Cleaning Output Folder(s)
- * Indicate whether the JavaBuilder is allowed to clean the output folders
- * when performing full build operations.
- * - option id: "net.sourceforge.phpdt.core.builder.cleanOutputFolder"
- * - possible values: { "clean", "ignore" }
- * - default: "clean"
+ * COMPILER / Reporting Invalid Import
+ * An import statement that cannot be resolved might optionally be reported
+ * as an error, as a warning or ignored.
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.invalidImport"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "error"
*
- * BUILDER / Reporting Duplicate Resources
- * Indicate the severity of the problem reported when more than one occurrence
- * of a resource is to be copied into the output location.
- * - option id: "net.sourceforge.phpdt.core.builder.duplicateResourceTask"
- * - possible values: { "error", "warning" }
- * - default: "warning"
+ * COMPILER / Reporting Attempt to Override Package-Default Method
+ * A package default method is not visible in a different package, and thus
+ * cannot be overridden. When enabling this option, the compiler will signal
+ * such scenarii either as an error or a warning.
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.overridingPackageDefaultMethod"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * JAVACORE / Computing Project Build Order
- * Indicate whether JavaCore should enforce the project build order to be based on
- * the classpath prerequisite chain. When requesting to compute, this takes over
- * the platform default order (based on project references).
- * - option id: "net.sourceforge.phpdt.core.computeJavaBuildOrder"
- * - possible values: { "compute", "ignore" }
- * - default: "ignore"
+ * COMPILER / Reporting Method With Constructor Name
+ * Naming a method with a constructor name is generally considered poor
+ * style programming. When enabling this option, the compiler will signal such
+ * scenarii either as an error or a warning.
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.methodWithConstructorName"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * JAVACORE / Specify Default Source Encoding Format
- * Get the encoding format for compiled sources. This setting is read-only, it is equivalent
- * to 'ResourcesPlugin.getEncoding()'.
- * - option id: "net.sourceforge.phpdt.core.encoding"
- * - possible values: { any of the supported encoding name}.
- * - default: <platform default>
+ * COMPILER / Reporting Deprecation
+ * When enabled, the compiler will signal use of deprecated API either as an
+ * error or a warning.
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.deprecation"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * JAVACORE / Reporting Incomplete Classpath
- * Indicate the severity of the problem reported when an entry on the classpath does not exist,
- * is not legite or is not visible (for example, a referenced project is closed).
- * - option id: "net.sourceforge.phpdt.core.incompleteClasspath"
- * - possible values: { "error", "warning"}
- * - default: "error"
+ * COMPILER / Reporting Deprecation Inside Deprecated Code
+ * When enabled, the compiler will signal use of deprecated API inside deprecated code.
+ * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.deprecation".
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.deprecationInDeprecatedCode"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
*
- * JAVACORE / Reporting Classpath Cycle
- * Indicate the severity of the problem reported when a project is involved in a cycle.
- * - option id: "net.sourceforge.phpdt.core.circularClasspath"
- * - possible values: { "error", "warning" }
- * - default: "error"
+ * COMPILER / Reporting Hidden Catch Block
+ * Locally to a try statement, some catch blocks may hide others . For example,
+ * try { throw new java.io.CharConversionException();
+ * } catch (java.io.CharConversionException e) {
+ * } catch (java.io.IOException e) {}.
+ * When enabling this option, the compiler will issue an error or a warning for hidden
+ * catch blocks corresponding to checked exceptions
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.hiddenCatchBlock"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * JAVACORE / Enabling Usage of Classpath Exclusion Patterns
- * When disabled, no entry on a project classpath can be associated with
- * an exclusion pattern.
- * - option id: "net.sourceforge.phpdt.core.classpath.exclusionPatterns"
- * - possible values: { "enabled", "disabled" }
- * - default: "enabled"
+ * COMPILER / Reporting Unused Local
+ * When enabled, the compiler will issue an error or a warning for unused local
+ * variables (that is, variables never read from)
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedLocal"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
*
- * JAVACORE / Enabling Usage of Classpath Multiple Output Locations
- * When disabled, no entry on a project classpath can be associated with
- * a specific output location, preventing thus usage of multiple output locations.
- * - option id: "net.sourceforge.phpdt.core.classpath.multipleOutputLocations"
- * - possible values: { "enabled", "disabled" }
- * - default: "enabled"
+ * COMPILER / Reporting Unused Parameter
+ * When enabled, the compiler will issue an error or a warning for unused method
+ * parameters (that is, parameters never read from)
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameter"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
*
- * FORMATTER / Inserting New Line Before Opening Brace
- * When Insert, a new line is inserted before an opening brace, otherwise nothing
- * is inserted
- * - option id: "net.sourceforge.phpdt.core.formatter.newline.openingBrace"
- * - possible values: { "insert", "do not insert" }
- * - default: "do not insert"
+ * COMPILER / Reporting Unused Parameter if Implementing Abstract Method
+ * When enabled, the compiler will signal unused parameters in abstract method implementations.
+ * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.unusedParameter".
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
*
- * FORMATTER / Inserting New Line Inside Control Statement
- * When Insert, a new line is inserted between } and following else, catch, finally
- * - option id: "net.sourceforge.phpdt.core.formatter.newline.controlStatement"
- * - possible values: { "insert", "do not insert" }
- * - default: "do not insert"
+ * COMPILER / Reporting Unused Parameter if Overriding Concrete Method
+ * When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
+ * The severity of the problem is controlled with option "net.sourceforge.phpdt.core.compiler.problem.unusedParameter".
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
*
- * FORMATTER / Clearing Blank Lines
- * When Clear all, all blank lines are removed. When Preserve one, only one is kept
- * and all others removed.
- * - option id: "net.sourceforge.phpdt.core.formatter.newline.clearAll"
- * - possible values: { "clear all", "preserve one" }
- * - default: "preserve one"
+ * COMPILER / Reporting Unused Import
+ * When enabled, the compiler will issue an error or a warning for unused import
+ * reference
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedImport"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * FORMATTER / Inserting New Line Between Else/If
- * When Insert, a blank line is inserted between an else and an if when they are
- * contiguous. When choosing to not insert, else-if will be kept on the same
- * line when possible.
- * - option id: "net.sourceforge.phpdt.core.formatter.newline.elseIf"
- * - possible values: { "insert", "do not insert" }
- * - default: "do not insert"
+ * COMPILER / Reporting Unused Private Members
+ * When enabled, the compiler will issue an error or a warning whenever a private
+ * method or field is declared but never used within the same unit.
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.unusedPrivateMember"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
*
- * FORMATTER / Inserting New Line In Empty Block
- * When insert, a line break is inserted between contiguous { and }, if } is not followed
- * by a keyword.
- * - option id: "net.sourceforge.phpdt.core.formatter.newline.emptyBlock"
- * - possible values: { "insert", "do not insert" }
- * - default: "insert"
+ * COMPILER / Reporting Synthetic Access Emulation
+ * When enabled, the compiler will issue an error or a warning whenever it emulates
+ * access to a non-accessible member of an enclosing type. Such access can have
+ * performance implications.
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.syntheticAccessEmulation"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
*
- * FORMATTER / Splitting Lines Exceeding Length
- * Enable splitting of long lines (exceeding the configurable length). Length of 0 will
- * disable line splitting
- * - option id: "net.sourceforge.phpdt.core.formatter.lineSplit"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "80"
+ * COMPILER / Reporting Non-Externalized String Literal
+ * When enabled, the compiler will issue an error or a warning for non externalized
+ * String literal (that is, not tagged with //$NON-NLS-<n>$).
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.nonExternalizedStringLiteral"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
+ *
+ * COMPILER / Reporting Usage of 'assert' Identifier
+ * When enabled, the compiler will issue an error or a warning whenever 'assert' is
+ * used as an identifier (reserved keyword in 1.4)
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.assertIdentifier"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
+ *
+ * COMPILER / Reporting Non-Static Reference to a Static Member
+ * When enabled, the compiler will issue an error or a warning whenever a static field
+ * or method is accessed with an expression receiver. A reference to a static member should
+ * be qualified with a type name.
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.staticAccessReceiver"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
+ *
+ * COMPILER / Reporting Assignment with no Effect
+ * When enabled, the compiler will issue an error or a warning whenever an assignment
+ * has no effect (e.g 'x = x').
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.noEffectAssignment"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
+ *
+ * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
+ * When enabled, the compiler will issue an error or a warning whenever an interface
+ * defines a method incompatible with a non-inherited Object method. Until this conflict
+ * is resolved, such an interface cannot be implemented, For example,
+ * interface I {
+ * int clone();
+ * }
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
+ *
+ * COMPILER / Reporting Usage of char[] Expressions in String Concatenations
+ * When enabled, the compiler will issue an error or a warning whenever a char[] expression
+ * is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
+ * - option id: "net.sourceforge.phpdt.core.compiler.problem.noImplicitStringConversion"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
*
- * FORMATTER / Compacting Assignment
- * Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
- * is inserted before the assignment operator
- * - option id: "net.sourceforge.phpdt.core.formatter.style.assignment"
- * - possible values: { "compact", "normal" }
- * - default: "normal"
+ * COMPILER / Setting Source Compatibility Mode
+ * Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
+ * reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
+ * level should be set to "1.4" and the compliance mode should be "1.4".
+ * - option id: "net.sourceforge.phpdt.core.compiler.source"
+ * - possible values: { "1.3", "1.4" }
+ * - default: "1.3"
+ *
+ * COMPILER / Setting Compliance Level
+ * Select the compliance level for the compiler. In "1.3" mode, source and target settings
+ * should not go beyond "1.3" level.
+ * - option id: "net.sourceforge.phpdt.core.compiler.compliance"
+ * - possible values: { "1.3", "1.4" }
+ * - default: "1.3"
+ *
+ * COMPILER / Maximum number of problems reported per compilation unit
+ * Specify the maximum number of problems reported on each compilation unit.
+ * - option id: "net.sourceforge.phpdt.core.compiler.maxProblemPerUnit"
+ * - possible values: "<n>" where <n> is zero or a positive integer (if zero then all problems are reported).
+ * - default: "100"
+ *
+ * COMPILER / Define the Automatic Task Tags
+ * When the tag list is not empty, the compiler will issue a task marker whenever it encounters
+ * one of the corresponding tag inside any comment in Java source code.
+ * Generated task messages will include the tag, and range until the next line separator or comment ending.
+ * Note that tasks messages are trimmed.
+ * - option id: "net.sourceforge.phpdt.core.compiler.taskTags"
+ * - possible values: { "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces
+ * - default: ""
+ *
+ * COMPILER / Define the Automatic Task Priorities
+ * In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
+ * of the task markers issued by the compiler.
+ * If the default is specified, the priority of each task marker is "NORMAL".
+ * - option id: "net.sourceforge.phpdt.core.compiler.taskPriorities"
+ * - possible values: { "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW"
+ * - default: ""
*
- * FORMATTER / Defining Indentation Character
- * Either choose to indent with tab characters or spaces
- * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.char"
- * - possible values: { "tab", "space" }
- * - default: "tab"
- *
- * FORMATTER / Defining Space Indentation Length
- * When using spaces, set the amount of space characters to use for each
- * indentation mark.
- * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.size"
- * - possible values: "<n>", where n is a positive integer
- * - default: "4"
- *
- * FORMATTER / Inserting space in cast expression
- * When Insert, a space is added between the type and the expression in a cast expression.
- * - option id: "net.sourceforge.phpdt.core.formatter.space.castexpression"
- * - possible values: { "insert", "do not insert" }
- * - default: "insert"
- *
- * CODEASSIST / Activate Visibility Sensitive Completion
- * When active, completion doesn't show that you can not see
- * (for example, you can not see private methods of a super class).
- * - option id: "net.sourceforge.phpdt.core.codeComplete.visibilityCheck"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
- *
- * CODEASSIST / Automatic Qualification of Implicit Members
- * When active, completion automatically qualifies completion on implicit
- * field references and message expressions.
- * - option id: "net.sourceforge.phpdt.core.codeComplete.forceImplicitQualification"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
- *
- * CODEASSIST / Define the Prefixes for Field Name
- * When the prefixes is non empty, completion for field name will begin with
- * one of the proposed prefixes.
- * - option id: "net.sourceforge.phpdt.core.codeComplete.fieldPrefixes"
- * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Prefixes for Static Field Name
- * When the prefixes is non empty, completion for static field name will begin with
- * one of the proposed prefixes.
- * - option id: "net.sourceforge.phpdt.core.codeComplete.staticFieldPrefixes"
- * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Prefixes for Local Variable Name
- * When the prefixes is non empty, completion for local variable name will begin with
- * one of the proposed prefixes.
- * - option id: "net.sourceforge.phpdt.core.codeComplete.localPrefixes"
- * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Prefixes for Argument Name
- * When the prefixes is non empty, completion for argument name will begin with
- * one of the proposed prefixes.
- * - option id: "net.sourceforge.phpdt.core.codeComplete.argumentPrefixes"
- * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Suffixes for Field Name
- * When the suffixes is non empty, completion for field name will end with
- * one of the proposed suffixes.
- * - option id: "net.sourceforge.phpdt.core.codeComplete.fieldSuffixes"
- * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Suffixes for Static Field Name
- * When the suffixes is non empty, completion for static field name will end with
- * one of the proposed suffixes.
- * - option id: "net.sourceforge.phpdt.core.codeComplete.staticFieldSuffixes"
- * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Suffixes for Local Variable Name
- * When the suffixes is non empty, completion for local variable name will end with
- * one of the proposed suffixes.
- * - option id: "net.sourceforge.phpdt.core.codeComplete.localSuffixes"
- * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
- * - default: ""
- *
- * CODEASSIST / Define the Suffixes for Argument Name
- * When the suffixes is non empty, completion for argument name will end with
- * one of the proposed suffixes.
- * - option id: "net.sourceforge.phpdt.core.codeComplete.argumentSuffixes"
- * - possible values: { "<suffix>[,<suffix>]*" } where <prefix> is a String without any wild-card
- * - default: ""
- * </pre>
- *
- * @return a mutable table containing the default settings of all known options
- * (key type:
+ * BUILDER / Specifying Filters for Resource Copying Control
+ * Allow to specify some filters to control the resource copy process.
+ * - option id: "net.sourceforge.phpdt.core.builder.resourceCopyExclusionFilter"
+ * - possible values: { "<name>[,<name>]* } where <name> is a file name pattern (* and ? wild-cards allowed)
+ * or the name of a folder which ends with '/'
+ * - default: ""
+ *
+ * BUILDER / Abort if Invalid Classpath
+ * Allow to toggle the builder to abort if the classpath is invalid
+ * - option id: "net.sourceforge.phpdt.core.builder.invalidClasspath"
+ * - possible values: { "abort", "ignore" }
+ * - default: "abort"
+ *
+ * BUILDER / Cleaning Output Folder(s)
+ * Indicate whether the JavaBuilder is allowed to clean the output folders
+ * when performing full build operations.
+ * - option id: "net.sourceforge.phpdt.core.builder.cleanOutputFolder"
+ * - possible values: { "clean", "ignore" }
+ * - default: "clean"
+ *
+ * BUILDER / Reporting Duplicate Resources
+ * Indicate the severity of the problem reported when more than one occurrence
+ * of a resource is to be copied into the output location.
+ * - option id: "net.sourceforge.phpdt.core.builder.duplicateResourceTask"
+ * - possible values: { "error", "warning" }
+ * - default: "warning"
+ *
+ * JAVACORE / Computing Project Build Order
+ * Indicate whether JavaCore should enforce the project build order to be based on
+ * the classpath prerequisite chain. When requesting to compute, this takes over
+ * the platform default order (based on project references).
+ * - option id: "net.sourceforge.phpdt.core.computeJavaBuildOrder"
+ * - possible values: { "compute", "ignore" }
+ * - default: "ignore"
+ *
+ * JAVACORE / Specify Default Source Encoding Format
+ * Get the encoding format for compiled sources. This setting is read-only, it is equivalent
+ * to 'ResourcesPlugin.getEncoding()'.
+ * - option id: "net.sourceforge.phpdt.core.encoding"
+ * - possible values: { any of the supported encoding name}.
+ * - default: <platform default>
+ *
+ * JAVACORE / Reporting Incomplete Classpath
+ * Indicate the severity of the problem reported when an entry on the classpath does not exist,
+ * is not legite or is not visible (for example, a referenced project is closed).
+ * - option id: "net.sourceforge.phpdt.core.incompleteClasspath"
+ * - possible values: { "error", "warning"}
+ * - default: "error"
+ *
+ * JAVACORE / Reporting Classpath Cycle
+ * Indicate the severity of the problem reported when a project is involved in a cycle.
+ * - option id: "net.sourceforge.phpdt.core.circularClasspath"
+ * - possible values: { "error", "warning" }
+ * - default: "error"
+ *
+ * JAVACORE / Enabling Usage of Classpath Exclusion Patterns
+ * When disabled, no entry on a project classpath can be associated with
+ * an exclusion pattern.
+ * - option id: "net.sourceforge.phpdt.core.classpath.exclusionPatterns"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "enabled"
+ *
+ * JAVACORE / Enabling Usage of Classpath Multiple Output Locations
+ * When disabled, no entry on a project classpath can be associated with
+ * a specific output location, preventing thus usage of multiple output locations.
+ * - option id: "net.sourceforge.phpdt.core.classpath.multipleOutputLocations"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "enabled"
+ *
+ * FORMATTER / Inserting New Line Before Opening Brace
+ * When Insert, a new line is inserted before an opening brace, otherwise nothing
+ * is inserted
+ * - option id: "net.sourceforge.phpdt.core.formatter.newline.openingBrace"
+ * - possible values: { "insert", "do not insert" }
+ * - default: "do not insert"
+ *
+ * FORMATTER / Inserting New Line Inside Control Statement
+ * When Insert, a new line is inserted between } and following else, catch, finally
+ * - option id: "net.sourceforge.phpdt.core.formatter.newline.controlStatement"
+ * - possible values: { "insert", "do not insert" }
+ * - default: "do not insert"
+ *
+ * FORMATTER / Clearing Blank Lines
+ * When Clear all, all blank lines are removed. When Preserve one, only one is kept
+ * and all others removed.
+ * - option id: "net.sourceforge.phpdt.core.formatter.newline.clearAll"
+ * - possible values: { "clear all", "preserve one" }
+ * - default: "preserve one"
+ *
+ * FORMATTER / Inserting New Line Between Else/If
+ * When Insert, a blank line is inserted between an else and an if when they are
+ * contiguous. When choosing to not insert, else-if will be kept on the same
+ * line when possible.
+ * - option id: "net.sourceforge.phpdt.core.formatter.newline.elseIf"
+ * - possible values: { "insert", "do not insert" }
+ * - default: "do not insert"
+ *
+ * FORMATTER / Inserting New Line In Empty Block
+ * When insert, a line break is inserted between contiguous { and }, if } is not followed
+ * by a keyword.
+ * - option id: "net.sourceforge.phpdt.core.formatter.newline.emptyBlock"
+ * - possible values: { "insert", "do not insert" }
+ * - default: "insert"
+ *
+ * FORMATTER / Splitting Lines Exceeding Length
+ * Enable splitting of long lines (exceeding the configurable length). Length of 0 will
+ * disable line splitting
+ * - option id: "net.sourceforge.phpdt.core.formatter.lineSplit"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "80"
+ *
+ * FORMATTER / Compacting Assignment
+ * Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
+ * is inserted before the assignment operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.style.assignment"
+ * - possible values: { "compact", "normal" }
+ * - default: "normal"
+ *
+ * FORMATTER / Defining Indentation Character
+ * Either choose to indent with tab characters or spaces
+ * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.char"
+ * - possible values: { "tab", "space" }
+ * - default: "tab"
+ *
+ * FORMATTER / Defining Space Indentation Length
+ * When using spaces, set the amount of space characters to use for each
+ * indentation mark.
+ * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.size"
+ * - possible values: "<n>", where n is a positive integer
+ * - default: "4"
+ *
+ * FORMATTER / Inserting space in cast expression
+ * When Insert, a space is added between the type and the expression in a cast expression.
+ * - option id: "net.sourceforge.phpdt.core.formatter.space.castexpression"
+ * - possible values: { "insert", "do not insert" }
+ * - default: "insert"
+ *
+ * CODEASSIST / Activate Visibility Sensitive Completion
+ * When active, completion doesn't show that you can not see
+ * (for example, you can not see private methods of a super class).
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.visibilityCheck"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
+ *
+ * CODEASSIST / Automatic Qualification of Implicit Members
+ * When active, completion automatically qualifies completion on implicit
+ * field references and message expressions.
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.forceImplicitQualification"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
+ *
+ * CODEASSIST / Define the Prefixes for Field Name
+ * When the prefixes is non empty, completion for field name will begin with
+ * one of the proposed prefixes.
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.fieldPrefixes"
+ * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Prefixes for Static Field Name
+ * When the prefixes is non empty, completion for static field name will begin with
+ * one of the proposed prefixes.
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.staticFieldPrefixes"
+ * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Prefixes for Local Variable Name
+ * When the prefixes is non empty, completion for local variable name will begin with
+ * one of the proposed prefixes.
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.localPrefixes"
+ * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Prefixes for Argument Name
+ * When the prefixes is non empty, completion for argument name will begin with
+ * one of the proposed prefixes.
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.argumentPrefixes"
+ * - possible values: { "<prefix>[,<prefix>]*" } where <prefix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Suffixes for Field Name
+ * When the suffixes is non empty, completion for field name will end with
+ * one of the proposed suffixes.
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.fieldSuffixes"
+ * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Suffixes for Static Field Name
+ * When the suffixes is non empty, completion for static field name will end with
+ * one of the proposed suffixes.
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.staticFieldSuffixes"
+ * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Suffixes for Local Variable Name
+ * When the suffixes is non empty, completion for local variable name will end with
+ * one of the proposed suffixes.
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.localSuffixes"
+ * - possible values: { "<suffix>[,<suffix>]*" } where <suffix> is a String without any wild-card
+ * - default: ""
+ *
+ * CODEASSIST / Define the Suffixes for Argument Name
+ * When the suffixes is non empty, completion for argument name will end with
+ * one of the proposed suffixes.
+ * - option id: "net.sourceforge.phpdt.core.codeComplete.argumentSuffixes"
+ * - possible values: { "<suffix>[,<suffix>]*" } where <prefix> is a String without any wild-card
+ * - default: ""
+ * </pre>
+ *
+ * @return a mutable table containing the default settings of all known options
+ * (key type:
*
* String
*
- * ; value type:
+ * ; value type:
*
* String
*
- * )
- * @see #setOptions
+ * )
+ * @see #setOptions
*
*/
public static Hashtable getDefaultOptions() {
@@ -2795,23 +2804,25 @@ public class JavaCore {
.isExported());
case IResource.FILE:
- // if (ProjectPrefUtil.isArchiveFileName(resolvedResource.getName())) {
- // // internal binary archive
- // return JavaCore.newLibraryEntry(
- // resolvedPath,
- // getResolvedVariablePath(entry.getSourceAttachmentPath()),
- // getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
- // entry.isExported());
- // }
+ // if
+ // (ProjectPrefUtil.isArchiveFileName(resolvedResource.getName()))
+ // {
+ // // internal binary archive
+ // return JavaCore.newLibraryEntry(
+ // resolvedPath,
+ // getResolvedVariablePath(entry.getSourceAttachmentPath()),
+ // getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
+ // entry.isExported());
+ // }
break;
case IResource.FOLDER:
// internal binary folder
- // return JavaCore.newLibraryEntry(
- // resolvedPath,
- // getResolvedVariablePath(entry.getSourceAttachmentPath()),
- // getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
- // entry.isExported());
+ // return JavaCore.newLibraryEntry(
+ // resolvedPath,
+ // getResolvedVariablePath(entry.getSourceAttachmentPath()),
+ // getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
+ // entry.isExported());
break;
}
}
@@ -2821,22 +2832,22 @@ public class JavaCore {
File externalFile = (File) target;
if (externalFile.isFile()) {
String fileName = externalFile.getName().toLowerCase();
- // if (fileName.endsWith(".jar" //$NON-NLS-1$
- // ) || fileName.endsWith(".zip" //$NON-NLS-1$
- // )) { // external binary archive
- // return JavaCore.newLibraryEntry(
- // resolvedPath,
- // getResolvedVariablePath(entry.getSourceAttachmentPath()),
- // getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
- // entry.isExported());
- // }
+ // if (fileName.endsWith(".jar" //$NON-NLS-1$
+ // ) || fileName.endsWith(".zip" //$NON-NLS-1$
+ // )) { // external binary archive
+ // return JavaCore.newLibraryEntry(
+ // resolvedPath,
+ // getResolvedVariablePath(entry.getSourceAttachmentPath()),
+ // getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
+ // entry.isExported());
+ // }
} else { // external binary folder
if (resolvedPath.isAbsolute()) {
- // return JavaCore.newLibraryEntry(
- // resolvedPath,
- // getResolvedVariablePath(entry.getSourceAttachmentPath()),
- // getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
- // entry.isExported());
+ // return JavaCore.newLibraryEntry(
+ // resolvedPath,
+ // getResolvedVariablePath(entry.getSourceAttachmentPath()),
+ // getResolvedVariablePath(entry.getSourceAttachmentRootPath()),
+ // entry.isExported());
}
}
}
@@ -2923,7 +2934,7 @@ public class JavaCore {
optionNames.add(COMPILER_CODEGEN_UNUSED_LOCAL);
preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1);
- optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM);
+ optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM);
preferences.setDefault(COMPILER_PB_PHP_VAR_DEPRECATED, IGNORE);
optionNames.add(COMPILER_PB_PHP_VAR_DEPRECATED);
@@ -2935,9 +2946,10 @@ public class JavaCore {
optionNames.add(COMPILER_PB_PHP_FILE_NOT_EXIST);
preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, WARNING);
optionNames.add(COMPILER_PB_UNREACHABLE_CODE);
- preferences.setDefault(COMPILER_PB_UNINITIALIZED_LOCAL_VARIABLE, WARNING);
+ preferences.setDefault(COMPILER_PB_UNINITIALIZED_LOCAL_VARIABLE,
+ WARNING);
optionNames.add(COMPILER_PB_UNINITIALIZED_LOCAL_VARIABLE);
-
+
preferences.setDefault(COMPILER_PB_INVALID_IMPORT, ERROR);
optionNames.add(COMPILER_PB_INVALID_IMPORT);
@@ -3141,7 +3153,7 @@ public class JavaCore {
if (element instanceof IMember) {
IMember member = (IMember) element;
if (member.isBinary()) {
- element = null; //member.getClassFile();
+ element = null; // member.getClassFile();
} else {
element = member.getCompilationUnit();
}
@@ -3156,24 +3168,25 @@ public class JavaCore {
return false;
IJavaElement markerElement = JavaCore.create(markerHandleId);
- // while (true){
+ // while (true){
if (element.equals(markerElement))
- return true; // external elements may still be equal with different
- // handleIDs.
+ return true; // external elements may still be equal with
+ // different
+ // handleIDs.
// cycle through enclosing types in case marker is associated with a
// classfile (15568)
- // if (markerElement instanceof IClassFile){
- // IType enclosingType =
+ // if (markerElement instanceof IClassFile){
+ // IType enclosingType =
// ((IClassFile)markerElement).getType().getDeclaringType();
- // if (enclosingType != null){
- // markerElement = enclosingType.getClassFile(); // retry with immediate
+ // if (enclosingType != null){
+ // markerElement = enclosingType.getClassFile(); // retry with immediate
// enclosing classfile
- // continue;
- // }
- // }
- // break;
- // }
+ // continue;
+ // }
+ // }
+ // break;
+ // }
return false;
}
@@ -3198,7 +3211,7 @@ public class JavaCore {
if (element instanceof IMember) {
IMember member = (IMember) element;
if (member.isBinary()) {
- element = null; //member.getClassFile();
+ element = null; // member.getClassFile();
} else {
element = member.getCompilationUnit();
}
@@ -3214,24 +3227,25 @@ public class JavaCore {
return false;
IJavaElement markerElement = JavaCore.create(markerDeltarHandleId);
- // while (true){
+ // while (true){
if (element.equals(markerElement))
- return true; // external elements may still be equal with different
- // handleIDs.
+ return true; // external elements may still be equal with
+ // different
+ // handleIDs.
// cycle through enclosing types in case marker is associated with a
// classfile (15568)
- // if (markerElement instanceof IClassFile){
- // IType enclosingType =
+ // if (markerElement instanceof IClassFile){
+ // IType enclosingType =
// ((IClassFile)markerElement).getType().getDeclaringType();
- // if (enclosingType != null){
- // markerElement = enclosingType.getClassFile(); // retry with immediate
+ // if (enclosingType != null){
+ // markerElement = enclosingType.getClassFile(); // retry with immediate
// enclosing classfile
- // continue;
- // }
- // }
- // break;
- // }
+ // continue;
+ // }
+ // }
+ // break;
+ // }
return false;
}
@@ -3250,14 +3264,15 @@ public class JavaCore {
*
* A container is exclusively resolved by a
* ClasspathContainerInitializer registered onto the
- * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
+ * extension point
+ * "net.sourceforge.phpdt.core.classpathContainerInitializer".
*
* A container path must be formed of at least one segment, where:
*
*
the first segment is a unique ID identifying the target container,
* there must be a container initializer registered onto this ID through the
- * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
- *
+ * extension point
+ * "net.sourceforge.phpdt.core.classpathContainerInitializer".
*
the remaining segments will be passed onto the initializer, and can
* be used as additional hints during the initialization phase.
@@ -3290,354 +3306,371 @@ public class JavaCore {
*/
public static IClasspathEntry newContainerEntry(IPath containerPath) {
- return newContainerEntry(containerPath, false);
- }
-
- /**
- * Creates and returns a new classpath entry of kind
- * CPE_CONTAINER for the given path. The path of the
- * container will be used during resolution so as to map this container
- * entry to a set of other classpath entries the container is acting for.
- *
- * A container entry allows to express indirect references to a set of
- * libraries, projects and variable entries, which can be interpreted
- * differently for each Java project where it is used. A classpath container
- * entry can be resolved using
- * JavaCore.getResolvedClasspathContainer, and updated with
- * JavaCore.classpathContainerChanged
- *
- * A container is exclusively resolved by a
- * ClasspathContainerInitializer registered onto the
- * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
- *
- * A container path must be formed of at least one segment, where:
- *
- *
the first segment is a unique ID identifying the target container,
- * there must be a container initializer registered onto this ID through the
- * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
- *
- *
the remaining segments will be passed onto the initializer, and can
- * be used as additional hints during the initialization phase.
- *
- *
- * Example of an ClasspathContainerInitializer for a classpath container
- * denoting a default JDK container:
- *
- * containerEntry = JavaCore.newContainerEntry(new
- * Path("MyProvidedJDK/default"));
- *
- *
- *
- *
- * Note that this operation does not attempt to validate classpath
- * containers or access the resources at the given paths.
- *
- *
- * @param containerPath
- * the path identifying the container, it must be formed of at
- * least one segment (ID+hints)
- * @param isExported
- * a boolean indicating whether this entry is contributed to
- * dependent projects in addition to the output location
- * @return a new container classpath entry
- *
- * @see JavaCore#getClasspathContainer(IPath, IJavaProject)
- * @see JavaCore#setClasspathContainer(IPath, IJavaProject[],
- * IClasspathContainer[], IProgressMonitor)
- * @see JavaCore#newContainerEntry(IPath, boolean)
- * @since 2.0
- */
-
- public static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported) {
-
- if (containerPath == null) Assert.isTrue(false, "Container path cannot be null"); //$NON-NLS-1$
- if (containerPath.segmentCount() < 1) {
- Assert.isTrue(
- false,
- "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$
+ return newContainerEntry(containerPath, false);
}
- return new ClasspathEntry(
- IPackageFragmentRoot.K_SOURCE,
- IClasspathEntry.CPE_CONTAINER,
- containerPath,
- ClasspathEntry.INCLUDE_ALL,
- ClasspathEntry.EXCLUDE_NONE,
- null, // source attachment
- null, // source attachment root
- null, // specific output folder
- isExported);
-}
-
- /**
- * Creates and returns a new non-exported classpath entry of kind
- * CPE_LIBRARY for the JAR or folder identified by the given
- * absolute path. This specifies that all package fragments within the root
- * will have children of type IClassFile.
- *
- * A library entry is used to denote a prerequisite JAR or root folder
- * containing binaries. The target JAR or folder can either be defined
- * internally to the workspace (absolute path relative to the workspace
- * root) or externally to the workspace (absolute path in the file system).
- *
- * e.g. Here are some examples of binary path usage
- *
- *
"c:/jdk1.2.2/jre/lib/rt.jar" - reference to an
- * external JAR
- *
"/Project/someLib.jar" - reference to an internal JAR
- *
- *
"c:/classes/" - reference to an external binary
- * folder
- *
- * Note that this operation does not attempt to validate or access the
- * resources at the given paths.
- *
- * The resulting entry is not exported to dependent projects. This method is
- * equivalent to newLibraryEntry(-,-,-,false).
- *
- *
- * @param path
- * the absolute path of the binary archive
- * @param sourceAttachmentPath
- * the absolute path of the corresponding source archive or
- * folder, or null if none
- * @param sourceAttachmentRootPath
- * the location of the root within the source archive or folder
- * or null if this location should be
- * automatically detected.
- * @return a new library classpath entry
- *
- * @see #newLibraryEntry(IPath, IPath, IPath, boolean)
- */
- //public static IClasspathEntry newLibraryEntry(
- // IPath path,
- // IPath sourceAttachmentPath,
- // IPath sourceAttachmentRootPath) {
- //
- // return newLibraryEntry(path, sourceAttachmentPath,
- // sourceAttachmentRootPath, false);
- //}
- /**
- * Creates and returns a new classpath entry of kind
- * CPE_LIBRARY for the JAR or folder identified by the given
- * absolute path. This specifies that all package fragments within the root
- * will have children of type IClassFile.
- *
- * A library entry is used to denote a prerequisite JAR or root folder
- * containing binaries. The target JAR or folder can either be defined
- * internally to the workspace (absolute path relative to the workspace
- * root) or externally to the workspace (absolute path in the file system).
- *
- * e.g. Here are some examples of binary path usage
- *
- *
"c:/jdk1.2.2/jre/lib/rt.jar" - reference to an
- * external JAR
- *
"/Project/someLib.jar" - reference to an internal JAR
- *
- *
"c:/classes/" - reference to an external binary
- * folder
- *
- * Note that this operation does not attempt to validate or access the
- * resources at the given paths.
- *
- *
- * @param path
- * the absolute path of the binary archive
- * @param sourceAttachmentPath
- * the absolute path of the corresponding source archive or
- * folder, or null if none
- * @param sourceAttachmentRootPath
- * the location of the root within the source archive or folder
- * or null if this location should be
- * automatically detected.
- * @param isExported
- * indicates whether this entry is contributed to dependent
- * projects in addition to the output location
- * @return a new library classpath entry
- * @since 2.0
- */
- //public static IClasspathEntry newLibraryEntry(
- // IPath path,
- // IPath sourceAttachmentPath,
- // IPath sourceAttachmentRootPath,
- // boolean isExported) {
- //
- // if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry
- // must be absolute"); //$NON-NLS-1$
- //
- // return new ClasspathEntry(
- // IPackageFragmentRoot.K_BINARY,
- // IClasspathEntry.CPE_LIBRARY,
- // JavaProject.canonicalizedPath(path),
- // ClasspathEntry.NO_EXCLUSION_PATTERNS,
- // sourceAttachmentPath,
- // sourceAttachmentRootPath,
- // null, // specific output folder
- // isExported);
- //}
- /**
- * Creates and returns a new non-exported classpath entry of kind
- * CPE_PROJECT for the project identified by the given
- * absolute path.
- *
- * A project entry is used to denote a prerequisite project on a classpath.
- * The referenced project will be contributed as a whole, either as sources
- * (in the Java Model, it contributes all its package fragment roots) or as
- * binaries (when building, it contributes its whole output location).
- *
- * A project reference allows to indirect through another project,
- * independently from its internal layout.
- *
- * The prerequisite project is referred to using an absolute path relative
- * to the workspace root.
- *
- * The resulting entry is not exported to dependent projects. This method is
- * equivalent to newProjectEntry(_,false).
- *
- *
- * @param path
- * the absolute path of the binary archive
- * @return a new project classpath entry
- *
- * @see JavaCore#newProjectEntry(IPath, boolean)
- */
- public static IClasspathEntry newProjectEntry(IPath path) {
- return newProjectEntry(path, false);
- }
-
- /**
- * Creates and returns a new classpath entry of kind
- * CPE_PROJECT for the project identified by the given
- * absolute path.
- *
- * A project entry is used to denote a prerequisite project on a classpath.
- * The referenced project will be contributed as a whole, either as sources
- * (in the Java Model, it contributes all its package fragment roots) or as
- * binaries (when building, it contributes its whole output location).
- *
- * A project reference allows to indirect through another project,
- * independently from its internal layout.
- *
- * The prerequisite project is referred to using an absolute path relative
- * to the workspace root.
- *
- *
- * @param path
- * the absolute path of the prerequisite project
- * @param isExported
- * indicates whether this entry is contributed to dependent
- * projects in addition to the output location
- * @return a new project classpath entry
- * @since 2.0
- */
- public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) {
-
- if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
-
- return new ClasspathEntry(
- IPackageFragmentRoot.K_SOURCE,
- IClasspathEntry.CPE_PROJECT,
- path,
- ClasspathEntry.INCLUDE_ALL,
- ClasspathEntry.EXCLUDE_NONE,
- null, // source attachment
- null, // source attachment root
- null, // specific output folder
- isExported);
-}
-
-
- /**
- * Returns a new empty region.
- *
- * @return a new empty region
- */
- public static IRegion newRegion() {
- return new Region();
- }
-
- /**
+
+ /**
+ * Creates and returns a new classpath entry of kind
+ * CPE_CONTAINER for the given path. The path of the
+ * container will be used during resolution so as to map this container
+ * entry to a set of other classpath entries the container is acting for.
+ *
+ * A container entry allows to express indirect references to a set of
+ * libraries, projects and variable entries, which can be interpreted
+ * differently for each Java project where it is used. A classpath container
+ * entry can be resolved using
+ * JavaCore.getResolvedClasspathContainer, and updated with
+ * JavaCore.classpathContainerChanged
+ *
+ * A container is exclusively resolved by a
+ * ClasspathContainerInitializer registered onto the
+ * extension point
+ * "net.sourceforge.phpdt.core.classpathContainerInitializer".
+ *
+ * A container path must be formed of at least one segment, where:
+ *
+ *
the first segment is a unique ID identifying the target container,
+ * there must be a container initializer registered onto this ID through the
+ * extension point
+ * "net.sourceforge.phpdt.core.classpathContainerInitializer".
+ *
the remaining segments will be passed onto the initializer, and can
+ * be used as additional hints during the initialization phase.
+ *
+ *
+ * Example of an ClasspathContainerInitializer for a classpath container
+ * denoting a default JDK container:
+ *
+ * containerEntry = JavaCore.newContainerEntry(new
+ * Path("MyProvidedJDK/default"));
+ *
+ *
+ *
+ *
+ * Note that this operation does not attempt to validate classpath
+ * containers or access the resources at the given paths.
+ *
+ *
+ * @param containerPath
+ * the path identifying the container, it must be formed of at
+ * least one segment (ID+hints)
+ * @param isExported
+ * a boolean indicating whether this entry is contributed to
+ * dependent projects in addition to the output location
+ * @return a new container classpath entry
+ *
+ * @see JavaCore#getClasspathContainer(IPath, IJavaProject)
+ * @see JavaCore#setClasspathContainer(IPath, IJavaProject[],
+ * IClasspathContainer[], IProgressMonitor)
+ * @see JavaCore#newContainerEntry(IPath, boolean)
+ * @since 2.0
+ */
+
+ public static IClasspathEntry newContainerEntry(IPath containerPath,
+ boolean isExported) {
+
+ if (containerPath == null)
+ Assert.isTrue(false, "Container path cannot be null"); //$NON-NLS-1$
+ if (containerPath.segmentCount() < 1) {
+ Assert
+ .isTrue(
+ false,
+ "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE,
+ IClasspathEntry.CPE_CONTAINER, containerPath,
+ ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null, // source
+ // attachment
+ null, // source attachment root
+ null, // specific output folder
+ isExported);
+ }
+
+ /**
+ * Creates and returns a new non-exported classpath entry of kind
+ * CPE_LIBRARY for the JAR or folder identified by the given
+ * absolute path. This specifies that all package fragments within the root
+ * will have children of type IClassFile.
+ *
+ * A library entry is used to denote a prerequisite JAR or root folder
+ * containing binaries. The target JAR or folder can either be defined
+ * internally to the workspace (absolute path relative to the workspace
+ * root) or externally to the workspace (absolute path in the file system).
+ *
+ * e.g. Here are some examples of binary path usage
+ *
+ *
"c:/jdk1.2.2/jre/lib/rt.jar" - reference to an
+ * external JAR
+ *
"/Project/someLib.jar" - reference to an internal JAR
+ *
+ *
"c:/classes/" - reference to an external binary
+ * folder
+ *
+ * Note that this operation does not attempt to validate or access the
+ * resources at the given paths.
+ *
+ * The resulting entry is not exported to dependent projects. This method is
+ * equivalent to newLibraryEntry(-,-,-,false).
+ *
+ *
+ * @param path
+ * the absolute path of the binary archive
+ * @param sourceAttachmentPath
+ * the absolute path of the corresponding source archive or
+ * folder, or null if none
+ * @param sourceAttachmentRootPath
+ * the location of the root within the source archive or folder
+ * or null if this location should be
+ * automatically detected.
+ * @return a new library classpath entry
+ *
+ * @see #newLibraryEntry(IPath, IPath, IPath, boolean)
+ */
+ // public static IClasspathEntry newLibraryEntry(
+ // IPath path,
+ // IPath sourceAttachmentPath,
+ // IPath sourceAttachmentRootPath) {
+ //
+ // return newLibraryEntry(path, sourceAttachmentPath,
+ // sourceAttachmentRootPath, false);
+ // }
+ /**
+ * Creates and returns a new classpath entry of kind
+ * CPE_LIBRARY for the JAR or folder identified by the given
+ * absolute path. This specifies that all package fragments within the root
+ * will have children of type IClassFile.
+ *
+ * A library entry is used to denote a prerequisite JAR or root folder
+ * containing binaries. The target JAR or folder can either be defined
+ * internally to the workspace (absolute path relative to the workspace
+ * root) or externally to the workspace (absolute path in the file system).
+ *
+ * e.g. Here are some examples of binary path usage
+ *
+ *
"c:/jdk1.2.2/jre/lib/rt.jar" - reference to an
+ * external JAR
+ *
"/Project/someLib.jar" - reference to an internal JAR
+ *
+ *
"c:/classes/" - reference to an external binary
+ * folder
+ *
+ * Note that this operation does not attempt to validate or access the
+ * resources at the given paths.
+ *
+ *
+ * @param path
+ * the absolute path of the binary archive
+ * @param sourceAttachmentPath
+ * the absolute path of the corresponding source archive or
+ * folder, or null if none
+ * @param sourceAttachmentRootPath
+ * the location of the root within the source archive or folder
+ * or null if this location should be
+ * automatically detected.
+ * @param isExported
+ * indicates whether this entry is contributed to dependent
+ * projects in addition to the output location
+ * @return a new library classpath entry
+ * @since 2.0
+ */
+ // public static IClasspathEntry newLibraryEntry(
+ // IPath path,
+ // IPath sourceAttachmentPath,
+ // IPath sourceAttachmentRootPath,
+ // boolean isExported) {
+ //
+ // if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry
+ // must be absolute"); //$NON-NLS-1$
+ //
+ // return new ClasspathEntry(
+ // IPackageFragmentRoot.K_BINARY,
+ // IClasspathEntry.CPE_LIBRARY,
+ // JavaProject.canonicalizedPath(path),
+ // ClasspathEntry.NO_EXCLUSION_PATTERNS,
+ // sourceAttachmentPath,
+ // sourceAttachmentRootPath,
+ // null, // specific output folder
+ // isExported);
+ // }
+ /**
+ * Creates and returns a new non-exported classpath entry of kind
+ * CPE_PROJECT for the project identified by the given
+ * absolute path.
+ *
+ * A project entry is used to denote a prerequisite project on a classpath.
+ * The referenced project will be contributed as a whole, either as sources
+ * (in the Java Model, it contributes all its package fragment roots) or as
+ * binaries (when building, it contributes its whole output location).
+ *
+ * A project reference allows to indirect through another project,
+ * independently from its internal layout.
+ *
+ * The prerequisite project is referred to using an absolute path relative
+ * to the workspace root.
+ *
+ * The resulting entry is not exported to dependent projects. This method is
+ * equivalent to newProjectEntry(_,false).
+ *
+ *
+ * @param path
+ * the absolute path of the binary archive
+ * @return a new project classpath entry
+ *
+ * @see JavaCore#newProjectEntry(IPath, boolean)
+ */
+ public static IClasspathEntry newProjectEntry(IPath path) {
+ return newProjectEntry(path, false);
+ }
+
+ /**
+ * Creates and returns a new classpath entry of kind
+ * CPE_PROJECT for the project identified by the given
+ * absolute path.
+ *
+ * A project entry is used to denote a prerequisite project on a classpath.
+ * The referenced project will be contributed as a whole, either as sources
+ * (in the Java Model, it contributes all its package fragment roots) or as
+ * binaries (when building, it contributes its whole output location).
+ *
+ * A project reference allows to indirect through another project,
+ * independently from its internal layout.
+ *
+ * The prerequisite project is referred to using an absolute path relative
+ * to the workspace root.
+ *
+ *
+ * @param path
+ * the absolute path of the prerequisite project
+ * @param isExported
+ * indicates whether this entry is contributed to dependent
+ * projects in addition to the output location
+ * @return a new project classpath entry
+ * @since 2.0
+ */
+ public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) {
+
+ if (!path.isAbsolute())
+ Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
+
+ return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE,
+ IClasspathEntry.CPE_PROJECT, path, ClasspathEntry.INCLUDE_ALL,
+ ClasspathEntry.EXCLUDE_NONE, null, // source attachment
+ null, // source attachment root
+ null, // specific output folder
+ isExported);
+ }
+
+ /**
+ * Returns a new empty region.
+ *
+ * @return a new empty region
+ */
+ public static IRegion newRegion() {
+ return new Region();
+ }
+
+ /**
* Creates and returns a new classpath entry of kind CPE_SOURCE
* for all files in the project's source folder identified by the given
* absolute workspace-relative path.
*
* The convenience method is fully equivalent to:
+ *
*
* newSourceEntry(path, new IPath[] {}, new IPath[] {}, null);
*
+ *
*
*
- * @param path the absolute workspace-relative path of a source folder
+ * @param path
+ * the absolute workspace-relative path of a source folder
* @return a new source classpath entry
* @see #newSourceEntry(IPath, IPath[], IPath[], IPath)
*/
public static IClasspathEntry newSourceEntry(IPath path) {
- return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, ClasspathEntry.EXCLUDE_NONE, null /*output location*/);
+ return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL,
+ ClasspathEntry.EXCLUDE_NONE, null /* output location */);
}
-
+
/**
* Creates and returns a new classpath entry of kind CPE_SOURCE
- * for the project's source folder identified by the given absolute
+ * for the project's source folder identified by the given absolute
* workspace-relative path but excluding all source files with paths
* matching any of the given patterns.
*
* The convenience method is fully equivalent to:
+ *
*
* newSourceEntry(path, new IPath[] {}, exclusionPatterns, null);
*
+ *
*
- *
- * @param path the absolute workspace-relative path of a source folder
- * @param exclusionPatterns the possibly empty list of exclusion patterns
- * represented as relative paths
+ *
+ * @param path
+ * the absolute workspace-relative path of a source folder
+ * @param exclusionPatterns
+ * the possibly empty list of exclusion patterns represented as
+ * relative paths
* @return a new source classpath entry
* @see #newSourceEntry(IPath, IPath[], IPath[], IPath)
* @since 2.1
*/
- public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) {
+ public static IClasspathEntry newSourceEntry(IPath path,
+ IPath[] exclusionPatterns) {
- return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, exclusionPatterns, null /*output location*/);
+ return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL,
+ exclusionPatterns, null /* output location */);
}
/**
* Creates and returns a new classpath entry of kind CPE_SOURCE
- * for the project's source folder identified by the given absolute
+ * for the project's source folder identified by the given absolute
* workspace-relative path but excluding all source files with paths
- * matching any of the given patterns, and associated with a specific output location
- * (that is, ".class" files are not going to the project default output location).
+ * matching any of the given patterns, and associated with a specific output
+ * location (that is, ".class" files are not going to the project default
+ * output location).
*
* The convenience method is fully equivalent to:
+ *
*
* newSourceEntry(path, new IPath[] {}, exclusionPatterns, specificOutputLocation);
*
+ *
*
- *
- * @param path the absolute workspace-relative path of a source folder
- * @param exclusionPatterns the possibly empty list of exclusion patterns
- * represented as relative paths
- * @param specificOutputLocation the specific output location for this source entry (null if using project default ouput location)
+ *
+ * @param path
+ * the absolute workspace-relative path of a source folder
+ * @param exclusionPatterns
+ * the possibly empty list of exclusion patterns represented as
+ * relative paths
+ * @param specificOutputLocation
+ * the specific output location for this source entry (null
+ * if using project default ouput location)
* @return a new source classpath entry
* @see #newSourceEntry(IPath, IPath[], IPath[], IPath)
* @since 2.1
*/
- public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns, IPath specificOutputLocation) {
+ public static IClasspathEntry newSourceEntry(IPath path,
+ IPath[] exclusionPatterns, IPath specificOutputLocation) {
- return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL, exclusionPatterns, specificOutputLocation);
+ return newSourceEntry(path, ClasspathEntry.INCLUDE_ALL,
+ exclusionPatterns, specificOutputLocation);
}
-
+
/**
* Creates and returns a new classpath entry of kind CPE_SOURCE
- * for the project's source folder identified by the given absolute
+ * for the project's source folder identified by the given absolute
* workspace-relative path using the given inclusion and exclusion patterns
* to determine which source files are included, and the given output path
* to control the output location of generated files.
*
* The source folder is referred to using an absolute path relative to the
- * workspace root, e.g. /Project/src. A project's source
- * folders are located with that project. That is, a source classpath
- * entry specifying the path /P1/src is only usable for
- * project P1.
+ * workspace root, e.g. /Project/src. A project's source
+ * folders are located with that project. That is, a source classpath entry
+ * specifying the path /P1/src is only usable for project
+ * P1.
*
*
* The inclusion patterns determines the initial set of source files that
@@ -3646,11 +3679,11 @@ public class JavaCore {
* includes all relevent files in the resource tree rooted at the source
* entry's path. On the other hand, specifying one or more inclusion
* patterns means that all and only files matching at least one of
- * the specified patterns are to be included. If exclusion patterns are
+ * the specified patterns are to be included. If exclusion patterns are
* specified, the initial set of files is then reduced by eliminating files
* matched by at least one of the exclusion patterns. Inclusion and
* exclusion patterns look like relative file paths with wildcards and are
- * interpreted relative to the source entry's path. File patterns are
+ * interpreted relative to the source entry's path. File patterns are
* case-sensitive can contain '**', '*' or '?' wildcards (see
* {@link IClasspathEntry#getExclusionPatterns()} for the full description
* of their syntax and semantics). The resulting set of files are included
@@ -3658,925 +3691,934 @@ public class JavaCore {
* the root will have children of type ICompilationUnit.
*
*
- * For example, if the source folder path is
- * /Project/src, there are no inclusion filters, and the
- * exclusion pattern is
- * com/xyz/tests/**, then source files
- * like /Project/src/com/xyz/Foo.java
- * and /Project/src/com/xyz/utils/Bar.java would be included,
- * whereas /Project/src/com/xyz/tests/T1.java
- * and /Project/src/com/xyz/tests/quick/T2.java would be
- * excluded.
+ * For example, if the source folder path is /Project/src,
+ * there are no inclusion filters, and the exclusion pattern is
+ * com/xyz/tests/**, then source files like
+ * /Project/src/com/xyz/Foo.java and
+ * /Project/src/com/xyz/utils/Bar.java would be included,
+ * whereas /Project/src/com/xyz/tests/T1.java and
+ * /Project/src/com/xyz/tests/quick/T2.java would be
+ * excluded.
*
*
- * Additionally, a source entry can be associated with a specific output location.
- * By doing so, the Java builder will ensure that the generated ".class" files will
- * be issued inside this output location, as opposed to be generated into the
- * project default output location (when output location is null).
- * Note that multiple source entries may target the same output location.
- * The output location is referred to using an absolute path relative to the
- * workspace root, e.g. "/Project/bin", it must be located inside
- * the same project as the source folder.
+ * Additionally, a source entry can be associated with a specific output
+ * location. By doing so, the Java builder will ensure that the generated
+ * ".class" files will be issued inside this output location, as opposed to
+ * be generated into the project default output location (when output
+ * location is null). Note that multiple source entries may
+ * target the same output location. The output location is referred to using
+ * an absolute path relative to the workspace root, e.g.
+ * "/Project/bin", it must be located inside the same
+ * project as the source folder.
*
*
- * Also note that all sources/binaries inside a project are contributed as
- * a whole through a project entry
- * (see JavaCore.newProjectEntry). Particular source entries
- * cannot be selectively exported.
+ * Also note that all sources/binaries inside a project are contributed as a
+ * whole through a project entry (see JavaCore.newProjectEntry).
+ * Particular source entries cannot be selectively exported.
*
- *
- * @param path the absolute workspace-relative path of a source folder
- * @param inclusionPatterns the possibly empty list of inclusion patterns
- * represented as relative paths
- * @param exclusionPatterns the possibly empty list of exclusion patterns
- * represented as relative paths
- * @param specificOutputLocation the specific output location for this source entry (null if using project default ouput location)
+ *
+ * @param path
+ * the absolute workspace-relative path of a source folder
+ * @param inclusionPatterns
+ * the possibly empty list of inclusion patterns represented as
+ * relative paths
+ * @param exclusionPatterns
+ * the possibly empty list of exclusion patterns represented as
+ * relative paths
+ * @param specificOutputLocation
+ * the specific output location for this source entry (null
+ * if using project default ouput location)
* @return a new source classpath entry with the given exclusion patterns
* @see IClasspathEntry#getInclusionPatterns()
* @see IClasspathEntry#getExclusionPatterns()
* @see IClasspathEntry#getOutputLocation()
* @since 3.0
*/
- public static IClasspathEntry newSourceEntry(IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns, IPath specificOutputLocation) {
-
- if (path == null) Assert.isTrue(false, "Source path cannot be null"); //$NON-NLS-1$
- if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
- if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$
- if (inclusionPatterns == null) Assert.isTrue(false, "Inclusion pattern set cannot be null"); //$NON-NLS-1$
-
- return new ClasspathEntry(
- IPackageFragmentRoot.K_SOURCE,
- IClasspathEntry.CPE_SOURCE,
- path,
- inclusionPatterns,
- exclusionPatterns,
- null, // source attachment
- null, // source attachment root
- specificOutputLocation, // custom output location
- false);
+ public static IClasspathEntry newSourceEntry(IPath path,
+ IPath[] inclusionPatterns, IPath[] exclusionPatterns,
+ IPath specificOutputLocation) {
+
+ if (path == null)
+ Assert.isTrue(false, "Source path cannot be null"); //$NON-NLS-1$
+ if (!path.isAbsolute())
+ Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$
+ if (exclusionPatterns == null)
+ Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$
+ if (inclusionPatterns == null)
+ Assert.isTrue(false, "Inclusion pattern set cannot be null"); //$NON-NLS-1$
+
+ return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE,
+ IClasspathEntry.CPE_SOURCE, path, inclusionPatterns,
+ exclusionPatterns, null, // source attachment
+ null, // source attachment root
+ specificOutputLocation, // custom output location
+ false);
}
- /**
- * Creates and returns a new non-exported classpath entry of kind
- * CPE_VARIABLE for the given path. The first segment of the
- * path is the name of a classpath variable. The trailing segments of the
- * path will be appended to resolved variable path.
- *
- * A variable entry allows to express indirect references on a classpath to
- * other projects or libraries, depending on what the classpath variable is
- * referring.
- *
- * It is possible to register an automatic initializer (
- * ClasspathVariableInitializer), which will be invoked
- * through the extension point
- * "net.sourceforge.phpdt.core.classpathVariableInitializer". After resolution, a
- * classpath variable entry may either correspond to a project or a library
- * entry.
- *
- * e.g. Here are some examples of variable path usage
- *
- *
"JDTCORE" where variable JDTCORE is bound to
- * "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the
- * library "c:\jars\jdtcore.jar"
- *
"JDTCORE" where variable JDTCORE is bound to
- * "/Project_JDTCORE". The resolved classpath entry is denoting the project
- * "/Project_JDTCORE"
- *
"PLUGINS/com.example/example.jar" where variable
- * PLUGINS is bound to "c:/eclipse/plugins". The resolved
- * classpath entry is denoting the library
- * "c:/eclipse/plugins/com.example/example.jar"
- *
- * Note that this operation does not attempt to validate classpath variables
- * or access the resources at the given paths.
- *
- * The resulting entry is not exported to dependent projects. This method is
- * equivalent to newVariableEntry(-,-,-,false).
- *
- *
- * @param variablePath
- * the path of the binary archive; first segment is the name of a
- * classpath variable
- * @param variableSourceAttachmentPath
- * the path of the corresponding source archive, or
- * null if none; if present, the first segment is
- * the name of a classpath variable (not necessarily the same
- * variable as the one that begins variablePath)
- * @param sourceAttachmentRootPath
- * the location of the root within the source archive or
- * null if archivePath is also
- * null
- * @return a new library classpath entry
- *
- * @see JavaCore#newVariableEntry(IPath, IPath, IPath, boolean)
- */
- //public static IClasspathEntry newVariableEntry(
- // IPath variablePath,
- // IPath variableSourceAttachmentPath,
- // IPath sourceAttachmentRootPath) {
- //
- // return newVariableEntry(variablePath, variableSourceAttachmentPath,
- // sourceAttachmentRootPath, false);
- //}
- /**
- * Creates and returns a new non-exported classpath entry of kind
- * CPE_VARIABLE for the given path. The first segment of the
- * path is the name of a classpath variable. The trailing segments of the
- * path will be appended to resolved variable path.
- *
- * A variable entry allows to express indirect references on a classpath to
- * other projects or libraries, depending on what the classpath variable is
- * referring.
- *
- * It is possible to register an automatic initializer (
- * ClasspathVariableInitializer), which will be invoked
- * through the extension point
- * "net.sourceforge.phpdt.core.classpathVariableInitializer". After resolution, a
- * classpath variable entry may either correspond to a project or a library
- * entry.
- *
- * e.g. Here are some examples of variable path usage
- *
- *
"JDTCORE" where variable JDTCORE is bound to
- * "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the
- * library "c:\jars\jdtcore.jar"
- *
"JDTCORE" where variable JDTCORE is bound to
- * "/Project_JDTCORE". The resolved classpath entry is denoting the project
- * "/Project_JDTCORE"
- *
"PLUGINS/com.example/example.jar" where variable
- * PLUGINS is bound to "c:/eclipse/plugins". The resolved
- * classpath entry is denoting the library
- * "c:/eclipse/plugins/com.example/example.jar"
- *
- * Note that this operation does not attempt to validate classpath variables
- * or access the resources at the given paths.
- *
- *
- * @param variablePath
- * the path of the binary archive; first segment is the name of a
- * classpath variable
- * @param variableSourceAttachmentPath
- * the path of the corresponding source archive, or
- * null if none; if present, the first segment is
- * the name of a classpath variable (not necessarily the same
- * variable as the one that begins variablePath)
- * @param sourceAttachmentRootPath
- * the location of the root within the source archive or
- * null if archivePath is also
- * null
- * @param isExported
- * indicates whether this entry is contributed to dependent
- * projects in addition to the output location
- * @return a new variable classpath entry
- * @since 2.0
- */
- //public static IClasspathEntry newVariableEntry(
- // IPath variablePath,
- // IPath variableSourceAttachmentPath,
- // IPath variableSourceAttachmentRootPath,
- // boolean isExported) {
- //
- // if (variablePath == null || variablePath.segmentCount() < 1) {
- // Assert.isTrue(
- // false,
- // "Illegal classpath variable path: \'" +
- // variablePath.makeRelative().toString() + "\', must have at least one
- // segment"); //$NON-NLS-1$//$NON-NLS-2$
- // }
- //
- // return new ClasspathEntry(
- // IPackageFragmentRoot.K_SOURCE,
- // IClasspathEntry.CPE_VARIABLE,
- // variablePath,
- // ClasspathEntry.NO_EXCLUSION_PATTERNS,
- // variableSourceAttachmentPath, // source attachment
- // variableSourceAttachmentRootPath, // source attachment root
- // null, // specific output folder
- // isExported);
- //}
- /**
- * Removed the given classpath variable. Does nothing if no value was set
- * for this classpath variable.
- *
- * This functionality cannot be used while the resource tree is locked.
- *
- * Classpath variable values are persisted locally to the workspace, and are
- * preserved from session to session.
- *
- *
- * @param variableName
- * the name of the classpath variable
- * @see #setClasspathVariable
- *
- * @deprecated - use version with extra IProgressMonitor
- */
- //public static void removeClasspathVariable(String variableName) {
- // removeClasspathVariable(variableName, null);
- //}
- /**
- * Removed the given classpath variable. Does nothing if no value was set
- * for this classpath variable.
- *
- * This functionality cannot be used while the resource tree is locked.
- *
- * Classpath variable values are persisted locally to the workspace, and are
- * preserved from session to session.
- *
- *
- * @param variableName
- * the name of the classpath variable
- * @param monitor
- * the progress monitor to report progress
- * @see #setClasspathVariable
- */
- //public static void removeClasspathVariable(
- // String variableName,
- // IProgressMonitor monitor) {
- //
- // try {
- // updateVariableValues(new String[]{ variableName}, new IPath[]{ null },
- // monitor);
- // } catch (JavaModelException e) {
- // }
- //}
- /**
- * Removes the given element changed listener. Has no affect if an identical
- * listener is not registered.
- *
- * @param listener
- * the listener
- */
- public static void removeElementChangedListener(
- IElementChangedListener listener) {
- JavaModelManager.getJavaModelManager().removeElementChangedListener(
- listener);
- }
-
- /**
- * Bind a container reference path to some actual containers (
- * IClasspathContainer). This API must be invoked whenever
- * changes in container need to be reflected onto the JavaModel. Containers
- * can have distinct values in different projects, therefore this API
- * considers a set of projects with their respective containers.
- *
- * containerPath is the path under which these values can be
- * referenced through container classpath entries (
- * IClasspathEntry#CPE_CONTAINER). A container path is
- * formed by a first ID segment followed with extra segments, which can be
- * used as additional hints for the resolution. The container ID is used to
- * identify a ClasspathContainerInitializer registered on the
- * extension point "net.sourceforge.phpdt.core.classpathContainerInitializer".
- *
- * There is no assumption that each individual container value passed in
- * argument (respectiveContainers) must answer the exact
- * same path when requested IClasspathContainer#getPath.
- * Indeed, the containerPath is just an indication for resolving it to an
- * actual container object. It can be delegated to a
- * ClasspathContainerInitializer, which can be activated
- * through the extension point
- * "net.sourceforge.phpdt.core.ClasspathContainerInitializer").
- *
- * In reaction to changing container values, the JavaModel will be updated
- * to reflect the new state of the updated container.
- *
- * This functionality cannot be used while the resource tree is locked.
- *
- * Classpath container values are persisted locally to the workspace, but
- * are not preserved from a session to another. It is thus highly
- * recommended to register a ClasspathContainerInitializer
- * for each referenced container (through the extension point
- * "net.sourceforge.phpdt.core.ClasspathContainerInitializer").
- *
- * Note: setting a container to null will cause it to be
- * lazily resolved again whenever its value is required. In particular, this
- * will cause a registered initializer to be invoked again.
- *
- *
- * @param containerPath -
- * the name of the container reference, which is being updated
- * @param affectedProjects -
- * the set of projects for which this container is being bound
- * @param respectiveContainers -
- * the set of respective containers for the affected projects
- * @param monitor
- * a monitor to report progress
- *
- * @see ClasspathContainerInitializer
- * @see #getClasspathContainer(IPath, IJavaProject)
- * @see IClasspathContainer
- * @since 2.0
- */
- //public static void setClasspathContainer(final IPath containerPath,
- // IJavaProject[] affectedProjects, IClasspathContainer[]
- // respectiveContainers, IProgressMonitor monitor) throws JavaModelException
- // {
- //
- // if (affectedProjects.length != respectiveContainers.length)
- // Assert.isTrue(false, "Projects and containers collections should have the
- // same size"); //$NON-NLS-1$
- //
- // if (monitor != null && monitor.isCanceled()) return;
- //
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.println("CPContainer SET - setting container:
- // ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$
- // + (ProjectPrefUtil.toString(affectedProjects,
- // new ProjectPrefUtil.Displayable(){
- // public String displayString(Object o) { return ((IJavaProject)
- // o).getElementName(); }
- // }))
- // + "} with values: " //$NON-NLS-1$
- // + (ProjectPrefUtil.toString(respectiveContainers,
- // new ProjectPrefUtil.Displayable(){
- // public String displayString(Object o) { return ((IClasspathContainer)
- // o).getDescription(); }
- // }))
- // );
- // }
- //
- // final int projectLength = affectedProjects.length;
- // final IJavaProject[] modifiedProjects;
- // System.arraycopy(affectedProjects, 0, modifiedProjects = new
- // IJavaProject[projectLength], 0, projectLength);
- // final IClasspathEntry[][] oldResolvedPaths = new
- // IClasspathEntry[projectLength][];
- //
- // // filter out unmodified project containers
- // int remaining = 0;
- // for (int i = 0; i < projectLength; i++){
- //
- // if (monitor != null && monitor.isCanceled()) return;
- //
- // IJavaProject affectedProject = affectedProjects[i];
- // IClasspathContainer newContainer = respectiveContainers[i];
- // if (newContainer == null) newContainer =
- // JavaModelManager.ContainerInitializationInProgress; // 30920 - prevent
- // infinite loop
- // boolean found = false;
- // if (JavaProject.hasJavaNature(affectedProject.getProject())){
- // IClasspathEntry[] rawClasspath = affectedProject.getRawClasspath();
- // for (int j = 0, cpLength = rawClasspath.length; j
- * This functionality cannot be used while the resource tree is locked.
- *
- * Classpath variable values are persisted locally to the workspace, and are
- * preserved from session to session.
- *
- *
- * @param variableName
- * the name of the classpath variable
- * @param path
- * the path
- * @see #getClasspathVariable
- *
- * @deprecated - use API with IProgressMonitor
- */
- //public static void setClasspathVariable(String variableName, IPath path)
- // throws JavaModelException {
- //
- // setClasspathVariable(variableName, path, null);
- //}
- /**
- * Sets the value of the given classpath variable. The path must not be
- * null.
- *
- * This functionality cannot be used while the resource tree is locked.
- *
- * Classpath variable values are persisted locally to the workspace, and are
- * preserved from session to session.
- *
- * Updating a variable with the same value has no effect.
- *
- * @param variableName
- * the name of the classpath variable
- * @param path
- * the path
- * @param monitor
- * a monitor to report progress
- * @see #getClasspathVariable
- */
- //public static void setClasspathVariable(
- // String variableName,
- // IPath path,
- // IProgressMonitor monitor)
- // throws JavaModelException {
- //
- // if (path == null) Assert.isTrue(false, "Variable path cannot be null");
- // //$NON-NLS-1$
- // setClasspathVariables(new String[]{variableName}, new IPath[]{ path },
- // monitor);
- //}
- /**
- * Sets the values of all the given classpath variables at once. Null paths
- * can be used to request corresponding variable removal.
- *
- * This functionality cannot be used while the resource tree is locked.
- *
- * Classpath variable values are persisted locally to the workspace, and are
- * preserved from session to session.
- *
- * Updating a variable with the same value has no effect.
- *
- * @param variableNames
- * an array of names for the updated classpath variables
- * @param paths
- * an array of path updates for the modified classpath variables
- * (null meaning that the corresponding value will be removed
- * @param monitor
- * a monitor to report progress
- * @see #getClasspathVariable
- * @since 2.0
- */
- //public static void setClasspathVariables(
- // String[] variableNames,
- // IPath[] paths,
- // IProgressMonitor monitor)
- // throws JavaModelException {
- //
- // if (variableNames.length != paths.length) Assert.isTrue(false, "Variable
- // names and paths collections should have the same size"); //$NON-NLS-1$
- // //TODO: should check that null cannot be used as variable paths
- // updateVariableValues(variableNames, paths, monitor);
- //}
- /*
- * (non-Javadoc) Method declared on IExecutableExtension. Record any
- * necessary initialization data from the plugin.
- */
- public void setInitializationData(IConfigurationElement cfig,
- String propertyName, Object data) throws CoreException {
- }
-
- /**
- * Sets the current table of options. All and only the options explicitly
- * included in the given table are remembered; all previous option settings
- * are forgotten, including ones not explicitly mentioned.
- *
- * For a complete description of the configurable options, see
- * getDefaultOptions.
- *
- *
- * @param newOptions
- * the new options (key type: String; value type:
- * String), or null to reset all
- * options to their default values
- * @see JavaCore#getDefaultOptions
- */
- public static void setOptions(Hashtable newOptions) {
-
- // see #initializeDefaultPluginPreferences() for changing default
- // settings
- Preferences preferences = getPlugin().getPluginPreferences();
-
- if (newOptions == null) {
- newOptions = JavaCore.getDefaultOptions();
- }
- Enumeration keys = newOptions.keys();
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- if (!JavaModelManager.OptionNames.contains(key))
- continue; // unrecognized option
- if (key.equals(CORE_ENCODING))
- continue; // skipped, contributed by resource prefs
- String value = (String) newOptions.get(key);
- preferences.setValue(key, value);
- }
-
- // persist options
- getPlugin().savePluginPreferences();
- }
-
- /**
- * Shutdown the JavaCore plug-in.
- *
- * De-registers the JavaModelManager as a resource changed listener and save
- * participant.
- *
- *
- * @see org.eclipse.core.runtime.Plugin#shutdown()
- */
- // moved to PHPeclipsePlugin#shutdown()
- //public void shutdown() {
- //
- // //savePluginPreferences();
- // getPlugin().savePluginPreferences();
- // IWorkspace workspace = ResourcesPlugin.getWorkspace();
- // workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaProcessor);
- // workspace.removeSaveParticipant(PHPeclipsePlugin.getDefault());
- //
- // ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown();
- //}
- /**
- * Initiate the background indexing process. This should be deferred after
- * the plugin activation.
- */
- //private void startIndexing() {
- //
- // JavaModelManager.getJavaModelManager().getIndexManager().reset();
- //}
- /**
- * Startup of the JavaCore plug-in.
- *
- * Registers the JavaModelManager as a resource changed listener and save
- * participant. Starts the background indexing, and restore saved classpath
- * variable values.
- *
- *
- * @see org.eclipse.core.runtime.Plugin#startup()
- */
-
- // moved to PHPeclipsePlugin#startup()
- //public void startup() {
- //
- // JavaModelManager manager = JavaModelManager.getJavaModelManager();
- // try {
- // manager.configurePluginDebugOptions();
- //
- // // request state folder creation (workaround 19885)
- // JavaCore.getPlugin().getStateLocation();
- //
- // // retrieve variable values
- // JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new
- // JavaModelManager.PluginPreferencesListener());
- //// TODO : jsurfer temp-del
- //// manager.loadVariablesAndContainers();
- //
- // IWorkspace workspace = ResourcesPlugin.getWorkspace();
- // workspace.addResourceChangeListener(
- // manager.deltaProcessor,
- // IResourceChangeEvent.PRE_AUTO_BUILD
- // | IResourceChangeEvent.POST_AUTO_BUILD
- // | IResourceChangeEvent.POST_CHANGE
- // | IResourceChangeEvent.PRE_DELETE
- // | IResourceChangeEvent.PRE_CLOSE);
- //
- //// startIndexing();
- // workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager);
- //
- // } catch (CoreException e) {
- // } catch (RuntimeException e) {
- // manager.shutdown();
- // throw e;
- // }
- //}
- /**
- * Internal updating of a variable values (null path meaning removal),
- * allowing to change multiple variable values at once.
- */
- //private static void updateVariableValues(
- // String[] variableNames,
- // IPath[] variablePaths,
- // IProgressMonitor monitor) throws JavaModelException {
- //
- // if (monitor != null && monitor.isCanceled()) return;
- //
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.println("CPVariable SET - setting variables: {" +
- // ProjectPrefUtil.toString(variableNames) //$NON-NLS-1$
- // + "} with values: " + ProjectPrefUtil.toString(variablePaths)); //$NON-NLS-1$
- // }
- //
- // int varLength = variableNames.length;
- //
- // // gather classpath information for updating
- // final HashMap affectedProjects = new HashMap(5);
- // JavaModelManager manager = JavaModelManager.getJavaModelManager();
- // IJavaModel model = manager.getJavaModel();
- //
- // // filter out unmodified variables
- // int discardCount = 0;
- // for (int i = 0; i < varLength; i++){
- // String variableName = variableNames[i];
- // IPath oldPath = (IPath)JavaModelManager.variableGet(variableName); // if
- // reentering will provide previous session value
- // if (oldPath == JavaModelManager.VariableInitializationInProgress){
- // IPath previousPath =
- // (IPath)JavaModelManager.PreviousSessionVariables.get(variableName);
- // if (previousPath != null){
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.println("CPVariable INIT - reentering access to variable: " +
- // variableName+ " during its initialization, will see previous value: "+
- // previousPath); //$NON-NLS-1$ //$NON-NLS-2$
- // }
- // JavaModelManager.variablePut(variableName, previousPath); // replace
- // value so reentering calls are seeing old value
- // }
- // oldPath = null; //33695 - cannot filter out restored variable, must
- // update affected project to reset cached CP
- // }
- // if (oldPath != null && oldPath.equals(variablePaths[i])){
- // variableNames[i] = null;
- // discardCount++;
- // }
- // }
- // if (discardCount > 0){
- // if (discardCount == varLength) return;
- // int changedLength = varLength - discardCount;
- // String[] changedVariableNames = new String[changedLength];
- // IPath[] changedVariablePaths = new IPath[changedLength];
- // for (int i = 0, index = 0; i < varLength; i++){
- // if (variableNames[i] != null){
- // changedVariableNames[index] = variableNames[i];
- // changedVariablePaths[index] = variablePaths[i];
- // index++;
- // }
- // }
- // variableNames = changedVariableNames;
- // variablePaths = changedVariablePaths;
- // varLength = changedLength;
- // }
- //
- // if (monitor != null && monitor.isCanceled()) return;
- //
- // if (model != null) {
- // IJavaProject[] projects = model.getJavaProjects();
- // nextProject : for (int i = 0, projectLength = projects.length; i <
- // projectLength; i++){
- // IJavaProject project = projects[i];
- //
- // // check to see if any of the modified variables is present on the
- // classpath
- // IClasspathEntry[] classpath = project.getRawClasspath();
- // for (int j = 0, cpLength = classpath.length; j < cpLength; j++){
- //
- // IClasspathEntry entry = classpath[j];
- // for (int k = 0; k < varLength; k++){
- //
- // String variableName = variableNames[k];
- // if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE){
- //
- // if (variableName.equals(entry.getPath().segment(0))){
- // affectedProjects.put(project, project.getResolvedClasspath(true));
- // continue nextProject;
- // }
- // IPath sourcePath, sourceRootPath;
- // if (((sourcePath = entry.getSourceAttachmentPath()) != null &&
- // variableName.equals(sourcePath.segment(0)))
- // || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null &&
- // variableName.equals(sourceRootPath.segment(0)))) {
- //
- // affectedProjects.put(project, project.getResolvedClasspath(true));
- // continue nextProject;
- // }
- // }
- // }
- // }
- // }
- // }
- // // update variables
- // for (int i = 0; i < varLength; i++){
- // JavaModelManager.variablePut(variableNames[i], variablePaths[i]);
- // }
- // final String[] dbgVariableNames = variableNames;
- //
- // // update affected project classpaths
- // if (!affectedProjects.isEmpty()) {
- // try {
- // JavaCore_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt.run(
- // new IWorkspaceRunnable() {
- // public void run(IProgressMonitor monitor) throws CoreException {
- // // propagate classpath change
- // Iterator projectsToUpdate = affectedProjects.keySet().iterator();
- // while (projectsToUpdate.hasNext()) {
- //
- // if (monitor != null && monitor.isCanceled()) return;
- //
- // JavaProject project = (JavaProject) projectsToUpdate.next();
- //
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.println("CPVariable SET - updating affected project:
- // ["+project.getElementName()+"] due to setting variables: "+
- // ProjectPrefUtil.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$
- // }
- //
- // project
- // .setRawClasspath(
- // project.getRawClasspath(),
- // SetClasspathOperation.ReuseOutputLocation,
- // null, // don't call beginTask on the monitor (see
- // http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717)
- // !ResourcesPlugin.getWorkspace().isTreeLocked(), // can change resources
- // (IClasspathEntry[]) affectedProjects.get(project),
- // false, // updating - no validation
- // false); // updating - no need to save
- // }
- // }
- // },
- // monitor);
- // } catch (CoreException e) {
- // if (JavaModelManager.CP_RESOLVE_VERBOSE){
- // System.out.println("CPVariable SET - FAILED DUE TO EXCEPTION:
- // "+ProjectPrefUtil.toString(dbgVariableNames)); //$NON-NLS-1$
- // e.printStackTrace();
- // }
- // if (e instanceof JavaModelException) {
- // throw (JavaModelException)e;
- // } else {
- // throw new JavaModelException(e);
- // }
- // }
- // }
- //}
- /*
- * (non-Javadoc) Startup the JavaCore plug-in.
Registers the
- * JavaModelManager as a resource changed listener and save participant.
- * Starts the background indexing, and restore saved classpath variable
- * values.
@throws Exception
- *
- * @see org.eclipse.core.runtime.Plugin#start(BundleContext)
- */
- //public static void start(final Plugin plugin, BundleContext context)
- // throws Exception {
- //// super.start(context);
- //
- // final JavaModelManager manager = JavaModelManager.getJavaModelManager();
- // try {
- // manager.configurePluginDebugOptions();
- //
- // // request state folder creation (workaround 19885)
- // JavaCore.getPlugin().getStateLocation();
- //
- // // retrieve variable values
- // //JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new
- // JavaModelManager.PluginPreferencesListener());
- //// manager.loadVariablesAndContainers();
- //
- // final IWorkspace workspace = ResourcesPlugin.getWorkspace();
- // workspace.addResourceChangeListener(
- // manager.deltaState,
- // IResourceChangeEvent.PRE_BUILD
- // | IResourceChangeEvent.POST_BUILD
- // | IResourceChangeEvent.POST_CHANGE
- // | IResourceChangeEvent.PRE_DELETE
- // | IResourceChangeEvent.PRE_CLOSE);
- //
- //// startIndexing();
- //
- // // process deltas since last activated in indexer thread so that indexes
- // are up-to-date.
- // // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
- // Job processSavedState = new Job(ProjectPrefUtil.bind("savedState.jobName")) {
- // //$NON-NLS-1$
- // protected IStatus run(IProgressMonitor monitor) {
- // try {
- // // add save participant and process delta atomically
- // // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
- // workspace.run(
- // new IWorkspaceRunnable() {
- // public void run(IProgressMonitor progress) throws CoreException {
- //// ISavedState savedState = workspace.addSaveParticipant(JavaCore.this,
- // manager);
- // ISavedState savedState = workspace.addSaveParticipant(plugin, manager);
- // if (savedState != null) {
- // // the event type coming from the saved state is always POST_AUTO_BUILD
- // // force it to be POST_CHANGE so that the delta processor can handle it
- // manager.deltaState.getDeltaProcessor().overridenEventType =
- // IResourceChangeEvent.POST_CHANGE;
- // savedState.processResourceChangeEvents(manager.deltaState);
- // }
- // }
- // },
- // monitor);
- // } catch (CoreException e) {
- // return e.getStatus();
- // }
- // return Status.OK_STATUS;
- // }
- // };
- // processSavedState.setSystem(true);
- // processSavedState.setPriority(Job.SHORT); // process asap
- // processSavedState.schedule();
- // } catch (RuntimeException e) {
- // manager.shutdown();
- // throw e;
- // }
- //}
- /*
- * (non-Javadoc) Shutdown the JavaCore plug-in.
De-registers the
- * JavaModelManager as a resource changed listener and save participant.
- *
- * @see org.eclipse.core.runtime.Plugin#stop(BundleContext)
- */
-// public static void stop(Plugin plugin, BundleContext context)
-// throws Exception {
-// try {
-// plugin.savePluginPreferences();
-// IWorkspace workspace = ResourcesPlugin.getWorkspace();
-// workspace.removeResourceChangeListener(JavaModelManager
-// .getJavaModelManager().deltaState);
-// workspace.removeSaveParticipant(plugin);
-//
-// JavaModelManager.getJavaModelManager().shutdown();
-// } finally {
-// // ensure we call super.stop as the last thing
-// // super.stop(context);
-// }
-// }
+ /**
+ * Creates and returns a new non-exported classpath entry of kind
+ * CPE_VARIABLE for the given path. The first segment of the
+ * path is the name of a classpath variable. The trailing segments of the
+ * path will be appended to resolved variable path.
+ *
+ * A variable entry allows to express indirect references on a classpath to
+ * other projects or libraries, depending on what the classpath variable is
+ * referring.
+ *
+ * It is possible to register an automatic initializer (
+ * ClasspathVariableInitializer), which will be invoked
+ * through the extension point
+ * "net.sourceforge.phpdt.core.classpathVariableInitializer". After
+ * resolution, a classpath variable entry may either correspond to a project
+ * or a library entry.
+ *
+ * e.g. Here are some examples of variable path usage
+ *
+ *
"JDTCORE" where variable JDTCORE is bound to
+ * "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the
+ * library "c:\jars\jdtcore.jar"
+ *
"JDTCORE" where variable JDTCORE is bound to
+ * "/Project_JDTCORE". The resolved classpath entry is denoting the project
+ * "/Project_JDTCORE"
+ *
"PLUGINS/com.example/example.jar" where variable
+ * PLUGINS is bound to "c:/eclipse/plugins". The resolved
+ * classpath entry is denoting the library
+ * "c:/eclipse/plugins/com.example/example.jar"
+ *
+ * Note that this operation does not attempt to validate classpath variables
+ * or access the resources at the given paths.
+ *
+ * The resulting entry is not exported to dependent projects. This method is
+ * equivalent to newVariableEntry(-,-,-,false).
+ *
+ *
+ * @param variablePath
+ * the path of the binary archive; first segment is the name of a
+ * classpath variable
+ * @param variableSourceAttachmentPath
+ * the path of the corresponding source archive, or
+ * null if none; if present, the first segment is
+ * the name of a classpath variable (not necessarily the same
+ * variable as the one that begins variablePath)
+ * @param sourceAttachmentRootPath
+ * the location of the root within the source archive or
+ * null if archivePath is also
+ * null
+ * @return a new library classpath entry
+ *
+ * @see JavaCore#newVariableEntry(IPath, IPath, IPath, boolean)
+ */
+ // public static IClasspathEntry newVariableEntry(
+ // IPath variablePath,
+ // IPath variableSourceAttachmentPath,
+ // IPath sourceAttachmentRootPath) {
+ //
+ // return newVariableEntry(variablePath, variableSourceAttachmentPath,
+ // sourceAttachmentRootPath, false);
+ // }
+ /**
+ * Creates and returns a new non-exported classpath entry of kind
+ * CPE_VARIABLE for the given path. The first segment of the
+ * path is the name of a classpath variable. The trailing segments of the
+ * path will be appended to resolved variable path.
+ *
+ * A variable entry allows to express indirect references on a classpath to
+ * other projects or libraries, depending on what the classpath variable is
+ * referring.
+ *
+ * It is possible to register an automatic initializer (
+ * ClasspathVariableInitializer), which will be invoked
+ * through the extension point
+ * "net.sourceforge.phpdt.core.classpathVariableInitializer". After
+ * resolution, a classpath variable entry may either correspond to a project
+ * or a library entry.
+ *
+ * e.g. Here are some examples of variable path usage
+ *
+ *
"JDTCORE" where variable JDTCORE is bound to
+ * "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the
+ * library "c:\jars\jdtcore.jar"
+ *
"JDTCORE" where variable JDTCORE is bound to
+ * "/Project_JDTCORE". The resolved classpath entry is denoting the project
+ * "/Project_JDTCORE"
+ *
"PLUGINS/com.example/example.jar" where variable
+ * PLUGINS is bound to "c:/eclipse/plugins". The resolved
+ * classpath entry is denoting the library
+ * "c:/eclipse/plugins/com.example/example.jar"
+ *
+ * Note that this operation does not attempt to validate classpath variables
+ * or access the resources at the given paths.
+ *
+ *
+ * @param variablePath
+ * the path of the binary archive; first segment is the name of a
+ * classpath variable
+ * @param variableSourceAttachmentPath
+ * the path of the corresponding source archive, or
+ * null if none; if present, the first segment is
+ * the name of a classpath variable (not necessarily the same
+ * variable as the one that begins variablePath)
+ * @param sourceAttachmentRootPath
+ * the location of the root within the source archive or
+ * null if archivePath is also
+ * null
+ * @param isExported
+ * indicates whether this entry is contributed to dependent
+ * projects in addition to the output location
+ * @return a new variable classpath entry
+ * @since 2.0
+ */
+ // public static IClasspathEntry newVariableEntry(
+ // IPath variablePath,
+ // IPath variableSourceAttachmentPath,
+ // IPath variableSourceAttachmentRootPath,
+ // boolean isExported) {
+ //
+ // if (variablePath == null || variablePath.segmentCount() < 1) {
+ // Assert.isTrue(
+ // false,
+ // "Illegal classpath variable path: \'" +
+ // variablePath.makeRelative().toString() + "\', must have at least one
+ // segment"); //$NON-NLS-1$//$NON-NLS-2$
+ // }
+ //
+ // return new ClasspathEntry(
+ // IPackageFragmentRoot.K_SOURCE,
+ // IClasspathEntry.CPE_VARIABLE,
+ // variablePath,
+ // ClasspathEntry.NO_EXCLUSION_PATTERNS,
+ // variableSourceAttachmentPath, // source attachment
+ // variableSourceAttachmentRootPath, // source attachment root
+ // null, // specific output folder
+ // isExported);
+ // }
+ /**
+ * Removed the given classpath variable. Does nothing if no value was set
+ * for this classpath variable.
+ *
+ * This functionality cannot be used while the resource tree is locked.
+ *
+ * Classpath variable values are persisted locally to the workspace, and are
+ * preserved from session to session.
+ *
+ *
+ * @param variableName
+ * the name of the classpath variable
+ * @see #setClasspathVariable
+ *
+ * @deprecated - use version with extra IProgressMonitor
+ */
+ // public static void removeClasspathVariable(String variableName) {
+ // removeClasspathVariable(variableName, null);
+ // }
+ /**
+ * Removed the given classpath variable. Does nothing if no value was set
+ * for this classpath variable.
+ *
+ * This functionality cannot be used while the resource tree is locked.
+ *
+ * Classpath variable values are persisted locally to the workspace, and are
+ * preserved from session to session.
+ *
+ *
+ * @param variableName
+ * the name of the classpath variable
+ * @param monitor
+ * the progress monitor to report progress
+ * @see #setClasspathVariable
+ */
+ // public static void removeClasspathVariable(
+ // String variableName,
+ // IProgressMonitor monitor) {
+ //
+ // try {
+ // updateVariableValues(new String[]{ variableName}, new IPath[]{ null },
+ // monitor);
+ // } catch (JavaModelException e) {
+ // }
+ // }
+ /**
+ * Removes the given element changed listener. Has no affect if an identical
+ * listener is not registered.
+ *
+ * @param listener
+ * the listener
+ */
+ public static void removeElementChangedListener(
+ IElementChangedListener listener) {
+ JavaModelManager.getJavaModelManager().removeElementChangedListener(
+ listener);
+ }
+
+ /**
+ * Bind a container reference path to some actual containers (
+ * IClasspathContainer). This API must be invoked whenever
+ * changes in container need to be reflected onto the JavaModel. Containers
+ * can have distinct values in different projects, therefore this API
+ * considers a set of projects with their respective containers.
+ *
+ * containerPath is the path under which these values can be
+ * referenced through container classpath entries (
+ * IClasspathEntry#CPE_CONTAINER). A container path is
+ * formed by a first ID segment followed with extra segments, which can be
+ * used as additional hints for the resolution. The container ID is used to
+ * identify a ClasspathContainerInitializer registered on the
+ * extension point
+ * "net.sourceforge.phpdt.core.classpathContainerInitializer".
+ *
+ * There is no assumption that each individual container value passed in
+ * argument (respectiveContainers) must answer the exact
+ * same path when requested IClasspathContainer#getPath.
+ * Indeed, the containerPath is just an indication for resolving it to an
+ * actual container object. It can be delegated to a
+ * ClasspathContainerInitializer, which can be activated
+ * through the extension point
+ * "net.sourceforge.phpdt.core.ClasspathContainerInitializer").
+ *
+ * In reaction to changing container values, the JavaModel will be updated
+ * to reflect the new state of the updated container.
+ *
+ * This functionality cannot be used while the resource tree is locked.
+ *
+ * Classpath container values are persisted locally to the workspace, but
+ * are not preserved from a session to another. It is thus highly
+ * recommended to register a ClasspathContainerInitializer
+ * for each referenced container (through the extension point
+ * "net.sourceforge.phpdt.core.ClasspathContainerInitializer").
+ *
+ * Note: setting a container to null will cause it to be
+ * lazily resolved again whenever its value is required. In particular, this
+ * will cause a registered initializer to be invoked again.
+ *
+ *
+ * @param containerPath -
+ * the name of the container reference, which is being updated
+ * @param affectedProjects -
+ * the set of projects for which this container is being bound
+ * @param respectiveContainers -
+ * the set of respective containers for the affected projects
+ * @param monitor
+ * a monitor to report progress
+ *
+ * @see ClasspathContainerInitializer
+ * @see #getClasspathContainer(IPath, IJavaProject)
+ * @see IClasspathContainer
+ * @since 2.0
+ */
+ // public static void setClasspathContainer(final IPath containerPath,
+ // IJavaProject[] affectedProjects, IClasspathContainer[]
+ // respectiveContainers, IProgressMonitor monitor) throws JavaModelException
+ // {
+ //
+ // if (affectedProjects.length != respectiveContainers.length)
+ // Assert.isTrue(false, "Projects and containers collections should have the
+ // same size"); //$NON-NLS-1$
+ //
+ // if (monitor != null && monitor.isCanceled()) return;
+ //
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.println("CPContainer SET - setting container:
+ // ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$
+ // + (ProjectPrefUtil.toString(affectedProjects,
+ // new ProjectPrefUtil.Displayable(){
+ // public String displayString(Object o) { return ((IJavaProject)
+ // o).getElementName(); }
+ // }))
+ // + "} with values: " //$NON-NLS-1$
+ // + (ProjectPrefUtil.toString(respectiveContainers,
+ // new ProjectPrefUtil.Displayable(){
+ // public String displayString(Object o) { return ((IClasspathContainer)
+ // o).getDescription(); }
+ // }))
+ // );
+ // }
+ //
+ // final int projectLength = affectedProjects.length;
+ // final IJavaProject[] modifiedProjects;
+ // System.arraycopy(affectedProjects, 0, modifiedProjects = new
+ // IJavaProject[projectLength], 0, projectLength);
+ // final IClasspathEntry[][] oldResolvedPaths = new
+ // IClasspathEntry[projectLength][];
+ //
+ // // filter out unmodified project containers
+ // int remaining = 0;
+ // for (int i = 0; i < projectLength; i++){
+ //
+ // if (monitor != null && monitor.isCanceled()) return;
+ //
+ // IJavaProject affectedProject = affectedProjects[i];
+ // IClasspathContainer newContainer = respectiveContainers[i];
+ // if (newContainer == null) newContainer =
+ // JavaModelManager.ContainerInitializationInProgress; // 30920 - prevent
+ // infinite loop
+ // boolean found = false;
+ // if (JavaProject.hasJavaNature(affectedProject.getProject())){
+ // IClasspathEntry[] rawClasspath = affectedProject.getRawClasspath();
+ // for (int j = 0, cpLength = rawClasspath.length; j
+ * This functionality cannot be used while the resource tree is locked.
+ *
+ * Classpath variable values are persisted locally to the workspace, and are
+ * preserved from session to session.
+ *
+ *
+ * @param variableName
+ * the name of the classpath variable
+ * @param path
+ * the path
+ * @see #getClasspathVariable
+ *
+ * @deprecated - use API with IProgressMonitor
+ */
+ // public static void setClasspathVariable(String variableName, IPath path)
+ // throws JavaModelException {
+ //
+ // setClasspathVariable(variableName, path, null);
+ // }
+ /**
+ * Sets the value of the given classpath variable. The path must not be
+ * null.
+ *
+ * This functionality cannot be used while the resource tree is locked.
+ *
+ * Classpath variable values are persisted locally to the workspace, and are
+ * preserved from session to session.
+ *
+ * Updating a variable with the same value has no effect.
+ *
+ * @param variableName
+ * the name of the classpath variable
+ * @param path
+ * the path
+ * @param monitor
+ * a monitor to report progress
+ * @see #getClasspathVariable
+ */
+ // public static void setClasspathVariable(
+ // String variableName,
+ // IPath path,
+ // IProgressMonitor monitor)
+ // throws JavaModelException {
+ //
+ // if (path == null) Assert.isTrue(false, "Variable path cannot be null");
+ // //$NON-NLS-1$
+ // setClasspathVariables(new String[]{variableName}, new IPath[]{ path },
+ // monitor);
+ // }
+ /**
+ * Sets the values of all the given classpath variables at once. Null paths
+ * can be used to request corresponding variable removal.
+ *
+ * This functionality cannot be used while the resource tree is locked.
+ *
+ * Classpath variable values are persisted locally to the workspace, and are
+ * preserved from session to session.
+ *
+ * Updating a variable with the same value has no effect.
+ *
+ * @param variableNames
+ * an array of names for the updated classpath variables
+ * @param paths
+ * an array of path updates for the modified classpath variables
+ * (null meaning that the corresponding value will be removed
+ * @param monitor
+ * a monitor to report progress
+ * @see #getClasspathVariable
+ * @since 2.0
+ */
+ // public static void setClasspathVariables(
+ // String[] variableNames,
+ // IPath[] paths,
+ // IProgressMonitor monitor)
+ // throws JavaModelException {
+ //
+ // if (variableNames.length != paths.length) Assert.isTrue(false, "Variable
+ // names and paths collections should have the same size"); //$NON-NLS-1$
+ // //TODO: should check that null cannot be used as variable paths
+ // updateVariableValues(variableNames, paths, monitor);
+ // }
+ /*
+ * (non-Javadoc) Method declared on IExecutableExtension. Record any
+ * necessary initialization data from the plugin.
+ */
+ public void setInitializationData(IConfigurationElement cfig,
+ String propertyName, Object data) throws CoreException {
+ }
+
+ /**
+ * Sets the current table of options. All and only the options explicitly
+ * included in the given table are remembered; all previous option settings
+ * are forgotten, including ones not explicitly mentioned.
+ *
+ * For a complete description of the configurable options, see
+ * getDefaultOptions.
+ *
+ *
+ * @param newOptions
+ * the new options (key type: String; value type:
+ * String), or null to reset all
+ * options to their default values
+ * @see JavaCore#getDefaultOptions
+ */
+ public static void setOptions(Hashtable newOptions) {
+
+ // see #initializeDefaultPluginPreferences() for changing default
+ // settings
+ Preferences preferences = getPlugin().getPluginPreferences();
+
+ if (newOptions == null) {
+ newOptions = JavaCore.getDefaultOptions();
+ }
+ Enumeration keys = newOptions.keys();
+ while (keys.hasMoreElements()) {
+ String key = (String) keys.nextElement();
+ if (!JavaModelManager.OptionNames.contains(key))
+ continue; // unrecognized option
+ if (key.equals(CORE_ENCODING))
+ continue; // skipped, contributed by resource prefs
+ String value = (String) newOptions.get(key);
+ preferences.setValue(key, value);
+ }
+
+ // persist options
+ getPlugin().savePluginPreferences();
+ }
+
+ /**
+ * Shutdown the JavaCore plug-in.
+ *
+ * De-registers the JavaModelManager as a resource changed listener and save
+ * participant.
+ *
+ *
+ * @see org.eclipse.core.runtime.Plugin#shutdown()
+ */
+ // moved to PHPeclipsePlugin#shutdown()
+ // public void shutdown() {
+ //
+ // //savePluginPreferences();
+ // getPlugin().savePluginPreferences();
+ // IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ // workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaProcessor);
+ // workspace.removeSaveParticipant(PHPeclipsePlugin.getDefault());
+ //
+ // ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown();
+ // }
+ /**
+ * Initiate the background indexing process. This should be deferred after
+ * the plugin activation.
+ */
+ // private void startIndexing() {
+ //
+ // JavaModelManager.getJavaModelManager().getIndexManager().reset();
+ // }
+ /**
+ * Startup of the JavaCore plug-in.
+ *
+ * Registers the JavaModelManager as a resource changed listener and save
+ * participant. Starts the background indexing, and restore saved classpath
+ * variable values.
+ *
+ *
+ * @see org.eclipse.core.runtime.Plugin#startup()
+ */
+
+ // moved to PHPeclipsePlugin#startup()
+ // public void startup() {
+ //
+ // JavaModelManager manager = JavaModelManager.getJavaModelManager();
+ // try {
+ // manager.configurePluginDebugOptions();
+ //
+ // // request state folder creation (workaround 19885)
+ // JavaCore.getPlugin().getStateLocation();
+ //
+ // // retrieve variable values
+ // JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new
+ // JavaModelManager.PluginPreferencesListener());
+ // // TODO : jsurfer temp-del
+ // // manager.loadVariablesAndContainers();
+ //
+ // IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ // workspace.addResourceChangeListener(
+ // manager.deltaProcessor,
+ // IResourceChangeEvent.PRE_AUTO_BUILD
+ // | IResourceChangeEvent.POST_AUTO_BUILD
+ // | IResourceChangeEvent.POST_CHANGE
+ // | IResourceChangeEvent.PRE_DELETE
+ // | IResourceChangeEvent.PRE_CLOSE);
+ //
+ // // startIndexing();
+ // workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager);
+ //
+ // } catch (CoreException e) {
+ // } catch (RuntimeException e) {
+ // manager.shutdown();
+ // throw e;
+ // }
+ // }
+ /**
+ * Internal updating of a variable values (null path meaning removal),
+ * allowing to change multiple variable values at once.
+ */
+ // private static void updateVariableValues(
+ // String[] variableNames,
+ // IPath[] variablePaths,
+ // IProgressMonitor monitor) throws JavaModelException {
+ //
+ // if (monitor != null && monitor.isCanceled()) return;
+ //
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.println("CPVariable SET - setting variables: {" +
+ // ProjectPrefUtil.toString(variableNames) //$NON-NLS-1$
+ // + "} with values: " + ProjectPrefUtil.toString(variablePaths));
+ // //$NON-NLS-1$
+ // }
+ //
+ // int varLength = variableNames.length;
+ //
+ // // gather classpath information for updating
+ // final HashMap affectedProjects = new HashMap(5);
+ // JavaModelManager manager = JavaModelManager.getJavaModelManager();
+ // IJavaModel model = manager.getJavaModel();
+ //
+ // // filter out unmodified variables
+ // int discardCount = 0;
+ // for (int i = 0; i < varLength; i++){
+ // String variableName = variableNames[i];
+ // IPath oldPath = (IPath)JavaModelManager.variableGet(variableName); // if
+ // reentering will provide previous session value
+ // if (oldPath == JavaModelManager.VariableInitializationInProgress){
+ // IPath previousPath =
+ // (IPath)JavaModelManager.PreviousSessionVariables.get(variableName);
+ // if (previousPath != null){
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.println("CPVariable INIT - reentering access to variable: " +
+ // variableName+ " during its initialization, will see previous value: "+
+ // previousPath); //$NON-NLS-1$ //$NON-NLS-2$
+ // }
+ // JavaModelManager.variablePut(variableName, previousPath); // replace
+ // value so reentering calls are seeing old value
+ // }
+ // oldPath = null; //33695 - cannot filter out restored variable, must
+ // update affected project to reset cached CP
+ // }
+ // if (oldPath != null && oldPath.equals(variablePaths[i])){
+ // variableNames[i] = null;
+ // discardCount++;
+ // }
+ // }
+ // if (discardCount > 0){
+ // if (discardCount == varLength) return;
+ // int changedLength = varLength - discardCount;
+ // String[] changedVariableNames = new String[changedLength];
+ // IPath[] changedVariablePaths = new IPath[changedLength];
+ // for (int i = 0, index = 0; i < varLength; i++){
+ // if (variableNames[i] != null){
+ // changedVariableNames[index] = variableNames[i];
+ // changedVariablePaths[index] = variablePaths[i];
+ // index++;
+ // }
+ // }
+ // variableNames = changedVariableNames;
+ // variablePaths = changedVariablePaths;
+ // varLength = changedLength;
+ // }
+ //
+ // if (monitor != null && monitor.isCanceled()) return;
+ //
+ // if (model != null) {
+ // IJavaProject[] projects = model.getJavaProjects();
+ // nextProject : for (int i = 0, projectLength = projects.length; i <
+ // projectLength; i++){
+ // IJavaProject project = projects[i];
+ //
+ // // check to see if any of the modified variables is present on the
+ // classpath
+ // IClasspathEntry[] classpath = project.getRawClasspath();
+ // for (int j = 0, cpLength = classpath.length; j < cpLength; j++){
+ //
+ // IClasspathEntry entry = classpath[j];
+ // for (int k = 0; k < varLength; k++){
+ //
+ // String variableName = variableNames[k];
+ // if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE){
+ //
+ // if (variableName.equals(entry.getPath().segment(0))){
+ // affectedProjects.put(project, project.getResolvedClasspath(true));
+ // continue nextProject;
+ // }
+ // IPath sourcePath, sourceRootPath;
+ // if (((sourcePath = entry.getSourceAttachmentPath()) != null &&
+ // variableName.equals(sourcePath.segment(0)))
+ // || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null &&
+ // variableName.equals(sourceRootPath.segment(0)))) {
+ //
+ // affectedProjects.put(project, project.getResolvedClasspath(true));
+ // continue nextProject;
+ // }
+ // }
+ // }
+ // }
+ // }
+ // }
+ // // update variables
+ // for (int i = 0; i < varLength; i++){
+ // JavaModelManager.variablePut(variableNames[i], variablePaths[i]);
+ // }
+ // final String[] dbgVariableNames = variableNames;
+ //
+ // // update affected project classpaths
+ // if (!affectedProjects.isEmpty()) {
+ // try {
+ // JavaCore_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt.run(
+ // new IWorkspaceRunnable() {
+ // public void run(IProgressMonitor monitor) throws CoreException {
+ // // propagate classpath change
+ // Iterator projectsToUpdate = affectedProjects.keySet().iterator();
+ // while (projectsToUpdate.hasNext()) {
+ //
+ // if (monitor != null && monitor.isCanceled()) return;
+ //
+ // JavaProject project = (JavaProject) projectsToUpdate.next();
+ //
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.println("CPVariable SET - updating affected project:
+ // ["+project.getElementName()+"] due to setting variables: "+
+ // ProjectPrefUtil.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$
+ // }
+ //
+ // project
+ // .setRawClasspath(
+ // project.getRawClasspath(),
+ // SetClasspathOperation.ReuseOutputLocation,
+ // null, // don't call beginTask on the monitor (see
+ // http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717)
+ // !ResourcesPlugin.getWorkspace().isTreeLocked(), // can change resources
+ // (IClasspathEntry[]) affectedProjects.get(project),
+ // false, // updating - no validation
+ // false); // updating - no need to save
+ // }
+ // }
+ // },
+ // monitor);
+ // } catch (CoreException e) {
+ // if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ // System.out.println("CPVariable SET - FAILED DUE TO EXCEPTION:
+ // "+ProjectPrefUtil.toString(dbgVariableNames)); //$NON-NLS-1$
+ // e.printStackTrace();
+ // }
+ // if (e instanceof JavaModelException) {
+ // throw (JavaModelException)e;
+ // } else {
+ // throw new JavaModelException(e);
+ // }
+ // }
+ // }
+ // }
+ /*
+ * (non-Javadoc) Startup the JavaCore plug-in.
Registers the
+ * JavaModelManager as a resource changed listener and save participant.
+ * Starts the background indexing, and restore saved classpath variable
+ * values.
@throws Exception
+ *
+ * @see org.eclipse.core.runtime.Plugin#start(BundleContext)
+ */
+ // public static void start(final Plugin plugin, BundleContext context)
+ // throws Exception {
+ // // super.start(context);
+ //
+ // final JavaModelManager manager = JavaModelManager.getJavaModelManager();
+ // try {
+ // manager.configurePluginDebugOptions();
+ //
+ // // request state folder creation (workaround 19885)
+ // JavaCore.getPlugin().getStateLocation();
+ //
+ // // retrieve variable values
+ // //JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new
+ // JavaModelManager.PluginPreferencesListener());
+ // // manager.loadVariablesAndContainers();
+ //
+ // final IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ // workspace.addResourceChangeListener(
+ // manager.deltaState,
+ // IResourceChangeEvent.PRE_BUILD
+ // | IResourceChangeEvent.POST_BUILD
+ // | IResourceChangeEvent.POST_CHANGE
+ // | IResourceChangeEvent.PRE_DELETE
+ // | IResourceChangeEvent.PRE_CLOSE);
+ //
+ // // startIndexing();
+ //
+ // // process deltas since last activated in indexer thread so that indexes
+ // are up-to-date.
+ // // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
+ // Job processSavedState = new
+ // Job(ProjectPrefUtil.bind("savedState.jobName")) {
+ // //$NON-NLS-1$
+ // protected IStatus run(IProgressMonitor monitor) {
+ // try {
+ // // add save participant and process delta atomically
+ // // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
+ // workspace.run(
+ // new IWorkspaceRunnable() {
+ // public void run(IProgressMonitor progress) throws CoreException {
+ // // ISavedState savedState = workspace.addSaveParticipant(JavaCore.this,
+ // manager);
+ // ISavedState savedState = workspace.addSaveParticipant(plugin, manager);
+ // if (savedState != null) {
+ // // the event type coming from the saved state is always POST_AUTO_BUILD
+ // // force it to be POST_CHANGE so that the delta processor can handle it
+ // manager.deltaState.getDeltaProcessor().overridenEventType =
+ // IResourceChangeEvent.POST_CHANGE;
+ // savedState.processResourceChangeEvents(manager.deltaState);
+ // }
+ // }
+ // },
+ // monitor);
+ // } catch (CoreException e) {
+ // return e.getStatus();
+ // }
+ // return Status.OK_STATUS;
+ // }
+ // };
+ // processSavedState.setSystem(true);
+ // processSavedState.setPriority(Job.SHORT); // process asap
+ // processSavedState.schedule();
+ // } catch (RuntimeException e) {
+ // manager.shutdown();
+ // throw e;
+ // }
+ // }
+ /*
+ * (non-Javadoc) Shutdown the JavaCore plug-in.
De-registers the
+ * JavaModelManager as a resource changed listener and save participant.
+ *
+ * @see org.eclipse.core.runtime.Plugin#stop(BundleContext)
+ */
+ // public static void stop(Plugin plugin, BundleContext context)
+ // throws Exception {
+ // try {
+ // plugin.savePluginPreferences();
+ // IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ // workspace.removeResourceChangeListener(JavaModelManager
+ // .getJavaModelManager().deltaState);
+ // workspace.removeSaveParticipant(plugin);
+ //
+ // JavaModelManager.getJavaModelManager().shutdown();
+ // } finally {
+ // // ensure we call super.stop as the last thing
+ // // super.stop(context);
+ // }
+ // }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaModelException.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaModelException.java
index 2f77107..935b219 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaModelException.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaModelException.java
@@ -15,120 +15,133 @@ import net.sourceforge.phpdt.internal.core.JavaModelStatus;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-//import net.sourceforge.phpdt.internal.core.JavaModelStatus;
+// import net.sourceforge.phpdt.internal.core.JavaModelStatus;
/**
- * A checked exception representing a failure in the Java model.
- * Java model exceptions contain a Java-specific status object describing the
- * cause of the exception.
+ * A checked exception representing a failure in the Java model. Java model
+ * exceptions contain a Java-specific status object describing the cause of the
+ * exception.
*
* This class is not intended to be subclassed by clients. Instances of this
* class are automatically created by the Java model when problems arise, so
* there is generally no need for clients to create instances.
*
- *
+ *
* @see IJavaModelStatus
* @see IJavaModelStatusConstants
*/
public class JavaModelException extends CoreException {
CoreException nestedCoreException;
-/**
- * Creates a Java model exception that wrappers the given Throwable.
- * The exception contains a Java-specific status object with severity
- * IStatus.ERROR and the given status code.
- *
- * @param exception the Throwable
- * @param code one of the Java-specific status codes declared in
- * IJavaModelStatusConstants
- * @see IJavaModelStatusConstants
- * @see org.eclipse.core.runtime.IStatus#ERROR
- */
-public JavaModelException(Throwable e, int code) {
- this(new JavaModelStatus(code, e));
-}
-/**
- * Creates a Java model exception for the given CoreException.
- * Equivalent to
- * JavaModelException(exception,IJavaModelStatusConstants.CORE_EXCEPTION.
- *
- * @param exception the CoreException
- */
-public JavaModelException(CoreException exception) {
- super(exception.getStatus());
- this.nestedCoreException = exception;
-}
-/**
- * Creates a Java model exception for the given Java-specific status object.
- *
- * @param status the Java-specific status object
- */
-public JavaModelException(IJavaModelStatus status) {
- super(status);
-}
-/**
- * Returns the underlying Throwable that caused the failure.
- *
- * @return the wrappered Throwable, or null if the
- * direct case of the failure was at the Java model layer
- */
-public Throwable getException() {
- if (this.nestedCoreException == null) {
- return getStatus().getException();
- } else {
- return this.nestedCoreException;
+
+ /**
+ * Creates a Java model exception that wrappers the given
+ * Throwable. The exception contains a Java-specific status
+ * object with severity IStatus.ERROR and the given status
+ * code.
+ *
+ * @param exception
+ * the Throwable
+ * @param code
+ * one of the Java-specific status codes declared in
+ * IJavaModelStatusConstants
+ * @see IJavaModelStatusConstants
+ * @see org.eclipse.core.runtime.IStatus#ERROR
+ */
+ public JavaModelException(Throwable e, int code) {
+ this(new JavaModelStatus(code, e));
}
-}
-/**
- * Returns the Java model status object for this exception.
- * Equivalent to (IJavaModelStatus) getStatus().
- *
- * @return a status object
- */
-public IJavaModelStatus getJavaModelStatus() {
- IStatus status = this.getStatus();
- if (status instanceof IJavaModelStatus) {
- return (IJavaModelStatus)status;
- } else {
- // A regular IStatus is created only in the case of a CoreException.
- // See bug 13492 Should handle JavaModelExceptions that contains CoreException more gracefully
- return new JavaModelStatus(this.nestedCoreException);
+
+ /**
+ * Creates a Java model exception for the given CoreException.
+ * Equivalent to
+ * JavaModelException(exception,IJavaModelStatusConstants.CORE_EXCEPTION.
+ *
+ * @param exception
+ * the CoreException
+ */
+ public JavaModelException(CoreException exception) {
+ super(exception.getStatus());
+ this.nestedCoreException = exception;
}
-}
-/**
- * Returns whether this exception indicates that a Java model element does not
- * exist. Such exceptions have a status with a code of
- * IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST.
- * This is a convenience method.
- *
- * @return true if this exception indicates that a Java model
- * element does not exist
- * @see IJavaModelStatus#isDoesNotExist
- * @see IJavaModelStatusConstants#ELEMENT_DOES_NOT_EXIST
- */
-public boolean isDoesNotExist() {
- IJavaModelStatus javaModelStatus = getJavaModelStatus();
- return javaModelStatus != null && javaModelStatus.isDoesNotExist();
-}
-/**
- * Returns a printable representation of this exception suitable for debugging
- * purposes only.
- */
-public String toString() {
- StringBuffer buffer= new StringBuffer();
- buffer.append("Java Model Exception: "); //$NON-NLS-1$
- if (getException() != null) {
- if (getException() instanceof CoreException) {
- CoreException c= (CoreException)getException();
- buffer.append("Core Exception [code "); //$NON-NLS-1$
- buffer.append(c.getStatus().getCode());
- buffer.append("] "); //$NON-NLS-1$
- buffer.append(c.getStatus().getMessage());
+
+ /**
+ * Creates a Java model exception for the given Java-specific status object.
+ *
+ * @param status
+ * the Java-specific status object
+ */
+ public JavaModelException(IJavaModelStatus status) {
+ super(status);
+ }
+
+ /**
+ * Returns the underlying Throwable that caused the failure.
+ *
+ * @return the wrappered Throwable, or null
+ * if the direct case of the failure was at the Java model layer
+ */
+ public Throwable getException() {
+ if (this.nestedCoreException == null) {
+ return getStatus().getException();
} else {
- buffer.append(getException().toString());
+ return this.nestedCoreException;
}
- } else {
- buffer.append(getStatus().toString());
}
- return buffer.toString();
-}
+
+ /**
+ * Returns the Java model status object for this exception. Equivalent to
+ * (IJavaModelStatus) getStatus().
+ *
+ * @return a status object
+ */
+ public IJavaModelStatus getJavaModelStatus() {
+ IStatus status = this.getStatus();
+ if (status instanceof IJavaModelStatus) {
+ return (IJavaModelStatus) status;
+ } else {
+ // A regular IStatus is created only in the case of a CoreException.
+ // See bug 13492 Should handle JavaModelExceptions that contains
+ // CoreException more gracefully
+ return new JavaModelStatus(this.nestedCoreException);
+ }
+ }
+
+ /**
+ * Returns whether this exception indicates that a Java model element does
+ * not exist. Such exceptions have a status with a code of
+ * IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST. This is
+ * a convenience method.
+ *
+ * @return true if this exception indicates that a Java model
+ * element does not exist
+ * @see IJavaModelStatus#isDoesNotExist
+ * @see IJavaModelStatusConstants#ELEMENT_DOES_NOT_EXIST
+ */
+ public boolean isDoesNotExist() {
+ IJavaModelStatus javaModelStatus = getJavaModelStatus();
+ return javaModelStatus != null && javaModelStatus.isDoesNotExist();
+ }
+
+ /**
+ * Returns a printable representation of this exception suitable for
+ * debugging purposes only.
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Java Model Exception: "); //$NON-NLS-1$
+ if (getException() != null) {
+ if (getException() instanceof CoreException) {
+ CoreException c = (CoreException) getException();
+ buffer.append("Core Exception [code "); //$NON-NLS-1$
+ buffer.append(c.getStatus().getCode());
+ buffer.append("] "); //$NON-NLS-1$
+ buffer.append(c.getStatus().getMessage());
+ } else {
+ buffer.append(getException().toString());
+ }
+ } else {
+ buffer.append(getStatus().toString());
+ }
+ return buffer.toString();
+ }
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/NamingConventions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/NamingConventions.java
index 532ee06..a0c8d3e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/NamingConventions.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/NamingConventions.java
@@ -15,7 +15,6 @@ import net.sourceforge.phpdt.internal.codeassist.impl.AssistOptions;
import net.sourceforge.phpdt.internal.core.INamingRequestor;
import net.sourceforge.phpdt.internal.core.InternalNamingConventions;
-
/**
* Provides methods for computing Java-specific names.
*
@@ -24,22 +23,25 @@ import net.sourceforge.phpdt.internal.core.InternalNamingConventions;
* The possible options are :
*
*
CODEASSIST_FIELD_PREFIXES : Define the Prefixes for Field Name.
- *
CODEASSIST_STATIC_FIELD_PREFIXES : Define the Prefixes for Static Field Name.
+ *
CODEASSIST_STATIC_FIELD_PREFIXES : Define the Prefixes for Static Field
+ * Name.
*
CODEASSIST_LOCAL_PREFIXES : Define the Prefixes for Local Variable Name.
*
CODEASSIST_ARGUMENT_PREFIXES : Define the Prefixes for Argument Name.
*
CODEASSIST_FIELD_SUFFIXES : Define the Suffixes for Field Name.
- *
CODEASSIST_STATIC_FIELD_SUFFIXES : Define the Suffixes for Static Field Name.
+ *
CODEASSIST_STATIC_FIELD_SUFFIXES : Define the Suffixes for Static Field
+ * Name.
*
CODEASSIST_LOCAL_SUFFIXES : Define the Suffixes for Local Variable Name.
*
CODEASSIST_ARGUMENT_SUFFIXES : Define the Suffixes for Argument Name.
*
*
*
- * For a complete description of the configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of the configurable options, see
+ * getDefaultOptions. For programmaticaly change these options,
+ * see JavaCore#setOptions().
*
*
- * This class provides static methods and constants only; it is not intended to be
- * instantiated or subclassed by clients.
+ * This class provides static methods and constants only; it is not intended to
+ * be instantiated or subclassed by clients.
*
*
* @see JavaCore#setOptions(java.util.Hashtable)
@@ -48,132 +50,138 @@ import net.sourceforge.phpdt.internal.core.InternalNamingConventions;
*/
public final class NamingConventions {
private static final char[] GETTER_BOOL_NAME = "is".toCharArray(); //$NON-NLS-1$
+
private static final char[] GETTER_NAME = "get".toCharArray(); //$NON-NLS-1$
+
private static final char[] SETTER_NAME = "set".toCharArray(); //$NON-NLS-1$
-
+
private static class NamingRequestor implements INamingRequestor {
private final static int SIZE = 10;
-
+
// for acceptNameWithPrefixAndSuffix
private char[][] firstPrefixAndFirstSuffixResults = new char[SIZE][];
+
private int firstPrefixAndFirstSuffixResultsCount = 0;
+
private char[][] firstPrefixAndSuffixResults = new char[SIZE][];
+
private int firstPrefixAndSuffixResultsCount = 0;
+
private char[][] prefixAndFirstSuffixResults = new char[SIZE][];
+
private int prefixAndFirstSuffixResultsCount = 0;
+
private char[][] prefixAndSuffixResults = new char[SIZE][];
+
private int prefixAndSuffixResultsCount = 0;
-
+
// for acceptNameWithPrefix
private char[][] firstPrefixResults = new char[SIZE][];
+
private int firstPrefixResultsCount = 0;
+
private char[][] prefixResults = new char[SIZE][];
+
private int prefixResultsCount = 0;
-
+
// for acceptNameWithSuffix
private char[][] firstSuffixResults = new char[SIZE][];
+
private int firstSuffixResultsCount = 0;
+
private char[][] suffixResults = new char[SIZE][];
+
private int suffixResultsCount = 0;
-
+
// for acceptNameWithoutPrefixAndSuffix
private char[][] otherResults = new char[SIZE][];
+
private int otherResultsCount = 0;
- public void acceptNameWithPrefixAndSuffix(char[] name, boolean isFirstPrefix, boolean isFirstSuffix) {
- if(isFirstPrefix && isFirstSuffix) {
+
+ public void acceptNameWithPrefixAndSuffix(char[] name,
+ boolean isFirstPrefix, boolean isFirstSuffix) {
+ if (isFirstPrefix && isFirstSuffix) {
int length = this.firstPrefixAndFirstSuffixResults.length;
- if(length == this.firstPrefixAndFirstSuffixResultsCount) {
- System.arraycopy(
- this.firstPrefixAndFirstSuffixResults,
- 0,
- this.firstPrefixAndFirstSuffixResults = new char[length * 2][],
- 0,
- length);
+ if (length == this.firstPrefixAndFirstSuffixResultsCount) {
+ System
+ .arraycopy(
+ this.firstPrefixAndFirstSuffixResults,
+ 0,
+ this.firstPrefixAndFirstSuffixResults = new char[length * 2][],
+ 0, length);
}
- this.firstPrefixAndFirstSuffixResults[this.firstPrefixAndFirstSuffixResultsCount++] = name;
+ this.firstPrefixAndFirstSuffixResults[this.firstPrefixAndFirstSuffixResultsCount++] = name;
} else if (isFirstPrefix) {
int length = this.firstPrefixAndSuffixResults.length;
- if(length == this.firstPrefixAndSuffixResultsCount) {
- System.arraycopy(
- this.firstPrefixAndSuffixResults,
- 0,
- this.firstPrefixAndSuffixResults = new char[length * 2][],
- 0,
- length);
+ if (length == this.firstPrefixAndSuffixResultsCount) {
+ System
+ .arraycopy(
+ this.firstPrefixAndSuffixResults,
+ 0,
+ this.firstPrefixAndSuffixResults = new char[length * 2][],
+ 0, length);
}
this.firstPrefixAndSuffixResults[this.firstPrefixAndSuffixResultsCount++] = name;
- } else if(isFirstSuffix) {
+ } else if (isFirstSuffix) {
int length = this.prefixAndFirstSuffixResults.length;
- if(length == this.prefixAndFirstSuffixResultsCount) {
- System.arraycopy(
- this.prefixAndFirstSuffixResults,
- 0,
- this.prefixAndFirstSuffixResults = new char[length * 2][],
- 0,
- length);
+ if (length == this.prefixAndFirstSuffixResultsCount) {
+ System
+ .arraycopy(
+ this.prefixAndFirstSuffixResults,
+ 0,
+ this.prefixAndFirstSuffixResults = new char[length * 2][],
+ 0, length);
}
this.prefixAndFirstSuffixResults[this.prefixAndFirstSuffixResultsCount++] = name;
} else {
int length = this.prefixAndSuffixResults.length;
- if(length == this.prefixAndSuffixResultsCount) {
- System.arraycopy(
- this.prefixAndSuffixResults,
- 0,
- this.prefixAndSuffixResults = new char[length * 2][],
- 0,
- length);
+ if (length == this.prefixAndSuffixResultsCount) {
+ System
+ .arraycopy(
+ this.prefixAndSuffixResults,
+ 0,
+ this.prefixAndSuffixResults = new char[length * 2][],
+ 0, length);
}
this.prefixAndSuffixResults[this.prefixAndSuffixResultsCount++] = name;
}
}
public void acceptNameWithPrefix(char[] name, boolean isFirstPrefix) {
- if(isFirstPrefix) {
+ if (isFirstPrefix) {
int length = this.firstPrefixResults.length;
- if(length == this.firstPrefixResultsCount) {
- System.arraycopy(
- this.firstPrefixResults,
- 0,
- this.firstPrefixResults = new char[length * 2][],
- 0,
- length);
+ if (length == this.firstPrefixResultsCount) {
+ System.arraycopy(this.firstPrefixResults, 0,
+ this.firstPrefixResults = new char[length * 2][],
+ 0, length);
}
this.firstPrefixResults[this.firstPrefixResultsCount++] = name;
- } else{
+ } else {
int length = this.prefixResults.length;
- if(length == this.prefixResultsCount) {
- System.arraycopy(
- this.prefixResults,
- 0,
- this.prefixResults = new char[length * 2][],
- 0,
- length);
+ if (length == this.prefixResultsCount) {
+ System.arraycopy(this.prefixResults, 0,
+ this.prefixResults = new char[length * 2][], 0,
+ length);
}
this.prefixResults[this.prefixResultsCount++] = name;
}
}
public void acceptNameWithSuffix(char[] name, boolean isFirstSuffix) {
- if(isFirstSuffix) {
+ if (isFirstSuffix) {
int length = this.firstSuffixResults.length;
- if(length == this.firstSuffixResultsCount) {
- System.arraycopy(
- this.firstSuffixResults,
- 0,
- this.firstSuffixResults = new char[length * 2][],
- 0,
- length);
+ if (length == this.firstSuffixResultsCount) {
+ System.arraycopy(this.firstSuffixResults, 0,
+ this.firstSuffixResults = new char[length * 2][],
+ 0, length);
}
this.firstSuffixResults[this.firstSuffixResultsCount++] = name;
} else {
int length = this.suffixResults.length;
- if(length == this.suffixResultsCount) {
- System.arraycopy(
- this.suffixResults,
- 0,
- this.suffixResults = new char[length * 2][],
- 0,
- length);
+ if (length == this.suffixResultsCount) {
+ System.arraycopy(this.suffixResults, 0,
+ this.suffixResults = new char[length * 2][], 0,
+ length);
}
this.suffixResults[this.suffixResultsCount++] = name;
}
@@ -181,94 +189,104 @@ public final class NamingConventions {
public void acceptNameWithoutPrefixAndSuffix(char[] name) {
int length = this.otherResults.length;
- if(length == this.otherResultsCount) {
- System.arraycopy(
- this.otherResults,
- 0,
- this.otherResults = new char[length * 2][],
- 0,
- length);
+ if (length == this.otherResultsCount) {
+ System.arraycopy(this.otherResults, 0,
+ this.otherResults = new char[length * 2][], 0, length);
}
this.otherResults[this.otherResultsCount++] = name;
}
- public char[][] getResults(){
- int count =
- this.firstPrefixAndFirstSuffixResultsCount
- + this.firstPrefixAndSuffixResultsCount
- + this.prefixAndFirstSuffixResultsCount
- + this.prefixAndSuffixResultsCount
- + this.firstPrefixResultsCount
- + this.prefixResultsCount
- + this.firstSuffixResultsCount
- + this.suffixResultsCount
- + this.otherResultsCount;
-
+
+ public char[][] getResults() {
+ int count = this.firstPrefixAndFirstSuffixResultsCount
+ + this.firstPrefixAndSuffixResultsCount
+ + this.prefixAndFirstSuffixResultsCount
+ + this.prefixAndSuffixResultsCount
+ + this.firstPrefixResultsCount + this.prefixResultsCount
+ + this.firstSuffixResultsCount + this.suffixResultsCount
+ + this.otherResultsCount;
+
char[][] results = new char[count][];
-
+
int index = 0;
- System.arraycopy(this.firstPrefixAndFirstSuffixResults, 0, results, index, this.firstPrefixAndFirstSuffixResultsCount);
+ System.arraycopy(this.firstPrefixAndFirstSuffixResults, 0, results,
+ index, this.firstPrefixAndFirstSuffixResultsCount);
index += this.firstPrefixAndFirstSuffixResultsCount;
- System.arraycopy(this.firstPrefixAndSuffixResults, 0, results, index, this.firstPrefixAndSuffixResultsCount);
+ System.arraycopy(this.firstPrefixAndSuffixResults, 0, results,
+ index, this.firstPrefixAndSuffixResultsCount);
index += this.firstPrefixAndSuffixResultsCount;
- System.arraycopy(this.prefixAndFirstSuffixResults, 0, results, index, this.prefixAndFirstSuffixResultsCount);
- index += this.prefixAndFirstSuffixResultsCount;
- System.arraycopy(this.prefixAndSuffixResults, 0, results, index, this.prefixAndSuffixResultsCount);
+ System.arraycopy(this.prefixAndFirstSuffixResults, 0, results,
+ index, this.prefixAndFirstSuffixResultsCount);
+ index += this.prefixAndFirstSuffixResultsCount;
+ System.arraycopy(this.prefixAndSuffixResults, 0, results, index,
+ this.prefixAndSuffixResultsCount);
index += this.prefixAndSuffixResultsCount;
- System.arraycopy(this.firstPrefixResults, 0, results, index, this.firstPrefixResultsCount);
+ System.arraycopy(this.firstPrefixResults, 0, results, index,
+ this.firstPrefixResultsCount);
index += this.firstPrefixResultsCount;
- System.arraycopy(this.prefixResults, 0, results, index, this.prefixResultsCount);
+ System.arraycopy(this.prefixResults, 0, results, index,
+ this.prefixResultsCount);
index += this.prefixResultsCount;
- System.arraycopy(this.firstSuffixResults, 0, results, index, this.firstSuffixResultsCount);
+ System.arraycopy(this.firstSuffixResults, 0, results, index,
+ this.firstSuffixResultsCount);
index += this.firstSuffixResultsCount;
- System.arraycopy(this.suffixResults, 0, results, index, this.suffixResultsCount);
+ System.arraycopy(this.suffixResults, 0, results, index,
+ this.suffixResultsCount);
index += this.suffixResultsCount;
- System.arraycopy(this.otherResults, 0, results, index, this.otherResultsCount);
-
+ System.arraycopy(this.otherResults, 0, results, index,
+ this.otherResultsCount);
+
return results;
}
}
-
private NamingConventions() {
// Not instantiable
}
- private static char[] removePrefixAndSuffix(char[] name, char[][] prefixes, char[][] suffixes) {
+ private static char[] removePrefixAndSuffix(char[] name, char[][] prefixes,
+ char[][] suffixes) {
// remove longer prefix
char[] withoutPrefixName = name;
if (prefixes != null) {
int bestLength = 0;
- for (int i= 0; i < prefixes.length; i++) {
+ for (int i = 0; i < prefixes.length; i++) {
char[] prefix = prefixes[i];
if (CharOperation.prefixEquals(prefix, name)) {
int currLen = prefix.length;
- boolean lastCharIsLetter = Character.isLetter(prefix[currLen - 1]);
- if(!lastCharIsLetter || (lastCharIsLetter && name.length > currLen && Character.isUpperCase(name[currLen]))) {
+ boolean lastCharIsLetter = Character
+ .isLetter(prefix[currLen - 1]);
+ if (!lastCharIsLetter
+ || (lastCharIsLetter && name.length > currLen && Character
+ .isUpperCase(name[currLen]))) {
if (bestLength < currLen && name.length != currLen) {
- withoutPrefixName = CharOperation.subarray(name, currLen, name.length);
+ withoutPrefixName = CharOperation.subarray(name,
+ currLen, name.length);
bestLength = currLen;
}
}
}
}
}
-
+
// remove longer suffix
char[] withoutSuffixName = withoutPrefixName;
- if(suffixes != null) {
+ if (suffixes != null) {
int bestLength = 0;
for (int i = 0; i < suffixes.length; i++) {
char[] suffix = suffixes[i];
- if(CharOperation.endsWith(withoutPrefixName, suffix)) {
+ if (CharOperation.endsWith(withoutPrefixName, suffix)) {
int currLen = suffix.length;
- if(bestLength < currLen && withoutPrefixName.length != currLen) {
- withoutSuffixName = CharOperation.subarray(withoutPrefixName, 0, withoutPrefixName.length - currLen);
+ if (bestLength < currLen
+ && withoutPrefixName.length != currLen) {
+ withoutSuffixName = CharOperation.subarray(
+ withoutPrefixName, 0, withoutPrefixName.length
+ - currLen);
bestLength = currLen;
}
}
}
}
-
+
withoutSuffixName[0] = Character.toLowerCase(withoutSuffixName[0]);
return withoutSuffixName;
}
@@ -276,521 +294,615 @@ public final class NamingConventions {
/**
* Remove prefix and suffix from an argument name.
*
- * If argument name prefix is pre and argument name suffix is suf
- * then for an argument named preArgsuf the result of this method is arg.
- * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
- * name preArgsuf.
+ * If argument name prefix is pre and argument name suffix is
+ * suf then for an argument named preArgsuf
+ * the result of this method is arg. If there is no prefix
+ * or suffix defined in JavaCore options the result is the unchanged name
+ * preArgsuf.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_ARGUMENT_PREFIXES and
- * CODEASSIST_ARGUMENT_SUFFIXES.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_ARGUMENT_PREFIXES and CODEASSIST_ARGUMENT_SUFFIXES.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
- *
- * @param javaProject project which contains the argument.
- * @param argumentName argument's name.
+ *
+ * @param javaProject
+ * project which contains the argument.
+ * @param argumentName
+ * argument's name.
* @return char[] the name without prefix and suffix.
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static char[] removePrefixAndSuffixForArgumentName(IJavaProject javaProject, char[] argumentName) {
- AssistOptions assistOptions = new AssistOptions(javaProject.getOptions(true));
- return removePrefixAndSuffix(
- argumentName,
- assistOptions.argumentPrefixes,
- assistOptions.argumentSuffixes);
+ public static char[] removePrefixAndSuffixForArgumentName(
+ IJavaProject javaProject, char[] argumentName) {
+ AssistOptions assistOptions = new AssistOptions(javaProject
+ .getOptions(true));
+ return removePrefixAndSuffix(argumentName,
+ assistOptions.argumentPrefixes, assistOptions.argumentSuffixes);
}
-
+
/**
* Remove prefix and suffix from an argument name.
*
- * If argument name prefix is pre and argument name suffix is suf
- * then for an argument named preArgsuf the result of this method is arg.
- * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
- * name preArgsuf.
+ * If argument name prefix is pre and argument name suffix is
+ * suf then for an argument named preArgsuf
+ * the result of this method is arg. If there is no prefix
+ * or suffix defined in JavaCore options the result is the unchanged name
+ * preArgsuf.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_ARGUMENT_PREFIXES and
- * CODEASSIST_ARGUMENT_SUFFIXES.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_ARGUMENT_PREFIXES and CODEASSIST_ARGUMENT_SUFFIXES.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
- *
- * @param javaProject project which contains the argument.
- * @param argumentName argument's name.
+ *
+ * @param javaProject
+ * project which contains the argument.
+ * @param argumentName
+ * argument's name.
* @return char[] the name without prefix and suffix.
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static String removePrefixAndSuffixForArgumentName(IJavaProject javaProject, String argumentName) {
- return String.valueOf(removePrefixAndSuffixForArgumentName(javaProject, argumentName.toCharArray()));
+ public static String removePrefixAndSuffixForArgumentName(
+ IJavaProject javaProject, String argumentName) {
+ return String.valueOf(removePrefixAndSuffixForArgumentName(javaProject,
+ argumentName.toCharArray()));
}
/**
* Remove prefix and suffix from a field name.
*
- * If field name prefix is pre and field name suffix is suf
- * then for a field named preFieldsuf the result of this method is field.
- * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
- * name preFieldsuf.
+ * If field name prefix is pre and field name suffix is
+ * suf then for a field named preFieldsuf the
+ * result of this method is field. If there is no prefix or
+ * suffix defined in JavaCore options the result is the unchanged name
+ * preFieldsuf.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES,
- * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES,
- * CODEASSIST_STATIC_FIELD_SUFFIXES for static field.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_FIELD_PREFIXES, CODEASSIST_FIELD_SUFFIXES for instance field
+ * and CODEASSIST_STATIC_FIELD_PREFIXES, CODEASSIST_STATIC_FIELD_SUFFIXES
+ * for static field.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param javaProject project which contains the field.
- * @param fieldName field's name.
- * @param modifiers field's modifiers as defined by the class
- * Flags.
+ * @param javaProject
+ * project which contains the field.
+ * @param fieldName
+ * field's name.
+ * @param modifiers
+ * field's modifiers as defined by the class Flags.
* @return char[] the name without prefix and suffix.
* @see Flags
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static char[] removePrefixAndSuffixForFieldName(IJavaProject javaProject, char[] fieldName, int modifiers) {
+ public static char[] removePrefixAndSuffixForFieldName(
+ IJavaProject javaProject, char[] fieldName, int modifiers) {
boolean isStatic = Flags.isStatic(modifiers);
- AssistOptions assistOptions = new AssistOptions(javaProject.getOptions(true));
- return removePrefixAndSuffix(
- fieldName,
- isStatic ? assistOptions.staticFieldPrefixes : assistOptions.fieldPrefixes,
- isStatic ? assistOptions.staticFieldSuffixes : assistOptions.fieldSuffixes);
+ AssistOptions assistOptions = new AssistOptions(javaProject
+ .getOptions(true));
+ return removePrefixAndSuffix(fieldName,
+ isStatic ? assistOptions.staticFieldPrefixes
+ : assistOptions.fieldPrefixes,
+ isStatic ? assistOptions.staticFieldSuffixes
+ : assistOptions.fieldSuffixes);
}
/**
* Remove prefix and suffix from a field name.
*
- * If field name prefix is pre and field name suffix is suf
- * then for a field named preFieldsuf the result of this method is field.
- * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
- * name preFieldsuf.
+ * If field name prefix is pre and field name suffix is
+ * suf then for a field named preFieldsuf the
+ * result of this method is field. If there is no prefix or
+ * suffix defined in JavaCore options the result is the unchanged name
+ * preFieldsuf.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES,
- * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES,
- * CODEASSIST_STATIC_FIELD_SUFFIXES for static field.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_FIELD_PREFIXES, CODEASSIST_FIELD_SUFFIXES for instance field
+ * and CODEASSIST_STATIC_FIELD_PREFIXES, CODEASSIST_STATIC_FIELD_SUFFIXES
+ * for static field.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param javaProject project which contains the field.
- * @param fieldName field's name.
- * @param modifiers field's modifiers as defined by the class
- * Flags.
+ * @param javaProject
+ * project which contains the field.
+ * @param fieldName
+ * field's name.
+ * @param modifiers
+ * field's modifiers as defined by the class Flags.
* @return char[] the name without prefix and suffix.
* @see Flags
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static String removePrefixAndSuffixForFieldName(IJavaProject javaProject, String fieldName, int modifiers) {
- return String.valueOf(removePrefixAndSuffixForFieldName(javaProject, fieldName.toCharArray(), modifiers));
+ public static String removePrefixAndSuffixForFieldName(
+ IJavaProject javaProject, String fieldName, int modifiers) {
+ return String.valueOf(removePrefixAndSuffixForFieldName(javaProject,
+ fieldName.toCharArray(), modifiers));
}
+
/**
* Remove prefix and suffix from a local variable name.
*
- * If local variable name prefix is pre and local variable name suffix is suf
- * then for a local variable named preLocalsuf the result of this method is local.
- * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
- * name preLocalsuf.
+ * If local variable name prefix is pre and local variable
+ * name suffix is suf then for a local variable named
+ * preLocalsuf the result of this method is
+ * local. If there is no prefix or suffix defined in
+ * JavaCore options the result is the unchanged name
+ * preLocalsuf.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_LOCAL_PREFIXES and
- * CODEASSIST_LOCAL_SUFFIXES.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_LOCAL_PREFIXES and CODEASSIST_LOCAL_SUFFIXES.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param javaProject project which contains the variable.
- * @param localName variable's name.
+ * @param javaProject
+ * project which contains the variable.
+ * @param localName
+ * variable's name.
* @return char[] the name without prefix and suffix.
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static char[] removePrefixAndSuffixForLocalVariableName(IJavaProject javaProject, char[] localName) {
- AssistOptions assistOptions = new AssistOptions(javaProject.getOptions(true));
- return removePrefixAndSuffix(
- localName,
- assistOptions.argumentPrefixes,
- assistOptions.argumentSuffixes);
+ public static char[] removePrefixAndSuffixForLocalVariableName(
+ IJavaProject javaProject, char[] localName) {
+ AssistOptions assistOptions = new AssistOptions(javaProject
+ .getOptions(true));
+ return removePrefixAndSuffix(localName, assistOptions.argumentPrefixes,
+ assistOptions.argumentSuffixes);
}
-
+
/**
* Remove prefix and suffix from a local variable name.
*
- * If local variable name prefix is pre and local variable name suffix is suf
- * then for a local variable named preLocalsuf the result of this method is local.
- * If there is no prefix or suffix defined in JavaCore options the result is the unchanged
- * name preLocalsuf.
+ * If local variable name prefix is pre and local variable
+ * name suffix is suf then for a local variable named
+ * preLocalsuf the result of this method is
+ * local. If there is no prefix or suffix defined in
+ * JavaCore options the result is the unchanged name
+ * preLocalsuf.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_LOCAL_PREFIXES and
- * CODEASSIST_LOCAL_SUFFIXES.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_LOCAL_PREFIXES and CODEASSIST_LOCAL_SUFFIXES.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param javaProject project which contains the variable.
- * @param localName variable's name.
+ * @param javaProject
+ * project which contains the variable.
+ * @param localName
+ * variable's name.
* @return char[] the name without prefix and suffix.
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static String removePrefixAndSuffixForLocalVariableName(IJavaProject javaProject, String localName) {
- return String.valueOf(removePrefixAndSuffixForLocalVariableName(javaProject, localName.toCharArray()));
+ public static String removePrefixAndSuffixForLocalVariableName(
+ IJavaProject javaProject, String localName) {
+ return String.valueOf(removePrefixAndSuffixForLocalVariableName(
+ javaProject, localName.toCharArray()));
}
/**
* Suggest names for an argument. The name is computed from argument's type
* and possible prefixes or suffixes are added.
*
- * If the type of the argument is TypeName, the prefix for argument is pre
- * and the suffix for argument is suf then the proposed names are preTypeNamesuf
- * and preNamesuf. If there is no prefix or suffix the proposals are typeName
- * and name.
+ * If the type of the argument is TypeName, the prefix for
+ * argument is pre and the suffix for argument is
+ * suf then the proposed names are
+ * preTypeNamesuf and preNamesuf. If there is
+ * no prefix or suffix the proposals are typeName and
+ * name.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_ARGUMENT_PREFIXES and
- * CODEASSIST_ARGUMENT_SUFFIXES.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_ARGUMENT_PREFIXES and CODEASSIST_ARGUMENT_SUFFIXES.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param javaProject project which contains the argument.
- * @param packageName package of the argument's type.
- * @param qualifiedTypeName argument's type.
- * @param dim argument's dimension (0 if the argument is not an array).
- * @param excludedNames a list of names which cannot be suggested (already used names).
- * Can be null if there is no excluded names.
+ * @param javaProject
+ * project which contains the argument.
+ * @param packageName
+ * package of the argument's type.
+ * @param qualifiedTypeName
+ * argument's type.
+ * @param dim
+ * argument's dimension (0 if the argument is not an array).
+ * @param excludedNames
+ * a list of names which cannot be suggested (already used
+ * names). Can be null if there is no excluded
+ * names.
* @return char[][] an array of names.
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static char[][] suggestArgumentNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, char[][] excludedNames) {
+ public static char[][] suggestArgumentNames(IJavaProject javaProject,
+ char[] packageName, char[] qualifiedTypeName, int dim,
+ char[][] excludedNames) {
NamingRequestor requestor = new NamingRequestor();
- InternalNamingConventions.suggestArgumentNames(
- javaProject,
- packageName,
- qualifiedTypeName,
- dim,
- excludedNames,
- requestor);
+ InternalNamingConventions.suggestArgumentNames(javaProject,
+ packageName, qualifiedTypeName, dim, excludedNames, requestor);
return requestor.getResults();
}
-
+
/**
* Suggest names for an argument. The name is computed from argument's type
* and possible prefixes or suffixes are added.
*
- * If the type of the argument is TypeName, the prefix for argument is pre
- * and the suffix for argument is suf then the proposed names are preTypeNamesuf
- * and preNamesuf. If there is no prefix or suffix the proposals are typeName
- * and name.
+ * If the type of the argument is TypeName, the prefix for
+ * argument is pre and the suffix for argument is
+ * suf then the proposed names are
+ * preTypeNamesuf and preNamesuf. If there is
+ * no prefix or suffix the proposals are typeName and
+ * name.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_ARGUMENT_PREFIXES and
- * CODEASSIST_ARGUMENT_SUFFIXES.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_ARGUMENT_PREFIXES and CODEASSIST_ARGUMENT_SUFFIXES.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param javaProject project which contains the argument.
- * @param packageName package of the argument's type.
- * @param qualifiedTypeName argument's type.
- * @param dim argument's dimension (0 if the argument is not an array).
- * @param excludedNames a list of names which cannot be suggested (already used names).
- * Can be null if there is no excluded names.
+ * @param javaProject
+ * project which contains the argument.
+ * @param packageName
+ * package of the argument's type.
+ * @param qualifiedTypeName
+ * argument's type.
+ * @param dim
+ * argument's dimension (0 if the argument is not an array).
+ * @param excludedNames
+ * a list of names which cannot be suggested (already used
+ * names). Can be null if there is no excluded
+ * names.
* @return char[][] an array of names.
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static String[] suggestArgumentNames(IJavaProject javaProject, String packageName, String qualifiedTypeName, int dim, String[] excludedNames) {
- return convertCharsToString(
- suggestArgumentNames(
- javaProject,
- packageName.toCharArray(),
- qualifiedTypeName.toCharArray(),
- dim,
- convertStringToChars(excludedNames)));
+ public static String[] suggestArgumentNames(IJavaProject javaProject,
+ String packageName, String qualifiedTypeName, int dim,
+ String[] excludedNames) {
+ return convertCharsToString(suggestArgumentNames(javaProject,
+ packageName.toCharArray(), qualifiedTypeName.toCharArray(),
+ dim, convertStringToChars(excludedNames)));
}
+
/**
- * Suggest names for a field. The name is computed from field's type
- * and possible prefixes or suffixes are added.
+ * Suggest names for a field. The name is computed from field's type and
+ * possible prefixes or suffixes are added.
*
- * If the type of the field is TypeName, the prefix for field is pre
- * and the suffix for field is suf then the proposed names are preTypeNamesuf
- * and preNamesuf. If there is no prefix or suffix the proposals are typeName
- * and name.
+ * If the type of the field is TypeName, the prefix for
+ * field is pre and the suffix for field is suf
+ * then the proposed names are preTypeNamesuf and
+ * preNamesuf. If there is no prefix or suffix the proposals
+ * are typeName and name.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES,
- * CODEASSIST_FIELD_SUFFIXES and for instance field and CODEASSIST_STATIC_FIELD_PREFIXES,
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_FIELD_PREFIXES, CODEASSIST_FIELD_SUFFIXES and for instance
+ * field and CODEASSIST_STATIC_FIELD_PREFIXES,
* CODEASSIST_STATIC_FIELD_SUFFIXES for static field.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param javaProject project which contains the field.
- * @param packageName package of the field's type.
- * @param qualifiedTypeName field's type.
- * @param dim field's dimension (0 if the field is not an array).
- * @param modifiers field's modifiers as defined by the class
- * Flags.
- * @param excludedNames a list of names which cannot be suggested (already used names).
- * Can be null if there is no excluded names.
+ * @param javaProject
+ * project which contains the field.
+ * @param packageName
+ * package of the field's type.
+ * @param qualifiedTypeName
+ * field's type.
+ * @param dim
+ * field's dimension (0 if the field is not an array).
+ * @param modifiers
+ * field's modifiers as defined by the class Flags.
+ * @param excludedNames
+ * a list of names which cannot be suggested (already used
+ * names). Can be null if there is no excluded
+ * names.
* @return char[][] an array of names.
* @see Flags
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static char[][] suggestFieldNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, int modifiers, char[][] excludedNames) {
+ public static char[][] suggestFieldNames(IJavaProject javaProject,
+ char[] packageName, char[] qualifiedTypeName, int dim,
+ int modifiers, char[][] excludedNames) {
NamingRequestor requestor = new NamingRequestor();
- InternalNamingConventions.suggestFieldNames(
- javaProject,
- packageName,
- qualifiedTypeName,
- dim,
- modifiers,
- excludedNames,
- requestor);
+ InternalNamingConventions.suggestFieldNames(javaProject, packageName,
+ qualifiedTypeName, dim, modifiers, excludedNames, requestor);
return requestor.getResults();
}
-
+
/**
- * Suggest names for a field. The name is computed from field's type
- * and possible prefixes or suffixes are added.
+ * Suggest names for a field. The name is computed from field's type and
+ * possible prefixes or suffixes are added.
*
- * If the type of the field is TypeName, the prefix for field is pre
- * and the suffix for field is suf then the proposed names are preTypeNamesuf
- * and preNamesuf. If there is no prefix or suffix the proposals are typeName
- * and name.
+ * If the type of the field is TypeName, the prefix for
+ * field is pre and the suffix for field is suf
+ * then the proposed names are preTypeNamesuf and
+ * preNamesuf. If there is no prefix or suffix the proposals
+ * are typeName and name.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES,
- * CODEASSIST_FIELD_SUFFIXES and for instance field and CODEASSIST_STATIC_FIELD_PREFIXES,
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_FIELD_PREFIXES, CODEASSIST_FIELD_SUFFIXES and for instance
+ * field and CODEASSIST_STATIC_FIELD_PREFIXES,
* CODEASSIST_STATIC_FIELD_SUFFIXES for static field.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param javaProject project which contains the field.
- * @param packageName package of the field's type.
- * @param qualifiedTypeName field's type.
- * @param dim field's dimension (0 if the field is not an array).
- * @param modifiers field's modifiers as defined by the class
- * Flags.
- * @param excludedNames a list of names which cannot be suggested (already used names).
- * Can be null if there is no excluded names.
+ * @param javaProject
+ * project which contains the field.
+ * @param packageName
+ * package of the field's type.
+ * @param qualifiedTypeName
+ * field's type.
+ * @param dim
+ * field's dimension (0 if the field is not an array).
+ * @param modifiers
+ * field's modifiers as defined by the class Flags.
+ * @param excludedNames
+ * a list of names which cannot be suggested (already used
+ * names). Can be null if there is no excluded
+ * names.
* @return char[][] an array of names.
* @see Flags
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static String[] suggestFieldNames(IJavaProject javaProject, String packageName, String qualifiedTypeName, int dim, int modifiers, String[] excludedNames) {
- return convertCharsToString(
- suggestFieldNames(
- javaProject,
- packageName.toCharArray(),
- qualifiedTypeName.toCharArray(),
- dim,
- modifiers,
- convertStringToChars(excludedNames)));
+ public static String[] suggestFieldNames(IJavaProject javaProject,
+ String packageName, String qualifiedTypeName, int dim,
+ int modifiers, String[] excludedNames) {
+ return convertCharsToString(suggestFieldNames(javaProject, packageName
+ .toCharArray(), qualifiedTypeName.toCharArray(), dim,
+ modifiers, convertStringToChars(excludedNames)));
}
-
+
/**
- * Suggest names for a local variable. The name is computed from variable's type
- * and possible prefixes or suffixes are added.
+ * Suggest names for a local variable. The name is computed from variable's
+ * type and possible prefixes or suffixes are added.
*
- * If the type of the local variable is TypeName, the prefix for local variable is pre
- * and the suffix for local variable is suf then the proposed names are preTypeNamesuf
- * and preNamesuf. If there is no prefix or suffix the proposals are typeName
- * and name.
+ * If the type of the local variable is TypeName, the prefix
+ * for local variable is pre and the suffix for local
+ * variable is suf then the proposed names are
+ * preTypeNamesuf and preNamesuf. If there is
+ * no prefix or suffix the proposals are typeName and
+ * name.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_LOCAL_PREFIXES and
- * CODEASSIST_LOCAL_SUFFIXES.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_LOCAL_PREFIXES and CODEASSIST_LOCAL_SUFFIXES.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param javaProject project which contains the variable.
- * @param packageName package of the variable's type.
- * @param qualifiedTypeName variable's type.
- * @param dim variable's dimension (0 if the variable is not an array).
- * @param excludedNames a list of names which cannot be suggested (already used names).
- * Can be null if there is no excluded names.
+ * @param javaProject
+ * project which contains the variable.
+ * @param packageName
+ * package of the variable's type.
+ * @param qualifiedTypeName
+ * variable's type.
+ * @param dim
+ * variable's dimension (0 if the variable is not an array).
+ * @param excludedNames
+ * a list of names which cannot be suggested (already used
+ * names). Can be null if there is no excluded
+ * names.
* @return char[][] an array of names.
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static char[][] suggestLocalVariableNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, char[][] excludedNames) {
+ public static char[][] suggestLocalVariableNames(IJavaProject javaProject,
+ char[] packageName, char[] qualifiedTypeName, int dim,
+ char[][] excludedNames) {
NamingRequestor requestor = new NamingRequestor();
- InternalNamingConventions.suggestLocalVariableNames(
- javaProject,
- packageName,
- qualifiedTypeName,
- dim,
- excludedNames,
- requestor);
+ InternalNamingConventions.suggestLocalVariableNames(javaProject,
+ packageName, qualifiedTypeName, dim, excludedNames, requestor);
return requestor.getResults();
}
-
+
/**
- * Suggest names for a local variable. The name is computed from variable's type
- * and possible prefixes or suffixes are added.
+ * Suggest names for a local variable. The name is computed from variable's
+ * type and possible prefixes or suffixes are added.
*
- * If the type of the local variable is TypeName, the prefix for local variable is pre
- * and the suffix for local variable is suf then the proposed names are preTypeNamesuf
- * and preNamesuf. If there is no prefix or suffix the proposals are typeName
- * and name.
+ * If the type of the local variable is TypeName, the prefix
+ * for local variable is pre and the suffix for local
+ * variable is suf then the proposed names are
+ * preTypeNamesuf and preNamesuf. If there is
+ * no prefix or suffix the proposals are typeName and
+ * name.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_LOCAL_PREFIXES and
- * CODEASSIST_LOCAL_SUFFIXES.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_LOCAL_PREFIXES and CODEASSIST_LOCAL_SUFFIXES.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param javaProject project which contains the variable.
- * @param packageName package of the variable's type.
- * @param qualifiedTypeName variable's type.
- * @param dim variable's dimension (0 if the variable is not an array).
- * @param excludedNames a list of names which cannot be suggested (already used names).
- * Can be null if there is no excluded names.
+ * @param javaProject
+ * project which contains the variable.
+ * @param packageName
+ * package of the variable's type.
+ * @param qualifiedTypeName
+ * variable's type.
+ * @param dim
+ * variable's dimension (0 if the variable is not an array).
+ * @param excludedNames
+ * a list of names which cannot be suggested (already used
+ * names). Can be null if there is no excluded
+ * names.
* @return char[][] an array of names.
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static String[] suggestLocalVariableNames(IJavaProject javaProject, String packageName, String qualifiedTypeName, int dim, String[] excludedNames) {
- return convertCharsToString(
- suggestLocalVariableNames(
- javaProject,
- packageName.toCharArray(),
- qualifiedTypeName.toCharArray(),
- dim,
- convertStringToChars(excludedNames)));
+ public static String[] suggestLocalVariableNames(IJavaProject javaProject,
+ String packageName, String qualifiedTypeName, int dim,
+ String[] excludedNames) {
+ return convertCharsToString(suggestLocalVariableNames(javaProject,
+ packageName.toCharArray(), qualifiedTypeName.toCharArray(),
+ dim, convertStringToChars(excludedNames)));
}
-
+
/**
* Suggest name for a getter method. The name is computed from field's name
* and possible prefixes or suffixes are removed.
*
- * If the field name is preFieldNamesuf and the prefix for field is pre and
- * the suffix for field is suf then the prosposed name is isFieldName for boolean field or
- * getFieldName for others. If there is no prefix and suffix the proposal is isPreFieldNamesuf
- * for boolean field or getPreFieldNamesuf for others.
+ * If the field name is preFieldNamesuf and the prefix for
+ * field is pre and the suffix for field is suf
+ * then the prosposed name is isFieldName for boolean field
+ * or getFieldName for others. If there is no prefix and
+ * suffix the proposal is isPreFieldNamesuf for boolean field
+ * or getPreFieldNamesuf for others.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES,
- * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES,
- * CODEASSIST_STATIC_FIELD_SUFFIXES for static field.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_FIELD_PREFIXES, CODEASSIST_FIELD_SUFFIXES for instance field
+ * and CODEASSIST_STATIC_FIELD_PREFIXES, CODEASSIST_STATIC_FIELD_SUFFIXES
+ * for static field.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param project project which contains the field.
- * @param fieldName field's name's.
- * @param modifiers field's modifiers as defined by the class
- * Flags.
- * @param isBoolean true if the field's type is boolean
- * @param excludedNames a list of names which cannot be suggested (already used names).
- * Can be null if there is no excluded names.
+ * @param project
+ * project which contains the field.
+ * @param fieldName
+ * field's name's.
+ * @param modifiers
+ * field's modifiers as defined by the class Flags.
+ * @param isBoolean
+ * true if the field's type is boolean
+ * @param excludedNames
+ * a list of names which cannot be suggested (already used
+ * names). Can be null if there is no excluded
+ * names.
* @return char[] a name.
* @see Flags
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static char[] suggestGetterName(IJavaProject project, char[] fieldName, int modifiers, boolean isBoolean, char[][] excludedNames) {
+ public static char[] suggestGetterName(IJavaProject project,
+ char[] fieldName, int modifiers, boolean isBoolean,
+ char[][] excludedNames) {
if (isBoolean) {
- char[] name = removePrefixAndSuffixForFieldName(project, fieldName, modifiers);
- int prefixLen = GETTER_BOOL_NAME.length;
- if (CharOperation.prefixEquals(GETTER_BOOL_NAME, name)
- && name.length > prefixLen && Character.isUpperCase(name[prefixLen])) {
+ char[] name = removePrefixAndSuffixForFieldName(project, fieldName,
+ modifiers);
+ int prefixLen = GETTER_BOOL_NAME.length;
+ if (CharOperation.prefixEquals(GETTER_BOOL_NAME, name)
+ && name.length > prefixLen
+ && Character.isUpperCase(name[prefixLen])) {
return suggestNewName(name, excludedNames);
} else {
- return suggestNewName(
- CharOperation.concat(GETTER_BOOL_NAME, suggestAccessorName(project, fieldName, modifiers)),
- excludedNames
- );
+ return suggestNewName(CharOperation.concat(GETTER_BOOL_NAME,
+ suggestAccessorName(project, fieldName, modifiers)),
+ excludedNames);
}
} else {
- return suggestNewName(
- CharOperation.concat(GETTER_NAME, suggestAccessorName(project, fieldName, modifiers)),
- excludedNames
- );
+ return suggestNewName(CharOperation.concat(GETTER_NAME,
+ suggestAccessorName(project, fieldName, modifiers)),
+ excludedNames);
}
}
-
+
/**
* Suggest name for a getter method. The name is computed from field's name
* and possible prefixes or suffixes are removed.
*
- * If the field name is preFieldNamesuf and the prefix for field is pre and
- * the suffix for field is suf then the prosposed name is isFieldName for boolean field or
- * getFieldName for others. If there is no prefix and suffix the proposal is isPreFieldNamesuf
- * for boolean field or getPreFieldNamesuf for others.
+ * If the field name is preFieldNamesuf and the prefix for
+ * field is pre and the suffix for field is suf
+ * then the prosposed name is isFieldName for boolean field
+ * or getFieldName for others. If there is no prefix and
+ * suffix the proposal is isPreFieldNamesuf for boolean field
+ * or getPreFieldNamesuf for others.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES,
- * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES,
- * CODEASSIST_STATIC_FIELD_SUFFIXES for static field.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_FIELD_PREFIXES, CODEASSIST_FIELD_SUFFIXES for instance field
+ * and CODEASSIST_STATIC_FIELD_PREFIXES, CODEASSIST_STATIC_FIELD_SUFFIXES
+ * for static field.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param project project which contains the field.
- * @param fieldName field's name's.
- * @param modifiers field's modifiers as defined by the class
- * Flags.
- * @param isBoolean true if the field's type is boolean
- * @param excludedNames a list of names which cannot be suggested (already used names).
- * Can be null if there is no excluded names.
+ * @param project
+ * project which contains the field.
+ * @param fieldName
+ * field's name's.
+ * @param modifiers
+ * field's modifiers as defined by the class Flags.
+ * @param isBoolean
+ * true if the field's type is boolean
+ * @param excludedNames
+ * a list of names which cannot be suggested (already used
+ * names). Can be null if there is no excluded
+ * names.
* @return char[] a name.
* @see Flags
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static String suggestGetterName(IJavaProject project, String fieldName, int modifiers, boolean isBoolean, String[] excludedNames) {
- return String.valueOf(
- suggestGetterName(
- project,
- fieldName.toCharArray(),
- modifiers,
- isBoolean,
+ public static String suggestGetterName(IJavaProject project,
+ String fieldName, int modifiers, boolean isBoolean,
+ String[] excludedNames) {
+ return String.valueOf(suggestGetterName(project, fieldName
+ .toCharArray(), modifiers, isBoolean,
convertStringToChars(excludedNames)));
}
@@ -798,117 +910,135 @@ public final class NamingConventions {
* Suggest name for a setter method. The name is computed from field's name
* and possible prefixes or suffixes are removed.
*
- * If the field name is preFieldNamesuf and the prefix for field is pre and
- * the suffix for field is suf then the proposed name is setFieldName.
- * If there is no prefix and suffix the proposal is setPreFieldNamesuf.
+ * If the field name is preFieldNamesuf and the prefix for
+ * field is pre and the suffix for field is suf
+ * then the proposed name is setFieldName. If there is no
+ * prefix and suffix the proposal is setPreFieldNamesuf.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES,
- * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES,
- * CODEASSIST_STATIC_FIELD_SUFFIXES for static field.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_FIELD_PREFIXES, CODEASSIST_FIELD_SUFFIXES for instance field
+ * and CODEASSIST_STATIC_FIELD_PREFIXES, CODEASSIST_STATIC_FIELD_SUFFIXES
+ * for static field.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param project project which contains the field.
- * @param fieldName field's name's.
- * @param modifiers field's modifiers as defined by the class
- * Flags.
- * @param isBoolean true if the field's type is boolean
- * @param excludedNames a list of names which cannot be suggested (already used names).
- * Can be null if there is no excluded names.
+ * @param project
+ * project which contains the field.
+ * @param fieldName
+ * field's name's.
+ * @param modifiers
+ * field's modifiers as defined by the class Flags.
+ * @param isBoolean
+ * true if the field's type is boolean
+ * @param excludedNames
+ * a list of names which cannot be suggested (already used
+ * names). Can be null if there is no excluded
+ * names.
* @return char[] a name.
* @see Flags
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static char[] suggestSetterName(IJavaProject project, char[] fieldName, int modifiers, boolean isBoolean, char[][] excludedNames) {
+ public static char[] suggestSetterName(IJavaProject project,
+ char[] fieldName, int modifiers, boolean isBoolean,
+ char[][] excludedNames) {
if (isBoolean) {
- char[] name = removePrefixAndSuffixForFieldName(project, fieldName, modifiers);
- int prefixLen = GETTER_BOOL_NAME.length;
- if (CharOperation.prefixEquals(GETTER_BOOL_NAME, name)
- && name.length > prefixLen && Character.isUpperCase(name[prefixLen])) {
+ char[] name = removePrefixAndSuffixForFieldName(project, fieldName,
+ modifiers);
+ int prefixLen = GETTER_BOOL_NAME.length;
+ if (CharOperation.prefixEquals(GETTER_BOOL_NAME, name)
+ && name.length > prefixLen
+ && Character.isUpperCase(name[prefixLen])) {
name = CharOperation.subarray(name, prefixLen, name.length);
- return suggestNewName(
- CharOperation.concat(SETTER_NAME, suggestAccessorName(project, name, modifiers)),
- excludedNames
- );
+ return suggestNewName(CharOperation.concat(SETTER_NAME,
+ suggestAccessorName(project, name, modifiers)),
+ excludedNames);
} else {
- return suggestNewName(
- CharOperation.concat(SETTER_NAME, suggestAccessorName(project, fieldName, modifiers)),
- excludedNames
- );
+ return suggestNewName(CharOperation.concat(SETTER_NAME,
+ suggestAccessorName(project, fieldName, modifiers)),
+ excludedNames);
}
} else {
- return suggestNewName(
- CharOperation.concat(SETTER_NAME, suggestAccessorName(project, fieldName, modifiers)),
- excludedNames
- );
+ return suggestNewName(CharOperation.concat(SETTER_NAME,
+ suggestAccessorName(project, fieldName, modifiers)),
+ excludedNames);
}
}
-
+
/**
* Suggest name for a setter method. The name is computed from field's name
* and possible prefixes or suffixes are removed.
*
- * If the field name is preFieldNamesuf and the prefix for field is pre and
- * the suffix for field is suf then the proposed name is setFieldName.
- * If there is no prefix and suffix the proposal is setPreFieldNamesuf.
+ * If the field name is preFieldNamesuf and the prefix for
+ * field is pre and the suffix for field is suf
+ * then the proposed name is setFieldName. If there is no
+ * prefix and suffix the proposal is setPreFieldNamesuf.
*
*
- * This method is affected by the following JavaCore options : CODEASSIST_FIELD_PREFIXES,
- * CODEASSIST_FIELD_SUFFIXES for instance field and CODEASSIST_STATIC_FIELD_PREFIXES,
- * CODEASSIST_STATIC_FIELD_SUFFIXES for static field.
+ * This method is affected by the following JavaCore options :
+ * CODEASSIST_FIELD_PREFIXES, CODEASSIST_FIELD_SUFFIXES for instance field
+ * and CODEASSIST_STATIC_FIELD_PREFIXES, CODEASSIST_STATIC_FIELD_SUFFIXES
+ * for static field.
*
*
- * For a complete description of these configurable options, see getDefaultOptions.
- * For programmaticaly change these options, see JavaCore#setOptions().
+ * For a complete description of these configurable options, see
+ * getDefaultOptions. For programmaticaly change these
+ * options, see JavaCore#setOptions().
*
*
- * @param project project which contains the field.
- * @param fieldName field's name's.
- * @param modifiers field's modifiers as defined by the class
- * Flags.
- * @param isBoolean true if the field's type is boolean
- * @param excludedNames a list of names which cannot be suggested (already used names).
- * Can be null if there is no excluded names.
+ * @param project
+ * project which contains the field.
+ * @param fieldName
+ * field's name's.
+ * @param modifiers
+ * field's modifiers as defined by the class Flags.
+ * @param isBoolean
+ * true if the field's type is boolean
+ * @param excludedNames
+ * a list of names which cannot be suggested (already used
+ * names). Can be null if there is no excluded
+ * names.
* @return char[] a name.
* @see Flags
* @see JavaCore#setOptions(java.util.Hashtable)
* @see JavaCore#getDefaultOptions()
*/
- public static String suggestSetterName(IJavaProject project, String fieldName, int modifiers, boolean isBoolean, String[] excludedNames) {
- return String.valueOf(
- suggestSetterName(
- project,
- fieldName.toCharArray(),
- modifiers,
- isBoolean,
+ public static String suggestSetterName(IJavaProject project,
+ String fieldName, int modifiers, boolean isBoolean,
+ String[] excludedNames) {
+ return String.valueOf(suggestSetterName(project, fieldName
+ .toCharArray(), modifiers, isBoolean,
convertStringToChars(excludedNames)));
}
-
- private static char[] suggestAccessorName(IJavaProject project, char[] fieldName, int modifiers) {
- char[] name = removePrefixAndSuffixForFieldName(project, fieldName, modifiers);
+
+ private static char[] suggestAccessorName(IJavaProject project,
+ char[] fieldName, int modifiers) {
+ char[] name = removePrefixAndSuffixForFieldName(project, fieldName,
+ modifiers);
if (name.length > 0 && Character.isLowerCase(name[0])) {
name[0] = Character.toUpperCase(name[0]);
}
return name;
}
-
- private static char[] suggestNewName(char[] name, char[][] excludedNames){
- if(excludedNames == null) {
+
+ private static char[] suggestNewName(char[] name, char[][] excludedNames) {
+ if (excludedNames == null) {
return name;
}
-
+
char[] newName = name;
int count = 2;
int i = 0;
while (i < excludedNames.length) {
- if(CharOperation.equals(newName, excludedNames[i], false)) {
- newName = CharOperation.concat(name, String.valueOf(count++).toCharArray());
+ if (CharOperation.equals(newName, excludedNames[i], false)) {
+ newName = CharOperation.concat(name, String.valueOf(count++)
+ .toCharArray());
i = 0;
} else {
i++;
@@ -916,7 +1046,7 @@ public final class NamingConventions {
}
return newName;
}
-
+
private static String[] convertCharsToString(char[][] c) {
int length = c == null ? 0 : c.length;
String[] s = new String[length];
@@ -925,12 +1055,12 @@ public final class NamingConventions {
}
return s;
}
-
+
private static char[][] convertStringToChars(String[] s) {
int length = s == null ? 0 : s.length;
char[][] c = new char[length][];
for (int i = 0; i < length; i++) {
- if(s[i] == null) {
+ if (s[i] == null) {
c[i] = CharOperation.NO_CHAR;
} else {
c[i] = s[i].toCharArray();
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Signature.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Signature.java
index de4c360..c9f8da2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Signature.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/Signature.java
@@ -16,50 +16,58 @@ import net.sourceforge.phpdt.core.compiler.CharOperation;
* Provides methods for encoding and decoding type and method signature strings.
*
* The syntax for a type signature is:
+ *
*
- * typeSignature ::=
- * "B" // byte
- * | "C" // char
- * | "D" // double
- * | "F" // float
- * | "I" // int
- * | "J" // long
- * | "S" // short
- * | "V" // void
- * | "Z" // boolean
- * | "L" + binaryTypeName + ";" // resolved named type (in compiled code)
- * | "Q" + sourceTypeName + ";" // unresolved named type (in source code)
- * | "[" + typeSignature // array of type denoted by typeSignature
+ * typeSignature ::=
+ * "B" // byte
+ * | "C" // char
+ * | "D" // double
+ * | "F" // float
+ * | "I" // int
+ * | "J" // long
+ * | "S" // short
+ * | "V" // void
+ * | "Z" // boolean
+ * | "L" + binaryTypeName + ";" // resolved named type (in compiled code)
+ * | "Q" + sourceTypeName + ";" // unresolved named type (in source code)
+ * | "[" + typeSignature // array of type denoted by typeSignature
*
+ *
*
*
* Examples:
*
- *
"[[I" denotes int[][]
- *
"Ljava.lang.String;" denotes java.lang.String in compiled code
- *
"QString" denotes String in source code
- *
"Qjava.lang.String" denotes java.lang.String in source code
- *
"[QString" denotes String[] in source code
+ *
"[[I" denotes int[][]
+ *
"Ljava.lang.String;" denotes
+ * java.lang.String in compiled code
+ *
"QString" denotes String in source code
+ *
"Qjava.lang.String" denotes java.lang.String
+ * in source code
"([Ljava.lang.String;)V" denotes void foo(java.lang.String[]) in compiled code
- *
"(QString;)QObject;" denotes Object foo(String) in source code
+ *
"()I" denotes int foo()
+ *
"([Ljava.lang.String;)V" denotes
+ * void foo(java.lang.String[]) in compiled code
+ *
"(QString;)QObject;" denotes
+ * Object foo(String) in source code
*
*
*
- * This class provides static methods and constants only; it is not intended to be
- * instantiated or subclassed by clients.
+ * This class provides static methods and constants only; it is not intended to
+ * be instantiated or subclassed by clients.
*
*/
public final class Signature {
@@ -68,1069 +76,1221 @@ public final class Signature {
* Character constant indicating the primitive type boolean in a signature.
* Value is 'Z'.
*/
- public static final char C_BOOLEAN = 'Z';
+ public static final char C_BOOLEAN = 'Z';
/**
* Character constant indicating the primitive type byte in a signature.
* Value is 'B'.
*/
- public static final char C_BYTE = 'B';
+ public static final char C_BYTE = 'B';
/**
* Character constant indicating the primitive type char in a signature.
* Value is 'C'.
*/
- public static final char C_CHAR = 'C';
+ public static final char C_CHAR = 'C';
/**
* Character constant indicating the primitive type double in a signature.
* Value is 'D'.
*/
- public static final char C_DOUBLE = 'D';
+ public static final char C_DOUBLE = 'D';
/**
* Character constant indicating the primitive type float in a signature.
* Value is 'F'.
*/
- public static final char C_FLOAT = 'F';
+ public static final char C_FLOAT = 'F';
/**
* Character constant indicating the primitive type int in a signature.
* Value is 'I'.
*/
- public static final char C_INT = 'I';
-
+ public static final char C_INT = 'I';
+
/**
- * Character constant indicating the semicolon in a signature.
- * Value is ';'.
+ * Character constant indicating the semicolon in a signature. Value is
+ * ';'.
*/
- public static final char C_SEMICOLON = ';';
+ public static final char C_SEMICOLON = ';';
/**
* Character constant indicating the primitive type long in a signature.
* Value is 'J'.
*/
- public static final char C_LONG = 'J';
-
+ public static final char C_LONG = 'J';
+
/**
* Character constant indicating the primitive type short in a signature.
* Value is 'S'.
*/
- public static final char C_SHORT = 'S';
-
+ public static final char C_SHORT = 'S';
+
/**
- * Character constant indicating result type void in a signature.
- * Value is 'V'.
+ * Character constant indicating result type void in a signature. Value is
+ * 'V'.
*/
- public static final char C_VOID = 'V';
-
- /**
- * Character constant indicating the dot in a signature.
- * Value is '.'.
+ public static final char C_VOID = 'V';
+
+ /**
+ * Character constant indicating the dot in a signature. Value is
+ * '.'.
*/
- public static final char C_DOT = '.';
-
- /**
- * Character constant indicating the dollar in a signature.
- * Value is '$'.
+ public static final char C_DOT = '.';
+
+ /**
+ * Character constant indicating the dollar in a signature. Value is
+ * '$'.
*/
- public static final char C_DOLLAR = '$';
+ public static final char C_DOLLAR = '$';
- /**
- * Character constant indicating an array type in a signature.
- * Value is '['.
+ /**
+ * Character constant indicating an array type in a signature. Value is
+ * '['.
*/
- public static final char C_ARRAY = '[';
+ public static final char C_ARRAY = '[';
- /**
- * Character constant indicating the start of a resolved, named type in a
+ /**
+ * Character constant indicating the start of a resolved, named type in a
* signature. Value is 'L'.
*/
- public static final char C_RESOLVED = 'L';
+ public static final char C_RESOLVED = 'L';
- /**
+ /**
* Character constant indicating the start of an unresolved, named type in a
* signature. Value is 'Q'.
*/
- public static final char C_UNRESOLVED = 'Q';
+ public static final char C_UNRESOLVED = 'Q';
/**
- * Character constant indicating the end of a named type in a signature.
+ * Character constant indicating the end of a named type in a signature.
* Value is ';'.
*/
- public static final char C_NAME_END = ';';
+ public static final char C_NAME_END = ';';
/**
* Character constant indicating the start of a parameter type list in a
* signature. Value is '('.
*/
- public static final char C_PARAM_START = '(';
+ public static final char C_PARAM_START = '(';
/**
- * Character constant indicating the end of a parameter type list in a
+ * Character constant indicating the end of a parameter type list in a
* signature. Value is ')'.
*/
- public static final char C_PARAM_END = ')';
+ public static final char C_PARAM_END = ')';
/**
- * String constant for the signature of the primitive type boolean.
- * Value is "Z".
+ * String constant for the signature of the primitive type boolean. Value is
+ * "Z".
*/
- public static final String SIG_BOOLEAN = "Z"; //$NON-NLS-1$
+ public static final String SIG_BOOLEAN = "Z"; //$NON-NLS-1$
/**
- * String constant for the signature of the primitive type byte.
- * Value is "B".
+ * String constant for the signature of the primitive type byte. Value is
+ * "B".
*/
- public static final String SIG_BYTE = "B"; //$NON-NLS-1$
+ public static final String SIG_BYTE = "B"; //$NON-NLS-1$
/**
- * String constant for the signature of the primitive type char.
- * Value is "C".
+ * String constant for the signature of the primitive type char. Value is
+ * "C".
*/
- public static final String SIG_CHAR = "C"; //$NON-NLS-1$
+ public static final String SIG_CHAR = "C"; //$NON-NLS-1$
/**
- * String constant for the signature of the primitive type double.
- * Value is "D".
+ * String constant for the signature of the primitive type double. Value is
+ * "D".
*/
- public static final String SIG_DOUBLE = "D"; //$NON-NLS-1$
+ public static final String SIG_DOUBLE = "D"; //$NON-NLS-1$
/**
- * String constant for the signature of the primitive type float.
- * Value is "F".
+ * String constant for the signature of the primitive type float. Value is
+ * "F".
*/
- public static final String SIG_FLOAT = "F"; //$NON-NLS-1$
+ public static final String SIG_FLOAT = "F"; //$NON-NLS-1$
/**
- * String constant for the signature of the primitive type int.
- * Value is "I".
+ * String constant for the signature of the primitive type int. Value is
+ * "I".
*/
- public static final String SIG_INT = "I"; //$NON-NLS-1$
+ public static final String SIG_INT = "I"; //$NON-NLS-1$
/**
- * String constant for the signature of the primitive type long.
- * Value is "J".
+ * String constant for the signature of the primitive type long. Value is
+ * "J".
*/
- public static final String SIG_LONG = "J"; //$NON-NLS-1$
+ public static final String SIG_LONG = "J"; //$NON-NLS-1$
/**
- * String constant for the signature of the primitive type short.
- * Value is "S".
+ * String constant for the signature of the primitive type short. Value is
+ * "S".
*/
- public static final String SIG_SHORT = "S"; //$NON-NLS-1$
+ public static final String SIG_SHORT = "S"; //$NON-NLS-1$
- /** String constant for the signature of result type void.
- * Value is "V".
+ /**
+ * String constant for the signature of result type void. Value is
+ * "V".
*/
- public static final String SIG_VOID = "V"; //$NON-NLS-1$
-
- private static final char[] BOOLEAN = {'b', 'o', 'o', 'l', 'e', 'a', 'n'};
- private static final char[] BYTE = {'b', 'y', 't', 'e'};
- private static final char[] CHAR = {'c', 'h', 'a', 'r'};
- private static final char[] DOUBLE = {'d', 'o', 'u', 'b', 'l', 'e'};
- private static final char[] FLOAT = {'f', 'l', 'o', 'a', 't'};
- private static final char[] INT = {'i', 'n', 't'};
- private static final char[] LONG = {'l', 'o', 'n', 'g'};
- private static final char[] SHORT = {'s', 'h', 'o', 'r', 't'};
- private static final char[] VOID = {'v', 'o', 'i', 'd'};
-
+ public static final String SIG_VOID = "V"; //$NON-NLS-1$
+
+ private static final char[] BOOLEAN = { 'b', 'o', 'o', 'l', 'e', 'a', 'n' };
+
+ private static final char[] BYTE = { 'b', 'y', 't', 'e' };
+
+ private static final char[] CHAR = { 'c', 'h', 'a', 'r' };
+
+ private static final char[] DOUBLE = { 'd', 'o', 'u', 'b', 'l', 'e' };
+
+ private static final char[] FLOAT = { 'f', 'l', 'o', 'a', 't' };
+
+ private static final char[] INT = { 'i', 'n', 't' };
+
+ private static final char[] LONG = { 'l', 'o', 'n', 'g' };
+
+ private static final char[] SHORT = { 's', 'h', 'o', 'r', 't' };
+
+ private static final char[] VOID = { 'v', 'o', 'i', 'd' };
+
private static final String EMPTY = new String(CharOperation.NO_CHAR);
-
-/**
- * Not instantiable.
- */
-private Signature() {}
-private static long copyType(char[] signature, int sigPos, char[] dest, int index, boolean fullyQualifyTypeNames) {
- int arrayCount = 0;
- loop: while (true) {
- switch (signature[sigPos++]) {
- case C_ARRAY :
+ /**
+ * Not instantiable.
+ */
+ private Signature() {
+ }
+
+ private static long copyType(char[] signature, int sigPos, char[] dest,
+ int index, boolean fullyQualifyTypeNames) {
+ int arrayCount = 0;
+ loop: while (true) {
+ switch (signature[sigPos++]) {
+ case C_ARRAY:
arrayCount++;
break;
- case C_BOOLEAN :
+ case C_BOOLEAN:
int length = BOOLEAN.length;
System.arraycopy(BOOLEAN, 0, dest, index, length);
index += length;
break loop;
- case C_BYTE :
+ case C_BYTE:
length = BYTE.length;
System.arraycopy(BYTE, 0, dest, index, length);
index += length;
break loop;
- case C_CHAR :
+ case C_CHAR:
length = CHAR.length;
System.arraycopy(CHAR, 0, dest, index, length);
index += length;
break loop;
- case C_DOUBLE :
+ case C_DOUBLE:
length = DOUBLE.length;
System.arraycopy(DOUBLE, 0, dest, index, length);
index += length;
break loop;
- case C_FLOAT :
+ case C_FLOAT:
length = FLOAT.length;
System.arraycopy(FLOAT, 0, dest, index, length);
index += length;
break loop;
- case C_INT :
+ case C_INT:
length = INT.length;
System.arraycopy(INT, 0, dest, index, length);
index += length;
break loop;
- case C_LONG :
+ case C_LONG:
length = LONG.length;
System.arraycopy(LONG, 0, dest, index, length);
index += length;
break loop;
- case C_SHORT :
+ case C_SHORT:
length = SHORT.length;
System.arraycopy(SHORT, 0, dest, index, length);
index += length;
break loop;
- case C_VOID :
+ case C_VOID:
length = VOID.length;
System.arraycopy(VOID, 0, dest, index, length);
index += length;
break loop;
- case C_RESOLVED :
- case C_UNRESOLVED :
+ case C_RESOLVED:
+ case C_UNRESOLVED:
int end = CharOperation.indexOf(C_SEMICOLON, signature, sigPos);
- if (end == -1) throw new IllegalArgumentException();
+ if (end == -1)
+ throw new IllegalArgumentException();
int start;
if (fullyQualifyTypeNames) {
start = sigPos;
} else {
- start = CharOperation.lastIndexOf(C_DOT, signature, sigPos, end)+1;
- if (start == 0) start = sigPos;
- }
- length = end-start;
+ start = CharOperation.lastIndexOf(C_DOT, signature, sigPos,
+ end) + 1;
+ if (start == 0)
+ start = sigPos;
+ }
+ length = end - start;
System.arraycopy(signature, start, dest, index, length);
- sigPos = end+1;
+ sigPos = end + 1;
index += length;
break loop;
+ }
}
+ while (arrayCount-- > 0) {
+ dest[index++] = '[';
+ dest[index++] = ']';
+ }
+ return (((long) index) << 32) + sigPos;
}
- while (arrayCount-- > 0) {
- dest[index++] = '[';
- dest[index++] = ']';
+
+ /**
+ * Creates a new type signature with the given amount of array nesting added
+ * to the given type signature.
+ *
+ * @param typeSignature
+ * the type signature
+ * @param arrayCount
+ * the desired number of levels of array nesting
+ * @return the encoded array type signature
+ *
+ * @since 2.0
+ */
+ public static char[] createArraySignature(char[] typeSignature,
+ int arrayCount) {
+ if (arrayCount == 0)
+ return typeSignature;
+ int sigLength = typeSignature.length;
+ char[] result = new char[arrayCount + sigLength];
+ for (int i = 0; i < arrayCount; i++) {
+ result[i] = C_ARRAY;
+ }
+ System.arraycopy(typeSignature, 0, result, arrayCount, sigLength);
+ return result;
}
- return (((long) index) << 32) + sigPos;
-}
-/**
- * Creates a new type signature with the given amount of array nesting added
- * to the given type signature.
- *
- * @param typeSignature the type signature
- * @param arrayCount the desired number of levels of array nesting
- * @return the encoded array type signature
- *
- * @since 2.0
- */
-public static char[] createArraySignature(char[] typeSignature, int arrayCount) {
- if (arrayCount == 0) return typeSignature;
- int sigLength = typeSignature.length;
- char[] result = new char[arrayCount + sigLength];
- for (int i = 0; i < arrayCount; i++) {
- result[i] = C_ARRAY;
+
+ /**
+ * Creates a new type signature with the given amount of array nesting added
+ * to the given type signature.
+ *
+ * @param typeSignature
+ * the type signature
+ * @param arrayCount
+ * the desired number of levels of array nesting
+ * @return the encoded array type signature
+ */
+ public static String createArraySignature(String typeSignature,
+ int arrayCount) {
+ return new String(createArraySignature(typeSignature.toCharArray(),
+ arrayCount));
}
- System.arraycopy(typeSignature, 0, result, arrayCount, sigLength);
- return result;
-}
-/**
- * Creates a new type signature with the given amount of array nesting added
- * to the given type signature.
- *
- * @param typeSignature the type signature
- * @param arrayCount the desired number of levels of array nesting
- * @return the encoded array type signature
- */
-public static String createArraySignature(String typeSignature, int arrayCount) {
- return new String(createArraySignature(typeSignature.toCharArray(), arrayCount));
-}
-/**
- * Creates a method signature from the given parameter and return type
- * signatures. The encoded method signature is dot-based.
- *
- * @param parameterTypes the list of parameter type signatures
- * @param returnType the return type signature
- * @return the encoded method signature
- *
- * @since 2.0
- */
-public static char[] createMethodSignature(char[][] parameterTypes, char[] returnType) {
- int parameterTypesLength = parameterTypes.length;
- int parameterLength = 0;
- for (int i = 0; i < parameterTypesLength; i++) {
- parameterLength += parameterTypes[i].length;
-
+
+ /**
+ * Creates a method signature from the given parameter and return type
+ * signatures. The encoded method signature is dot-based.
+ *
+ * @param parameterTypes
+ * the list of parameter type signatures
+ * @param returnType
+ * the return type signature
+ * @return the encoded method signature
+ *
+ * @since 2.0
+ */
+ public static char[] createMethodSignature(char[][] parameterTypes,
+ char[] returnType) {
+ int parameterTypesLength = parameterTypes.length;
+ int parameterLength = 0;
+ for (int i = 0; i < parameterTypesLength; i++) {
+ parameterLength += parameterTypes[i].length;
+
+ }
+ int returnTypeLength = returnType.length;
+ char[] result = new char[1 + parameterLength + 1 + returnTypeLength];
+ result[0] = C_PARAM_START;
+ int index = 1;
+ for (int i = 0; i < parameterTypesLength; i++) {
+ char[] parameterType = parameterTypes[i];
+ int length = parameterType.length;
+ System.arraycopy(parameterType, 0, result, index, length);
+ index += length;
+ }
+ result[index] = C_PARAM_END;
+ System.arraycopy(returnType, 0, result, index + 1, returnTypeLength);
+ return result;
}
- int returnTypeLength = returnType.length;
- char[] result = new char[1 + parameterLength + 1 + returnTypeLength];
- result[0] = C_PARAM_START;
- int index = 1;
- for (int i = 0; i < parameterTypesLength; i++) {
- char[] parameterType = parameterTypes[i];
- int length = parameterType.length;
- System.arraycopy(parameterType, 0, result, index, length);
- index += length;
+
+ /**
+ * Creates a method signature from the given parameter and return type
+ * signatures. The encoded method signature is dot-based.
+ *
+ * @param parameterTypes
+ * the list of parameter type signatures
+ * @param returnType
+ * the return type signature
+ * @return the encoded method signature
+ */
+ public static String createMethodSignature(String[] parameterTypes,
+ String returnType) {
+ int parameterTypesLenth = parameterTypes.length;
+ char[][] parameters = new char[parameterTypesLenth][];
+ for (int i = 0; i < parameterTypesLenth; i++) {
+ parameters[i] = parameterTypes[i].toCharArray();
+ }
+ return new String(createMethodSignature(parameters, returnType
+ .toCharArray()));
}
- result[index] = C_PARAM_END;
- System.arraycopy(returnType, 0, result, index+1, returnTypeLength);
- return result;
-}
-/**
- * Creates a method signature from the given parameter and return type
- * signatures. The encoded method signature is dot-based.
- *
- * @param parameterTypes the list of parameter type signatures
- * @param returnType the return type signature
- * @return the encoded method signature
- */
-public static String createMethodSignature(String[] parameterTypes, String returnType) {
- int parameterTypesLenth = parameterTypes.length;
- char[][] parameters = new char[parameterTypesLenth][];
- for (int i = 0; i < parameterTypesLenth; i++) {
- parameters[i] = parameterTypes[i].toCharArray();
+
+ /**
+ * Creates a new type signature from the given type name encoded as a
+ * character array. This method is equivalent to
+ * createTypeSignature(new String(typeName),isResolved),
+ * although more efficient for callers with character arrays rather than
+ * strings. If the type name is qualified, then it is expected to be
+ * dot-based.
+ *
+ * @param typeName
+ * the possibly qualified type name
+ * @param isResolved
+ * true if the type name is to be considered
+ * resolved (for example, a type name from a binary class file),
+ * and false if the type name is to be considered
+ * unresolved (for example, a type name found in source code)
+ * @return the encoded type signature
+ * @see #createTypeSignature(java.lang.String,boolean)
+ */
+ public static String createTypeSignature(char[] typeName, boolean isResolved) {
+ return new String(createCharArrayTypeSignature(typeName, isResolved));
}
- return new String(createMethodSignature(parameters, returnType.toCharArray()));
-}
-/**
- * Creates a new type signature from the given type name encoded as a character
- * array. This method is equivalent to
- * createTypeSignature(new String(typeName),isResolved), although
- * more efficient for callers with character arrays rather than strings. If the
- * type name is qualified, then it is expected to be dot-based.
- *
- * @param typeName the possibly qualified type name
- * @param isResolved true if the type name is to be considered
- * resolved (for example, a type name from a binary class file), and
- * false if the type name is to be considered unresolved
- * (for example, a type name found in source code)
- * @return the encoded type signature
- * @see #createTypeSignature(java.lang.String,boolean)
- */
-public static String createTypeSignature(char[] typeName, boolean isResolved) {
- return new String(createCharArrayTypeSignature(typeName, isResolved));
-}
-/**
- * Creates a new type signature from the given type name encoded as a character
- * array. This method is equivalent to
- * createTypeSignature(new String(typeName),isResolved).toCharArray(), although
- * more efficient for callers with character arrays rather than strings. If the
- * type name is qualified, then it is expected to be dot-based.
- *
- * @param typeName the possibly qualified type name
- * @param isResolved true if the type name is to be considered
- * resolved (for example, a type name from a binary class file), and
- * false if the type name is to be considered unresolved
- * (for example, a type name found in source code)
- * @return the encoded type signature
- * @see #createTypeSignature(java.lang.String,boolean)
- *
- * @since 2.0
- */
-public static char[] createCharArrayTypeSignature(char[] typeName, boolean isResolved) {
- if (typeName == null) throw new IllegalArgumentException("null"); //$NON-NLS-1$
- int length = typeName.length;
- if (length == 0) throw new IllegalArgumentException(new String(typeName));
+ /**
+ * Creates a new type signature from the given type name encoded as a
+ * character array. This method is equivalent to
+ * createTypeSignature(new String(typeName),isResolved).toCharArray(),
+ * although more efficient for callers with character arrays rather than
+ * strings. If the type name is qualified, then it is expected to be
+ * dot-based.
+ *
+ * @param typeName
+ * the possibly qualified type name
+ * @param isResolved
+ * true if the type name is to be considered
+ * resolved (for example, a type name from a binary class file),
+ * and false if the type name is to be considered
+ * unresolved (for example, a type name found in source code)
+ * @return the encoded type signature
+ * @see #createTypeSignature(java.lang.String,boolean)
+ *
+ * @since 2.0
+ */
+ public static char[] createCharArrayTypeSignature(char[] typeName,
+ boolean isResolved) {
+
+ if (typeName == null)
+ throw new IllegalArgumentException("null"); //$NON-NLS-1$
+ int length = typeName.length;
+ if (length == 0)
+ throw new IllegalArgumentException(new String(typeName));
- int arrayCount = CharOperation.occurencesOf('[', typeName);
- char[] sig;
-
- switch (typeName[0]) {
+ int arrayCount = CharOperation.occurencesOf('[', typeName);
+ char[] sig;
+
+ switch (typeName[0]) {
// primitive type?
- case 'b' :
+ case 'b':
if (CharOperation.fragmentEquals(BOOLEAN, typeName, 0, true)) {
- sig = new char[arrayCount+1];
+ sig = new char[arrayCount + 1];
sig[arrayCount] = C_BOOLEAN;
break;
} else if (CharOperation.fragmentEquals(BYTE, typeName, 0, true)) {
- sig = new char[arrayCount+1];
+ sig = new char[arrayCount + 1];
sig[arrayCount] = C_BYTE;
break;
}
case 'c':
if (CharOperation.fragmentEquals(CHAR, typeName, 0, true)) {
- sig = new char[arrayCount+1];
+ sig = new char[arrayCount + 1];
sig[arrayCount] = C_CHAR;
break;
}
case 'd':
if (CharOperation.fragmentEquals(DOUBLE, typeName, 0, true)) {
- sig = new char[arrayCount+1];
+ sig = new char[arrayCount + 1];
sig[arrayCount] = C_DOUBLE;
break;
}
case 'f':
if (CharOperation.fragmentEquals(FLOAT, typeName, 0, true)) {
- sig = new char[arrayCount+1];
+ sig = new char[arrayCount + 1];
sig[arrayCount] = C_FLOAT;
break;
}
case 'i':
if (CharOperation.fragmentEquals(INT, typeName, 0, true)) {
- sig = new char[arrayCount+1];
+ sig = new char[arrayCount + 1];
sig[arrayCount] = C_INT;
break;
}
case 'l':
if (CharOperation.fragmentEquals(LONG, typeName, 0, true)) {
- sig = new char[arrayCount+1];
+ sig = new char[arrayCount + 1];
sig[arrayCount] = C_LONG;
break;
}
case 's':
if (CharOperation.fragmentEquals(SHORT, typeName, 0, true)) {
- sig = new char[arrayCount+1];
+ sig = new char[arrayCount + 1];
sig[arrayCount] = C_SHORT;
break;
}
case 'v':
if (CharOperation.fragmentEquals(VOID, typeName, 0, true)) {
- sig = new char[arrayCount+1];
+ sig = new char[arrayCount + 1];
sig[arrayCount] = C_VOID;
break;
}
default:
// non primitive type
- int sigLength = arrayCount + 1 + length + 1; // for example '[[[Ljava.lang.String;'
+ int sigLength = arrayCount + 1 + length + 1; // for example
+ // '[[[Ljava.lang.String;'
sig = new char[sigLength];
- int sigIndex = arrayCount+1; // index in sig
+ int sigIndex = arrayCount + 1; // index in sig
int startID = 0; // start of current ID in typeName
int index = 0; // index in typeName
while (index < length) {
char currentChar = typeName[index];
switch (currentChar) {
- case '.':
- if (startID == -1) throw new IllegalArgumentException(new String(typeName));
+ case '.':
+ if (startID == -1)
+ throw new IllegalArgumentException(new String(typeName));
+ if (startID < index) {
+ sig = CharOperation.append(sig, sigIndex, typeName,
+ startID, index);
+ sigIndex += index - startID;
+ }
+ sig[sigIndex++] = C_DOT;
+ index++;
+ startID = index;
+ break;
+ case '[':
+ if (startID != -1) {
if (startID < index) {
- sig = CharOperation.append(sig, sigIndex, typeName, startID, index);
- sigIndex += index-startID;
+ sig = CharOperation.append(sig, sigIndex, typeName,
+ startID, index);
+ sigIndex += index - startID;
}
- sig[sigIndex++] = C_DOT;
- index++;
- startID = index;
- break;
- case '[':
- if (startID != -1) {
- if (startID < index) {
- sig = CharOperation.append(sig, sigIndex, typeName, startID, index);
- sigIndex += index-startID;
- }
- startID = -1; // no more id after []
- }
- index++;
- break;
- default :
- if (startID != -1 && CharOperation.isWhitespace(currentChar)) {
- if (startID < index) {
- sig = CharOperation.append(sig, sigIndex, typeName, startID, index);
- sigIndex += index-startID;
- }
- startID = index+1;
+ startID = -1; // no more id after []
+ }
+ index++;
+ break;
+ default:
+ if (startID != -1
+ && CharOperation.isWhitespace(currentChar)) {
+ if (startID < index) {
+ sig = CharOperation.append(sig, sigIndex, typeName,
+ startID, index);
+ sigIndex += index - startID;
}
- index++;
- break;
+ startID = index + 1;
+ }
+ index++;
+ break;
}
}
// last id
if (startID != -1 && startID < index) {
- sig = CharOperation.append(sig, sigIndex, typeName, startID, index);
- sigIndex += index-startID;
+ sig = CharOperation.append(sig, sigIndex, typeName, startID,
+ index);
+ sigIndex += index - startID;
}
-
+
// add L (or Q) at the beigininig and ; at the end
sig[arrayCount] = isResolved ? C_RESOLVED : C_UNRESOLVED;
sig[sigIndex++] = C_NAME_END;
-
+
// resize if needed
if (sigLength > sigIndex) {
System.arraycopy(sig, 0, sig = new char[sigIndex], 0, sigIndex);
}
+ }
+
+ // add array info
+ for (int i = 0; i < arrayCount; i++) {
+ sig[i] = C_ARRAY;
+ }
+
+ return sig;
}
- // add array info
- for (int i = 0; i < arrayCount; i++) {
- sig[i] = C_ARRAY;
+ /**
+ * Creates a new type signature from the given type name. If the type name
+ * is qualified, then it is expected to be dot-based.
+ *
+ *
+ *
+ *
+ * @param typeName
+ * the possibly qualified type name
+ * @param isResolved
+ * true if the type name is to be considered
+ * resolved (for example, a type name from a binary class file),
+ * and false if the type name is to be considered
+ * unresolved (for example, a type name found in source code)
+ * @return the encoded type signature
+ */
+ public static String createTypeSignature(String typeName, boolean isResolved) {
+ return createTypeSignature(typeName == null ? null : typeName
+ .toCharArray(), isResolved);
}
-
- return sig;
-}
-/**
- * Creates a new type signature from the given type name. If the type name is qualified,
- * then it is expected to be dot-based.
- *
- *
- *
- * @param typeName the possibly qualified type name
- * @param isResolved true if the type name is to be considered
- * resolved (for example, a type name from a binary class file), and
- * false if the type name is to be considered unresolved
- * (for example, a type name found in source code)
- * @return the encoded type signature
- */
-public static String createTypeSignature(String typeName, boolean isResolved) {
- return createTypeSignature(typeName == null ? null : typeName.toCharArray(), isResolved);
-}
-/**
- * Returns the array count (array nesting depth) of the given type signature.
- *
- * @param typeSignature the type signature
- * @return the array nesting depth, or 0 if not an array
- * @exception IllegalArgumentException if the signature is not syntactically
- * correct
- *
- * @since 2.0
- */
-public static int getArrayCount(char[] typeSignature) throws IllegalArgumentException {
- try {
- int count = 0;
- while (typeSignature[count] == C_ARRAY) {
- ++count;
+
+ /**
+ * Returns the array count (array nesting depth) of the given type
+ * signature.
+ *
+ * @param typeSignature
+ * the type signature
+ * @return the array nesting depth, or 0 if not an array
+ * @exception IllegalArgumentException
+ * if the signature is not syntactically correct
+ *
+ * @since 2.0
+ */
+ public static int getArrayCount(char[] typeSignature)
+ throws IllegalArgumentException {
+ try {
+ int count = 0;
+ while (typeSignature[count] == C_ARRAY) {
+ ++count;
+ }
+ return count;
+ } catch (ArrayIndexOutOfBoundsException e) { // signature is
+ // syntactically
+ // incorrect if last
+ // character is C_ARRAY
+ throw new IllegalArgumentException();
}
- return count;
- } catch (ArrayIndexOutOfBoundsException e) { // signature is syntactically incorrect if last character is C_ARRAY
- throw new IllegalArgumentException();
}
-}
-/**
- * Returns the array count (array nesting depth) of the given type signature.
- *
- * @param typeSignature the type signature
- * @return the array nesting depth, or 0 if not an array
- * @exception IllegalArgumentException if the signature is not syntactically
- * correct
- */
-public static int getArrayCount(String typeSignature) throws IllegalArgumentException {
- return getArrayCount(typeSignature.toCharArray());
-}
-/**
- * Returns the type signature without any array nesting.
- *
- *
- *
- * @param typeSignature the type signature
- * @return the type signature without arrays
- * @exception IllegalArgumentException if the signature is not syntactically
- * correct
- *
- * @since 2.0
- */
-public static char[] getElementType(char[] typeSignature) throws IllegalArgumentException {
- int count = getArrayCount(typeSignature);
- if (count == 0) return typeSignature;
- int length = typeSignature.length;
- char[] result = new char[length-count];
- System.arraycopy(typeSignature, count, result, 0, length-count);
- return result;
-}
-/**
- * Returns the type signature without any array nesting.
- *
- * For example:
- *
- *
- * getElementType("[[I") --> "I".
- *
- *
- *
- *
- * @param typeSignature the type signature
- * @return the type signature without arrays
- * @exception IllegalArgumentException if the signature is not syntactically
- * correct
- */
-public static String getElementType(String typeSignature) throws IllegalArgumentException {
- return new String(getElementType(typeSignature.toCharArray()));
-}
-/**
- * Returns the number of parameter types in the given method signature.
- *
- * @param methodSignature the method signature
- * @return the number of parameters
- * @exception IllegalArgumentException if the signature is not syntactically
- * correct
- * @since 2.0
- */
-public static int getParameterCount(char[] methodSignature) throws IllegalArgumentException {
- try {
- int count = 0;
- int i = CharOperation.indexOf(C_PARAM_START, methodSignature) + 1;
- if (i == 0)
- throw new IllegalArgumentException();
- for (;;) {
- char c = methodSignature[i++];
- switch (c) {
- case C_ARRAY :
+
+ /**
+ * Returns the array count (array nesting depth) of the given type
+ * signature.
+ *
+ * @param typeSignature
+ * the type signature
+ * @return the array nesting depth, or 0 if not an array
+ * @exception IllegalArgumentException
+ * if the signature is not syntactically correct
+ */
+ public static int getArrayCount(String typeSignature)
+ throws IllegalArgumentException {
+ return getArrayCount(typeSignature.toCharArray());
+ }
+
+ /**
+ * Returns the type signature without any array nesting.
+ *
+ *
+ *
+ *
+ * @param typeSignature
+ * the type signature
+ * @return the type signature without arrays
+ * @exception IllegalArgumentException
+ * if the signature is not syntactically correct
+ *
+ * @since 2.0
+ */
+ public static char[] getElementType(char[] typeSignature)
+ throws IllegalArgumentException {
+ int count = getArrayCount(typeSignature);
+ if (count == 0)
+ return typeSignature;
+ int length = typeSignature.length;
+ char[] result = new char[length - count];
+ System.arraycopy(typeSignature, count, result, 0, length - count);
+ return result;
+ }
+
+ /**
+ * Returns the type signature without any array nesting.
+ *
+ * For example:
+ *
+ *
+ *
+ * getElementType("[[I") --> "I".
+ *
+ *
+ *
+ *
+ *
+ * @param typeSignature
+ * the type signature
+ * @return the type signature without arrays
+ * @exception IllegalArgumentException
+ * if the signature is not syntactically correct
+ */
+ public static String getElementType(String typeSignature)
+ throws IllegalArgumentException {
+ return new String(getElementType(typeSignature.toCharArray()));
+ }
+
+ /**
+ * Returns the number of parameter types in the given method signature.
+ *
+ * @param methodSignature
+ * the method signature
+ * @return the number of parameters
+ * @exception IllegalArgumentException
+ * if the signature is not syntactically correct
+ * @since 2.0
+ */
+ public static int getParameterCount(char[] methodSignature)
+ throws IllegalArgumentException {
+ try {
+ int count = 0;
+ int i = CharOperation.indexOf(C_PARAM_START, methodSignature) + 1;
+ if (i == 0)
+ throw new IllegalArgumentException();
+ for (;;) {
+ char c = methodSignature[i++];
+ switch (c) {
+ case C_ARRAY:
break;
- case C_BOOLEAN :
- case C_BYTE :
- case C_CHAR :
- case C_DOUBLE :
- case C_FLOAT :
- case C_INT :
- case C_LONG :
- case C_SHORT :
- case C_VOID :
+ case C_BOOLEAN:
+ case C_BYTE:
+ case C_CHAR:
+ case C_DOUBLE:
+ case C_FLOAT:
+ case C_INT:
+ case C_LONG:
+ case C_SHORT:
+ case C_VOID:
++count;
break;
- case C_RESOLVED :
- case C_UNRESOLVED :
+ case C_RESOLVED:
+ case C_UNRESOLVED:
i = CharOperation.indexOf(C_SEMICOLON, methodSignature, i) + 1;
if (i == 0)
throw new IllegalArgumentException();
++count;
break;
- case C_PARAM_END :
+ case C_PARAM_END:
return count;
- default :
+ default:
throw new IllegalArgumentException();
+ }
}
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new IllegalArgumentException();
}
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException();
}
-}
-/**
- * Returns the number of parameter types in the given method signature.
- *
- * @param methodSignature the method signature
- * @return the number of parameters
- * @exception IllegalArgumentException if the signature is not syntactically
- * correct
- */
-public static int getParameterCount(String methodSignature) throws IllegalArgumentException {
- return getParameterCount(methodSignature.toCharArray());
-}
-/**
- * Extracts the parameter type signatures from the given method signature.
- * The method signature is expected to be dot-based.
- *
- * @param methodSignature the method signature
- * @return the list of parameter type signatures
- * @exception IllegalArgumentException if the signature is syntactically
- * incorrect
- *
- * @since 2.0
- */
-public static char[][] getParameterTypes(char[] methodSignature) throws IllegalArgumentException {
- try {
- int count = getParameterCount(methodSignature);
- char[][] result = new char[count][];
- if (count == 0)
- return result;
- int i = CharOperation.indexOf(C_PARAM_START, methodSignature) + 1;
- count = 0;
- int start = i;
- for (;;) {
- char c = methodSignature[i++];
- switch (c) {
- case C_ARRAY :
+
+ /**
+ * Returns the number of parameter types in the given method signature.
+ *
+ * @param methodSignature
+ * the method signature
+ * @return the number of parameters
+ * @exception IllegalArgumentException
+ * if the signature is not syntactically correct
+ */
+ public static int getParameterCount(String methodSignature)
+ throws IllegalArgumentException {
+ return getParameterCount(methodSignature.toCharArray());
+ }
+
+ /**
+ * Extracts the parameter type signatures from the given method signature.
+ * The method signature is expected to be dot-based.
+ *
+ * @param methodSignature
+ * the method signature
+ * @return the list of parameter type signatures
+ * @exception IllegalArgumentException
+ * if the signature is syntactically incorrect
+ *
+ * @since 2.0
+ */
+ public static char[][] getParameterTypes(char[] methodSignature)
+ throws IllegalArgumentException {
+ try {
+ int count = getParameterCount(methodSignature);
+ char[][] result = new char[count][];
+ if (count == 0)
+ return result;
+ int i = CharOperation.indexOf(C_PARAM_START, methodSignature) + 1;
+ count = 0;
+ int start = i;
+ for (;;) {
+ char c = methodSignature[i++];
+ switch (c) {
+ case C_ARRAY:
// array depth is i - start;
break;
- case C_BOOLEAN :
- case C_BYTE :
- case C_CHAR :
- case C_DOUBLE :
- case C_FLOAT :
- case C_INT :
- case C_LONG :
- case C_SHORT :
- case C_VOID :
+ case C_BOOLEAN:
+ case C_BYTE:
+ case C_CHAR:
+ case C_DOUBLE:
+ case C_FLOAT:
+ case C_INT:
+ case C_LONG:
+ case C_SHORT:
+ case C_VOID:
// common case of base types
if (i - start == 1) {
switch (c) {
- case C_BOOLEAN :
- result[count++] = new char[] {C_BOOLEAN};
- break;
- case C_BYTE :
- result[count++] = new char[] {C_BYTE};
- break;
- case C_CHAR :
- result[count++] = new char[] {C_CHAR};
- break;
- case C_DOUBLE :
- result[count++] = new char[] {C_DOUBLE};
- break;
- case C_FLOAT :
- result[count++] = new char[] {C_FLOAT};
- break;
- case C_INT :
- result[count++] = new char[] {C_INT};
- break;
- case C_LONG :
- result[count++] = new char[] {C_LONG};
- break;
- case C_SHORT :
- result[count++] = new char[] {C_SHORT};
- break;
- case C_VOID :
- result[count++] = new char[] {C_VOID};
- break;
+ case C_BOOLEAN:
+ result[count++] = new char[] { C_BOOLEAN };
+ break;
+ case C_BYTE:
+ result[count++] = new char[] { C_BYTE };
+ break;
+ case C_CHAR:
+ result[count++] = new char[] { C_CHAR };
+ break;
+ case C_DOUBLE:
+ result[count++] = new char[] { C_DOUBLE };
+ break;
+ case C_FLOAT:
+ result[count++] = new char[] { C_FLOAT };
+ break;
+ case C_INT:
+ result[count++] = new char[] { C_INT };
+ break;
+ case C_LONG:
+ result[count++] = new char[] { C_LONG };
+ break;
+ case C_SHORT:
+ result[count++] = new char[] { C_SHORT };
+ break;
+ case C_VOID:
+ result[count++] = new char[] { C_VOID };
+ break;
}
} else {
- result[count++] = CharOperation.subarray(methodSignature, start, i);
+ result[count++] = CharOperation.subarray(
+ methodSignature, start, i);
}
start = i;
break;
- case C_RESOLVED :
- case C_UNRESOLVED :
+ case C_RESOLVED:
+ case C_UNRESOLVED:
i = CharOperation.indexOf(C_SEMICOLON, methodSignature, i) + 1;
if (i == 0)
throw new IllegalArgumentException();
- result[count++] = CharOperation.subarray(methodSignature, start, i);
+ result[count++] = CharOperation.subarray(methodSignature,
+ start, i);
start = i;
break;
case C_PARAM_END:
return result;
- default :
+ default:
throw new IllegalArgumentException();
+ }
}
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new IllegalArgumentException();
}
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException();
- }
-}
-/**
- * Extracts the parameter type signatures from the given method signature.
- * The method signature is expected to be dot-based.
- *
- * @param methodSignature the method signature
- * @return the list of parameter type signatures
- * @exception IllegalArgumentException if the signature is syntactically
- * incorrect
- */
-public static String[] getParameterTypes(String methodSignature) throws IllegalArgumentException {
- char[][] parameterTypes = getParameterTypes(methodSignature.toCharArray());
- int length = parameterTypes.length;
- String[] result = new String[length];
- for (int i = 0; i < length; i++) {
- result[i] = new String(parameterTypes[i]);
}
- return result;
-}
-/**
- * Returns a char array containing all but the last segment of the given
- * dot-separated qualified name. Returns the empty char array if it is not qualified.
- *
- *
- *
- * @param name the name
- * @return the qualifier prefix, or the empty char array if the name contains no
- * dots
- * @exception NullPointerException if name is null
- * @since 2.0
- */
-public static char[] getQualifier(char[] name) {
- int lastDot = CharOperation.lastIndexOf(C_DOT, name);
- if (lastDot == -1) {
- return CharOperation.NO_CHAR;
- }
- return CharOperation.subarray(name, 0, lastDot);
-}
-/**
- * Returns a string containing all but the last segment of the given
- * dot-separated qualified name. Returns the empty string if it is not qualified.
- *
- *
- *
- * @param name the name
- * @return the qualifier prefix, or the empty string if the name contains no
- * dots
- * @exception NullPointerException if name is null
- */
-public static String getQualifier(String name) {
- int lastDot = name.lastIndexOf(C_DOT);
- if (lastDot == -1) {
- return EMPTY;
+
+ /**
+ * Extracts the parameter type signatures from the given method signature.
+ * The method signature is expected to be dot-based.
+ *
+ * @param methodSignature
+ * the method signature
+ * @return the list of parameter type signatures
+ * @exception IllegalArgumentException
+ * if the signature is syntactically incorrect
+ */
+ public static String[] getParameterTypes(String methodSignature)
+ throws IllegalArgumentException {
+ char[][] parameterTypes = getParameterTypes(methodSignature
+ .toCharArray());
+ int length = parameterTypes.length;
+ String[] result = new String[length];
+ for (int i = 0; i < length; i++) {
+ result[i] = new String(parameterTypes[i]);
+ }
+ return result;
}
- return name.substring(0, lastDot);
-}
-/**
- * Extracts the return type from the given method signature. The method signature is
- * expected to be dot-based.
- *
- * @param methodSignature the method signature
- * @return the type signature of the return type
- * @exception IllegalArgumentException if the signature is syntactically
- * incorrect
- *
- * @since 2.0
- */
-public static char[] getReturnType(char[] methodSignature) throws IllegalArgumentException {
- int i = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
- if (i == -1) {
- throw new IllegalArgumentException();
+
+ /**
+ * Returns a char array containing all but the last segment of the given
+ * dot-separated qualified name. Returns the empty char array if it is not
+ * qualified.
+ *
+ *
+ *
+ *
+ * @param name
+ * the name
+ * @return the qualifier prefix, or the empty char array if the name
+ * contains no dots
+ * @exception NullPointerException
+ * if name is null
+ * @since 2.0
+ */
+ public static char[] getQualifier(char[] name) {
+ int lastDot = CharOperation.lastIndexOf(C_DOT, name);
+ if (lastDot == -1) {
+ return CharOperation.NO_CHAR;
+ }
+ return CharOperation.subarray(name, 0, lastDot);
}
- return CharOperation.subarray(methodSignature, i + 1, methodSignature.length);
-}
-/**
- * Extracts the return type from the given method signature. The method signature is
- * expected to be dot-based.
- *
- * @param methodSignature the method signature
- * @return the type signature of the return type
- * @exception IllegalArgumentException if the signature is syntactically
- * incorrect
- */
-public static String getReturnType(String methodSignature) throws IllegalArgumentException {
- return new String(getReturnType(methodSignature.toCharArray()));
-}
-/**
- * Returns the last segment of the given dot-separated qualified name.
- * Returns the given name if it is not qualified.
- *
- *
- *
- * @param name the name
- * @return the last segment of the qualified name
- * @exception NullPointerException if name is null
- * @since 2.0
- */
-public static char[] getSimpleName(char[] name) {
- int lastDot = CharOperation.lastIndexOf(C_DOT, name);
- if (lastDot == -1) {
- return name;
+
+ /**
+ * Returns a string containing all but the last segment of the given
+ * dot-separated qualified name. Returns the empty string if it is not
+ * qualified.
+ *
+ *
+ *
+ *
+ * @param name
+ * the name
+ * @return the qualifier prefix, or the empty string if the name contains no
+ * dots
+ * @exception NullPointerException
+ * if name is null
+ */
+ public static String getQualifier(String name) {
+ int lastDot = name.lastIndexOf(C_DOT);
+ if (lastDot == -1) {
+ return EMPTY;
+ }
+ return name.substring(0, lastDot);
}
- return CharOperation.subarray(name, lastDot + 1, name.length);
-}
-/**
- * Returns the last segment of the given dot-separated qualified name.
- * Returns the given name if it is not qualified.
- *
- *
- *
- * @param name the name
- * @return the last segment of the qualified name
- * @exception NullPointerException if name is null
- */
-public static String getSimpleName(String name) {
- int lastDot = name.lastIndexOf(C_DOT);
- if (lastDot == -1) {
- return name;
+
+ /**
+ * Extracts the return type from the given method signature. The method
+ * signature is expected to be dot-based.
+ *
+ * @param methodSignature
+ * the method signature
+ * @return the type signature of the return type
+ * @exception IllegalArgumentException
+ * if the signature is syntactically incorrect
+ *
+ * @since 2.0
+ */
+ public static char[] getReturnType(char[] methodSignature)
+ throws IllegalArgumentException {
+ int i = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
+ if (i == -1) {
+ throw new IllegalArgumentException();
+ }
+ return CharOperation.subarray(methodSignature, i + 1,
+ methodSignature.length);
}
- return name.substring(lastDot + 1, name.length());
-}
-/**
- * Returns all segments of the given dot-separated qualified name.
- * Returns an array with only the given name if it is not qualified.
- * Returns an empty array if the name is empty.
- *
- *
- * @param name the name
- * @return the list of simple names, possibly empty
- * @exception NullPointerException if name is null
- * @since 2.0
- */
-public static char[][] getSimpleNames(char[] name) {
- if (name.length == 0) {
- return CharOperation.NO_CHAR_CHAR;
+
+ /**
+ * Extracts the return type from the given method signature. The method
+ * signature is expected to be dot-based.
+ *
+ * @param methodSignature
+ * the method signature
+ * @return the type signature of the return type
+ * @exception IllegalArgumentException
+ * if the signature is syntactically incorrect
+ */
+ public static String getReturnType(String methodSignature)
+ throws IllegalArgumentException {
+ return new String(getReturnType(methodSignature.toCharArray()));
}
- int dot = CharOperation.indexOf(C_DOT, name);
- if (dot == -1) {
- return new char[][] {name};
+
+ /**
+ * Returns the last segment of the given dot-separated qualified name.
+ * Returns the given name if it is not qualified.
+ *
+ *
+ *
+ *
+ * @param name
+ * the name
+ * @return the last segment of the qualified name
+ * @exception NullPointerException
+ * if name is null
+ * @since 2.0
+ */
+ public static char[] getSimpleName(char[] name) {
+ int lastDot = CharOperation.lastIndexOf(C_DOT, name);
+ if (lastDot == -1) {
+ return name;
+ }
+ return CharOperation.subarray(name, lastDot + 1, name.length);
}
- int n = 1;
- while ((dot = CharOperation.indexOf(C_DOT, name, dot + 1)) != -1) {
- ++n;
+
+ /**
+ * Returns the last segment of the given dot-separated qualified name.
+ * Returns the given name if it is not qualified.
+ *
+ *
+ *
+ *
+ * @param name
+ * the name
+ * @return the last segment of the qualified name
+ * @exception NullPointerException
+ * if name is null
+ */
+ public static String getSimpleName(String name) {
+ int lastDot = name.lastIndexOf(C_DOT);
+ if (lastDot == -1) {
+ return name;
+ }
+ return name.substring(lastDot + 1, name.length());
}
- char[][] result = new char[n + 1][];
- int segStart = 0;
- for (int i = 0; i < n; ++i) {
- dot = CharOperation.indexOf(C_DOT, name, segStart);
- result[i] = CharOperation.subarray(name, segStart, dot);
- segStart = dot + 1;
+
+ /**
+ * Returns all segments of the given dot-separated qualified name. Returns
+ * an array with only the given name if it is not qualified. Returns an
+ * empty array if the name is empty.
+ *
+ *
+ * @param name
+ * the name
+ * @return the list of simple names, possibly empty
+ * @exception NullPointerException
+ * if name is null
+ * @since 2.0
+ */
+ public static char[][] getSimpleNames(char[] name) {
+ if (name.length == 0) {
+ return CharOperation.NO_CHAR_CHAR;
+ }
+ int dot = CharOperation.indexOf(C_DOT, name);
+ if (dot == -1) {
+ return new char[][] { name };
+ }
+ int n = 1;
+ while ((dot = CharOperation.indexOf(C_DOT, name, dot + 1)) != -1) {
+ ++n;
+ }
+ char[][] result = new char[n + 1][];
+ int segStart = 0;
+ for (int i = 0; i < n; ++i) {
+ dot = CharOperation.indexOf(C_DOT, name, segStart);
+ result[i] = CharOperation.subarray(name, segStart, dot);
+ segStart = dot + 1;
+ }
+ result[n] = CharOperation.subarray(name, segStart, name.length);
+ return result;
}
- result[n] = CharOperation.subarray(name, segStart, name.length);
- return result;
-}
-/**
- * Returns all segments of the given dot-separated qualified name.
- * Returns an array with only the given name if it is not qualified.
- * Returns an empty array if the name is empty.
- *
- *
- * @param name the name
- * @return the list of simple names, possibly empty
- * @exception NullPointerException if name is null
- */
-public static String[] getSimpleNames(String name) {
- char[][] simpleNames = getSimpleNames(name.toCharArray());
- int length = simpleNames.length;
- String[] result = new String[length];
- for (int i = 0; i < length; i++) {
- result[i] = new String(simpleNames[i]);
+
+ /**
+ * Returns all segments of the given dot-separated qualified name. Returns
+ * an array with only the given name if it is not qualified. Returns an
+ * empty array if the name is empty.
+ *
+ *
+ * @param name
+ * the name
+ * @return the list of simple names, possibly empty
+ * @exception NullPointerException
+ * if name is null
+ */
+ public static String[] getSimpleNames(String name) {
+ char[][] simpleNames = getSimpleNames(name.toCharArray());
+ int length = simpleNames.length;
+ String[] result = new String[length];
+ for (int i = 0; i < length; i++) {
+ result[i] = new String(simpleNames[i]);
+ }
+ return result;
}
- return result;
-}
-/**
- * Converts the given method signature to a readable form. The method signature is expected to
- * be dot-based.
- *
- *
- *
- * @param methodSignature the method signature to convert
- * @param methodName the name of the method to insert in the result, or
- * null if no method name is to be included
- * @param parameterNames the parameter names to insert in the result, or
- * null if no parameter names are to be included; if supplied,
- * the number of parameter names must match that of the method signature
- * @param fullyQualifyTypeNames true if type names should be fully
- * qualified, and false to use only simple names
- * @param includeReturnType true if the return type is to be
- * included
- * @return the char array representation of the method signature
- *
- * @since 2.0
- */
-public static char[] toCharArray(char[] methodSignature, char[] methodName, char[][] parameterNames, boolean fullyQualifyTypeNames, boolean includeReturnType) {
- try {
- int firstParen = CharOperation.indexOf(C_PARAM_START, methodSignature);
- if (firstParen == -1) throw new IllegalArgumentException();
-
- int sigLength = methodSignature.length;
-
- // compute result length
-
- // method signature
- int paramCount = 0;
- int lastParen = -1;
- int resultLength = 0;
- signature: for (int i = firstParen; i < sigLength; i++) {
- switch (methodSignature[i]) {
- case C_ARRAY :
+
+ /**
+ * Converts the given method signature to a readable form. The method
+ * signature is expected to be dot-based.
+ *
+ *
+ *
+ *
+ * @param methodSignature
+ * the method signature to convert
+ * @param methodName
+ * the name of the method to insert in the result, or
+ * null if no method name is to be included
+ * @param parameterNames
+ * the parameter names to insert in the result, or
+ * null if no parameter names are to be included;
+ * if supplied, the number of parameter names must match that of
+ * the method signature
+ * @param fullyQualifyTypeNames
+ * true if type names should be fully qualified,
+ * and false to use only simple names
+ * @param includeReturnType
+ * true if the return type is to be included
+ * @return the char array representation of the method signature
+ *
+ * @since 2.0
+ */
+ public static char[] toCharArray(char[] methodSignature, char[] methodName,
+ char[][] parameterNames, boolean fullyQualifyTypeNames,
+ boolean includeReturnType) {
+ try {
+ int firstParen = CharOperation.indexOf(C_PARAM_START,
+ methodSignature);
+ if (firstParen == -1)
+ throw new IllegalArgumentException();
+
+ int sigLength = methodSignature.length;
+
+ // compute result length
+
+ // method signature
+ int paramCount = 0;
+ int lastParen = -1;
+ int resultLength = 0;
+ signature: for (int i = firstParen; i < sigLength; i++) {
+ switch (methodSignature[i]) {
+ case C_ARRAY:
resultLength += 2; // []
continue signature;
- case C_BOOLEAN :
+ case C_BOOLEAN:
resultLength += BOOLEAN.length;
break;
- case C_BYTE :
+ case C_BYTE:
resultLength += BYTE.length;
break;
- case C_CHAR :
+ case C_CHAR:
resultLength += CHAR.length;
break;
- case C_DOUBLE :
+ case C_DOUBLE:
resultLength += DOUBLE.length;
break;
- case C_FLOAT :
+ case C_FLOAT:
resultLength += FLOAT.length;
break;
- case C_INT :
+ case C_INT:
resultLength += INT.length;
break;
- case C_LONG :
+ case C_LONG:
resultLength += LONG.length;
break;
- case C_SHORT :
+ case C_SHORT:
resultLength += SHORT.length;
break;
- case C_VOID :
+ case C_VOID:
resultLength += VOID.length;
break;
- case C_RESOLVED :
- case C_UNRESOLVED :
- int end = CharOperation.indexOf(C_SEMICOLON, methodSignature, i);
- if (end == -1) throw new IllegalArgumentException();
+ case C_RESOLVED:
+ case C_UNRESOLVED:
+ int end = CharOperation.indexOf(C_SEMICOLON,
+ methodSignature, i);
+ if (end == -1)
+ throw new IllegalArgumentException();
int start;
if (fullyQualifyTypeNames) {
- start = i+1;
+ start = i + 1;
} else {
- start = CharOperation.lastIndexOf(C_DOT, methodSignature, i, end) + 1;
- if (start == 0) start = i+1;
- }
- resultLength += end-start;
+ start = CharOperation.lastIndexOf(C_DOT,
+ methodSignature, i, end) + 1;
+ if (start == 0)
+ start = i + 1;
+ }
+ resultLength += end - start;
i = end;
break;
- case C_PARAM_START :
+ case C_PARAM_START:
// add space for "("
resultLength++;
continue signature;
- case C_PARAM_END :
+ case C_PARAM_END:
lastParen = i;
if (includeReturnType) {
if (paramCount > 0) {
- // remove space for ", " that was added with last parameter and remove space that is going to be added for ", " after return type
+ // remove space for ", " that was added with last
+ // parameter and remove space that is going to be
+ // added for ", " after return type
// and add space for ") "
resultLength -= 2;
- } //else
- // remove space that is going to be added for ", " after return type
- // and add space for ") "
- // -> noop
-
- // decrement param count because it is going to be added for return type
+ } // else
+ // remove space that is going to be added for ", " after
+ // return type
+ // and add space for ") "
+ // -> noop
+
+ // decrement param count because it is going to be added
+ // for return type
paramCount--;
continue signature;
} else {
if (paramCount > 0) {
- // remove space for ", " that was added with last parameter and add space for ")"
+ // remove space for ", " that was added with last
+ // parameter and add space for ")"
resultLength--;
} else {
// add space for ")"
@@ -1138,297 +1298,338 @@ public static char[] toCharArray(char[] methodSignature, char[] methodName, char
}
break signature;
}
- default :
+ default:
throw new IllegalArgumentException();
+ }
+ resultLength += 2; // add space for ", "
+ paramCount++;
}
- resultLength += 2; // add space for ", "
- paramCount++;
- }
-
- // parameter names
- int parameterNamesLength = parameterNames == null ? 0 : parameterNames.length;
- for (int i = 0; i >> 32);
- result[index++] = ' ';
- }
-
- // selector
- if (methodName != null) {
- System.arraycopy(methodName, 0, result, index, selectorLength);
- index += selectorLength;
- }
-
- // parameters
- result[index++] = C_PARAM_START;
- int sigPos = firstParen+1;
- for (int i = 0; i < paramCount; i++) {
- long pos = copyType(methodSignature, sigPos, result, index, fullyQualifyTypeNames);
- index = (int) (pos >>> 32);
- sigPos = (int)pos;
- if (parameterNames != null) {
- result[index++] = ' ';
- char[] parameterName = parameterNames[i];
- int paramLength = parameterName.length;
- System.arraycopy(parameterName, 0, result, index, paramLength);
- index += paramLength;
+
+ // parameter names
+ int parameterNamesLength = parameterNames == null ? 0
+ : parameterNames.length;
+ for (int i = 0; i < parameterNamesLength; i++) {
+ resultLength += parameterNames[i].length + 1; // parameter
+ // name + space
}
- if (i != paramCount-1) {
- result[index++] = ',';
+
+ // selector
+ int selectorLength = methodName == null ? 0 : methodName.length;
+ resultLength += selectorLength;
+
+ // create resulting char array
+ char[] result = new char[resultLength];
+
+ // returned type
+ int index = 0;
+ if (includeReturnType) {
+ long pos = copyType(methodSignature, lastParen + 1, result,
+ index, fullyQualifyTypeNames);
+ index = (int) (pos >>> 32);
result[index++] = ' ';
}
- }
- if (sigPos >= sigLength) {
- throw new IllegalArgumentException(); // should be on last paren
- }
- result[index++] = C_PARAM_END;
-
- return result;
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException();
- }
-}
-/**
- * Converts the given type signature to a readable string. The signature is expected to
- * be dot-based.
- *
- *
- * Note: This method assumes that a type signature containing a '$'
- * is an inner type signature. While this is correct in most cases, someone could
- * define a non-inner type name containing a '$'. Handling this
- * correctly in all cases would have required resolving the signature, which
- * generally not feasible.
- *
- *
- * @param signature the type signature
- * @return the string representation of the type
- * @exception IllegalArgumentException if the signature is not syntactically
- * correct
- *
- * @since 2.0
- */
-public static char[] toCharArray(char[] signature) throws IllegalArgumentException {
- try {
- int sigLength = signature.length;
- if (sigLength == 0 || signature[0] == C_PARAM_START) {
- return toCharArray(signature, CharOperation.NO_CHAR, null, true, true);
- }
-
- // compute result length
- int resultLength = 0;
- int index = -1;
- while (signature[++index] == C_ARRAY) {
- resultLength += 2; // []
+ // selector
+ if (methodName != null) {
+ System.arraycopy(methodName, 0, result, index, selectorLength);
+ index += selectorLength;
+ }
+
+ // parameters
+ result[index++] = C_PARAM_START;
+ int sigPos = firstParen + 1;
+ for (int i = 0; i < paramCount; i++) {
+ long pos = copyType(methodSignature, sigPos, result, index,
+ fullyQualifyTypeNames);
+ index = (int) (pos >>> 32);
+ sigPos = (int) pos;
+ if (parameterNames != null) {
+ result[index++] = ' ';
+ char[] parameterName = parameterNames[i];
+ int paramLength = parameterName.length;
+ System.arraycopy(parameterName, 0, result, index,
+ paramLength);
+ index += paramLength;
+ }
+ if (i != paramCount - 1) {
+ result[index++] = ',';
+ result[index++] = ' ';
+ }
+ }
+ if (sigPos >= sigLength) {
+ throw new IllegalArgumentException(); // should be on last
+ // paren
+ }
+ result[index++] = C_PARAM_END;
+
+ return result;
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new IllegalArgumentException();
}
- switch (signature[index]) {
- case C_BOOLEAN :
+ }
+
+ /**
+ * Converts the given type signature to a readable string. The signature is
+ * expected to be dot-based.
+ *
+ *
+ * Note: This method assumes that a type signature containing a
+ * '$' is an inner type signature. While this is correct in
+ * most cases, someone could define a non-inner type name containing a
+ * '$'. Handling this correctly in all cases would have
+ * required resolving the signature, which generally not feasible.
+ *
+ *
+ * @param signature
+ * the type signature
+ * @return the string representation of the type
+ * @exception IllegalArgumentException
+ * if the signature is not syntactically correct
+ *
+ * @since 2.0
+ */
+ public static char[] toCharArray(char[] signature)
+ throws IllegalArgumentException {
+ try {
+ int sigLength = signature.length;
+
+ if (sigLength == 0 || signature[0] == C_PARAM_START) {
+ return toCharArray(signature, CharOperation.NO_CHAR, null,
+ true, true);
+ }
+
+ // compute result length
+ int resultLength = 0;
+ int index = -1;
+ while (signature[++index] == C_ARRAY) {
+ resultLength += 2; // []
+ }
+ switch (signature[index]) {
+ case C_BOOLEAN:
resultLength += BOOLEAN.length;
break;
- case C_BYTE :
+ case C_BYTE:
resultLength += BYTE.length;
break;
- case C_CHAR :
+ case C_CHAR:
resultLength += CHAR.length;
break;
- case C_DOUBLE :
+ case C_DOUBLE:
resultLength += DOUBLE.length;
break;
- case C_FLOAT :
+ case C_FLOAT:
resultLength += FLOAT.length;
break;
- case C_INT :
+ case C_INT:
resultLength += INT.length;
break;
- case C_LONG :
+ case C_LONG:
resultLength += LONG.length;
break;
- case C_SHORT :
+ case C_SHORT:
resultLength += SHORT.length;
break;
- case C_VOID :
+ case C_VOID:
resultLength += VOID.length;
break;
- case C_RESOLVED :
- case C_UNRESOLVED :
+ case C_RESOLVED:
+ case C_UNRESOLVED:
int end = CharOperation.indexOf(C_SEMICOLON, signature, index);
- if (end == -1) throw new IllegalArgumentException();
+ if (end == -1)
+ throw new IllegalArgumentException();
int start = index + 1;
- resultLength += end-start;
+ resultLength += end - start;
break;
- default :
+ default:
throw new IllegalArgumentException();
+ }
+
+ char[] result = new char[resultLength];
+ copyType(signature, 0, result, 0, true);
+
+ /**
+ * Converts '$' separated type signatures into '.' separated type
+ * signature. NOTE: This assumes that the type signature is an inner
+ * type signature. This is true in most cases, but someone can
+ * define a non-inner type name containing a '$'. However to tell
+ * the difference, we would have to resolve the signature, which
+ * cannot be done at this point.
+ */
+ CharOperation.replace(result, C_DOLLAR, C_DOT);
+
+ return result;
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new IllegalArgumentException();
}
-
- char[] result = new char[resultLength];
- copyType(signature, 0, result, 0, true);
+ }
- /**
- * Converts '$' separated type signatures into '.' separated type signature.
- * NOTE: This assumes that the type signature is an inner type signature.
- * This is true in most cases, but someone can define a non-inner type
- * name containing a '$'. However to tell the difference, we would have
- * to resolve the signature, which cannot be done at this point.
- */
- CharOperation.replace(result, C_DOLLAR, C_DOT);
+ /**
+ * Converts the given array of qualified name segments to a qualified name.
+ *
- *
- *
- * @param segments the list of name segments, possibly empty
- * @return the dot-separated qualified name, or the empty string
- *
- * @since 2.0
- */
-public static char[] toQualifiedName(char[][] segments) {
- int length = segments.length;
- if (length == 0) return CharOperation.NO_CHAR;
- if (length == 1) return segments[0];
-
- int resultLength = 0;
- for (int i = 0; i < length; i++) {
- resultLength += segments[i].length+1;
}
- resultLength--;
- char[] result = new char[resultLength];
- int index = 0;
- for (int i = 0; i < length; i++) {
- char[] segment = segments[i];
- int segmentLength = segment.length;
- System.arraycopy(segment, 0, result, index, segmentLength);
- index += segmentLength;
- if (i != length-1) {
- result[index++] = C_DOT;
+
+ /**
+ * Converts the given array of qualified name segments to a qualified name.
+ *
+ *
+ *
+ *
+ * @param segments
+ * the list of name segments, possibly empty
+ * @return the dot-separated qualified name, or the empty string
+ */
+ public static String toQualifiedName(String[] segments) {
+ int length = segments.length;
+ char[][] charArrays = new char[length][];
+ for (int i = 0; i < length; i++) {
+ charArrays[i] = segments[i].toCharArray();
}
+ return new String(toQualifiedName(charArrays));
}
- return result;
-}
-/**
- * Converts the given array of qualified name segments to a qualified name.
- *
- *
- *
- * @param segments the list of name segments, possibly empty
- * @return the dot-separated qualified name, or the empty string
- */
-public static String toQualifiedName(String[] segments) {
- int length = segments.length;
- char[][] charArrays = new char[length][];
- for (int i = 0; i < length; i++) {
- charArrays[i] = segments[i].toCharArray();
+
+ /**
+ * Converts the given type signature to a readable string. The signature is
+ * expected to be dot-based.
+ *
+ *
+ * Note: This method assumes that a type signature containing a
+ * '$' is an inner type signature. While this is correct in
+ * most cases, someone could define a non-inner type name containing a
+ * '$'. Handling this correctly in all cases would have
+ * required resolving the signature, which generally not feasible.
+ *
+ *
+ * @param signature
+ * the type signature
+ * @return the string representation of the type
+ * @exception IllegalArgumentException
+ * if the signature is not syntactically correct
+ */
+ public static String toString(String signature)
+ throws IllegalArgumentException {
+ // return new String(toCharArray(signature.toCharArray()));
+ return "";
}
- return new String(toQualifiedName(charArrays));
-}
-/**
- * Converts the given type signature to a readable string. The signature is expected to
- * be dot-based.
- *
- *
- * Note: This method assumes that a type signature containing a '$'
- * is an inner type signature. While this is correct in most cases, someone could
- * define a non-inner type name containing a '$'. Handling this
- * correctly in all cases would have required resolving the signature, which
- * generally not feasible.
- *
- *
- * @param signature the type signature
- * @return the string representation of the type
- * @exception IllegalArgumentException if the signature is not syntactically
- * correct
- */
-public static String toString(String signature) throws IllegalArgumentException {
-// return new String(toCharArray(signature.toCharArray()));
- return "";
-}
-/**
- * Converts the given method signature to a readable string. The method signature is expected to
- * be dot-based.
- *
- *
- *
- * @param methodSignature the method signature to convert
- * @param methodName the name of the method to insert in the result, or
- * null if no method name is to be included
- * @param parameterNames the parameter names to insert in the result, or
- * null if no parameter names are to be included; if supplied,
- * the number of parameter names must match that of the method signature
- * @param fullyQualifyTypeNames true if type names should be fully
- * qualified, and false to use only simple names
- * @param includeReturnType true if the return type is to be
- * included
- * @return the string representation of the method signature
- */
-public static String toString(String methodSignature, String methodName, String[] parameterNames, boolean fullyQualifyTypeNames, boolean includeReturnType) {
- char[][] params;
- if (parameterNames == null) {
- params = null;
- } else {
- int paramLength = parameterNames.length;
- params = new char[paramLength][];
- for (int i = 0; i < paramLength; i++) {
- params[i] = parameterNames[i].toCharArray();
+
+ /**
+ * Converts the given method signature to a readable string. The method
+ * signature is expected to be dot-based.
+ *
+ *
+ *
+ *
+ * @param methodSignature
+ * the method signature to convert
+ * @param methodName
+ * the name of the method to insert in the result, or
+ * null if no method name is to be included
+ * @param parameterNames
+ * the parameter names to insert in the result, or
+ * null if no parameter names are to be included;
+ * if supplied, the number of parameter names must match that of
+ * the method signature
+ * @param fullyQualifyTypeNames
+ * true if type names should be fully qualified,
+ * and false to use only simple names
+ * @param includeReturnType
+ * true if the return type is to be included
+ * @return the string representation of the method signature
+ */
+ public static String toString(String methodSignature, String methodName,
+ String[] parameterNames, boolean fullyQualifyTypeNames,
+ boolean includeReturnType) {
+ char[][] params;
+ if (parameterNames == null) {
+ params = null;
+ } else {
+ int paramLength = parameterNames.length;
+ params = new char[paramLength][];
+ for (int i = 0; i < paramLength; i++) {
+ params[i] = parameterNames[i].toCharArray();
+ }
}
+ return new String(toCharArray(methodSignature.toCharArray(),
+ methodName == null ? null : methodName.toCharArray(), params,
+ fullyQualifyTypeNames, includeReturnType));
}
- return new String(toCharArray(methodSignature.toCharArray(), methodName == null ? null : methodName.toCharArray(), params, fullyQualifyTypeNames, includeReturnType));
-}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java
index aea8d2e..34590c9 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java
@@ -10,7 +10,7 @@
* IBM Corporation - added #createScanner allowing to make comment check stricter
******************************************************************************/
package net.sourceforge.phpdt.core;
-
+
import java.util.Map;
import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
@@ -19,9 +19,11 @@ import net.sourceforge.phpdt.internal.formatter.CodeFormatter;
import org.eclipse.core.runtime.Plugin;
/**
- * Factory for creating various compiler tools, such as scanners, parsers and compilers.
+ * Factory for creating various compiler tools, such as scanners, parsers and
+ * compilers.
*
- * This class provides static methods only; it is not intended to be instantiated or subclassed by clients.
+ * This class provides static methods only; it is not intended to be
+ * instantiated or subclassed by clients.
*
*
* @since 2.0
@@ -29,142 +31,183 @@ import org.eclipse.core.runtime.Plugin;
public class ToolFactory {
/**
- * Create an instance of a code formatter. A code formatter implementation can be contributed via the
- * extension point "org.phpeclipse.phpdt.core.codeFormatter". If unable to find a registered extension, the factory
- * will default to using the default code formatter.
+ * Create an instance of a code formatter. A code formatter implementation
+ * can be contributed via the extension point
+ * "org.phpeclipse.phpdt.core.codeFormatter". If unable to find a registered
+ * extension, the factory will default to using the default code formatter.
*
* @return an instance of a code formatter
* @see ICodeFormatter
* @see ToolFactory#createDefaultCodeFormatter(Map)
*/
- public static ICodeFormatter createCodeFormatter(){
-
- Plugin jdtCorePlugin = JavaCore.getPlugin();
- if (jdtCorePlugin == null) return null;
-
-// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.FORMATTER_EXTPOINT_ID);
-// if (extension != null) {
-// IExtension[] extensions = extension.getExtensions();
-// for(int i = 0; i < extensions.length; i++){
-// IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
-// for(int j = 0; j < configElements.length; j++){
-// try {
-// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
-// if (execExt instanceof ICodeFormatter){
-// // use first contribution found
-// return (ICodeFormatter)execExt;
-// }
-// } catch(CoreException e){
-// }
-// }
-// }
-// }
- // no proper contribution found, use default formatter
+ public static ICodeFormatter createCodeFormatter() {
+
+ Plugin jdtCorePlugin = JavaCore.getPlugin();
+ if (jdtCorePlugin == null)
+ return null;
+
+ // IExtensionPoint extension =
+ // jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.FORMATTER_EXTPOINT_ID);
+ // if (extension != null) {
+ // IExtension[] extensions = extension.getExtensions();
+ // for(int i = 0; i < extensions.length; i++){
+ // IConfigurationElement [] configElements =
+ // extensions[i].getConfigurationElements();
+ // for(int j = 0; j < configElements.length; j++){
+ // try {
+ // Object execExt =
+ // configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
+ // if (execExt instanceof ICodeFormatter){
+ // // use first contribution found
+ // return (ICodeFormatter)execExt;
+ // }
+ // } catch(CoreException e){
+ // }
+ // }
+ // }
+ // }
+ // no proper contribution found, use default formatter
return createDefaultCodeFormatter(null);
}
/**
- * Create an instance of the built-in code formatter. A code formatter implementation can be contributed via the
- * extension point "org.phpeclipse.phpdt.core.codeFormatter". If unable to find a registered extension, the factory will
- * default to using the default code formatter.
+ * Create an instance of the built-in code formatter. A code formatter
+ * implementation can be contributed via the extension point
+ * "org.phpeclipse.phpdt.core.codeFormatter". If unable to find a registered
+ * extension, the factory will default to using the default code formatter.
*
- * @param options - the options map to use for formatting with the default code formatter. Recognized options
- * are documented on JavaCore#getDefaultOptions(). If set to null, then use
- * the current settings from JavaCore#getOptions.
+ * @param options -
+ * the options map to use for formatting with the default code
+ * formatter. Recognized options are documented on
+ * JavaCore#getDefaultOptions(). If set to
+ * null, then use the current settings from
+ * JavaCore#getOptions.
* @return an instance of the built-in code formatter
* @see ICodeFormatter
* @see ToolFactory#createCodeFormatter()
* @see JavaCore#getOptions()
*/
- public static ICodeFormatter createDefaultCodeFormatter(Map options){
+ public static ICodeFormatter createDefaultCodeFormatter(Map options) {
- if (options == null) options = JavaCore.getOptions();
+ if (options == null)
+ options = JavaCore.getOptions();
return new CodeFormatter(options);
}
-
+
/**
- * Create a scanner, indicating the level of detail requested for tokenizing. The scanner can then be
- * used to tokenize some source in a Java aware way.
- * Here is a typical scanning loop:
+ * Create a scanner, indicating the level of detail requested for
+ * tokenizing. The scanner can then be used to tokenize some source in a
+ * Java aware way. Here is a typical scanning loop:
*
*
*
- * IScanner scanner = ToolFactory.createScanner(false, false, false, false);
- * scanner.setSource("int i = 0;".toCharArray());
- * while (true) {
- * int token = scanner.getNextToken();
- * if (token == ITerminalSymbols.TokenNameEOF) break;
- * System.out.println(token + " : " + new String(scanner.getCurrentTokenSource()));
- * }
+ * IScanner scanner = ToolFactory.createScanner(false, false, false, false);
+ * scanner.setSource("int i = 0;".toCharArray());
+ * while (true) {
+ * int token = scanner.getNextToken();
+ * if (token == ITerminalSymbols.TokenNameEOF)
+ * break;
+ * System.out.println(token + " : "
+ * + new String(scanner.getCurrentTokenSource()));
+ * }
*
*
*
*
- * The returned scanner will tolerate unterminated line comments (missing line separator). It can be made stricter
- * by using API with extra boolean parameter (strictCommentMode).
+ * The returned scanner will tolerate unterminated line comments (missing
+ * line separator). It can be made stricter by using API with extra boolean
+ * parameter (strictCommentMode).
*
- * @param tokenizeComments if set to false, comments will be silently consumed
- * @param tokenizeWhiteSpace if set to false, white spaces will be silently consumed,
- * @param assertKeyword if set to false, occurrences of 'assert' will be reported as identifiers
- * (ITerminalSymbols#TokenNameIdentifier), whereas if set to true, it
- * would report assert keywords (ITerminalSymbols#TokenNameassert). Java 1.4 has introduced
- * a new 'assert' keyword.
- * @param recordLineSeparator if set to true, the scanner will record positions of encountered line
- * separator ends. In case of multi-character line separators, the last character position is considered. These positions
- * can then be extracted using IScanner#getLineEnds. Only non-unicode escape sequences are
- * considered as valid line separators.
- * @return a scanner
+ *
+ * @param tokenizeComments
+ * if set to false, comments will be silently
+ * consumed
+ * @param tokenizeWhiteSpace
+ * if set to false, white spaces will be silently
+ * consumed,
+ * @param assertKeyword
+ * if set to false, occurrences of 'assert' will
+ * be reported as identifiers (ITerminalSymbols#TokenNameIdentifier),
+ * whereas if set to true, it would report assert
+ * keywords (ITerminalSymbols#TokenNameassert).
+ * Java 1.4 has introduced a new 'assert' keyword.
+ * @param recordLineSeparator
+ * if set to true, the scanner will record
+ * positions of encountered line separator ends. In case of
+ * multi-character line separators, the last character position
+ * is considered. These positions can then be extracted using
+ * IScanner#getLineEnds. Only non-unicode escape
+ * sequences are considered as valid line separators.
+ * @return a scanner
* @see ToolFactory#createScanner(boolean,boolean,boolean,boolean, boolean)
* @see org.phpeclipse.phpdt.core.compiler.IScanner
*/
-// public static IScanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean recordLineSeparator){
-// return createScanner(tokenizeComments, tokenizeWhiteSpace, recordLineSeparator);
-// }
-
+ // public static IScanner createScanner(boolean tokenizeComments, boolean
+ // tokenizeWhiteSpace, boolean recordLineSeparator){
+ // return createScanner(tokenizeComments, tokenizeWhiteSpace,
+ // recordLineSeparator);
+ // }
/**
- * Create a scanner, indicating the level of detail requested for tokenizing. The scanner can then be
- * used to tokenize some source in a Java aware way.
- * Here is a typical scanning loop:
+ * Create a scanner, indicating the level of detail requested for
+ * tokenizing. The scanner can then be used to tokenize some source in a
+ * Java aware way. Here is a typical scanning loop:
*
*
*
- * IScanner scanner = ToolFactory.createScanner(false, false, false, false);
- * scanner.setSource("int i = 0;".toCharArray());
- * while (true) {
- * int token = scanner.getNextToken();
- * if (token == ITerminalSymbols.TokenNameEOF) break;
- * System.out.println(token + " : " + new String(scanner.getCurrentTokenSource()));
- * }
+ * IScanner scanner = ToolFactory.createScanner(false, false, false, false);
+ * scanner.setSource("int i = 0;".toCharArray());
+ * while (true) {
+ * int token = scanner.getNextToken();
+ * if (token == ITerminalSymbols.TokenNameEOF)
+ * break;
+ * System.out.println(token + " : "
+ * + new String(scanner.getCurrentTokenSource()));
+ * }
*
*
*
- * @param tokenizeComments if set to false, comments will be silently consumed
- * @param tokenizeWhiteSpace if set to false, white spaces will be silently consumed,
- * @param assertMode if set to false, occurrences of 'assert' will be reported as identifiers
- * (ITerminalSymbols#TokenNameIdentifier), whereas if set to true, it
- * would report assert keywords (ITerminalSymbols#TokenNameassert). Java 1.4 has introduced
- * a new 'assert' keyword.
- * @param recordLineSeparator if set to true, the scanner will record positions of encountered line
- * separator ends. In case of multi-character line separators, the last character position is considered. These positions
- * can then be extracted using IScanner#getLineEnds. Only non-unicode escape sequences are
- * considered as valid line separators.
- * @param strictCommentMode if set to true, line comments with no trailing line separator will be
- * treated as invalid tokens.
- * @return a scanner
+ * @param tokenizeComments
+ * if set to false, comments will be silently
+ * consumed
+ * @param tokenizeWhiteSpace
+ * if set to false, white spaces will be silently
+ * consumed,
+ * @param assertMode
+ * if set to false, occurrences of 'assert' will
+ * be reported as identifiers (ITerminalSymbols#TokenNameIdentifier),
+ * whereas if set to true, it would report assert
+ * keywords (ITerminalSymbols#TokenNameassert).
+ * Java 1.4 has introduced a new 'assert' keyword.
+ * @param recordLineSeparator
+ * if set to true, the scanner will record
+ * positions of encountered line separator ends. In case of
+ * multi-character line separators, the last character position
+ * is considered. These positions can then be extracted using
+ * IScanner#getLineEnds. Only non-unicode escape
+ * sequences are considered as valid line separators.
+ * @param strictCommentMode
+ * if set to true, line comments with no trailing
+ * line separator will be treated as invalid tokens.
+ * @return a scanner
*
* @see org.phpeclipse.phpdt.core.compiler.IScanner
* @since 2.1
*/
- public static Scanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean recordLineSeparator){
+ public static Scanner createScanner(boolean tokenizeComments,
+ boolean tokenizeWhiteSpace, boolean recordLineSeparator) {
- Scanner scanner = new Scanner(tokenizeComments, tokenizeWhiteSpace, false/*nls*/);
+ Scanner scanner = new Scanner(tokenizeComments, tokenizeWhiteSpace,
+ false/* nls */);
scanner.recordLineSeparator = recordLineSeparator;
return scanner;
}
-
- public static Scanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean recordLineSeparator, boolean phpMode){
- Scanner scanner = new Scanner(tokenizeComments, tokenizeWhiteSpace, false/*nls*/);
+ public static Scanner createScanner(boolean tokenizeComments,
+ boolean tokenizeWhiteSpace, boolean recordLineSeparator,
+ boolean phpMode) {
+
+ Scanner scanner = new Scanner(tokenizeComments, tokenizeWhiteSpace,
+ false/* nls */);
scanner.recordLineSeparator = recordLineSeparator;
scanner.setPHPMode(phpMode);
return scanner;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/WorkingCopyOwner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/WorkingCopyOwner.java
index e1688f6..4463023 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/WorkingCopyOwner.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/WorkingCopyOwner.java
@@ -14,57 +14,69 @@ import net.sourceforge.phpdt.internal.core.BufferManager;
import net.sourceforge.phpdt.internal.core.DefaultWorkingCopyOwner;
/**
- * The owner of an ICompilationUnit handle in working copy mode.
+ * The owner of an ICompilationUnit handle in working copy mode.
* An owner is used to identify a working copy and to create its buffer.
*
- * Clients should subclass this class to instantiate a working copy owner that is specific to their need and that
- * they can pass in to various APIs (e.g. IType.resolveType(String, WorkingCopyOwner).
- * Clients can also override the default implementation of createBuffer(ICompilationUnit).
- *
- * Note: even though this class has no abstract method, which means that it provides functional default behvior,
- * it is still an abstract class, as clients are intended to own their owner implementation.
+ * Clients should subclass this class to instantiate a working copy owner that
+ * is specific to their need and that they can pass in to various APIs (e.g.
+ * IType.resolveType(String, WorkingCopyOwner). Clients can also
+ * override the default implementation of
+ * createBuffer(ICompilationUnit).
*
+ * Note: even though this class has no abstract method, which means that it
+ * provides functional default behvior, it is still an abstract class, as
+ * clients are intended to own their owner implementation.
+ *
+ *
+ * @see ICompilationUnit#becomeWorkingCopy(IProblemRequestor,
+ * org.eclipse.core.runtime.IProgressMonitor)
* @see ICompilationUnit#discardWorkingCopy()
* @see ICompilationUnit#getWorkingCopy(org.eclipse.core.runtime.IProgressMonitor)
* @since 3.0
*/
public abstract class WorkingCopyOwner {
-
+
/**
- * Sets the buffer provider of the primary working copy owner. Note that even if the
- * buffer provider is a working copy owner, only its createBuffer(ICompilationUnit)
- * method is used by the primary working copy owner. It doesn't replace the internal primary
+ * Sets the buffer provider of the primary working copy owner. Note that
+ * even if the buffer provider is a working copy owner, only its
+ * createBuffer(ICompilationUnit) method is used by the
+ * primary working copy owner. It doesn't replace the internal primary
* working owner.
- *
- * This method is for internal use by the jdt-related plug-ins.
- * Clients outside of the jdt should not reference this method.
+ *
+ * This method is for internal use by the jdt-related plug-ins. Clients
+ * outside of the jdt should not reference this method.
*
*
- * @param primaryBufferProvider the primary buffer provider
+ * @param primaryBufferProvider
+ * the primary buffer provider
*/
- public static void setPrimaryBufferProvider(WorkingCopyOwner primaryBufferProvider) {
+ public static void setPrimaryBufferProvider(
+ WorkingCopyOwner primaryBufferProvider) {
DefaultWorkingCopyOwner.PRIMARY.primaryBufferProvider = primaryBufferProvider;
}
-
+
/**
- * Creates a buffer for the given working copy.
- * The new buffer will be initialized with the contents of the underlying file
- * if and only if it was not already initialized by the compilation owner (a buffer is
+ * Creates a buffer for the given working copy. The new buffer will be
+ * initialized with the contents of the underlying file if and only if it
+ * was not already initialized by the compilation owner (a buffer is
* uninitialized if its content is null).
*
- * Note: This buffer will be associated to the working copy for its entire life-cycle. Another
- * working copy on same unit but owned by a different owner would not share the same buffer
- * unless its owner decided to implement such a sharing behaviour.
+ * Note: This buffer will be associated to the working copy for its entire
+ * life-cycle. Another working copy on same unit but owned by a different
+ * owner would not share the same buffer unless its owner decided to
+ * implement such a sharing behaviour.
*
*
- * @param workingCopy the working copy of the buffer
+ * @param workingCopy
+ * the working copy of the buffer
* @return IBuffer the created buffer for the given working copy
* @see IBuffer
*/
public IBuffer createBuffer(ICompilationUnit workingCopy) {
- return BufferManager.getDefaultBufferManager().createBuffer(workingCopy);
+ return BufferManager.getDefaultBufferManager()
+ .createBuffer(workingCopy);
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/CharOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/CharOperation.java
index ae0ed10..75fe787 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/CharOperation.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/CharOperation.java
@@ -26,28 +26,37 @@ public final class CharOperation {
* Constant for an empty char array with two dimensions.
*/
public static final char[][] NO_CHAR_CHAR = new char[0][];
-
+
/**
- * Answers a new array with appending the suffix character at the end of the array.
- *
+ * Answers a new array with appending the suffix character at the end of the
+ * array.
*
* For example:
*
- *
*
*
- * @param array the array that is concanated with the suffix character
- * @param suffix the suffix character
+ * @param array
+ * the array that is concanated with the suffix character
+ * @param suffix
+ * the suffix character
* @return the new array
*/
public static final char[] append(char[] array, char suffix) {
@@ -58,88 +67,117 @@ public final class CharOperation {
array[length] = suffix;
return array;
}
+
/**
- * Append the given subarray to append to the target array starting at the given index in the target array.
- * The start of the subarray is inclusive, the end is exclusive.
- * Answers a new target array if it needs to grow, otherwise answers the same target array.
- *
+ * Append the given subarray to append to the target array starting at the
+ * given index in the target array. The start of the subarray is inclusive,
+ * the end is exclusive. Answers a new target array if it needs to grow,
+ * otherwise answers the same target array.
* For example:
*
- *
*
*/
- public static final char[] append(char[] target, int index, char[] array, int start, int end) {
+ public static final char[] append(char[] target, int index, char[] array,
+ int start, int end) {
int targetLength = target.length;
- int subLength = end-start;
- int newTargetLength = subLength+index;
+ int subLength = end - start;
+ int newTargetLength = subLength + index;
if (newTargetLength > targetLength) {
- System.arraycopy(target, 0, target = new char[newTargetLength*2], 0, index);
+ System.arraycopy(target, 0, target = new char[newTargetLength * 2],
+ 0, index);
}
System.arraycopy(array, start, target, index, subLength);
return target;
}
/**
- * Answers the concatenation of the two arrays. It answers null if the two arrays are null.
- * If the first array is null, then the second array is returned.
- * If the second array is null, then the first array is returned.
+ * Answers the concatenation of the two arrays. It answers null if the two
+ * arrays are null. If the first array is null, then the second array is
+ * returned. If the second array is null, then the first array is returned.
*
*
* For example:
*
- *
- * first = null
- * second = null
- * => result = null
+ *
+ *
+ *
+ * first = null
+ * second = null
+ * => result = null
*
+ *
*
- *
- * first = { { ' a' } }
- * second = null
- * => result = { { ' a' } }
+ *
+ *
+ *
+ * first = { { ' a' } }
+ * second = null
+ * => result = { { ' a' } }
*
+ *
*
- *
- * first = null
- * second = { { ' a' } }
- * => result = { { ' a' } }
+ *
+ *
+ *
+ * first = null
+ * second = { { ' a' } }
+ * => result = { { ' a' } }
*
+ *
*
- *
- * first = { { ' b' } }
- * second = { { ' a' } }
- * => result = { { ' b' }, { ' a' } }
+ *
+ *
+ *
+ * first = { { ' b' } }
+ * second = { { ' a' } }
+ * => result = { { ' b' }, { ' a' } }
*
+ *
*
*
*
- * @param first the first array to concatenate
- * @param second the second array to concatenate
- * @return the concatenation of the two arrays, or null if the two arrays are null.
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the second array to concatenate
+ * @return the concatenation of the two arrays, or null if the two arrays
+ * are null.
*/
public static final char[][] arrayConcat(char[][] first, char[][] second) {
if (first == null)
@@ -156,36 +194,47 @@ public final class CharOperation {
}
/**
- * Answers a new array adding the second array at the end of first array.
- * It answers null if the first and second are null.
- * If the first array is null, then a new array char[][] is created with second.
- * If the second array is null, then the first array is returned.
- *
+ * Answers a new array adding the second array at the end of first array. It
+ * answers null if the first and second are null. If the first array is
+ * null, then a new array char[][] is created with second. If the second
+ * array is null, then the first array is returned.
*
* For example:
*
- *
- * first = null
- * second = { 'a' }
- * => result = { { ' a' } }
+ *
+ *
+ *
+ * first = null
+ * second = { 'a' }
+ * => result = { { ' a' } }
*
- *
- * first = { { ' a' } }
- * second = null
- * => result = { { ' a' } }
+ *
+ *
+ *
+ *
+ * first = { { ' a' } }
+ * second = null
+ * => result = { { ' a' } }
*
+ *
*
- *
- * first = { { ' a' } }
- * second = { ' b' }
- * => result = { { ' a' } , { ' b' } }
+ *
+ *
+ *
+ * first = { { ' a' } }
+ * second = { ' b' }
+ * => result = { { ' a' } , { ' b' } }
*
+ *
*
*
*
- * @param first the first array to concatenate
- * @param second the array to add at the end of the first array
- * @return a new array adding the second array at the end of first array, or null if the two arrays are null.
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the array to add at the end of the first array
+ * @return a new array adding the second array at the end of first array, or
+ * null if the two arrays are null.
*/
public static final char[][] arrayConcat(char[][] first, char[] second) {
if (second == null)
@@ -201,36 +250,48 @@ public final class CharOperation {
}
/**
- * Answers the concatenation of the two arrays. It answers null if the two arrays are null.
- * If the first array is null, then the second array is returned.
- * If the second array is null, then the first array is returned.
+ * Answers the concatenation of the two arrays. It answers null if the two
+ * arrays are null. If the first array is null, then the second array is
+ * returned. If the second array is null, then the first array is returned.
*
*
* For example:
*
- *
- * first = null
- * second = { 'a' }
- * => result = { ' a' }
+ *
+ *
+ *
+ * first = null
+ * second = { 'a' }
+ * => result = { ' a' }
*
+ *
*
- *
- * first = { ' a' }
- * second = null
- * => result = { ' a' }
+ *
+ *
+ *
+ * first = { ' a' }
+ * second = null
+ * => result = { ' a' }
*
+ *
*
- *
- * first = { ' a' }
- * second = { ' b' }
- * => result = { ' a' , ' b' }
+ *
+ *
+ *
+ * first = { ' a' }
+ * second = { ' b' }
+ * => result = { ' a' , ' b' }
*
+ *
*
*
*
- * @param first the first array to concatenate
- * @param second the second array to concatenate
- * @return the concatenation of the two arrays, or null if the two arrays are null.
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the second array to concatenate
+ * @return the concatenation of the two arrays, or null if the two arrays
+ * are null.
*/
public static final char[] concat(char[] first, char[] second) {
if (first == null)
@@ -247,61 +308,77 @@ public final class CharOperation {
}
/**
- * Answers the concatenation of the three arrays. It answers null if the three arrays are null.
- * If first is null, it answers the concatenation of second and third.
- * If second is null, it answers the concatenation of first and third.
- * If third is null, it answers the concatenation of first and second.
- *
+ * Answers the concatenation of the three arrays. It answers null if the
+ * three arrays are null. If first is null, it answers the concatenation of
+ * second and third. If second is null, it answers the concatenation of
+ * first and third. If third is null, it answers the concatenation of first
+ * and second.
*
* For example:
*
- *
- * first = null
- * second = { 'a' }
- * third = { 'b' }
- * => result = { ' a', 'b' }
+ *
+ *
+ *
+ * first = null
+ * second = { 'a' }
+ * third = { 'b' }
+ * => result = { ' a', 'b' }
*
+ *
*
- *
- * first = { 'a' }
- * second = null
- * third = { 'b' }
- * => result = { ' a', 'b' }
+ *
+ *
+ *
+ * first = { 'a' }
+ * second = null
+ * third = { 'b' }
+ * => result = { ' a', 'b' }
*
+ *
*
- *
- * first = { 'a' }
- * second = { 'b' }
- * third = null
- * => result = { ' a', 'b' }
+ *
+ *
+ *
+ * first = { 'a' }
+ * second = { 'b' }
+ * third = null
+ * => result = { ' a', 'b' }
*
+ *
*
- *
- * first = null
- * second = null
- * third = null
- * => result = null
+ *
+ *
+ *
+ * first = null
+ * second = null
+ * third = null
+ * => result = null
*
+ *
*
- *
- * first = { 'a' }
- * second = { 'b' }
- * third = { 'c' }
- * => result = { 'a', 'b', 'c' }
+ *
+ *
+ *
+ * first = { 'a' }
+ * second = { 'b' }
+ * third = { 'c' }
+ * => result = { 'a', 'b', 'c' }
*
+ *
*
*
*
- * @param first the first array to concatenate
- * @param second the second array to concatenate
- * @param third the third array to concatenate
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the second array to concatenate
+ * @param third
+ * the third array to concatenate
*
- * @return the concatenation of the three arrays, or null if the three arrays are null.
+ * @return the concatenation of the three arrays, or null if the three
+ * arrays are null.
*/
- public static final char[] concat(
- char[] first,
- char[] second,
- char[] third) {
+ public static final char[] concat(char[] first, char[] second, char[] third) {
if (first == null)
return concat(second, third);
if (second == null)
@@ -320,47 +397,57 @@ public final class CharOperation {
}
/**
- * Answers the concatenation of the two arrays inserting the separator character between the two arrays.
- * It answers null if the two arrays are null.
- * If the first array is null, then the second array is returned.
- * If the second array is null, then the first array is returned.
- *
+ * Answers the concatenation of the two arrays inserting the separator
+ * character between the two arrays. It answers null if the two arrays are
+ * null. If the first array is null, then the second array is returned. If
+ * the second array is null, then the first array is returned.
*
* For example:
*
- *
- * first = null
- * second = { 'a' }
- * separator = '/'
- * => result = { ' a' }
+ *
+ *
+ *
+ * first = null
+ * second = { 'a' }
+ * separator = '/'
+ * => result = { ' a' }
*
+ *
*
- *
- * first = { ' a' }
- * second = null
- * separator = '/'
- * => result = { ' a' }
+ *
+ *
+ *
+ * first = { ' a' }
+ * second = null
+ * separator = '/'
+ * => result = { ' a' }
*
+ *
*
- *
- * first = { ' a' }
- * second = { ' b' }
- * separator = '/'
- * => result = { ' a' , '/', 'b' }
+ *
+ *
+ *
+ * first = { ' a' }
+ * second = { ' b' }
+ * separator = '/'
+ * => result = { ' a' , '/', 'b' }
*
+ *
*
*
*
- * @param first the first array to concatenate
- * @param second the second array to concatenate
- * @param separator the character to insert
- * @return the concatenation of the two arrays inserting the separator character
- * between the two arrays , or null if the two arrays are null.
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the second array to concatenate
+ * @param separator
+ * the character to insert
+ * @return the concatenation of the two arrays inserting the separator
+ * character between the two arrays , or null if the two arrays are
+ * null.
*/
- public static final char[] concat(
- char[] first,
- char[] second,
- char separator) {
+ public static final char[] concat(char[] first, char[] second,
+ char separator) {
if (first == null)
return second;
if (second == null)
@@ -381,51 +468,59 @@ public final class CharOperation {
}
/**
- * Answers the concatenation of the three arrays inserting the sep1 character between the
- * two arrays and sep2 between the last two.
- * It answers null if the three arrays are null.
- * If the first array is null, then it answers the concatenation of second and third inserting
- * the sep2 character between them.
- * If the second array is null, then the first array is returned.
- *
+ * Answers the concatenation of the three arrays inserting the sep1
+ * character between the two arrays and sep2 between the last two. It
+ * answers null if the three arrays are null. If the first array is null,
+ * then it answers the concatenation of second and third inserting the sep2
+ * character between them. If the second array is null, then the first array
+ * is returned.
*
* For example:
*
- *
- * first = null
- * second = { 'a' }
- * separator = '/'
- * => result = { ' a' }
+ *
+ *
+ *
+ * first = null
+ * second = { 'a' }
+ * separator = '/'
+ * => result = { ' a' }
*
+ *
*
- *
- * first = { ' a' }
- * second = null
- * separator = '/'
- * => result = { ' a' }
+ *
+ *
+ *
+ * first = { ' a' }
+ * second = null
+ * separator = '/'
+ * => result = { ' a' }
*
+ *
*
- *
- * first = { ' a' }
- * second = { ' b' }
- * separator = '/'
- * => result = { ' a' , '/', 'b' }
+ *
+ *
+ *
+ * first = { ' a' }
+ * second = { ' b' }
+ * separator = '/'
+ * => result = { ' a' , '/', 'b' }
*
+ *
*
*
*
- * @param first the first array to concatenate
- * @param second the second array to concatenate
- * @param separator the character to insert
- * @return the concatenation of the two arrays inserting the separator character
- * between the two arrays , or null if the two arrays are null.
+ * @param first
+ * the first array to concatenate
+ * @param second
+ * the second array to concatenate
+ * @param separator
+ * the character to insert
+ * @return the concatenation of the two arrays inserting the separator
+ * character between the two arrays , or null if the two arrays are
+ * null.
*/
- public static final char[] concat(
- char[] first,
- char sep1,
- char[] second,
- char sep2,
- char[] third) {
+ public static final char[] concat(char[] first, char sep1, char[] second,
+ char sep2, char[] third) {
if (first == null)
return concat(second, third, sep2);
if (second == null)
@@ -446,31 +541,41 @@ public final class CharOperation {
}
/**
- * Answers a new array with prepending the prefix character and appending the suffix
- * character at the end of the array. If array is null, it answers a new array containing the
- * prefix and the suffix characters.
- *
+ * Answers a new array with prepending the prefix character and appending
+ * the suffix character at the end of the array. If array is null, it
+ * answers a new array containing the prefix and the suffix characters.
*
* For example:
*
- *
*
*
- * @param prefix the prefix character
- * @param array the array that is concanated with the prefix and suffix characters
- * @param suffix the suffix character
+ * @param prefix
+ * the prefix character
+ * @param array
+ * the array that is concanated with the prefix and suffix
+ * characters
+ * @param suffix
+ * the suffix character
* @return the new array
*/
public static final char[] concat(char prefix, char[] array, char suffix) {
@@ -484,45 +589,57 @@ public final class CharOperation {
result[length + 1] = suffix;
return result;
}
-
+
/**
- * Answers the concatenation of the given array parts using the given separator between each
- * part and appending the given name at the end.
- *
+ * Answers the concatenation of the given array parts using the given
+ * separator between each part and appending the given name at the end.
*
* For example:
*
- *
+ * name = { ' c' }
+ * array = null
+ * separator = '.'
+ * => result = { 'c' }
+ *
+ *
+ *
*
*
- * @param name the given name
- * @param array the given array
- * @param separator the given separator
- * @return the concatenation of the given array parts using the given separator between each
- * part and appending the given name at the end
+ * @param name
+ * the given name
+ * @param array
+ * the given array
+ * @param separator
+ * the given separator
+ * @return the concatenation of the given array parts using the given
+ * separator between each part and appending the given name at the
+ * end
*/
- public static final char[] concatWith(
- char[] name,
- char[][] array,
- char separator) {
+ public static final char[] concatWith(char[] name, char[][] array,
+ char separator) {
int nameLength = name == null ? 0 : name.length;
if (nameLength == 0)
return concatWith(array, separator);
@@ -551,43 +668,55 @@ public final class CharOperation {
}
/**
- * Answers the concatenation of the given array parts using the given separator between each
- * part and appending the given name at the end.
- *
+ * Answers the concatenation of the given array parts using the given
+ * separator between each part and appending the given name at the end.
*
* For example:
*
- *
+ * name = { ' c' }
+ * array = null
+ * separator = '.'
+ * => result = { 'c' }
+ *
+ *
+ *
*
*
- * @param array the given array
- * @param name the given name
- * @param separator the given separator
- * @return the concatenation of the given array parts using the given separator between each
- * part and appending the given name at the end
+ * @param array
+ * the given array
+ * @param name
+ * the given name
+ * @param separator
+ * the given separator
+ * @return the concatenation of the given array parts using the given
+ * separator between each part and appending the given name at the
+ * end
*/
- public static final char[] concatWith(
- char[][] array,
- char[] name,
- char separator) {
+ public static final char[] concatWith(char[][] array, char[] name,
+ char separator) {
int nameLength = name == null ? 0 : name.length;
if (nameLength == 0)
return concatWith(array, separator);
@@ -616,27 +745,37 @@ public final class CharOperation {
}
/**
- * Answers the concatenation of the given array parts using the given separator between each part.
- *
+ * Answers the concatenation of the given array parts using the given
+ * separator between each part.
*
* For example:
*
- *
*
*
- * @param array the given array
- * @param separator the given separator
- * @return the concatenation of the given array parts using the given separator between each part
+ * @param array
+ * the given array
+ * @param separator
+ * the given separator
+ * @return the concatenation of the given array parts using the given
+ * separator between each part
*/
public static final char[] concatWith(char[][] array, char separator) {
int length = array == null ? 0 : array.length;
@@ -658,45 +797,52 @@ public final class CharOperation {
while (--index >= 0) {
length = array[index].length;
if (length > 0) {
- System.arraycopy(
- array[index],
- 0,
- result,
- (size -= length),
- length);
+ System.arraycopy(array[index], 0, result, (size -= length),
+ length);
if (--size >= 0)
result[size] = separator;
}
}
return result;
}
-
+
/**
- * Answers true if the array contains an occurrence of character, false otherwise.
+ * Answers true if the array contains an occurrence of character, false
+ * otherwise.
*
*
*
* For example:
*
- *
- * character = 'c'
- * array = { { ' a' }, { ' b' } }
- * result => false
+ *
+ *
+ *
+ * character = 'c'
+ * array = { { ' a' }, { ' b' } }
+ * result => false
*
+ *
*
- *
- * character = 'a'
- * array = { { ' a' }, { ' b' } }
- * result => true
+ *
+ *
+ *
+ * character = 'a'
+ * array = { { ' a' }, { ' b' } }
+ * result => true
*
+ *
*
*
*
- * @param character the character to search
- * @param array the array in which the search is done
- * @exception NullPointerException if array is null.
+ * @param character
+ * the character to search
+ * @param array
+ * the array in which the search is done
+ * @exception NullPointerException
+ * if array is null.
*
- * @return true if the array contains an occurrence of character, false otherwise.
+ * @return true if the array contains an occurrence of character, false
+ * otherwise.
*/
public static final boolean contains(char character, char[][] array) {
for (int i = array.length; --i >= 0;) {
@@ -709,31 +855,42 @@ public final class CharOperation {
}
/**
- * Answers true if the array contains an occurrence of character, false otherwise.
+ * Answers true if the array contains an occurrence of character, false
+ * otherwise.
*
*
*
* For example:
*
- *
- * character = 'c'
- * array = { ' b' }
- * result => false
+ *
+ *
+ *
+ * character = 'c'
+ * array = { ' b' }
+ * result => false
*
+ *
*
- *
- * character = 'a'
- * array = { ' a' , ' b' }
- * result => true
+ *
+ *
+ *
+ * character = 'a'
+ * array = { ' a' , ' b' }
+ * result => true
*
+ *
*
*
*
- * @param character the character to search
- * @param array the array in which the search is done
- * @exception NullPointerException if array is null.
+ * @param character
+ * the character to search
+ * @param array
+ * the array in which the search is done
+ * @exception NullPointerException
+ * if array is null.
*
- * @return true if the array contains an occurrence of character, false otherwise.
+ * @return true if the array contains an occurrence of character, false
+ * otherwise.
*/
public static final boolean contains(char character, char[] array) {
for (int i = array.length; --i >= 0;)
@@ -741,11 +898,12 @@ public final class CharOperation {
return true;
return false;
}
-
+
/**
* Answers a deep copy of the toCopy array.
*
- * @param toCopy the array to copy
+ * @param toCopy
+ * the array to copy
* @return a deep copy of the toCopy array.
*/
public static final char[][] deepCopy(char[][] toCopy) {
@@ -762,31 +920,39 @@ public final class CharOperation {
}
/**
- * Return true if array ends with the sequence of characters contained in toBeFound,
- * otherwise false.
- *
+ * Return true if array ends with the sequence of characters contained in
+ * toBeFound, otherwise false.
*
* For example:
*
- *
*
*
- * @param array the array to check
- * @param toBeFound the array to find
- * @exception NullPointerException if array is null or toBeFound is null
- * @return true if array ends with the sequence of characters contained in toBeFound,
- * otherwise false.
+ * @param array
+ * the array to check
+ * @param toBeFound
+ * the array to find
+ * @exception NullPointerException
+ * if array is null or toBeFound is null
+ * @return true if array ends with the sequence of characters contained in
+ * toBeFound, otherwise false.
*/
public static final boolean endsWith(char[] array, char[] toBeFound) {
int i = toBeFound.length;
@@ -801,40 +967,55 @@ public final class CharOperation {
}
/**
- * Answers true if the two arrays are identical character by character, otherwise false.
- * The equality is case sensitive.
- *
+ * Answers true if the two arrays are identical character by character,
+ * otherwise false. The equality is case sensitive.
*
* For example:
*
- *
- * first = null
- * second = null
- * result => true
+ *
+ *
+ *
+ * first = null
+ * second = null
+ * result => true
*
+ *
*
- *
- * first = { { } }
- * second = null
- * result => false
+ *
+ *
+ *
+ * first = { { } }
+ * second = null
+ * result => false
*
+ *
*
- *
- * first = { { 'a' } }
- * second = { { 'a' } }
- * result => true
+ *
+ *
+ *
+ * first = { { 'a' } }
+ * second = { { 'a' } }
+ * result => true
*
+ *
*
- *
- * first = { { 'A' } }
- * second = { { 'a' } }
- * result => false
+ *
+ *
+ *
+ * first = { { 'A' } }
+ * second = { { 'a' } }
+ * result => false
*
+ *
*
*
- * @param first the first array
- * @param second the second array
- * @return true if the two arrays are identical character by character, otherwise false
+ *
+ * @param first
+ * the first array
+ * @param second
+ * the second array
+ * @return true if the two arrays are identical character by character,
+ * otherwise false
*/
public static final boolean equals(char[][] first, char[][] second) {
if (first == second)
@@ -851,54 +1032,66 @@ public final class CharOperation {
}
/**
- * If isCaseSensite is true, answers true if the two arrays are identical character
- * by character, otherwise false.
- * If it is false, answers true if the two arrays are identical character by
- * character without checking the case, otherwise false.
- *
+ * If isCaseSensite is true, answers true if the two arrays are identical
+ * character by character, otherwise false. If it is false, answers true if
+ * the two arrays are identical character by character without checking the
+ * case, otherwise false.
*
* For example:
*
- *
- * first = null
- * second = null
- * isCaseSensitive = true
- * result => true
+ *
+ *
+ *
+ * first = null
+ * second = null
+ * isCaseSensitive = true
+ * result => true
*
+ *
*
- *
- * first = { { } }
- * second = null
- * isCaseSensitive = true
- * result => false
+ *
+ *
+ *
+ * first = { { } }
+ * second = null
+ * isCaseSensitive = true
+ * result => false
*
+ *
*
- *
- * first = { { 'A' } }
- * second = { { 'a' } }
- * isCaseSensitive = true
- * result => false
+ *
+ *
+ *
+ * first = { { 'A' } }
+ * second = { { 'a' } }
+ * isCaseSensitive = true
+ * result => false
*
+ *
*
- *
- * first = { { 'A' } }
- * second = { { 'a' } }
- * isCaseSensitive = false
- * result => true
+ *
+ *
+ *
+ * first = { { 'A' } }
+ * second = { { 'a' } }
+ * isCaseSensitive = false
+ * result => true
*
+ *
*
*
*
- * @param first the first array
- * @param second the second array
- * @param isCaseSensitive check whether or not the equality should be case sensitive
- * @return true if the two arrays are identical character by character according to the value
- * of isCaseSensitive, otherwise false
+ * @param first
+ * the first array
+ * @param second
+ * the second array
+ * @param isCaseSensitive
+ * check whether or not the equality should be case sensitive
+ * @return true if the two arrays are identical character by character
+ * according to the value of isCaseSensitive, otherwise false
*/
- public static final boolean equals(
- char[][] first,
- char[][] second,
- boolean isCaseSensitive) {
+ public static final boolean equals(char[][] first, char[][] second,
+ boolean isCaseSensitive) {
if (isCaseSensitive) {
return equals(first, second);
@@ -917,40 +1110,55 @@ public final class CharOperation {
}
/**
- * Answers true if the two arrays are identical character by character, otherwise false.
- * The equality is case sensitive.
- *
+ * Answers true if the two arrays are identical character by character,
+ * otherwise false. The equality is case sensitive.
*
* For example:
*
- *
- * first = null
- * second = null
- * result => true
+ *
+ *
+ *
+ * first = null
+ * second = null
+ * result => true
*
+ *
*
- *
- * first = { }
- * second = null
- * result => false
+ *
+ *
+ *
+ * first = { }
+ * second = null
+ * result => false
*
+ *
*
- *
- * first = { 'a' }
- * second = { 'a' }
- * result => true
+ *
+ *
+ *
+ * first = { 'a' }
+ * second = { 'a' }
+ * result => true
*
+ *
*
- *
- * first = { 'a' }
- * second = { 'A' }
- * result => false
+ *
+ *
+ *
+ * first = { 'a' }
+ * second = { 'A' }
+ * result => false
*
+ *
*
*
- * @param first the first array
- * @param second the second array
- * @return true if the two arrays are identical character by character, otherwise false
+ *
+ * @param first
+ * the first array
+ * @param second
+ * the second array
+ * @return true if the two arrays are identical character by character,
+ * otherwise false
*/
public static final boolean equals(char[] first, char[] second) {
if (first == second)
@@ -967,54 +1175,66 @@ public final class CharOperation {
}
/**
- * If isCaseSensite is true, answers true if the two arrays are identical character
- * by character, otherwise false.
- * If it is false, answers true if the two arrays are identical character by
- * character without checking the case, otherwise false.
- *
+ * If isCaseSensite is true, answers true if the two arrays are identical
+ * character by character, otherwise false. If it is false, answers true if
+ * the two arrays are identical character by character without checking the
+ * case, otherwise false.
*
* For example:
*
- *
- * first = null
- * second = null
- * isCaseSensitive = true
- * result => true
+ *
+ *
+ *
+ * first = null
+ * second = null
+ * isCaseSensitive = true
+ * result => true
*
+ *
*
- *
- * first = { }
- * second = null
- * isCaseSensitive = true
- * result => false
+ *
+ *
+ *
+ * first = { }
+ * second = null
+ * isCaseSensitive = true
+ * result => false
*
+ *
*
- *
- * first = { 'A' }
- * second = { 'a' }
- * isCaseSensitive = true
- * result => false
+ *
+ *
+ *
+ * first = { 'A' }
+ * second = { 'a' }
+ * isCaseSensitive = true
+ * result => false
*
+ *
*
- *
- * first = { 'A' }
- * second = { 'a' }
- * isCaseSensitive = false
- * result => true
+ *
+ *
+ *
+ * first = { 'A' }
+ * second = { 'a' }
+ * isCaseSensitive = false
+ * result => true
*
+ *
*
*
*
- * @param first the first array
- * @param second the second array
- * @param isCaseSensitive check whether or not the equality should be case sensitive
- * @return true if the two arrays are identical character by character according to the value
- * of isCaseSensitive, otherwise false
+ * @param first
+ * the first array
+ * @param second
+ * the second array
+ * @param isCaseSensitive
+ * check whether or not the equality should be case sensitive
+ * @return true if the two arrays are identical character by character
+ * according to the value of isCaseSensitive, otherwise false
*/
- public static final boolean equals(
- char[] first,
- char[] second,
- boolean isCaseSensitive) {
+ public static final boolean equals(char[] first, char[] second,
+ boolean isCaseSensitive) {
if (isCaseSensitive) {
return equals(first, second);
@@ -1027,83 +1247,98 @@ public final class CharOperation {
return false;
for (int i = first.length; --i >= 0;)
- if (Character.toLowerCase(first[i])
- != Character.toLowerCase(second[i]))
+ if (Character.toLowerCase(first[i]) != Character
+ .toLowerCase(second[i]))
return false;
return true;
}
+
/**
- * If isCaseSensite is true, the equality is case sensitive, otherwise it is case insensitive.
+ * If isCaseSensite is true, the equality is case sensitive, otherwise it is
+ * case insensitive.
*
- * Answers true if the name contains the fragment at the starting index startIndex, otherwise false.
- *
+ * Answers true if the name contains the fragment at the starting index
+ * startIndex, otherwise false.
*
* For example:
*
- *
*
*
- * @param fragment the fragment to check
- * @param second the array to check
- * @param startIndex the starting index
- * @param isCaseSensitive check whether or not the equality should be case sensitive
- * @return true if the name contains the fragment at the starting index startIndex according to the
- * value of isCaseSensitive, otherwise false.
- * @exception NullPointerException if fragment or name is null.
+ * @param fragment
+ * the fragment to check
+ * @param second
+ * the array to check
+ * @param startIndex
+ * the starting index
+ * @param isCaseSensitive
+ * check whether or not the equality should be case sensitive
+ * @return true if the name contains the fragment at the starting index
+ * startIndex according to the value of isCaseSensitive, otherwise
+ * false.
+ * @exception NullPointerException
+ * if fragment or name is null.
*/
- public static final boolean fragmentEquals(
- char[] fragment,
- char[] name,
- int startIndex,
- boolean isCaseSensitive) {
+ public static final boolean fragmentEquals(char[] fragment, char[] name,
+ int startIndex, boolean isCaseSensitive) {
int max = fragment.length;
if (name.length < max + startIndex)
return false;
if (isCaseSensitive) {
- for (int i = max;
- --i >= 0;
- ) // assumes the prefix is not larger than the name
+ for (int i = max; --i >= 0;)
+ // assumes the prefix is not larger than the name
if (fragment[i] != name[i + startIndex])
return false;
return true;
}
- for (int i = max;
- --i >= 0;
- ) // assumes the prefix is not larger than the name
- if (Character.toLowerCase(fragment[i])
- != Character.toLowerCase(name[i + startIndex]))
+ for (int i = max; --i >= 0;)
+ // assumes the prefix is not larger than the name
+ if (Character.toLowerCase(fragment[i]) != Character
+ .toLowerCase(name[i + startIndex]))
return false;
return true;
}
@@ -1111,9 +1346,11 @@ public final class CharOperation {
/**
* Answers a hashcode for the array
*
- * @param array the array for which a hashcode is required
+ * @param array
+ * the array for which a hashcode is required
* @return the hashcode
- * @exception NullPointerException if array is null
+ * @exception NullPointerException
+ * if array is null
*/
public static final int hashCode(char[] array) {
int hash = 0;
@@ -1130,66 +1367,83 @@ public final class CharOperation {
}
return hash & 0x7FFFFFFF;
}
+
/**
- * Answers true if c is a whitespace according to the JLS (\u000a, \u000c, \u000d, \u0009), otherwise false.
- *
+ * Answers true if c is a whitespace according to the JLS (\u000a,
+ * \u000c, \u000d, \u0009), otherwise false.
*
* For example:
*
- *
- * c = ' '
- * result => true
+ *
+ *
+ *
+ * c = ' '
+ * result => true
*
+ *
*
- *
- * c = '\u3000'
- * result => false
+ *
+ *
+ *
+ * c = ' \u3000'
+ * result => false
*
+ *
*
*
*
- * @param c the character to check
+ * @param c
+ * the character to check
* @return true if c is a whitespace according to the JLS, otherwise false.
*/
public static boolean isWhitespace(char c) {
switch (c) {
- case 10 : /* \ u000a: LINE FEED */
- case 12 : /* \ u000c: FORM FEED */
- case 13 : /* \ u000d: CARRIAGE RETURN */
- case 32 : /* \ u0020: SPACE */
- case 9 : /* \ u0009: HORIZONTAL TABULATION */
- return true;
- default :
- return false;
+ case 10: /* \ u000a: LINE FEED */
+ case 12: /* \ u000c: FORM FEED */
+ case 13: /* \ u000d: CARRIAGE RETURN */
+ case 32: /* \ u0020: SPACE */
+ case 9: /* \ u0009: HORIZONTAL TABULATION */
+ return true;
+ default:
+ return false;
}
}
-
+
/**
- * Answers the first index in the array for which the corresponding character is
- * equal to toBeFound. Answers -1 if no occurrence of this character is found.
- *
+ * Answers the first index in the array for which the corresponding
+ * character is equal to toBeFound. Answers -1 if no occurrence of this
+ * character is found.
*
* For example:
*
- *
*
*
- * @param toBeFound the character to search
- * @param array the array to be searched
- * @return the first index in the array for which the corresponding character is
- * equal to toBeFound, -1 otherwise
- * @exception NullPointerException if array is null
+ * @param toBeFound
+ * the character to search
+ * @param array
+ * the array to be searched
+ * @return the first index in the array for which the corresponding
+ * character is equal to toBeFound, -1 otherwise
+ * @exception NullPointerException
+ * if array is null
*/
public static final int indexOf(char toBeFound, char[] array) {
for (int i = 0; i < array.length; i++)
@@ -1199,43 +1453,56 @@ public final class CharOperation {
}
/**
- * Answers the first index in the array for which the corresponding character is
- * equal to toBeFound starting the search at index start.
- * Answers -1 if no occurrence of this character is found.
- *
+ * Answers the first index in the array for which the corresponding
+ * character is equal to toBeFound starting the search at index start.
+ * Answers -1 if no occurrence of this character is found.
*
* For example:
*
- *
*
*
- * @param toBeFound the character to search
- * @param array the array to be searched
- * @param start the starting index
- * @return the first index in the array for which the corresponding character is
- * equal to toBeFound, -1 otherwise
- * @exception NullPointerException if array is null
- * @exception ArrayIndexOutOfBoundsException if start is lower than 0
+ * @param toBeFound
+ * the character to search
+ * @param array
+ * the array to be searched
+ * @param start
+ * the starting index
+ * @return the first index in the array for which the corresponding
+ * character is equal to toBeFound, -1 otherwise
+ * @exception NullPointerException
+ * if array is null
+ * @exception ArrayIndexOutOfBoundsException
+ * if start is lower than 0
*/
public static final int indexOf(char toBeFound, char[] array, int start) {
for (int i = start; i < array.length; i++)
@@ -1245,32 +1512,41 @@ public final class CharOperation {
}
/**
- * Answers the last index in the array for which the corresponding character is
- * equal to toBeFound starting from the end of the array.
- * Answers -1 if no occurrence of this character is found.
- *
+ * Answers the last index in the array for which the corresponding character
+ * is equal to toBeFound starting from the end of the array. Answers -1 if
+ * no occurrence of this character is found.
*
* For example:
*
- *
*
- *
- * @param toBeFound the character to search
- * @param array the array to be searched
- * @return the last index in the array for which the corresponding character is
- * equal to toBeFound starting from the end of the array, -1 otherwise
- * @exception NullPointerException if array is null
+ *
+ * @param toBeFound
+ * the character to search
+ * @param array
+ * the array to be searched
+ * @return the last index in the array for which the corresponding character
+ * is equal to toBeFound starting from the end of the array, -1
+ * otherwise
+ * @exception NullPointerException
+ * if array is null
*/
public static final int lastIndexOf(char toBeFound, char[] array) {
for (int i = array.length; --i >= 0;)
@@ -1280,48 +1556,60 @@ public final class CharOperation {
}
/**
- * Answers the last index in the array for which the corresponding character is
- * equal to toBeFound stopping at the index startIndex.
- * Answers -1 if no occurrence of this character is found.
- *
+ * Answers the last index in the array for which the corresponding character
+ * is equal to toBeFound stopping at the index startIndex. Answers -1 if no
+ * occurrence of this character is found.
*
* For example:
*
- *
*
- *
- * @param toBeFound the character to search
- * @param array the array to be searched
- * @param startIndex the stopping index
- * @return the last index in the array for which the corresponding character is
- * equal to toBeFound stopping at the index startIndex, -1 otherwise
- * @exception NullPointerException if array is null
- * @exception ArrayIndexOutOfBoundsException if startIndex is lower than 0
+ *
+ * @param toBeFound
+ * the character to search
+ * @param array
+ * the array to be searched
+ * @param startIndex
+ * the stopping index
+ * @return the last index in the array for which the corresponding character
+ * is equal to toBeFound stopping at the index startIndex, -1
+ * otherwise
+ * @exception NullPointerException
+ * if array is null
+ * @exception ArrayIndexOutOfBoundsException
+ * if startIndex is lower than 0
*/
- public static final int lastIndexOf(
- char toBeFound,
- char[] array,
- int startIndex) {
+ public static final int lastIndexOf(char toBeFound, char[] array,
+ int startIndex) {
for (int i = array.length; --i >= startIndex;)
if (toBeFound == array[i])
return i;
@@ -1329,72 +1617,88 @@ public final class CharOperation {
}
/**
- * Answers the last index in the array for which the corresponding character is
- * equal to toBeFound starting from endIndex to startIndex.
- * Answers -1 if no occurrence of this character is found.
- *
+ * Answers the last index in the array for which the corresponding character
+ * is equal to toBeFound starting from endIndex to startIndex. Answers -1 if
+ * no occurrence of this character is found.
*
* For example:
*
- *
*
*
- * @param toBeFound the character to search
- * @param array the array to be searched
- * @param startIndex the stopping index
- * @param endIndex the starting index
- * @return the last index in the array for which the corresponding character is
- * equal to toBeFound starting from endIndex to startIndex, -1 otherwise
- * @exception NullPointerException if array is null
- * @exception ArrayIndexOutOfBoundsException if endIndex is greater or equals to array length or starting is lower than 0
+ * @param toBeFound
+ * the character to search
+ * @param array
+ * the array to be searched
+ * @param startIndex
+ * the stopping index
+ * @param endIndex
+ * the starting index
+ * @return the last index in the array for which the corresponding character
+ * is equal to toBeFound starting from endIndex to startIndex, -1
+ * otherwise
+ * @exception NullPointerException
+ * if array is null
+ * @exception ArrayIndexOutOfBoundsException
+ * if endIndex is greater or equals to array length or
+ * starting is lower than 0
*/
- public static final int lastIndexOf(
- char toBeFound,
- char[] array,
- int startIndex,
- int endIndex) {
+ public static final int lastIndexOf(char toBeFound, char[] array,
+ int startIndex, int endIndex) {
for (int i = endIndex; --i >= startIndex;)
if (toBeFound == array[i])
return i;
return -1;
}
-
+
/**
- * Answers the last portion of a name given a separator.
- *
+ * Answers the last portion of a name given a separator.
*
* For example,
+ *
*
*
- * @param array the array
- * @param separator the given separator
+ * @param array
+ * the array
+ * @param separator
+ * the given separator
* @return the last portion of a name given a separator
- * @exception NullPointerException if array is null
+ * @exception NullPointerException
+ * if array is null
*/
final static public char[] lastSegment(char[] array, char separator) {
int pos = lastIndexOf(separator, array);
@@ -1404,117 +1708,130 @@ public final class CharOperation {
}
/**
- * Answers true if the pattern matches the given name, false otherwise. This char[] pattern matching
- * accepts wild-cards '*' and '?'.
- *
- * When not case sensitive, the pattern is assumed to already be lowercased, the
- * name will be lowercased character per character as comparing.
- * If name is null, the answer is false.
- * If pattern is null, the answer is true if name is not null.
- *
+ * Answers true if the pattern matches the given name, false otherwise. This
+ * char[] pattern matching accepts wild-cards '*' and '?'.
+ *
+ * When not case sensitive, the pattern is assumed to already be lowercased,
+ * the name will be lowercased character per character as comparing. If name
+ * is null, the answer is false. If pattern is null, the answer is true if
+ * name is not null.
*
* For example:
*
- *
*
*
- * @param pattern the given pattern
- * @param name the given name
- * @param isCaseSensitive flag to know whether or not the matching should be case sensitive
+ * @param pattern
+ * the given pattern
+ * @param name
+ * the given name
+ * @param isCaseSensitive
+ * flag to know whether or not the matching should be case
+ * sensitive
* @return true if the pattern matches the given name, false otherwise
*/
- public static final boolean match(
- char[] pattern,
- char[] name,
- boolean isCaseSensitive) {
+ public static final boolean match(char[] pattern, char[] name,
+ boolean isCaseSensitive) {
if (name == null)
return false; // null name cannot match
if (pattern == null)
return true; // null pattern is equivalent to '*'
- return match(
- pattern,
- 0,
- pattern.length,
- name,
- 0,
- name.length,
- isCaseSensitive);
+ return match(pattern, 0, pattern.length, name, 0, name.length,
+ isCaseSensitive);
}
/**
- * Answers true if the a sub-pattern matches the subpart of the given name, false otherwise.
- * char[] pattern matching, accepting wild-cards '*' and '?'. Can match only subset of name/pattern.
- * end positions are non-inclusive.
- * The subpattern is defined by the patternStart and pattternEnd positions.
- * When not case sensitive, the pattern is assumed to already be lowercased, the
- * name will be lowercased character per character as comparing.
- *
+ * Answers true if the a sub-pattern matches the subpart of the given name,
+ * false otherwise. char[] pattern matching, accepting wild-cards '*' and
+ * '?'. Can match only subset of name/pattern. end positions are
+ * non-inclusive. The subpattern is defined by the patternStart and
+ * pattternEnd positions. When not case sensitive, the pattern is assumed to
+ * already be lowercased, the name will be lowercased character per
+ * character as comparing.
*
* For example:
*
- *
*
*
- * @param toBeFound the given character
- * @param array the given array
- * @return the number of occurrences of the given character in the given array, 0 if any
- * @exception NullPointerException if array is null
+ * @param toBeFound
+ * the given character
+ * @param array
+ * the given array
+ * @return the number of occurrences of the given character in the given
+ * array, 0 if any
+ * @exception NullPointerException
+ * if array is null
*/
public static final int occurencesOf(char toBeFound, char[] array) {
int count = 0;
@@ -1829,39 +2141,47 @@ public final class CharOperation {
}
/**
- * Answers the number of occurrences of the given character in the given array starting
- * at the given index, 0 if any.
+ * Answers the number of occurrences of the given character in the given
+ * array starting at the given index, 0 if any.
*
*
*
* For example:
*
- *
*
*
- * @param toBeFound the given character
- * @param array the given array
- * @return the number of occurrences of the given character in the given array, 0 if any
- * @exception NullPointerException if array is null
- * @exception ArrayIndexOutOfBoundsException if start is lower than 0
+ * @param toBeFound
+ * the given character
+ * @param array
+ * the given array
+ * @return the number of occurrences of the given character in the given
+ * array, 0 if any
+ * @exception NullPointerException
+ * if array is null
+ * @exception ArrayIndexOutOfBoundsException
+ * if start is lower than 0
*/
- public static final int occurencesOf(
- char toBeFound,
- char[] array,
- int start) {
+ public static final int occurencesOf(char toBeFound, char[] array, int start) {
int count = 0;
for (int i = start; i < array.length; i++)
if (toBeFound == array[i])
@@ -1870,131 +2190,154 @@ public final class CharOperation {
}
/**
- * Answers true if the given name starts with the given prefix, false otherwise.
- * The comparison is case sensitive.
- *
+ * Answers true if the given name starts with the given prefix, false
+ * otherwise. The comparison is case sensitive.
*
* For example:
*
- *
*
*
- * @param prefix the given prefix
- * @param name the given name
- * @return true if the given name starts with the given prefix, false otherwise
- * @exception NullPointerException if the given name is null or if the given prefix is null
+ * @param prefix
+ * the given prefix
+ * @param name
+ * the given name
+ * @return true if the given name starts with the given prefix, false
+ * otherwise
+ * @exception NullPointerException
+ * if the given name is null or if the given prefix is null
*/
public static final boolean prefixEquals(char[] prefix, char[] name) {
int max = prefix.length;
if (name.length < max)
return false;
- for (int i = max;
- --i >= 0;
- ) // assumes the prefix is not larger than the name
+ for (int i = max; --i >= 0;)
+ // assumes the prefix is not larger than the name
if (prefix[i] != name[i])
return false;
return true;
}
/**
- * Answers true if the given name starts with the given prefix, false otherwise.
- * isCaseSensitive is used to find out whether or not the comparison should be case sensitive.
- *
+ * Answers true if the given name starts with the given prefix, false
+ * otherwise. isCaseSensitive is used to find out whether or not the
+ * comparison should be case sensitive.
*
* For example:
*
- *
*
*
- * @param prefix the given prefix
- * @param name the given name
- * @param isCaseSensitive to find out whether or not the comparison should be case sensitive
- * @return true if the given name starts with the given prefix, false otherwise
- * @exception NullPointerException if the given name is null or if the given prefix is null
+ * @param prefix
+ * the given prefix
+ * @param name
+ * the given name
+ * @param isCaseSensitive
+ * to find out whether or not the comparison should be case
+ * sensitive
+ * @return true if the given name starts with the given prefix, false
+ * otherwise
+ * @exception NullPointerException
+ * if the given name is null or if the given prefix is null
*/
- public static final boolean prefixEquals(
- char[] prefix,
- char[] name,
- boolean isCaseSensitive) {
+ public static final boolean prefixEquals(char[] prefix, char[] name,
+ boolean isCaseSensitive) {
int max = prefix.length;
if (name.length < max)
return false;
if (isCaseSensitive) {
- for (int i = max;
- --i >= 0;
- ) // assumes the prefix is not larger than the name
+ for (int i = max; --i >= 0;)
+ // assumes the prefix is not larger than the name
if (prefix[i] != name[i])
return false;
return true;
}
- for (int i = max;
- --i >= 0;
- ) // assumes the prefix is not larger than the name
- if (Character.toLowerCase(prefix[i])
- != Character.toLowerCase(name[i]))
+ for (int i = max; --i >= 0;)
+ // assumes the prefix is not larger than the name
+ if (Character.toLowerCase(prefix[i]) != Character
+ .toLowerCase(name[i]))
return false;
return true;
}
/**
- * Replace all occurrence of the character to be replaced with the remplacement character in the
- * given array.
- *
+ * Replace all occurrence of the character to be replaced with the
+ * remplacement character in the given array.
*
* For example:
*
- *
- * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
- * toBeReplaced = 'b'
- * replacementChar = 'a'
- * result => No returned value, but array is now equals to { 'a' , 'a', 'a', 'a', 'a', 'a' }
+ *
+ *
+ *
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeReplaced = 'b'
+ * replacementChar = 'a'
+ * result => No returned value, but array is now equals to { 'a' , 'a', 'a', 'a', 'a', 'a' }
*
+ *
*
- *
- * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
- * toBeReplaced = 'c'
- * replacementChar = 'a'
- * result => No returned value, but array is now equals to { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ *
+ *
+ *
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeReplaced = 'c'
+ * replacementChar = 'a'
+ * result => No returned value, but array is now equals to { 'a' , 'b', 'b', 'a', 'b', 'a' }
*
+ *
*
*
*
- * @param array the given array
- * @param toBeReplaced the character to be replaced
- * @param replacementChar the replacement character
- * @exception NullPointerException if the given array is null
+ * @param array
+ * the given array
+ * @param toBeReplaced
+ * the character to be replaced
+ * @param replacementChar
+ * the replacement character
+ * @exception NullPointerException
+ * if the given array is null
*/
- public static final void replace(
- char[] array,
- char toBeReplaced,
- char replacementChar) {
+ public static final void replace(char[] array, char toBeReplaced,
+ char replacementChar) {
if (toBeReplaced != replacementChar) {
for (int i = 0, max = array.length; i < max; i++) {
if (array[i] == toBeReplaced)
@@ -2004,39 +2347,47 @@ public final class CharOperation {
}
/**
- * Answers a new array of characters with substitutions. No side-effect is operated on the original
- * array, in case no substitution happened, then the result is the same as the
- * original one.
- *
+ * Answers a new array of characters with substitutions. No side-effect is
+ * operated on the original array, in case no substitution happened, then
+ * the result is the same as the original one.
*
* For example:
*
- *
*
*
- * @param the given array
- * @param toBeReplaced characters to be replaced
- * @param the replacement characters
- * @return a new array of characters with substitutions or the given array if none
- * @exception NullPointerException if the given array is null
+ * @param the
+ * given array
+ * @param toBeReplaced
+ * characters to be replaced
+ * @param the
+ * replacement characters
+ * @return a new array of characters with substitutions or the given array
+ * if none
+ * @exception NullPointerException
+ * if the given array is null
*/
- public static final char[] replace(
- char[] array,
- char[] toBeReplaced,
- char[] replacementChars) {
+ public static final char[] replace(char[] array, char[] toBeReplaced,
+ char[] replacementChars) {
int max = array.length;
int replacedLength = toBeReplaced.length;
@@ -2047,7 +2398,7 @@ public final class CharOperation {
if (!equals(toBeReplaced, replacementChars)) {
- next : for (int i = 0; i < max; i++) {
+ next: for (int i = 0; i < max; i++) {
int j = 0;
while (j < replacedLength) {
if (i + j == max)
@@ -2056,33 +2407,25 @@ public final class CharOperation {
continue next;
}
if (occurrenceCount == starts.length) {
- System.arraycopy(
- starts,
- 0,
- starts = new int[occurrenceCount * 2],
- 0,
- occurrenceCount);
+ System.arraycopy(starts, 0,
+ starts = new int[occurrenceCount * 2], 0,
+ occurrenceCount);
}
starts[occurrenceCount++] = i;
}
}
if (occurrenceCount == 0)
return array;
- char[] result =
- new char[max
- + occurrenceCount * (replacementLength - replacedLength)];
+ char[] result = new char[max + occurrenceCount
+ * (replacementLength - replacedLength)];
int inStart = 0, outStart = 0;
for (int i = 0; i < occurrenceCount; i++) {
int offset = starts[i] - inStart;
System.arraycopy(array, inStart, result, outStart, offset);
inStart += offset;
outStart += offset;
- System.arraycopy(
- replacementChars,
- 0,
- result,
- outStart,
- replacementLength);
+ System.arraycopy(replacementChars, 0, result, outStart,
+ replacementLength);
inStart += replacedLength;
outStart += replacementLength;
}
@@ -2091,42 +2434,56 @@ public final class CharOperation {
}
/**
- * Return a new array which is the split of the given array using the given divider and triming each subarray to remove
- * whitespaces equals to ' '.
+ * Return a new array which is the split of the given array using the given
+ * divider and triming each subarray to remove whitespaces equals to ' '.
*
*
* For example:
*
- *
*
*
- * @param divider the given divider
- * @param array the given array
- * @return a new array which is the split of the given array using the given divider and triming each subarray to remove
- * whitespaces equals to ' '
+ * @param divider
+ * the given divider
+ * @param array
+ * the given array
+ * @return a new array which is the split of the given array using the given
+ * divider and triming each subarray to remove whitespaces equals to ' '
*/
public static final char[][] splitAndTrimOn(char divider, char[] array) {
int length = array == null ? 0 : array.length;
@@ -2147,12 +2504,8 @@ public final class CharOperation {
while (end > start && array[end] == ' ')
end--;
split[currentWord] = new char[end - start + 1];
- System.arraycopy(
- array,
- start,
- split[currentWord++],
- 0,
- end - start + 1);
+ System.arraycopy(array, start, split[currentWord++], 0, end
+ - start + 1);
last = i + 1;
}
}
@@ -2162,44 +2515,53 @@ public final class CharOperation {
while (end > start && array[end] == ' ')
end--;
split[currentWord] = new char[end - start + 1];
- System.arraycopy(
- array,
- start,
- split[currentWord++],
- 0,
- end - start + 1);
+ System
+ .arraycopy(array, start, split[currentWord++], 0, end - start
+ + 1);
return split;
}
/**
- * Return a new array which is the split of the given array using the given divider.
- *
+ * Return a new array which is the split of the given array using the given
+ * divider.
*
* For example:
*
- *
*
*
- * @param divider the given divider
- * @param array the given array
- * @return a new array which is the split of the given array using the given divider
+ * @param divider
+ * the given divider
+ * @param array
+ * the given array
+ * @return a new array which is the split of the given array using the given
+ * divider
*/
public static final char[][] splitOn(char divider, char[] array) {
int length = array == null ? 0 : array.length;
@@ -2215,12 +2577,9 @@ public final class CharOperation {
for (int i = 0; i < length; i++) {
if (array[i] == divider) {
split[currentWord] = new char[i - last];
- System.arraycopy(
- array,
- last,
- split[currentWord++],
- 0,
- i - last);
+ System
+ .arraycopy(array, last, split[currentWord++], 0, i
+ - last);
last = i + 1;
}
}
@@ -2230,34 +2589,41 @@ public final class CharOperation {
}
/**
- * Return a new array which is the split of the given array using the given divider. The given end
- * is exclusive and the given start is inclusive.
+ * Return a new array which is the split of the given array using the given
+ * divider. The given end is exclusive and the given start is inclusive.
*
*
* For example:
*
- *
*
*
- * @param divider the given divider
- * @param array the given array
- * @param start the given starting index
- * @param end the given ending index
- * @return a new array which is the split of the given array using the given divider
- * @exception ArrayIndexOutOfBoundsException if start is lower than 0 or end is greater than the array length
+ * @param divider
+ * the given divider
+ * @param array
+ * the given array
+ * @param start
+ * the given starting index
+ * @param end
+ * the given ending index
+ * @return a new array which is the split of the given array using the given
+ * divider
+ * @exception ArrayIndexOutOfBoundsException
+ * if start is lower than 0 or end is greater than the array
+ * length
*/
- public static final char[][] splitOn(
- char divider,
- char[] array,
- int start,
- int end) {
+ public static final char[][] splitOn(char divider, char[] array, int start,
+ int end) {
int length = array == null ? 0 : array.length;
if (length == 0 || start > end)
return NO_CHAR_CHAR;
@@ -2271,12 +2637,9 @@ public final class CharOperation {
for (int i = start; i < end; i++) {
if (array[i] == divider) {
split[currentWord] = new char[i - last];
- System.arraycopy(
- array,
- last,
- split[currentWord++],
- 0,
- i - last);
+ System
+ .arraycopy(array, last, split[currentWord++], 0, i
+ - last);
last = i + 1;
}
}
@@ -2286,30 +2649,40 @@ public final class CharOperation {
}
/**
- * Answers true if the given array starts with the given characters, false otherwise.
- * The comparison is case sensitive.
- *
+ * Answers true if the given array starts with the given characters, false
+ * otherwise. The comparison is case sensitive.
*
* For example:
*
- *
*
*
- * @param array the given array
- * @param toBeFound the given character to search
- * @return true if the given array starts with the given characters, false otherwise
- * @exception NullPointerException if the given array is null or if the given characters array to be found is null
+ * @param array
+ * the given array
+ * @param toBeFound
+ * the given character to search
+ * @return true if the given array starts with the given characters, false
+ * otherwise
+ * @exception NullPointerException
+ * if the given array is null or if the given characters
+ * array to be found is null
*/
public static final boolean startsWith(char[] array, char[] toBeFound) {
int i = toBeFound.length;
@@ -2320,38 +2693,48 @@ public final class CharOperation {
return false;
return true;
}
-
+
/**
- * Answers a new array which is a copy of the given array starting at the given start and
- * ending at the given end. The given start is inclusive and the given end is exclusive.
- * Answers null if start is greater than end, if start is lower than 0 or if end is greater
- * than the length of the given array. If end equals -1, it is converted to the array length.
- *
+ * Answers a new array which is a copy of the given array starting at the
+ * given start and ending at the given end. The given start is inclusive and
+ * the given end is exclusive. Answers null if start is greater than end, if
+ * start is lower than 0 or if end is greater than the length of the given
+ * array. If end equals -1, it is converted to the array length.
*
* For example:
*
- *
*
- *
- * @param array the given array
- * @param start the given starting index
- * @param end the given ending index
- * @return a new array which is a copy of the given array starting at the given start and
- * ending at the given end
- * @exception NullPointerException if the given array is null
+ *
+ * @param array
+ * the given array
+ * @param start
+ * the given starting index
+ * @param end
+ * the given ending index
+ * @return a new array which is a copy of the given array starting at the
+ * given start and ending at the given end
+ * @exception NullPointerException
+ * if the given array is null
*/
public static final char[][] subarray(char[][] array, int start, int end) {
if (end == -1)
@@ -2369,36 +2752,46 @@ public final class CharOperation {
}
/**
- * Answers a new array which is a copy of the given array starting at the given start and
- * ending at the given end. The given start is inclusive and the given end is exclusive.
- * Answers null if start is greater than end, if start is lower than 0 or if end is greater
- * than the length of the given array. If end equals -1, it is converted to the array length.
- *
+ * Answers a new array which is a copy of the given array starting at the
+ * given start and ending at the given end. The given start is inclusive and
+ * the given end is exclusive. Answers null if start is greater than end, if
+ * start is lower than 0 or if end is greater than the length of the given
+ * array. If end equals -1, it is converted to the array length.
*
* For example:
*
- *
*
- *
- * @param array the given array
- * @param start the given starting index
- * @param end the given ending index
- * @return a new array which is a copy of the given array starting at the given start and
- * ending at the given end
- * @exception NullPointerException if the given array is null
+ *
+ * @param array
+ * the given array
+ * @param start
+ * the given starting index
+ * @param end
+ * the given ending index
+ * @return a new array which is a copy of the given array starting at the
+ * given start and ending at the given end
+ * @exception NullPointerException
+ * if the given array is null
*/
public static final char[] subarray(char[] array, int start, int end) {
if (end == -1)
@@ -2414,27 +2807,35 @@ public final class CharOperation {
System.arraycopy(array, start, result, 0, end - start);
return result;
}
+
/**
- * Answers the result of a char[] conversion to lowercase. Answers null if the given chars array is null.
- *
+ * Answers the result of a char[] conversion to lowercase. Answers null if
+ * the given chars array is null.
* NOTE: if no conversion was necessary, then answers back the argument one.
*
*
* For example:
*
- *
*
*
- * @param chars the chars to convert
+ * @param chars
+ * the chars to convert
* @return the result of a char[] conversion to lowercase
*/
final static public char[] toLowerCase(char[] chars) {
@@ -2447,12 +2848,8 @@ public final class CharOperation {
char lc = Character.toLowerCase(c);
if ((c != lc) || (lowerChars != null)) {
if (lowerChars == null) {
- System.arraycopy(
- chars,
- 0,
- lowerChars = new char[length],
- 0,
- i);
+ System.arraycopy(chars, 0, lowerChars = new char[length],
+ 0, i);
}
lowerChars[i] = lc;
}
@@ -2461,25 +2858,31 @@ public final class CharOperation {
}
/**
- * Answers a new array removing leading and trailing spaces (' '). Answers the given array if there is no
- * space characters to remove.
- *
+ * Answers a new array removing leading and trailing spaces (' '). Answers
+ * the given array if there is no space characters to remove.
*
* For example:
*
- *
*
*
- * @param chars the given array
+ * @param chars
+ * the given array
* @return a new array removing leading and trailing spaces (' ')
*/
final static public char[] trim(char[] chars) {
@@ -2501,25 +2904,33 @@ public final class CharOperation {
}
/**
- * Answers a string which is the concatenation of the given array using the '.' as a separator.
- *
+ * Answers a string which is the concatenation of the given array using the
+ * '.' as a separator.
*
* For example:
*
- *
*
*
- * @param chars the given array
- * @return a string which is the concatenation of the given array using the '.' as a separator
+ * @param chars
+ * the given array
+ * @return a string which is the concatenation of the given array using the
+ * '.' as a separator
*/
final static public String toString(char[][] array) {
char[] result = concatWith(array, '.');
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java
index 24cd371..85b68a2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java
@@ -33,31 +33,35 @@
* IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod
*******************************************************************************/
package net.sourceforge.phpdt.core.compiler;
-
+
import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReasons;
/**
- * Description of a Java problem, as detected by the compiler or some of the underlying
- * technology reusing the compiler.
- * A problem provides access to:
+ * Description of a Java problem, as detected by the compiler or some of the
+ * underlying technology reusing the compiler. A problem provides access to:
*
- *
its location (originating source file name, source position, line number),
- *
its message description and a predicate to check its severity (warning or error).
- *
its ID : an number identifying the very nature of this problem. All possible IDs are listed
- * as constants on this interface.
+ *
its location (originating source file name, source position, line
+ * number),
+ *
its message description and a predicate to check its severity (warning
+ * or error).
+ *
its ID : an number identifying the very nature of this problem. All
+ * possible IDs are listed as constants on this interface.
*
*
- * Note: the compiler produces IProblems internally, which are turned into markers by the JavaBuilder
- * so as to persist problem descriptions. This explains why there is no API allowing to reach IProblem detected
- * when compiling. However, the Java problem markers carry equivalent information to IProblem, in particular
- * their ID (attribute "id") is set to one of the IDs defined on this interface.
+ * Note: the compiler produces IProblems internally, which are turned into
+ * markers by the JavaBuilder so as to persist problem descriptions. This
+ * explains why there is no API allowing to reach IProblem detected when
+ * compiling. However, the Java problem markers carry equivalent information to
+ * IProblem, in particular their ID (attribute "id") is set to one of the IDs
+ * defined on this interface.
*
* @since 2.0
*/
-public interface IProblem {
-
+public interface IProblem {
+
/**
* Answer back the original arguments recorded into the problem.
+ *
* @return the original arguments recorded into the problem
*/
String[] getArguments();
@@ -70,9 +74,11 @@ public interface IProblem {
int getID();
/**
- * Answer a localized, human-readable message string which describes the problem.
+ * Answer a localized, human-readable message string which describes the
+ * problem.
*
- * @return a localized, human-readable message string which describes the problem
+ * @return a localized, human-readable message string which describes the
+ * problem
*/
String getMessage();
@@ -82,7 +88,7 @@ public interface IProblem {
* @return the file name in which the problem was found
*/
char[] getOriginatingFileName();
-
+
/**
* Answer the end position of the problem (inclusive), or -1 if unknown.
*
@@ -114,68 +120,84 @@ public interface IProblem {
/**
* Checks the severity to see if the Error bit is not set.
*
- * @return true if the Error bit is not set for the severity, false otherwise
+ * @return true if the Error bit is not set for the severity, false
+ * otherwise
*/
boolean isWarning();
/**
- * Set the end position of the problem (inclusive), or -1 if unknown.
- * Used for shifting problem positions.
+ * Set the end position of the problem (inclusive), or -1 if unknown. Used
+ * for shifting problem positions.
*
- * @param sourceEnd the given end position
+ * @param sourceEnd
+ * the given end position
*/
void setSourceEnd(int sourceEnd);
/**
* Set the line number in source where the problem begins.
*
- * @param lineNumber the given line number
+ * @param lineNumber
+ * the given line number
*/
void setSourceLineNumber(int lineNumber);
/**
- * Set the start position of the problem (inclusive), or -1 if unknown.
- * Used for shifting problem positions.
+ * Set the start position of the problem (inclusive), or -1 if unknown. Used
+ * for shifting problem positions.
*
- * @param the given start position
+ * @param the
+ * given start position
*/
void setSourceStart(int sourceStart);
-
+
/**
- * Problem Categories
- * The high bits of a problem ID contains information about the category of a problem.
- * For example, (problemID & TypeRelated) != 0, indicates that this problem is type related.
+ * Problem Categories The high bits of a problem ID contains information
+ * about the category of a problem. For example, (problemID & TypeRelated) !=
+ * 0, indicates that this problem is type related.
*
- * A problem category can help to implement custom problem filters. Indeed, when numerous problems
- * are listed, focusing on import related problems first might be relevant.
+ * A problem category can help to implement custom problem filters. Indeed,
+ * when numerous problems are listed, focusing on import related problems
+ * first might be relevant.
*
- * When a problem is tagged as Internal, it means that no change other than a local source code change
- * can fix the corresponding problem.
+ * When a problem is tagged as Internal, it means that no change other than
+ * a local source code change can fix the corresponding problem.
*/
int TypeRelated = 0x01000000;
+
int FieldRelated = 0x02000000;
+
int MethodRelated = 0x04000000;
+
int ConstructorRelated = 0x08000000;
+
int ImportRelated = 0x10000000;
+
int Internal = 0x20000000;
- int Syntax = 0x40000000;
+
+ int Syntax = 0x40000000;
+
/**
* @since 3.0
*/
int Javadoc = 0x80000000;
+
/**
- * Mask to use in order to filter out the category portion of the problem ID.
+ * Mask to use in order to filter out the category portion of the problem
+ * ID.
*/
int IgnoreCategoriesMask = 0xFFFFFF;
/**
- * Below are listed all available problem IDs. Note that this list could be augmented in the future,
- * as new features are added to the Java core implementation.
+ * Below are listed all available problem IDs. Note that this list could be
+ * augmented in the future, as new features are added to the Java core
+ * implementation.
*/
/**
- * ID reserved for referencing an internal error inside the JavaCore implementation which
- * may be surfaced as a problem associated with the compilation unit which caused it to occur.
+ * ID reserved for referencing an internal error inside the JavaCore
+ * implementation which may be surfaced as a problem associated with the
+ * compilation unit which caused it to occur.
*/
int Unclassified = 0;
@@ -183,489 +205,830 @@ public interface IProblem {
* Generic type related problems
*/
int ObjectHasNoSuperclass = TypeRelated + 1;
+
int UndefinedType = TypeRelated + 2;
+
int NotVisibleType = TypeRelated + 3;
+
int AmbiguousType = TypeRelated + 4;
+
int UsingDeprecatedType = TypeRelated + 5;
+
int InternalTypeNameProvided = TypeRelated + 6;
+
/** @since 2.1 */
int UnusedPrivateType = Internal + TypeRelated + 7;
-
+
int IncompatibleTypesInEqualityOperator = TypeRelated + 15;
+
int IncompatibleTypesInConditionalOperator = TypeRelated + 16;
+
int TypeMismatch = TypeRelated + 17;
/**
* Inner types related problems
*/
int MissingEnclosingInstanceForConstructorCall = TypeRelated + 20;
+
int MissingEnclosingInstance = TypeRelated + 21;
+
int IncorrectEnclosingInstanceReference = TypeRelated + 22;
- int IllegalEnclosingInstanceSpecification = TypeRelated + 23;
+
+ int IllegalEnclosingInstanceSpecification = TypeRelated + 23;
+
int CannotDefineStaticInitializerInLocalType = Internal + 24;
+
int OuterLocalMustBeFinal = Internal + 25;
+
int CannotDefineInterfaceInLocalType = Internal + 26;
+
int IllegalPrimitiveOrArrayTypeForEnclosingInstance = TypeRelated + 27;
+
/** @since 2.1 */
int EnclosingInstanceInConstructorCall = Internal + 28;
+
int AnonymousClassCannotExtendFinalClass = TypeRelated + 29;
// variables
int UndefinedName = 50;
+
int UninitializedLocalVariable = Internal + 51;
+
int VariableTypeCannotBeVoid = Internal + 52;
+
int VariableTypeCannotBeVoidArray = Internal + 53;
+
int CannotAllocateVoidArray = Internal + 54;
+
// local variables
int RedefinedLocal = Internal + 55;
+
int RedefinedArgument = Internal + 56;
+
// final local variables
int DuplicateFinalLocalInitialization = Internal + 57;
+
/** @since 2.1 */
int NonBlankFinalLocalAssignment = Internal + 58;
+
int FinalOuterLocalAssignment = Internal + 60;
+
int LocalVariableIsNeverUsed = Internal + 61;
+
int ArgumentIsNeverUsed = Internal + 62;
+
int BytecodeExceeds64KLimit = Internal + 63;
+
int BytecodeExceeds64KLimitForClinit = Internal + 64;
+
int TooManyArgumentSlots = Internal + 65;
+
int TooManyLocalVariableSlots = Internal + 66;
+
/** @since 2.1 */
int TooManySyntheticArgumentSlots = Internal + 67;
+
/** @since 2.1 */
int TooManyArrayDimensions = Internal + 68;
+
/** @since 2.1 */
int BytecodeExceeds64KLimitForConstructor = Internal + 69;
// fields
int UndefinedField = FieldRelated + 70;
+
int NotVisibleField = FieldRelated + 71;
+
int AmbiguousField = FieldRelated + 72;
+
int UsingDeprecatedField = FieldRelated + 73;
+
int NonStaticFieldFromStaticInvocation = FieldRelated + 74;
+
int ReferenceToForwardField = FieldRelated + Internal + 75;
+
/** @since 2.1 */
int NonStaticAccessToStaticField = Internal + FieldRelated + 76;
+
/** @since 2.1 */
int UnusedPrivateField = Internal + FieldRelated + 77;
-
+
// blank final fields
int FinalFieldAssignment = FieldRelated + 80;
+
int UninitializedBlankFinalField = FieldRelated + 81;
+
int DuplicateBlankFinalFieldInitialization = FieldRelated + 82;
// methods
int UndefinedMethod = MethodRelated + 100;
+
int NotVisibleMethod = MethodRelated + 101;
+
int AmbiguousMethod = MethodRelated + 102;
+
int UsingDeprecatedMethod = MethodRelated + 103;
+
int DirectInvocationOfAbstractMethod = MethodRelated + 104;
+
int VoidMethodReturnsValue = MethodRelated + 105;
+
int MethodReturnsVoid = MethodRelated + 106;
+
int MethodRequiresBody = Internal + MethodRelated + 107;
+
int ShouldReturnValue = Internal + MethodRelated + 108;
+
int MethodButWithConstructorName = MethodRelated + 110;
+
int MissingReturnType = TypeRelated + 111;
+
int BodyForNativeMethod = Internal + MethodRelated + 112;
+
int BodyForAbstractMethod = Internal + MethodRelated + 113;
+
int NoMessageSendOnBaseType = MethodRelated + 114;
+
int ParameterMismatch = MethodRelated + 115;
+
int NoMessageSendOnArrayType = MethodRelated + 116;
+
/** @since 2.1 */
- int NonStaticAccessToStaticMethod = Internal + MethodRelated + 117;
+ int NonStaticAccessToStaticMethod = Internal + MethodRelated + 117;
+
/** @since 2.1 */
int UnusedPrivateMethod = Internal + MethodRelated + 118;
-
+
// constructors
int UndefinedConstructor = ConstructorRelated + 130;
+
int NotVisibleConstructor = ConstructorRelated + 131;
+
int AmbiguousConstructor = ConstructorRelated + 132;
+
int UsingDeprecatedConstructor = ConstructorRelated + 133;
+
/** @since 2.1 */
int UnusedPrivateConstructor = Internal + MethodRelated + 134;
+
// explicit constructor calls
int InstanceFieldDuringConstructorInvocation = ConstructorRelated + 135;
+
int InstanceMethodDuringConstructorInvocation = ConstructorRelated + 136;
+
int RecursiveConstructorInvocation = ConstructorRelated + 137;
+
int ThisSuperDuringConstructorInvocation = ConstructorRelated + 138;
+
// implicit constructor calls
int UndefinedConstructorInDefaultConstructor = ConstructorRelated + 140;
+
int NotVisibleConstructorInDefaultConstructor = ConstructorRelated + 141;
+
int AmbiguousConstructorInDefaultConstructor = ConstructorRelated + 142;
+
int UndefinedConstructorInImplicitConstructorCall = ConstructorRelated + 143;
+
int NotVisibleConstructorInImplicitConstructorCall = ConstructorRelated + 144;
+
int AmbiguousConstructorInImplicitConstructorCall = ConstructorRelated + 145;
+
int UnhandledExceptionInDefaultConstructor = TypeRelated + 146;
+
int UnhandledExceptionInImplicitConstructorCall = TypeRelated + 147;
-
+
// expressions
int ArrayReferenceRequired = Internal + 150;
+
int NoImplicitStringConversionForCharArrayExpression = Internal + 151;
+
// constant expressions
int StringConstantIsExceedingUtf8Limit = Internal + 152;
+
int NonConstantExpression = 153;
+
int NumericValueOutOfRange = Internal + 154;
+
// cast expressions
int IllegalCast = TypeRelated + 156;
+
// allocations
int InvalidClassInstantiation = TypeRelated + 157;
+
int CannotDefineDimensionExpressionsWithInit = Internal + 158;
+
int MustDefineEitherDimensionExpressionsOrInitializer = Internal + 159;
+
// operators
int InvalidOperator = Internal + 160;
+
// statements
int CodeCannotBeReached = Internal + 161;
+
int CannotReturnInInitializer = Internal + 162;
+
int InitializerMustCompleteNormally = Internal + 163;
-
+
// assert
int InvalidVoidExpression = Internal + 164;
+
// try
int MaskedCatch = TypeRelated + 165;
+
int DuplicateDefaultCase = 166;
+
int UnreachableCatch = TypeRelated + MethodRelated + 167;
+
int UnhandledException = TypeRelated + 168;
- // switch
+
+ // switch
int IncorrectSwitchType = TypeRelated + 169;
+
int DuplicateCase = FieldRelated + 170;
+
// labelled
int DuplicateLabel = Internal + 171;
+
int InvalidBreak = Internal + 172;
+
int InvalidContinue = Internal + 173;
+
int UndefinedLabel = Internal + 174;
- //synchronized
+
+ // synchronized
int InvalidTypeToSynchronized = Internal + 175;
+
int InvalidNullToSynchronized = Internal + 176;
+
// throw
int CannotThrowNull = Internal + 177;
+
// assignment
/** @since 2.1 */
int AssignmentHasNoEffect = Internal + 178;
-
+
// inner emulation
int NeedToEmulateFieldReadAccess = FieldRelated + 190;
+
int NeedToEmulateFieldWriteAccess = FieldRelated + 191;
+
int NeedToEmulateMethodAccess = MethodRelated + 192;
+
int NeedToEmulateConstructorAccess = MethodRelated + 193;
- //inherited name hides enclosing name (sort of ambiguous)
+ // inherited name hides enclosing name (sort of ambiguous)
int InheritedMethodHidesEnclosingName = MethodRelated + 195;
+
int InheritedFieldHidesEnclosingName = FieldRelated + 196;
+
int InheritedTypeHidesEnclosingName = TypeRelated + 197;
// miscellaneous
int ThisInStaticContext = Internal + 200;
+
int StaticMethodRequested = Internal + MethodRelated + 201;
+
int IllegalDimension = Internal + 202;
+
int InvalidTypeExpression = Internal + 203;
+
int ParsingError = Syntax + Internal + 204;
+
int ParsingErrorNoSuggestion = Syntax + Internal + 205;
+
int InvalidUnaryExpression = Syntax + Internal + 206;
// syntax errors
int InterfaceCannotHaveConstructors = Syntax + Internal + 207;
+
int ArrayConstantsOnlyInArrayInitializers = Syntax + Internal + 208;
- int ParsingErrorOnKeyword = Syntax + Internal + 209;
+
+ int ParsingErrorOnKeyword = Syntax + Internal + 209;
+
int ParsingErrorOnKeywordNoSuggestion = Syntax + Internal + 210;
+
int PHPParsingError = Syntax + Internal + 211;
+
int PHPParsingWarning = Syntax + Internal + 212;
+
int PHPVarDeprecatedWarning = Syntax + Internal + 213;
+
int PHPBadStyleKeywordWarning = Syntax + Internal + 214;
+
int PHPBadStyleUppercaseIdentifierWarning = Syntax + Internal + 215;
+
int PHPIncludeNotExistWarning = Syntax + Internal + 216;
-
+
int UnmatchedBracket = Syntax + Internal + 220;
+
int NoFieldOnBaseType = FieldRelated + 221;
+
int InvalidExpressionAsStatement = Syntax + Internal + 222;
+
/** @since 2.1 */
int ExpressionShouldBeAVariable = Syntax + Internal + 223;
+
/** @since 2.1 */
int MissingSemiColon = Syntax + Internal + 224;
+
/** @since 2.1 */
int InvalidParenthesizedExpression = Syntax + Internal + 225;
-
+
// scanner errors
int EndOfSource = Syntax + Internal + 250;
+
int InvalidHexa = Syntax + Internal + 251;
+
int InvalidOctal = Syntax + Internal + 252;
+
int InvalidCharacterConstant = Syntax + Internal + 253;
+
int InvalidEscape = Syntax + Internal + 254;
+
int InvalidInput = Syntax + Internal + 255;
+
int InvalidUnicodeEscape = Syntax + Internal + 256;
+
int InvalidFloat = Syntax + Internal + 257;
+
int NullSourceString = Syntax + Internal + 258;
+
int UnterminatedString = Syntax + Internal + 259;
+
int UnterminatedComment = Syntax + Internal + 260;
// type related problems
int InterfaceCannotHaveInitializers = TypeRelated + 300;
+
int DuplicateModifierForType = TypeRelated + 301;
+
int IllegalModifierForClass = TypeRelated + 302;
+
int IllegalModifierForInterface = TypeRelated + 303;
+
int IllegalModifierForMemberClass = TypeRelated + 304;
+
int IllegalModifierForMemberInterface = TypeRelated + 305;
+
int IllegalModifierForLocalClass = TypeRelated + 306;
int IllegalModifierCombinationFinalAbstractForClass = TypeRelated + 308;
+
int IllegalVisibilityModifierForInterfaceMemberType = TypeRelated + 309;
+
int IllegalVisibilityModifierCombinationForMemberType = TypeRelated + 310;
+
int IllegalStaticModifierForMemberType = TypeRelated + 311;
+
int SuperclassMustBeAClass = TypeRelated + 312;
+
int ClassExtendFinalClass = TypeRelated + 313;
+
int DuplicateSuperInterface = TypeRelated + 314;
+
int SuperInterfaceMustBeAnInterface = TypeRelated + 315;
+
int HierarchyCircularitySelfReference = TypeRelated + 316;
+
int HierarchyCircularity = TypeRelated + 317;
+
int HidingEnclosingType = TypeRelated + 318;
+
int DuplicateNestedType = TypeRelated + 319;
+
int CannotThrowType = TypeRelated + 320;
+
int PackageCollidesWithType = TypeRelated + 321;
+
int TypeCollidesWithPackage = TypeRelated + 322;
+
int DuplicateTypes = TypeRelated + 323;
+
int IsClassPathCorrect = TypeRelated + 324;
+
int PublicClassMustMatchFileName = TypeRelated + 325;
+
int MustSpecifyPackage = 326;
+
int HierarchyHasProblems = TypeRelated + 327;
+
int PackageIsNotExpectedPackage = 328;
+
/** @since 2.1 */
int ObjectCannotHaveSuperTypes = 329;
- // int InvalidSuperclassBase = TypeRelated + 329; // reserved to 334 included
- int SuperclassNotFound = TypeRelated + 329 + ProblemReasons.NotFound; // TypeRelated + 330
- int SuperclassNotVisible = TypeRelated + 329 + ProblemReasons.NotVisible; // TypeRelated + 331
- int SuperclassAmbiguous = TypeRelated + 329 + ProblemReasons.Ambiguous; // TypeRelated + 332
- int SuperclassInternalNameProvided = TypeRelated + 329 + ProblemReasons.InternalNameProvided; // TypeRelated + 333
- int SuperclassInheritedNameHidesEnclosingName = TypeRelated + 329 + ProblemReasons.InheritedNameHidesEnclosingName; // TypeRelated + 334
+ // int InvalidSuperclassBase = TypeRelated + 329; // reserved to 334
+ // included
+ int SuperclassNotFound = TypeRelated + 329 + ProblemReasons.NotFound; // TypeRelated
+ // +
+ // 330
+
+ int SuperclassNotVisible = TypeRelated + 329 + ProblemReasons.NotVisible; // TypeRelated
+ // +
+ // 331
+
+ int SuperclassAmbiguous = TypeRelated + 329 + ProblemReasons.Ambiguous; // TypeRelated
+ // +
+ // 332
+
+ int SuperclassInternalNameProvided = TypeRelated + 329
+ + ProblemReasons.InternalNameProvided; // TypeRelated + 333
+
+ int SuperclassInheritedNameHidesEnclosingName = TypeRelated + 329
+ + ProblemReasons.InheritedNameHidesEnclosingName; // TypeRelated +
+ // 334
// int InvalidInterfaceBase = TypeRelated + 334; // reserved to 339 included
- int InterfaceNotFound = TypeRelated + 334 + ProblemReasons.NotFound; // TypeRelated + 335
- int InterfaceNotVisible = TypeRelated + 334 + ProblemReasons.NotVisible; // TypeRelated + 336
- int InterfaceAmbiguous = TypeRelated + 334 + ProblemReasons.Ambiguous; // TypeRelated + 337
- int InterfaceInternalNameProvided = TypeRelated + 334 + ProblemReasons.InternalNameProvided; // TypeRelated + 338
- int InterfaceInheritedNameHidesEnclosingName = TypeRelated + 334 + ProblemReasons.InheritedNameHidesEnclosingName; // TypeRelated + 339
+ int InterfaceNotFound = TypeRelated + 334 + ProblemReasons.NotFound; // TypeRelated
+ // +
+ // 335
+
+ int InterfaceNotVisible = TypeRelated + 334 + ProblemReasons.NotVisible; // TypeRelated
+ // +
+ // 336
+
+ int InterfaceAmbiguous = TypeRelated + 334 + ProblemReasons.Ambiguous; // TypeRelated
+ // +
+ // 337
+
+ int InterfaceInternalNameProvided = TypeRelated + 334
+ + ProblemReasons.InternalNameProvided; // TypeRelated + 338
+
+ int InterfaceInheritedNameHidesEnclosingName = TypeRelated + 334
+ + ProblemReasons.InheritedNameHidesEnclosingName; // TypeRelated +
+ // 339
// field related problems
int DuplicateField = FieldRelated + 340;
+
int DuplicateModifierForField = FieldRelated + 341;
+
int IllegalModifierForField = FieldRelated + 342;
+
int IllegalModifierForInterfaceField = FieldRelated + 343;
+
int IllegalVisibilityModifierCombinationForField = FieldRelated + 344;
+
int IllegalModifierCombinationFinalVolatileForField = FieldRelated + 345;
+
int UnexpectedStaticModifierForField = FieldRelated + 346;
// int FieldTypeProblemBase = FieldRelated + 349; //reserved to 354
- int FieldTypeNotFound = FieldRelated + 349 + ProblemReasons.NotFound; // FieldRelated + 350
- int FieldTypeNotVisible = FieldRelated + 349 + ProblemReasons.NotVisible; // FieldRelated + 351
- int FieldTypeAmbiguous = FieldRelated + 349 + ProblemReasons.Ambiguous; // FieldRelated + 352
- int FieldTypeInternalNameProvided = FieldRelated + 349 + ProblemReasons.InternalNameProvided; // FieldRelated + 353
- int FieldTypeInheritedNameHidesEnclosingName = FieldRelated + 349 + ProblemReasons.InheritedNameHidesEnclosingName; // FieldRelated + 354
-
+ int FieldTypeNotFound = FieldRelated + 349 + ProblemReasons.NotFound; // FieldRelated
+ // +
+ // 350
+
+ int FieldTypeNotVisible = FieldRelated + 349 + ProblemReasons.NotVisible; // FieldRelated
+ // +
+ // 351
+
+ int FieldTypeAmbiguous = FieldRelated + 349 + ProblemReasons.Ambiguous; // FieldRelated
+ // +
+ // 352
+
+ int FieldTypeInternalNameProvided = FieldRelated + 349
+ + ProblemReasons.InternalNameProvided; // FieldRelated + 353
+
+ int FieldTypeInheritedNameHidesEnclosingName = FieldRelated + 349
+ + ProblemReasons.InheritedNameHidesEnclosingName; // FieldRelated
+ // + 354
+
// method related problems
int DuplicateMethod = MethodRelated + 355;
+
int IllegalModifierForArgument = MethodRelated + 356;
+
int DuplicateModifierForMethod = MethodRelated + 357;
+
int IllegalModifierForMethod = MethodRelated + 358;
+
int IllegalModifierForInterfaceMethod = MethodRelated + 359;
+
int IllegalVisibilityModifierCombinationForMethod = MethodRelated + 360;
+
int UnexpectedStaticModifierForMethod = MethodRelated + 361;
+
int IllegalAbstractModifierCombinationForMethod = MethodRelated + 362;
+
int AbstractMethodInAbstractClass = MethodRelated + 363;
+
int ArgumentTypeCannotBeVoid = MethodRelated + 364;
+
int ArgumentTypeCannotBeVoidArray = MethodRelated + 365;
+
int ReturnTypeCannotBeVoidArray = MethodRelated + 366;
+
int NativeMethodsCannotBeStrictfp = MethodRelated + 367;
+
int DuplicateModifierForArgument = MethodRelated + 368;
- // int ArgumentProblemBase = MethodRelated + 369; // reserved to 374 included.
- int ArgumentTypeNotFound = MethodRelated + 369 + ProblemReasons.NotFound; // MethodRelated + 370
- int ArgumentTypeNotVisible = MethodRelated + 369 + ProblemReasons.NotVisible; // MethodRelated + 371
- int ArgumentTypeAmbiguous = MethodRelated + 369 + ProblemReasons.Ambiguous; // MethodRelated + 372
- int ArgumentTypeInternalNameProvided = MethodRelated + 369 + ProblemReasons.InternalNameProvided; // MethodRelated + 373
- int ArgumentTypeInheritedNameHidesEnclosingName = MethodRelated + 369 + ProblemReasons.InheritedNameHidesEnclosingName; // MethodRelated + 374
-
- // int ExceptionTypeProblemBase = MethodRelated + 374; // reserved to 379 included.
- int ExceptionTypeNotFound = MethodRelated + 374 + ProblemReasons.NotFound; // MethodRelated + 375
- int ExceptionTypeNotVisible = MethodRelated + 374 + ProblemReasons.NotVisible; // MethodRelated + 376
- int ExceptionTypeAmbiguous = MethodRelated + 374 + ProblemReasons.Ambiguous; // MethodRelated + 377
- int ExceptionTypeInternalNameProvided = MethodRelated + 374 + ProblemReasons.InternalNameProvided; // MethodRelated + 378
- int ExceptionTypeInheritedNameHidesEnclosingName = MethodRelated + 374 + ProblemReasons.InheritedNameHidesEnclosingName; // MethodRelated + 379
-
- // int ReturnTypeProblemBase = MethodRelated + 379;
- int ReturnTypeNotFound = MethodRelated + 379 + ProblemReasons.NotFound; // MethodRelated + 380
- int ReturnTypeNotVisible = MethodRelated + 379 + ProblemReasons.NotVisible; // MethodRelated + 381
- int ReturnTypeAmbiguous = MethodRelated + 379 + ProblemReasons.Ambiguous; // MethodRelated + 382
- int ReturnTypeInternalNameProvided = MethodRelated + 379 + ProblemReasons.InternalNameProvided; // MethodRelated + 383
- int ReturnTypeInheritedNameHidesEnclosingName = MethodRelated + 379 + ProblemReasons.InheritedNameHidesEnclosingName; // MethodRelated + 384
+ // int ArgumentProblemBase = MethodRelated + 369; // reserved to 374
+ // included.
+ int ArgumentTypeNotFound = MethodRelated + 369 + ProblemReasons.NotFound; // MethodRelated
+ // +
+ // 370
+
+ int ArgumentTypeNotVisible = MethodRelated + 369
+ + ProblemReasons.NotVisible; // MethodRelated + 371
+
+ int ArgumentTypeAmbiguous = MethodRelated + 369 + ProblemReasons.Ambiguous; // MethodRelated
+ // +
+ // 372
+
+ int ArgumentTypeInternalNameProvided = MethodRelated + 369
+ + ProblemReasons.InternalNameProvided; // MethodRelated + 373
+
+ int ArgumentTypeInheritedNameHidesEnclosingName = MethodRelated + 369
+ + ProblemReasons.InheritedNameHidesEnclosingName; // MethodRelated
+ // + 374
+
+ // int ExceptionTypeProblemBase = MethodRelated + 374; // reserved to 379
+ // included.
+ int ExceptionTypeNotFound = MethodRelated + 374 + ProblemReasons.NotFound; // MethodRelated
+ // +
+ // 375
+
+ int ExceptionTypeNotVisible = MethodRelated + 374
+ + ProblemReasons.NotVisible; // MethodRelated + 376
+
+ int ExceptionTypeAmbiguous = MethodRelated + 374 + ProblemReasons.Ambiguous; // MethodRelated
+ // +
+ // 377
+
+ int ExceptionTypeInternalNameProvided = MethodRelated + 374
+ + ProblemReasons.InternalNameProvided; // MethodRelated + 378
+
+ int ExceptionTypeInheritedNameHidesEnclosingName = MethodRelated + 374
+ + ProblemReasons.InheritedNameHidesEnclosingName; // MethodRelated
+ // + 379
+
+ // int ReturnTypeProblemBase = MethodRelated + 379;
+ int ReturnTypeNotFound = MethodRelated + 379 + ProblemReasons.NotFound; // MethodRelated
+ // +
+ // 380
+
+ int ReturnTypeNotVisible = MethodRelated + 379 + ProblemReasons.NotVisible; // MethodRelated
+ // +
+ // 381
+
+ int ReturnTypeAmbiguous = MethodRelated + 379 + ProblemReasons.Ambiguous; // MethodRelated
+ // +
+ // 382
+
+ int ReturnTypeInternalNameProvided = MethodRelated + 379
+ + ProblemReasons.InternalNameProvided; // MethodRelated + 383
+
+ int ReturnTypeInheritedNameHidesEnclosingName = MethodRelated + 379
+ + ProblemReasons.InheritedNameHidesEnclosingName; // MethodRelated
+ // + 384
// import related problems
int ConflictingImport = ImportRelated + 385;
+
int DuplicateImport = ImportRelated + 386;
+
int CannotImportPackage = ImportRelated + 387;
+
int UnusedImport = ImportRelated + 388;
- // int ImportProblemBase = ImportRelated + 389;
- int ImportNotFound = ImportRelated + 389 + ProblemReasons.NotFound; // ImportRelated + 390
- int ImportNotVisible = ImportRelated + 389 + ProblemReasons.NotVisible; // ImportRelated + 391
- int ImportAmbiguous = ImportRelated + 389 + ProblemReasons.Ambiguous; // ImportRelated + 392
- int ImportInternalNameProvided = ImportRelated + 389 + ProblemReasons.InternalNameProvided; // ImportRelated + 393
- int ImportInheritedNameHidesEnclosingName = ImportRelated + 389 + ProblemReasons.InheritedNameHidesEnclosingName; // ImportRelated + 394
+ // int ImportProblemBase = ImportRelated + 389;
+ int ImportNotFound = ImportRelated + 389 + ProblemReasons.NotFound; // ImportRelated
+ // + 390
+
+ int ImportNotVisible = ImportRelated + 389 + ProblemReasons.NotVisible; // ImportRelated
+ // +
+ // 391
+
+ int ImportAmbiguous = ImportRelated + 389 + ProblemReasons.Ambiguous; // ImportRelated
+ // +
+ // 392
+
+ int ImportInternalNameProvided = ImportRelated + 389
+ + ProblemReasons.InternalNameProvided; // ImportRelated + 393
+
+ int ImportInheritedNameHidesEnclosingName = ImportRelated + 389
+ + ProblemReasons.InheritedNameHidesEnclosingName; // ImportRelated
+ // + 394
-
// local variable related problems
int DuplicateModifierForVariable = MethodRelated + 395;
+
int IllegalModifierForVariable = MethodRelated + 396;
// method verifier problems
int AbstractMethodMustBeImplemented = MethodRelated + 400;
+
int FinalMethodCannotBeOverridden = MethodRelated + 401;
+
int IncompatibleExceptionInThrowsClause = MethodRelated + 402;
+
int IncompatibleExceptionInInheritedMethodThrowsClause = MethodRelated + 403;
+
int IncompatibleReturnType = MethodRelated + 404;
+
int InheritedMethodReducesVisibility = MethodRelated + 405;
+
int CannotOverrideAStaticMethodWithAnInstanceMethod = MethodRelated + 406;
+
int CannotHideAnInstanceMethodWithAStaticMethod = MethodRelated + 407;
+
int StaticInheritedMethodConflicts = MethodRelated + 408;
+
int MethodReducesVisibility = MethodRelated + 409;
+
int OverridingNonVisibleMethod = MethodRelated + 410;
+
int AbstractMethodCannotBeOverridden = MethodRelated + 411;
+
int OverridingDeprecatedMethod = MethodRelated + 412;
+
/** @since 2.1 */
int IncompatibleReturnTypeForNonInheritedInterfaceMethod = MethodRelated + 413;
+
/** @since 2.1 */
int IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod = MethodRelated + 414;
-
+
// code snippet support
int CodeSnippetMissingClass = Internal + 420;
+
int CodeSnippetMissingMethod = Internal + 421;
+
int NonExternalizedStringLiteral = Internal + 261;
+
int CannotUseSuperInCodeSnippet = Internal + 422;
-
- //constant pool
+
+ // constant pool
int TooManyConstantsInConstantPool = Internal + 430;
+
/** @since 2.1 */
int TooManyBytesForStringConstant = Internal + 431;
// static constraints
/** @since 2.1 */
int TooManyFields = Internal + 432;
+
/** @since 2.1 */
- int TooManyMethods = Internal + 433;
-
+ int TooManyMethods = Internal + 433;
+
// 1.4 features
// assertion warning
int UseAssertAsAnIdentifier = Internal + 440;
-
+
// detected task
/** @since 2.1 */
int Task = Internal + 450;
-
-// block
+
+ // block
/** @since 3.0 */
int UndocumentedEmptyBlock = Internal + 460;
-
+
/*
* Javadoc comments
*/
/** @since 3.0 */
int JavadocUnexpectedTag = Javadoc + Internal + 470;
+
/** @since 3.0 */
int JavadocMissingParamTag = Javadoc + Internal + 471;
+
/** @since 3.0 */
int JavadocMissingParamName = Javadoc + Internal + 472;
+
/** @since 3.0 */
int JavadocDuplicateParamName = Javadoc + Internal + 473;
+
/** @since 3.0 */
int JavadocInvalidParamName = Javadoc + Internal + 474;
+
/** @since 3.0 */
int JavadocMissingReturnTag = Javadoc + Internal + 475;
+
/** @since 3.0 */
int JavadocDuplicateReturnTag = Javadoc + Internal + 476;
+
/** @since 3.0 */
int JavadocMissingThrowsTag = Javadoc + Internal + 477;
+
/** @since 3.0 */
int JavadocMissingThrowsClassName = Javadoc + Internal + 478;
+
/** @since 3.0 */
int JavadocInvalidThrowsClass = Javadoc + Internal + 479;
+
/** @since 3.0 */
int JavadocDuplicateThrowsClassName = Javadoc + Internal + 480;
+
/** @since 3.0 */
int JavadocInvalidThrowsClassName = Javadoc + Internal + 481;
+
/** @since 3.0 */
int JavadocMissingSeeReference = Javadoc + Internal + 482;
+
/** @since 3.0 */
int JavadocInvalidSeeReference = Javadoc + Internal + 483;
+
/** @since 3.0 */
int JavadocInvalidSeeHref = Javadoc + Internal + 484;
+
/** @since 3.0 */
int JavadocInvalidSeeArgs = Javadoc + Internal + 485;
+
/** @since 3.0 */
int JavadocMissing = Javadoc + Internal + 486;
+
/** @since 3.0 */
int JavadocInvalidTag = Javadoc + Internal + 487;
+
/*
* ID for field errors in Javadoc
*/
/** @since 3.0 */
int JavadocUndefinedField = Javadoc + Internal + 488;
+
/** @since 3.0 */
int JavadocNotVisibleField = Javadoc + Internal + 489;
+
/** @since 3.0 */
int JavadocAmbiguousField = Javadoc + Internal + 490;
+
/** @since 3.0 */
int JavadocUsingDeprecatedField = Javadoc + Internal + 491;
+
/*
* IDs for constructor errors in Javadoc
*/
/** @since 3.0 */
int JavadocUndefinedConstructor = Javadoc + Internal + 492;
+
/** @since 3.0 */
int JavadocNotVisibleConstructor = Javadoc + Internal + 493;
+
/** @since 3.0 */
int JavadocAmbiguousConstructor = Javadoc + Internal + 494;
+
/** @since 3.0 */
int JavadocUsingDeprecatedConstructor = Javadoc + Internal + 495;
+
/*
* IDs for method errors in Javadoc
*/
/** @since 3.0 */
int JavadocUndefinedMethod = Javadoc + Internal + 496;
+
/** @since 3.0 */
int JavadocNotVisibleMethod = Javadoc + Internal + 497;
+
/** @since 3.0 */
int JavadocAmbiguousMethod = Javadoc + Internal + 498;
+
/** @since 3.0 */
int JavadocUsingDeprecatedMethod = Javadoc + Internal + 499;
+
/** @since 3.0 */
int JavadocNoMessageSendOnBaseType = Javadoc + Internal + 500;
+
/** @since 3.0 */
int JavadocParameterMismatch = Javadoc + Internal + 501;
+
/** @since 3.0 */
int JavadocNoMessageSendOnArrayType = Javadoc + Internal + 502;
+
/*
* IDs for type errors in Javadoc
*/
/** @since 3.0 */
int JavadocUndefinedType = Javadoc + Internal + 503;
+
/** @since 3.0 */
int JavadocNotVisibleType = Javadoc + Internal + 504;
+
/** @since 3.0 */
int JavadocAmbiguousType = Javadoc + Internal + 505;
+
/** @since 3.0 */
int JavadocUsingDeprecatedType = Javadoc + Internal + 506;
+
/** @since 3.0 */
int JavadocInternalTypeNameProvided = Javadoc + Internal + 507;
+
/** @since 3.0 */
int JavadocInheritedMethodHidesEnclosingName = Javadoc + Internal + 508;
+
/** @since 3.0 */
int JavadocInheritedFieldHidesEnclosingName = Javadoc + Internal + 509;
+
/** @since 3.0 */
int JavadocInheritedNameHidesEnclosingTypeName = Javadoc + Internal + 510;
+
/** @since 3.0 */
int JavadocAmbiguousMethodReference = Javadoc + Internal + 511;
+
/** @since 3.0 */
int JavadocUnterminatedInlineTag = Javadoc + Internal + 512;
+
/** @since 3.0 */
int JavadocMalformedSeeReference = Javadoc + Internal + 513;
+
/** @since 3.0 */
int JavadocMessagePrefix = Internal + 515;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IScanner.java
index 3207a73..f3c6ff6 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IScanner.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IScanner.java
@@ -1,134 +1,154 @@
/**********************************************************************
-Copyright (c) 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 v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-�
-Contributors:
- IBM Corporation - initial API and implementation
-**********************************************************************/
+ Copyright (c) 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 v0.5
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v05.html
+ �
+ Contributors:
+ IBM Corporation - initial API and implementation
+ **********************************************************************/
package net.sourceforge.phpdt.core.compiler;
-
- /**
- * Definition of a Java scanner, as returned by the ToolFactory.
- * The scanner is responsible for tokenizing a given source, providing information about
- * the nature of the token read, its positions and source equivalent.
- *
- * When the scanner has finished tokenizing, it answers an EOF token (
- * ITerminalSymbols#TokenNameEOF.
- *
- * When encountering lexical errors, an InvalidInputException is thrown.
- *
- * @see net.sourceforge.phpdt.core.ToolFactory
- * @see ITerminalSymbols
- * @since 2.0
- */
+/**
+ * Definition of a Java scanner, as returned by the ToolFactory.
+ * The scanner is responsible for tokenizing a given source, providing
+ * information about the nature of the token read, its positions and source
+ * equivalent.
+ *
+ * When the scanner has finished tokenizing, it answers an EOF token (
+ * ITerminalSymbols#TokenNameEOF.
+ *
+ * When encountering lexical errors, an InvalidInputException is
+ * thrown.
+ *
+ * @see net.sourceforge.phpdt.core.ToolFactory
+ * @see ITerminalSymbols
+ * @since 2.0
+ */
public interface IScanner {
/**
- * Answers the current identifier source, after unicode escape sequences have
- * been translated into unicode characters.
- * e.g. if original source was \\u0061bc then it will answer abc.
+ * Answers the current identifier source, after unicode escape sequences
+ * have been translated into unicode characters. e.g. if original source was
+ * \\u0061bc then it will answer abc.
*
- * @return the current identifier source, after unicode escape sequences have
- * been translated into unicode characters
+ * @return the current identifier source, after unicode escape sequences
+ * have been translated into unicode characters
*/
char[] getCurrentTokenSource();
/**
- * Answers the starting position of the current token inside the original source.
- * This position is zero-based and inclusive. It corresponds to the position of the first character
- * which is part of this token. If this character was a unicode escape sequence, it points at the first
- * character of this sequence.
+ * Answers the starting position of the current token inside the original
+ * source. This position is zero-based and inclusive. It corresponds to the
+ * position of the first character which is part of this token. If this
+ * character was a unicode escape sequence, it points at the first character
+ * of this sequence.
*
- * @return the starting position of the current token inside the original source
+ * @return the starting position of the current token inside the original
+ * source
*/
int getCurrentTokenStartPosition();
/**
- * Answers the ending position of the current token inside the original source.
- * This position is zero-based and inclusive. It corresponds to the position of the last character
- * which is part of this token. If this character was a unicode escape sequence, it points at the last
- * character of this sequence.
+ * Answers the ending position of the current token inside the original
+ * source. This position is zero-based and inclusive. It corresponds to the
+ * position of the last character which is part of this token. If this
+ * character was a unicode escape sequence, it points at the last character
+ * of this sequence.
*
- * @return the ending position of the current token inside the original source
+ * @return the ending position of the current token inside the original
+ * source
*/
int getCurrentTokenEndPosition();
/**
- * Answers the starting position of a given line number. This line has to have been encountered
- * already in the tokenization process (i.e. it cannot be used to compute positions of lines beyond
- * current token). Once the entire source has been processed, it can be used without any limit.
- * Line starting positions are zero-based, and start immediately after the previous line separator (if any).
+ * Answers the starting position of a given line number. This line has to
+ * have been encountered already in the tokenization process (i.e. it cannot
+ * be used to compute positions of lines beyond current token). Once the
+ * entire source has been processed, it can be used without any limit. Line
+ * starting positions are zero-based, and start immediately after the
+ * previous line separator (if any).
*
- * @param lineNumber the given line number
+ * @param lineNumber
+ * the given line number
* @return the starting position of a given line number
*/
int getLineStart(int lineNumber);
/**
- * Answers the ending position of a given line number. This line has to have been encountered
- * already in the tokenization process (i.e. it cannot be used to compute positions of lines beyond
- * current token). Once the entire source has been processed, it can be used without any limit.
- * Line ending positions are zero-based, and correspond to the last character of the line separator
- * (in case multi-character line separators).
+ * Answers the ending position of a given line number. This line has to have
+ * been encountered already in the tokenization process (i.e. it cannot be
+ * used to compute positions of lines beyond current token). Once the entire
+ * source has been processed, it can be used without any limit. Line ending
+ * positions are zero-based, and correspond to the last character of the
+ * line separator (in case multi-character line separators).
*
- * @param lineNumber the given line number
+ * @param lineNumber
+ * the given line number
* @return the ending position of a given line number
- **/
+ */
int getLineEnd(int lineNumber);
/**
- * Answers an array of the ending positions of the lines encountered so far. Line ending positions
- * are zero-based, and correspond to the last character of the line separator (in case multi-character
- * line separators).
+ * Answers an array of the ending positions of the lines encountered so far.
+ * Line ending positions are zero-based, and correspond to the last
+ * character of the line separator (in case multi-character line
+ * separators).
*
* @return an array of the ending positions of the lines encountered so far
*/
int[] getLineEnds();
/**
- * Answers a 1-based line number using the lines which have been encountered so far. If the position
- * is located beyond the current scanned line, then the last line number will be answered.
+ * Answers a 1-based line number using the lines which have been encountered
+ * so far. If the position is located beyond the current scanned line, then
+ * the last line number will be answered.
*
- * @param charPosition the given character position
- * @return a 1-based line number using the lines which have been encountered so far
+ * @param charPosition
+ * the given character position
+ * @return a 1-based line number using the lines which have been encountered
+ * so far
*/
int getLineNumber(int charPosition);
/**
- * Read the next token in the source, and answers its ID as specified by ITerminalSymbols.
- * Note that the actual token ID values are subject to change if new keywords were added to the language
- * (i.e. 'assert' keyword in 1.4).
+ * Read the next token in the source, and answers its ID as specified by
+ * ITerminalSymbols. Note that the actual token ID values
+ * are subject to change if new keywords were added to the language (i.e.
+ * 'assert' keyword in 1.4).
*
- * @throws InvalidInputException - in case a lexical error was detected while reading the current token
+ * @throws InvalidInputException -
+ * in case a lexical error was detected while reading the
+ * current token
*/
int getNextToken() throws InvalidInputException;
/**
- * Answers the original source being processed (not a copy of it).
+ * Answers the original source being processed (not a copy of it).
*
* @return the original source being processed
*/
char[] getSource();
/**
- * Reposition the scanner on some portion of the original source. Once reaching the given endPosition
- * it will answer EOF tokens (ITerminalSymbols.TokenNameEOF).
+ * Reposition the scanner on some portion of the original source. Once
+ * reaching the given endPosition it will answer EOF tokens (ITerminalSymbols.TokenNameEOF).
*
- * @param startPosition the given start position
- * @param endPosition the given end position
+ * @param startPosition
+ * the given start position
+ * @param endPosition
+ * the given end position
*/
void resetTo(int startPosition, int endPosition);
/**
- * Set the scanner source to process. By default, the scanner will consider starting at the beginning of the
- * source until it reaches its end.
+ * Set the scanner source to process. By default, the scanner will consider
+ * starting at the beginning of the source until it reaches its end.
*
- * @param source the given source
+ * @param source
+ * the given source
*/
void setSource(char[] source);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java
index 6440ffd..ae1db34 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java
@@ -9,201 +9,350 @@
IBM Corporation - initial API and implementation
**********************************************************************/
package net.sourceforge.phpdt.core.compiler;
+
/**
* Maps each terminal symbol in the php-grammar into a unique integer. This
* integer is used to represent the terminal when computing a parsing action.
- *
+ *
* @see IScanner
* @since 2.0
*/
public interface ITerminalSymbols {
- public final static String[] PHP_TYPES = {"array", "string", "object",
- "bool", "boolean", "real", "double", "float", "int", "integer",};
- //"array",
- public final static int TokenNameWHITESPACE = 900,
- TokenNameCOMMENT_LINE = 901, TokenNameCOMMENT_BLOCK = 902,
- TokenNameCOMMENT_PHPDOC = 903;
- // TokenNameHTML = 904;
- final static int TokenNameEOF = 0;
- final static int TokenNameERROR = 1;
- final static int TokenNameINLINE_HTML = 2;
- final static int TokenNameREMAINDER = 30;
- final static int TokenNameNOT = 31;
- final static int TokenNameDOT = 32;
- final static int TokenNameXOR = 33;
- final static int TokenNameDIVIDE = 34;
- final static int TokenNameMULTIPLY = 35;
- final static int TokenNameMINUS = 36;
- final static int TokenNamePLUS = 37;
- final static int TokenNameEQUAL_EQUAL = 38;
- final static int TokenNameNOT_EQUAL = 39;
- final static int TokenNameGREATER = 40;
- final static int TokenNameGREATER_EQUAL = 41;
- final static int TokenNameLESS = 42;
- final static int TokenNameLESS_EQUAL = 43;
- final static int TokenNameAND_AND = 44;
- final static int TokenNameOR_OR = 45;
- final static int TokenNameCOLON = 47;
- final static int TokenNameDOT_EQUAL = 48;
- final static int TokenNameEQUAL = 49;
- final static int TokenNameMINUS_GREATER = 50; // ->
- final static int TokenNameEQUAL_GREATER = 51; // => (for each operator)
- final static int TokenNameAND = 52;
- final static int TokenNameTWIDDLE = 54;
- final static int TokenNameTWIDDLE_EQUAL = 55;
- final static int TokenNameREMAINDER_EQUAL = 56;
- final static int TokenNameXOR_EQUAL = 57;
- final static int TokenNameRIGHT_SHIFT_EQUAL = 58;
- final static int TokenNameLEFT_SHIFT_EQUAL = 59;
- final static int TokenNameAND_EQUAL = 60;
- final static int TokenNameOR_EQUAL = 61;
- final static int TokenNameQUESTION = 62;
- final static int TokenNamePAAMAYIM_NEKUDOTAYIM = 63;
- final static int TokenNameAT = 64;
- final static int TokenNameand = 65;
- final static int TokenNameor = 66;
- final static int TokenNamexor = 67;
- final static int TokenNameDOLLAR = 126;
- final static int TokenNameDOLLAR_LBRACE = 127;
- final static int TokenNameLPAREN = 128;
- final static int TokenNameRPAREN = 129;
- final static int TokenNameLBRACE = 130;
- final static int TokenNameRBRACE = 131;
- final static int TokenNameLBRACKET = 132;
- final static int TokenNameRBRACKET = 133;
- final static int TokenNameCOMMA = 134;
- final static int TokenNameStringDoubleQuote = 136;
- final static int TokenNameIdentifier = 138;
- final static int TokenNameSEMICOLON = 140;
- final static int TokenNameMINUS_MINUS = 144;
- final static int TokenNamePLUS_PLUS = 145;
- final static int TokenNamePLUS_EQUAL = 146;
- final static int TokenNameDIVIDE_EQUAL = 147;
- final static int TokenNameMINUS_EQUAL = 148;
- final static int TokenNameMULTIPLY_EQUAL = 149;
- final static int TokenNameVariable = 150;
- final static int TokenNameIntegerLiteral = 151;
- final static int TokenNameDoubleLiteral = 152;
- final static int TokenNameStringInterpolated = 153;
- final static int TokenNameStringSingleQuote = 154;
- final static int TokenNameLEFT_SHIFT = 155;
- final static int TokenNameRIGHT_SHIFT = 156;
- final static int TokenNameEQUAL_EQUAL_EQUAL = 157;
- final static int TokenNameNOT_EQUAL_EQUAL = 158;
- final static int TokenNameOR = 160;
- final static int TokenNameHEREDOC = 161;
- final static int TokenNameintCAST = 174;
- final static int TokenNameboolCAST = 175;
- final static int TokenNamedoubleCAST = 176;
- final static int TokenNamestringCAST = 177;
- final static int TokenNamearrayCAST = 178;
- final static int TokenNameobjectCAST = 179;
- final static int TokenNameunsetCAST = 180;
-
- // �
- final static int TokenNameEncapsedString0 = 190;
- // '
-// final static int TokenNameEncapsedString1 = 191;
- // "
-// final static int TokenNameEncapsedString2 = 192;
-
- final static int TokenNameSTRING = 193;
-
- final static int TokenNameLBRACE_DOLLAR = 194;
-
- // start SQL token - the SQL tokens are only used in the
- // PHPCompletionprocessor:
- public final static int TokenNameSQLselect = 901;
- public final static int TokenNameSQLupdate = 902;
- public final static int TokenNameSQLinsert = 903;
- public final static int TokenNameSQLwhere = 904;
- public final static int TokenNameSQLfrom = 905;
- public final static int TokenNameSQLinto = 906;
- public final static int TokenNameSQLset = 907;
- public final static int TokenNameSQLvalues = 908;
- // stop SQL token
-
- /**
- * Special 0-length token for php short tag syntax;
- * Detected directly after <?=
- */
- public final static int TokenNameECHO_INVISIBLE = 990;
-
- public final static int TokenNameKEYWORD = 1000;
- public final static int TokenNameif = 1001;
- public final static int TokenNameelseif = 1002;
- public final static int TokenNameelse = 1003;
- public final static int TokenNameendif = 1004;
- public final static int TokenNamefor = 1005;
- public final static int TokenNameendfor = 1006;
- public final static int TokenNamewhile = 1007;
- public final static int TokenNameendwhile = 1008;
- public final static int TokenNameswitch = 1009;
- public final static int TokenNamecase = 10010;
- public final static int TokenNameendswitch = 1011;
- public final static int TokenNamebreak = 1012;
- public final static int TokenNamecontinue = 1013;
- public final static int TokenNamereturn = 1014;
- // public final static int TokenNamedefine = 1015;
- public final static int TokenNameinclude = 1016;
- public final static int TokenNameinclude_once = 1017;
- public final static int TokenNamerequire = 1018;
- public final static int TokenNamerequire_once = 1019;
- public final static int TokenNamefunction = 1020;
- public final static int TokenNameclass = 1021;
- public final static int TokenNamenew = 1022;
- public final static int TokenNamedo = 1023;
- public final static int TokenNameold_function = 1024;
- public final static int TokenNamedefault = 1025;
- public final static int TokenNameglobal = 1026;
- public final static int TokenNamestatic = 1027;
- public final static int TokenNameforeach = 1028;
- public final static int TokenNameendforeach = 1029;
- public final static int TokenNameextends = 1030;
- public final static int TokenNameempty = 1031;
- public final static int TokenNamearray = 1032;
- public final static int TokenNameecho = 1033;
- public final static int TokenNamevar = 1034;
- public final static int TokenNameas = 1035;
- public final static int TokenNameprint = 1036;
- public final static int TokenNameunset = 1037;
- public final static int TokenNameexit = 1038;
- // public final static int TokenNamedie = 1039;
- // public final static int TokenNameand = 1040;
- // public final static int TokenNameor = 1041;
- // public final static int TokenNamexor = 1042;
- public final static int TokenNamelist = 1043;
- // public final static int TokenNamenull = 1044;
- // public final static int TokenNamefalse = 1045;
- // public final static int TokenNametrue = 1046;
- // public final static int TokenNamethis = 1047;
- //
- public final static int TokenNameabstract = 1050;
- public final static int TokenNamecatch = 1051;
- public final static int TokenNamefinally = 1052;
- public final static int TokenNametry = 1053;
- public final static int TokenNameprivate = 1054;
- public final static int TokenNameprotected = 1055;
- public final static int TokenNamepublic = 1056;
- public final static int TokenNameinterface = 1057;
- public final static int TokenNameimplements = 1058;
- public final static int TokenNameinstanceof = 1059;
- public final static int TokenNamesuper = 1060;
- public final static int TokenNamethrow = 1061;
- public final static int TokenNameconst = 1062;
- public final static int TokenNameclone = 1063;
- public final static int TokenNamedeclare = 1064;
- public final static int TokenNameenddeclare = 1065;
- public final static int TokenNameeval = 1066;
- public final static int TokenNameuse = 1067;
- public final static int TokenNameisset = 1068;
- public final static int TokenNamefinal = 1069;
- public final static int TokenNameLINE = 1070;
- public final static int TokenNameFILE = 1071;
- public final static int TokenNameCLASS_C = 1072;
- public final static int TokenNameMETHOD_C = 1073;
- public final static int TokenNameFUNC_C = 1074;
-
- // special tokens not normally used in the parser
- public final static int TokenNamethis_PHP_COMPLETION = 2000;
+ public final static String[] PHP_TYPES = { "array", "string", "object",
+ "bool", "boolean", "real", "double", "float", "int", "integer", };
+
+ // "array",
+ public final static int TokenNameWHITESPACE = 900,
+ TokenNameCOMMENT_LINE = 901, TokenNameCOMMENT_BLOCK = 902,
+ TokenNameCOMMENT_PHPDOC = 903;
+
+ // TokenNameHTML = 904;
+ final static int TokenNameEOF = 0;
+
+ final static int TokenNameERROR = 1;
+
+ final static int TokenNameINLINE_HTML = 2;
+
+ final static int TokenNameREMAINDER = 30;
+
+ final static int TokenNameNOT = 31;
+
+ final static int TokenNameDOT = 32;
+
+ final static int TokenNameXOR = 33;
+
+ final static int TokenNameDIVIDE = 34;
+
+ final static int TokenNameMULTIPLY = 35;
+
+ final static int TokenNameMINUS = 36;
+
+ final static int TokenNamePLUS = 37;
+
+ final static int TokenNameEQUAL_EQUAL = 38;
+
+ final static int TokenNameNOT_EQUAL = 39;
+
+ final static int TokenNameGREATER = 40;
+
+ final static int TokenNameGREATER_EQUAL = 41;
+
+ final static int TokenNameLESS = 42;
+
+ final static int TokenNameLESS_EQUAL = 43;
+
+ final static int TokenNameAND_AND = 44;
+
+ final static int TokenNameOR_OR = 45;
+
+ final static int TokenNameCOLON = 47;
+
+ final static int TokenNameDOT_EQUAL = 48;
+
+ final static int TokenNameEQUAL = 49;
+
+ final static int TokenNameMINUS_GREATER = 50; // ->
+
+ final static int TokenNameEQUAL_GREATER = 51; // => (for each operator)
+
+ final static int TokenNameAND = 52;
+
+ final static int TokenNameTWIDDLE = 54;
+
+ final static int TokenNameTWIDDLE_EQUAL = 55;
+
+ final static int TokenNameREMAINDER_EQUAL = 56;
+
+ final static int TokenNameXOR_EQUAL = 57;
+
+ final static int TokenNameRIGHT_SHIFT_EQUAL = 58;
+
+ final static int TokenNameLEFT_SHIFT_EQUAL = 59;
+
+ final static int TokenNameAND_EQUAL = 60;
+
+ final static int TokenNameOR_EQUAL = 61;
+
+ final static int TokenNameQUESTION = 62;
+
+ final static int TokenNamePAAMAYIM_NEKUDOTAYIM = 63;
+
+ final static int TokenNameAT = 64;
+
+ final static int TokenNameand = 65;
+
+ final static int TokenNameor = 66;
+
+ final static int TokenNamexor = 67;
+
+ final static int TokenNameDOLLAR = 126;
+
+ final static int TokenNameDOLLAR_LBRACE = 127;
+
+ final static int TokenNameLPAREN = 128;
+
+ final static int TokenNameRPAREN = 129;
+
+ final static int TokenNameLBRACE = 130;
+
+ final static int TokenNameRBRACE = 131;
+
+ final static int TokenNameLBRACKET = 132;
+
+ final static int TokenNameRBRACKET = 133;
+
+ final static int TokenNameCOMMA = 134;
+
+ final static int TokenNameStringDoubleQuote = 136;
+
+ final static int TokenNameIdentifier = 138;
+
+ final static int TokenNameSEMICOLON = 140;
+
+ final static int TokenNameMINUS_MINUS = 144;
+
+ final static int TokenNamePLUS_PLUS = 145;
+
+ final static int TokenNamePLUS_EQUAL = 146;
+
+ final static int TokenNameDIVIDE_EQUAL = 147;
+
+ final static int TokenNameMINUS_EQUAL = 148;
+
+ final static int TokenNameMULTIPLY_EQUAL = 149;
+
+ final static int TokenNameVariable = 150;
+
+ final static int TokenNameIntegerLiteral = 151;
+
+ final static int TokenNameDoubleLiteral = 152;
+
+ final static int TokenNameStringInterpolated = 153;
+
+ final static int TokenNameStringSingleQuote = 154;
+
+ final static int TokenNameLEFT_SHIFT = 155;
+
+ final static int TokenNameRIGHT_SHIFT = 156;
+
+ final static int TokenNameEQUAL_EQUAL_EQUAL = 157;
+
+ final static int TokenNameNOT_EQUAL_EQUAL = 158;
+
+ final static int TokenNameOR = 160;
+
+ final static int TokenNameHEREDOC = 161;
+
+ final static int TokenNameintCAST = 174;
+
+ final static int TokenNameboolCAST = 175;
+
+ final static int TokenNamedoubleCAST = 176;
+
+ final static int TokenNamestringCAST = 177;
+
+ final static int TokenNamearrayCAST = 178;
+
+ final static int TokenNameobjectCAST = 179;
+
+ final static int TokenNameunsetCAST = 180;
+
+ // �
+ final static int TokenNameEncapsedString0 = 190;
+
+ // '
+ // final static int TokenNameEncapsedString1 = 191;
+ // "
+ // final static int TokenNameEncapsedString2 = 192;
+
+ final static int TokenNameSTRING = 193;
+
+ final static int TokenNameLBRACE_DOLLAR = 194;
+
+ // start SQL token - the SQL tokens are only used in the
+ // PHPCompletionprocessor:
+ public final static int TokenNameSQLselect = 901;
+
+ public final static int TokenNameSQLupdate = 902;
+
+ public final static int TokenNameSQLinsert = 903;
+
+ public final static int TokenNameSQLwhere = 904;
+
+ public final static int TokenNameSQLfrom = 905;
+
+ public final static int TokenNameSQLinto = 906;
+
+ public final static int TokenNameSQLset = 907;
+
+ public final static int TokenNameSQLvalues = 908;
+
+ // stop SQL token
+
+ /**
+ * Special 0-length token for php short tag syntax; Detected directly after
+ * <?=
+ */
+ public final static int TokenNameECHO_INVISIBLE = 990;
+
+ public final static int TokenNameKEYWORD = 1000;
+
+ public final static int TokenNameif = 1001;
+
+ public final static int TokenNameelseif = 1002;
+
+ public final static int TokenNameelse = 1003;
+
+ public final static int TokenNameendif = 1004;
+
+ public final static int TokenNamefor = 1005;
+
+ public final static int TokenNameendfor = 1006;
+
+ public final static int TokenNamewhile = 1007;
+
+ public final static int TokenNameendwhile = 1008;
+
+ public final static int TokenNameswitch = 1009;
+
+ public final static int TokenNamecase = 10010;
+
+ public final static int TokenNameendswitch = 1011;
+
+ public final static int TokenNamebreak = 1012;
+
+ public final static int TokenNamecontinue = 1013;
+
+ public final static int TokenNamereturn = 1014;
+
+ // public final static int TokenNamedefine = 1015;
+ public final static int TokenNameinclude = 1016;
+
+ public final static int TokenNameinclude_once = 1017;
+
+ public final static int TokenNamerequire = 1018;
+
+ public final static int TokenNamerequire_once = 1019;
+
+ public final static int TokenNamefunction = 1020;
+
+ public final static int TokenNameclass = 1021;
+
+ public final static int TokenNamenew = 1022;
+
+ public final static int TokenNamedo = 1023;
+
+ public final static int TokenNameold_function = 1024;
+
+ public final static int TokenNamedefault = 1025;
+
+ public final static int TokenNameglobal = 1026;
+
+ public final static int TokenNamestatic = 1027;
+
+ public final static int TokenNameforeach = 1028;
+
+ public final static int TokenNameendforeach = 1029;
+
+ public final static int TokenNameextends = 1030;
+
+ public final static int TokenNameempty = 1031;
+
+ public final static int TokenNamearray = 1032;
+
+ public final static int TokenNameecho = 1033;
+
+ public final static int TokenNamevar = 1034;
+
+ public final static int TokenNameas = 1035;
+
+ public final static int TokenNameprint = 1036;
+
+ public final static int TokenNameunset = 1037;
+
+ public final static int TokenNameexit = 1038;
+
+ // public final static int TokenNamedie = 1039;
+ // public final static int TokenNameand = 1040;
+ // public final static int TokenNameor = 1041;
+ // public final static int TokenNamexor = 1042;
+ public final static int TokenNamelist = 1043;
+
+ // public final static int TokenNamenull = 1044;
+ // public final static int TokenNamefalse = 1045;
+ // public final static int TokenNametrue = 1046;
+ // public final static int TokenNamethis = 1047;
+ //
+ public final static int TokenNameabstract = 1050;
+
+ public final static int TokenNamecatch = 1051;
+
+ public final static int TokenNamefinally = 1052;
+
+ public final static int TokenNametry = 1053;
+
+ public final static int TokenNameprivate = 1054;
+
+ public final static int TokenNameprotected = 1055;
+
+ public final static int TokenNamepublic = 1056;
+
+ public final static int TokenNameinterface = 1057;
+
+ public final static int TokenNameimplements = 1058;
+
+ public final static int TokenNameinstanceof = 1059;
+
+ public final static int TokenNamesuper = 1060;
+
+ public final static int TokenNamethrow = 1061;
+
+ public final static int TokenNameconst = 1062;
+
+ public final static int TokenNameclone = 1063;
+
+ public final static int TokenNamedeclare = 1064;
+
+ public final static int TokenNameenddeclare = 1065;
+
+ public final static int TokenNameeval = 1066;
+
+ public final static int TokenNameuse = 1067;
+
+ public final static int TokenNameisset = 1068;
+
+ public final static int TokenNamefinal = 1069;
+
+ public final static int TokenNameLINE = 1070;
+
+ public final static int TokenNameFILE = 1071;
+
+ public final static int TokenNameCLASS_C = 1072;
+
+ public final static int TokenNameMETHOD_C = 1073;
+
+ public final static int TokenNameFUNC_C = 1074;
+
+ // special tokens not normally used in the parser
+ public final static int TokenNamethis_PHP_COMPLETION = 2000;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/InvalidInputException.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/InvalidInputException.java
index a4367a7..5a3767b 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/InvalidInputException.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/InvalidInputException.java
@@ -1,13 +1,13 @@
/**********************************************************************
-Copyright (c) 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 v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-Â
-Contributors:
- IBM Corporation - initial API and implementation
-**********************************************************************/
+ Copyright (c) 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 v0.5
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/cpl-v05.html
+ �
+ Contributors:
+ IBM Corporation - initial API and implementation
+ **********************************************************************/
package net.sourceforge.phpdt.core.compiler;
@@ -22,9 +22,12 @@ public class InvalidInputException extends Exception {
public InvalidInputException() {
super();
}
+
/**
* InvalidInputException constructor comment.
- * @param s java.lang.String
+ *
+ * @param s
+ * java.lang.String
*/
public InvalidInputException(String s) {
super(s);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java
index 5570ff9..1b3e452 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/dom/CompilationUnit.java
@@ -1,4 +1,5 @@
package net.sourceforge.phpdt.core.dom;
+
/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -10,7 +11,6 @@ package net.sourceforge.phpdt.core.dom;
* IBM Corporation - initial API and implementation
*******************************************************************************/
-
/**
* Java compilation unit AST node type. This is the type of the root of an AST.
*
@@ -18,826 +18,851 @@ package net.sourceforge.phpdt.core.dom;
* including leading and trailing whitespace and comments.
*
- * For JLS3, the kinds of type declarations
- * grew to include enum and annotation type declarations:
+ *
+ * For JLS3, the kinds of type declarations grew to include enum and annotation
+ * type declarations:
+ *
*
- *
+ *
* @since 2.0
*/
public class CompilationUnit {
-// /**
-// * The "package" structural property of this node type.
-// *
-// * @since 3.0
-// */
-// public static final ChildPropertyDescriptor PACKAGE_PROPERTY =
-// new ChildPropertyDescriptor(CompilationUnit.class, "package", PackageDeclaration.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$
-//
-// /**
-// * The "imports" structural property of this node type.
-// *
-// * @since 3.0
-// */
-// public static final ChildListPropertyDescriptor IMPORTS_PROPERTY =
-// new ChildListPropertyDescriptor(CompilationUnit.class, "imports", ImportDeclaration.class, NO_CYCLE_RISK); //$NON-NLS-1$
-//
-// /**
-// * The "types" structural property of this node type.
-// *
-// * @since 3.0
-// */
-// public static final ChildListPropertyDescriptor TYPES_PROPERTY =
-// new ChildListPropertyDescriptor(CompilationUnit.class, "types", AbstractTypeDeclaration.class, CYCLE_RISK); //$NON-NLS-1$
-//
-// /**
-// * A list of property descriptors (element type:
-// * {@link StructuralPropertyDescriptor}),
-// * or null if uninitialized.
-// * @since 3.0
-// */
-// private static final List PROPERTY_DESCRIPTORS;
-//
-// static {
-// createPropertyList(CompilationUnit.class);
-// addProperty(PACKAGE_PROPERTY);
-// addProperty(IMPORTS_PROPERTY);
-// addProperty(TYPES_PROPERTY);
-// PROPERTY_DESCRIPTORS = reapPropertyList();
-// }
-//
-// /**
-// * Returns a list of structural property descriptors for this node type.
-// * Clients must not modify the result.
-// *
-// * @param apiLevel the API level; one of the
-// * AST.JLS* constants
-//
-// * @return a list of property descriptors (element type:
-// * {@link StructuralPropertyDescriptor})
-// * @since 3.0
-// */
-// public static List propertyDescriptors(int apiLevel) {
-// return PROPERTY_DESCRIPTORS;
-// }
-//
-// /**
-// * The comment table, or null if none; initially
-// * null. This array is the storage underlying
-// * the optionalCommentList ArrayList.
-// * @since 3.0
-// */
-// Comment[] optionalCommentTable = null;
-//
-// /**
-// * The comment list (element type: Comment,
-// * or null if none; initially null.
-// * @since 3.0
-// */
-// private List optionalCommentList = null;
-//
-// /**
-// * The package declaration, or null if none; initially
-// * null.
-// */
-// private PackageDeclaration optionalPackageDeclaration = null;
-//
-// /**
-// * The list of import declarations in textual order order;
-// * initially none (elementType: ImportDeclaration).
-// */
-// private ASTNode.NodeList imports =
-// new ASTNode.NodeList(IMPORTS_PROPERTY);
-//
-// /**
-// * The list of type declarations in textual order order;
-// * initially none (elementType: AbstractTypeDeclaration)
-// */
-// private ASTNode.NodeList types =
-// new ASTNode.NodeList(TYPES_PROPERTY);
-//
-// /**
-// * Line end table. If lineEndTable[i] == p then the
-// * line number i+1 ends at character position
-// * p. Except for the last line, the positions are that
-// * of the last character of the line delimiter.
-// * For example, the source string A\nB\nC has
-// * line end table {1, 3} (if \n is one character).
-// */
-// private int[] lineEndTable = new int[0];
-//
-// /**
-// * Canonical empty list of messages.
-// */
-// private static final Message[] EMPTY_MESSAGES = new Message[0];
-//
-// /**
-// * Canonical empty list of problems.
-// */
-// private static final IProblem[] EMPTY_PROBLEMS = new IProblem[0];
-//
-// /**
-// * Messages reported by the compiler during parsing or name resolution.
-// */
-// private Message[] messages;
-//
-// /**
-// * Problems reported by the compiler during parsing or name resolution.
-// */
-// private IProblem[] problems = EMPTY_PROBLEMS;
-//
-// /**
-// * The comment mapper, or null in none;
-// * initially null.
-// * @since 3.0
-// */
-// private DefaultCommentMapper commentMapper = null;
-//
-// /**
-// * Sets the line end table for this compilation unit.
-// * If lineEndTable[i] == p then line number i+1
-// * ends at character position p. Except for the last line, the
-// * positions are that of (the last character of) the line delimiter.
-// * For example, the source string A\nB\nC has
-// * line end table {1, 3, 4}.
-// *
-// * @param lineEndtable the line end table
-// */
-// void setLineEndTable(int[] lineEndTable) {
-// if (lineEndTable == null) {
-// throw new NullPointerException();
-// }
-// // alternate root is *not* considered a structural property
-// // but we protect them nevertheless
-// checkModifiable();
-// this.lineEndTable = lineEndTable;
-// }
-//
-// /**
-// * Creates a new AST node for a compilation owned by the given AST.
-// * The compilation unit initially has no package declaration, no
-// * import declarations, and no type declarations.
-// *
-// * N.B. This constructor is package-private; all subclasses must be
-// * declared in the same package; clients are unable to declare
-// * additional subclasses.
-// *
-// *
-// * @param ast the AST that is to own this node
-// */
-// CompilationUnit(AST ast) {
-// super(ast);
-// }
-//
-// /* (omit javadoc for this method)
-// * Method declared on ASTNode.
-// * @since 3.0
-// */
-// final List internalStructuralPropertiesForType(int apiLevel) {
-// return propertyDescriptors(apiLevel);
-// }
-//
-// /* (omit javadoc for this method)
-// * Method declared on ASTNode.
-// */
-// final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) {
-// if (property == PACKAGE_PROPERTY) {
-// if (get) {
-// return getPackage();
-// } else {
-// setPackage((PackageDeclaration) child);
-// return null;
-// }
-// }
-// // allow default implementation to flag the error
-// return super.internalGetSetChildProperty(property, get, child);
-// }
-//
-// /* (omit javadoc for this method)
-// * Method declared on ASTNode.
-// */
-// final List internalGetChildListProperty(ChildListPropertyDescriptor property) {
-// if (property == IMPORTS_PROPERTY) {
-// return imports();
-// }
-// if (property == TYPES_PROPERTY) {
-// return types();
-// }
-// // allow default implementation to flag the error
-// return super.internalGetChildListProperty(property);
-// }
-//
-// /* (omit javadoc for this method)
-// * Method declared on ASTNode.
-// */
-// final int getNodeType0() {
-// return COMPILATION_UNIT;
-// }
-//
-// /* (omit javadoc for this method)
-// * Method declared on ASTNode.
-// */
-// ASTNode clone0(AST target) {
-// CompilationUnit result = new CompilationUnit(target);
-// // n.b do not copy line number table or messages
-// result.setSourceRange(this.getStartPosition(), this.getLength());
-// result.setPackage(
-// (PackageDeclaration) ASTNode.copySubtree(target, getPackage()));
-// result.imports().addAll(ASTNode.copySubtrees(target, imports()));
-// result.types().addAll(ASTNode.copySubtrees(target, types()));
-// return result;
-// }
-//
-// /* (omit javadoc for this method)
-// * Method declared on ASTNode.
-// */
-// final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
-// // dispatch to correct overloaded match method
-// return matcher.match(this, other);
-// }
-//
-// /* (omit javadoc for this method)
-// * Method declared on ASTNode.
-// */
-// void accept0(ASTVisitor visitor) {
-// boolean visitChildren = visitor.visit(this);
-// if (visitChildren) {
-// // visit children in normal left to right reading order
-// acceptChild(visitor, getPackage());
-// acceptChildren(visitor, this.imports);
-// acceptChildren(visitor, this.types);
-// }
-// visitor.endVisit(this);
-// }
-//
-// /**
-// * Returns the node for the package declaration of this compilation
-// * unit, or null if this compilation unit is in the
-// * default package.
-// *
-// * @return the package declaration node, or null if none
-// */
-// public PackageDeclaration getPackage() {
-// return this.optionalPackageDeclaration;
-// }
-//
-// /**
-// * Sets or clears the package declaration of this compilation unit
-// * node to the given package declaration node.
-// *
-// * @param pkgDecl the new package declaration node, or
-// * null if this compilation unit does not have a package
-// * declaration (that is in the default package)
-// * @exception IllegalArgumentException if:
-// *
-// *
the node belongs to a different AST
-// *
the node already has a parent
-// *
-// */
-// public void setPackage(PackageDeclaration pkgDecl) {
-// ASTNode oldChild = this.optionalPackageDeclaration;
-// preReplaceChild(oldChild, pkgDecl, PACKAGE_PROPERTY);
-// this.optionalPackageDeclaration = pkgDecl;
-// postReplaceChild(oldChild, pkgDecl, PACKAGE_PROPERTY);
-// }
-//
-// /**
-// * Returns the live list of nodes for the import declarations of this
-// * compilation unit, in order of appearance.
-// *
-// * @return the live list of import declaration nodes
-// * (elementType: ImportDeclaration)
-// */
-// public List imports() {
-// return this.imports;
-// }
-//
-// /**
-// * Returns the live list of nodes for the top-level type declarations of this
-// * compilation unit, in order of appearance.
-// *
-// * Note that in JLS3, the types may include both enum declarations
-// * and annotation type declarations introduced in J2SE 1.5.
-// * For JLS2, the elements are always TypeDeclaration.
-// *
-// *
-// * @return the live list of top-level type declaration
-// * nodes (elementType: AbstractTypeDeclaration)
-// */
-// public List types() {
-// return this.types;
-// }
-//
-// /**
-// * Finds the corresponding AST node in the given compilation unit from
-// * which the given binding originated. Returns null if the
-// * binding does not correspond to any node in this compilation unit.
-// * This method always returns null if bindings were not requested
-// * when this AST was built.
-// *
-// * The following table indicates the expected node type for the various
-// * different kinds of bindings:
-// *
-// *
-// *
package - a PackageDeclaration
-// *
class or interface - a TypeDeclaration or a
-// * AnonymousClassDeclaration (for anonymous classes)
-// *
primitive type - none
-// *
array type - none
-// *
field - a VariableDeclarationFragment in a
-// * FieldDeclaration
-// *
local variable - a SingleVariableDeclaration, or
-// * a VariableDeclarationFragment in a
-// * VariableDeclarationStatement or
-// * VariableDeclarationExpression
-// *
method - a MethodDeclaration
-// *
constructor - a MethodDeclaration
-// *
annotation type - an AnnotationTypeDeclaration
-// *
annotation type member - an AnnotationTypeMemberDeclaration
-// *
enum type - an EnumDeclaration
-// *
enum constant - an EnumConstantDeclaration
-// *
-// *
-// *
-// * Each call to {@link ASTParser#createAST(IProgressMonitor)} with a request for bindings
-// * gives rise to separate universe of binding objects. This method always returns
-// * null when the binding object comes from a different AST.
-// * Use findDeclaringNode(binding.getKey()) when the binding comes
-// * from a different AST.
-// *
-// *
-// * @param binding the binding
-// * @return the corresponding node where the given binding is declared,
-// * or null if the binding does not correspond to a node in this
-// * compilation unit or if bindings were not requested when this AST was built
-// * @see #findDeclaringNode(String)
-// */
-// public ASTNode findDeclaringNode(IBinding binding) {
-// return this.ast.getBindingResolver().findDeclaringNode(binding);
-// }
-//
-// /**
-// * Finds the corresponding AST node in the given compilation unit from
-// * which the binding with the given key originated. Returns
-// * null if the corresponding node cannot be determined.
-// * This method always returns null if bindings were not requested
-// * when this AST was built.
-// *
-// * The following table indicates the expected node type for the various
-// * different kinds of binding keys:
-// *
-// *
-// *
package - a PackageDeclaration
-// *
class or interface - a TypeDeclaration or a
-// * AnonymousClassDeclaration (for anonymous classes)
-// *
primitive type - none
-// *
array type - none
-// *
field - a VariableDeclarationFragment in a
-// * FieldDeclaration
-// *
local variable - a SingleVariableDeclaration, or
-// * a VariableDeclarationFragment in a
-// * VariableDeclarationStatement or
-// * VariableDeclarationExpression
-// *
method - a MethodDeclaration
-// *
constructor - a MethodDeclaration
-// *
annotation type - an AnnotationTypeDeclaration
-// *
annotation type member - an AnnotationTypeMemberDeclaration
-// *
enum type - an EnumDeclaration
-// *
enum constant - an EnumConstantDeclaration
-// *
-// *
-// *
-// * Note that as explained in {@link IBinding#getKey() IBinding.getkey}
-// * there may be no keys for finding the declaring node for local variables,
-// * local or anonymous classes, etc.
-// *
-// *
-// * @param key the binding key, or null
-// * @return the corresponding node where a binding with the given
-// * key is declared, or null if the key is null
-// * or if the key does not correspond to a node in this compilation unit
-// * or if bindings were not requested when this AST was built
-// * @see IBinding#getKey()
-// * @since 2.1
-// */
-// public ASTNode findDeclaringNode(String key) {
-// return this.ast.getBindingResolver().findDeclaringNode(key);
-// }
-//
-// /**
-// * Returns the internal comment mapper.
-// *
-// * @return the comment mapper, or null if none.
-// * @since 3.0
-// */
-// DefaultCommentMapper getCommentMapper() {
-// return this.commentMapper;
-// }
-//
-// /**
-// * Initializes the internal comment mapper with the given
-// * scanner.
-// *
-// * @param scanner the scanner
-// * @since 3.0
-// */
-// void initCommentMapper(Scanner scanner) {
-// this.commentMapper = new DefaultCommentMapper(this.optionalCommentTable);
-// this.commentMapper.initialize(this, scanner);
-// }
-//
-// /**
-// * Returns the extended start position of the given node. Unlike
-// * {@link ASTNode#getStartPosition()} and {@link ASTNode#getLength()()},
-// * the extended source range may include comments and whitespace
-// * immediately before or after the normal source range for the node.
-// *
-// * @param node the node
-// * @return the 0-based character index, or -1
-// * if no source position information is recorded for this node
-// * @see #getExtendedLength(ASTNode)
-// * @since 3.0
-// */
-// public int getExtendedStartPosition(ASTNode node) {
-// if (this.commentMapper == null) {
-// return -1;
-// } else {
-// return this.commentMapper.getExtendedStartPosition(node);
-// }
-// }
-//
-// /**
-// * Returns the extended source length of the given node. Unlike
-// * {@link ASTNode#getStartPosition()} and {@link ASTNode#getLength()()},
-// * the extended source range may include comments and whitespace
-// * immediately before or after the normal source range for the node.
-// *
-// * @param node the node
-// * @return a (possibly 0) length, or 0
-// * if no source position information is recorded for this node
-// * @see #getExtendedStartPosition(ASTNode)
-// * @since 3.0
-// */
-// public int getExtendedLength(ASTNode node) {
-// if (this.commentMapper == null) {
-// return 0;
-// } else {
-// return this.commentMapper.getExtendedLength(node);
-// }
-// }
-//
-// /**
-// * Returns the line number corresponding to the given source character
-// * position in the original source string. The initial line of the
-// * compilation unit is numbered 1, and each line extends through the
-// * last character of the end-of-line delimiter. The very last line extends
-// * through the end of the source string and has no line delimiter.
-// * For example, the source string class A\n{\n} has 3 lines
-// * corresponding to inclusive character ranges [0,7], [8,9], and [10,10].
-// * Returns 1 for a character position that does not correspond to any
-// * source line, or if no line number information is available for this
-// * compilation unit.
-// *
-// * @param position a 0-based character position, possibly
-// * negative or out of range
-// * @return the 1-based line number, or 1 if the character
-// * position does not correspond to a source line in the original
-// * source file or if line number information is not known for this
-// * compilation unit
-// * @see ASTParser
-// */
-// public int lineNumber(int position) {
-// int length = lineEndTable.length;
-// if (length == 0) {
-// // no line number info
-// return 1;
-// }
-// int low = 0;
-// if (position <= lineEndTable[low]) {
-// // position illegal or before the first line delimiter
-// return 1;
-// }
-// // assert position > lineEndTable[low+1] && low == 0
-// int hi = length - 1;
-// if (position > lineEndTable[hi]) {
-// // position beyond the last line separator
-// if (position >= getStartPosition() + getLength()) {
-// // this is beyond the end of the source length
-// return 1;
-// } else {
-// return length + 1;
-// }
-// }
-// // assert lineEndTable[low] < position <= lineEndTable[hi]
-// // && low == 0 && hi == length - 1 && low < hi
-//
-// // binary search line end table
-// while (true) {
-// // invariant lineEndTable[low] < position <= lineEndTable[hi]
-// // && 0 <= low < hi <= length - 1
-// // reducing measure hi - low
-// if (low + 1 == hi) {
-// // assert lineEndTable[low] < position <= lineEndTable[low+1]
-// // position is on line low+1 (line number is low+2)
-// return low + 2;
-// }
-// // assert hi - low >= 2, so average is truly in between
-// int mid = (low + hi) / 2;
-// // assert 0 <= low < mid < hi <= length - 1
-// if (position <= lineEndTable[mid]) {
-// // assert lineEndTable[low] < position <= lineEndTable[mid]
-// // && 0 <= low < mid < hi <= length - 1
-// hi = mid;
-// } else {
-// // position > lineEndTable[mid]
-// // assert lineEndTable[mid] < position <= lineEndTable[hi]
-// // && 0 <= low < mid < hi <= length - 1
-// low = mid;
-// }
-// // in both cases, invariant reachieved with reduced measure
-// }
-// }
-//
-// /**
-// * Returns the list of messages reported by the compiler during the parsing
-// * or the type checking of this compilation unit. This list might be a subset of
-// * errors detected and reported by a Java compiler.
-// *
-// * This list of messages is suitable for simple clients that do little
-// * more than log the messages or display them to the user. Clients that
-// * need further details should call getProblems to get
-// * compiler problem objects.
-// *
-// *
-// * @return the list of messages, possibly empty
-// * @see #getProblems()
-// * @see ASTParser
-// */
-// public Message[] getMessages() {
-// if (this.messages == null) {
-// int problemLength = this.problems.length;
-// if (problemLength == 0) {
-// this.messages = EMPTY_MESSAGES;
-// } else {
-// this.messages = new Message[problemLength];
-// for (int i = 0; i < problemLength; i++) {
-// IProblem problem = this.problems[i];
-// int start = problem.getSourceStart();
-// int end = problem.getSourceEnd();
-// messages[i] = new Message(problem.getMessage(), start, end - start + 1);
-// }
-// }
-// }
-// return this.messages;
-// }
-//
-// /**
-// * Returns the list of detailed problem reports noted by the compiler
-// * during the parsing or the type checking of this compilation unit. This
-// * list might be a subset of errors detected and reported by a Java
-// * compiler.
-// *
-// * Simple clients that do little more than log the messages or display
-// * them to the user should probably call getMessages instead.
-// *
-// *
-// * @return the list of detailed problem objects, possibly empty
-// * @see #getMessages()
-// * @see ASTParser
-// * @since 2.1
-// */
-// public IProblem[] getProblems() {
-// return this.problems;
-// }
-//
-// /**
-// * Sets the array of problems reported by the compiler during the parsing or
-// * name resolution of this compilation unit.
-// *
-// * @param problems the list of problems
-// */
-// void setProblems(IProblem[] problems) {
-// if (problems == null) {
-// throw new IllegalArgumentException();
-// }
-// this.problems = problems;
-// }
-//
-// /**
-// * Returns a list of the comments encountered while parsing
-// * this compilation unit.
-// *
-// * Since the Java language allows comments to appear most anywhere
-// * in the source text, it is problematic to locate comments in relation
-// * to the structure of an AST. The one exception is doc comments
-// * which, by convention, immediately precede type, field, and
-// * method declarations; these comments are located in the AST
-// * by {@link BodyDeclaration#getJavadoc BodyDeclaration.getJavadoc}.
-// * Other comments do not show up in the AST. The table of comments
-// * is provided for clients that need to find the source ranges of
-// * all comments in the original source string. It includes entries
-// * for comments of all kinds (line, block, and doc), arranged in order
-// * of increasing source position.
-// *
-// * Note on comment parenting: The {@link ASTNode#getParent() getParent()}
-// * of a doc comment associated with a body declaration is the body
-// * declaration node; for these comment nodes
-// * {@link ASTNode#getRoot() getRoot()} will return the compilation unit
-// * (assuming an unmodified AST) reflecting the fact that these nodes
-// * are property located in the AST for the compilation unit.
-// * However, for other comment nodes, {@link ASTNode#getParent() getParent()}
-// * will return null, and {@link ASTNode#getRoot() getRoot()}
-// * will return the comment node itself, indicating that these comment nodes
-// * are not directly connected to the AST for the compilation unit. The
-// * {@link Comment#getAlternateRoot Comment.getAlternateRoot}
-// * method provides a way to navigate from a comment to its compilation
-// * unit.
-// *
-// *
-// * A note on visitors: The only comment nodes that will be visited when
-// * visiting a compilation unit are the doc comments parented by body
-// * declarations. To visit all comments in normal reading order, iterate
-// * over the comment table and call {@link ASTNode#accept(ASTVisitor) accept}
-// * on each element.
-// *
-// *
-// * Clients cannot modify the resulting list.
-// *
-// *
-// * @return an unmodifiable list of comments in increasing order of source
-// * start position, or null if comment information
-// * for this compilation unit is not available
-// * @see ASTParser
-// * @since 3.0
-// */
-// public List getCommentList() {
-// return this.optionalCommentList;
-// }
-//
-// /**
-// * Sets the list of the comments encountered while parsing
-// * this compilation unit.
-// *
-// * @param commentTable a list of comments in increasing order
-// * of source start position, or null if comment
-// * information for this compilation unit is not available
-// * @exception IllegalArgumentException if the comment table is
-// * not in increasing order of source position
-// * @see #getCommentList()
-// * @see ASTParser
-// * @since 3.0
-// */
-// void setCommentTable(Comment[] commentTable) {
-// // double check table to ensure that all comments have
-// // source positions and are in strictly increasing order
-// if (commentTable == null) {
-// this.optionalCommentList = null;
-// this.optionalCommentTable = null;
-// } else {
-// int nextAvailablePosition = 0;
-// for (int i = 0; i < commentTable.length; i++) {
-// Comment comment = commentTable[i];
-// if (comment == null) {
-// throw new IllegalArgumentException();
-// }
-// int start = comment.getStartPosition();
-// int length = comment.getLength();
-// if (start < 0 || length < 0 || start < nextAvailablePosition) {
-// throw new IllegalArgumentException();
-// }
-// nextAvailablePosition = comment.getStartPosition() + comment.getLength();
-// }
-// this.optionalCommentTable = commentTable;
-// List commentList = Arrays.asList(commentTable);
-// // protect the list from further modification
-// this.optionalCommentList = Collections.unmodifiableList(commentList);
-// }
-// }
-//
-//
-// /* (omit javadoc for this method)
-// * Method declared on ASTNode.
-// */
-// void appendDebugString(StringBuffer buffer) {
-// buffer.append("CompilationUnit"); //$NON-NLS-1$
-// // include the type names
-// buffer.append("["); //$NON-NLS-1$
-// for (Iterator it = types().iterator(); it.hasNext(); ) {
-// AbstractTypeDeclaration d = (AbstractTypeDeclaration) it.next();
-// buffer.append(d.getName().getIdentifier());
-// if (it.hasNext()) {
-// buffer.append(","); //$NON-NLS-1$
-// }
-// }
-// buffer.append("]"); //$NON-NLS-1$
-// }
-//
-// /* (omit javadoc for this method)
-// * Method declared on ASTNode.
-// */
-// int memSize() {
-// int size = BASE_NODE_SIZE + 8 * 4;
-// if (this.lineEndTable != null) {
-// size += HEADERS + 4 * this.lineEndTable.length;
-// }
-// if (this.optionalCommentTable != null) {
-// size += HEADERS + 4 * this.optionalCommentTable.length;
-// }
-// // ignore the space taken up by optionalCommentList
-// return size;
-// }
-//
-// /* (omit javadoc for this method)
-// * Method declared on ASTNode.
-// */
-// int treeSize() {
-// int size = memSize();
-// if (this.optionalPackageDeclaration != null) {
-// size += getPackage().treeSize();
-// }
-// size += this.imports.listSize();
-// size += this.types.listSize();
-// // include disconnected comments
-// if (this.optionalCommentList != null) {
-// for (int i = 0; i < this.optionalCommentList.size(); i++) {
-// Comment comment = (Comment) this.optionalCommentList.get(i);
-// if (comment != null && comment.getParent() == null) {
-// size += comment.treeSize();
-// }
-// }
-// }
-// return size;
-// }
-//
-// /**
-// * Enables the recording of changes to this compilation
-// * unit and its descendents. The compilation unit must have
-// * been created by ASTParser and still be in
-// * its original state. Once recording is on,
-// * arbitrary changes to the subtree rooted at this compilation
-// * unit are recorded internally. Once the modification has
-// * been completed, call rewrite to get an object
-// * representing the corresponding edits to the original
-// * source code string.
-// *
-// * @exception IllegalArgumentException if this compilation unit is
-// * marked as unmodifiable, or if this compilation unit has already
-// * been tampered with, or recording has already been enabled
-// * @since 3.0
-// */
-// public void recordModifications() {
-// getAST().recordModifications(this);
-// }
-//
-// /**
-// * Converts all modifications recorded for this compilation
-// * unit into an object representing the corresponding text
-// * edits to the given document containing the original source
-// * code for this compilation unit.
-// *
-// * The compilation unit must have been created by
-// * ASTParser from the source code string in the
-// * given document, and recording must have been turned
-// * on with a prior call to recordModifications
-// * while the AST was still in its original state.
-// *
-// *
-// * Calling this methods does not discard the modifications
-// * on record. Subsequence modifications made to the AST
-// * are added to the ones already on record. If this method
-// * is called again later, the resulting text edit object will
-// * accurately reflect the net cumulative affect of all those
-// * changes.
-// *
-// *
-// * @param document original document containing source code
-// * for this compilation unit
-// * @param options the table of formatter options
-// * (key type: String; value type: String);
-// * or null to use the standard global options
-// * {@link JavaCore#getOptions() JavaCore.getOptions()}.
-// * @return text edit object describing the changes to the
-// * document corresponding to the recorded AST modifications
-// * @exception IllegalArgumentException if the document passed is
-// * null or does not correspond to this AST
-// * @exception IllegalStateException if recordModifications
-// * was not called to enable recording
-// * @see #recordModifications()
-// * @since 3.0
-// */
-// public TextEdit rewrite(IDocument document, Map options) {
-// return getAST().rewrite(document, options);
-// }
+ // /**
+ // * The "package" structural property of this node type.
+ // *
+ // * @since 3.0
+ // */
+ // public static final ChildPropertyDescriptor PACKAGE_PROPERTY =
+ // new ChildPropertyDescriptor(CompilationUnit.class, "package",
+ // PackageDeclaration.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$
+ //
+ // /**
+ // * The "imports" structural property of this node type.
+ // *
+ // * @since 3.0
+ // */
+ // public static final ChildListPropertyDescriptor IMPORTS_PROPERTY =
+ // new ChildListPropertyDescriptor(CompilationUnit.class, "imports",
+ // ImportDeclaration.class, NO_CYCLE_RISK); //$NON-NLS-1$
+ //
+ // /**
+ // * The "types" structural property of this node type.
+ // *
+ // * @since 3.0
+ // */
+ // public static final ChildListPropertyDescriptor TYPES_PROPERTY =
+ // new ChildListPropertyDescriptor(CompilationUnit.class, "types",
+ // AbstractTypeDeclaration.class, CYCLE_RISK); //$NON-NLS-1$
+ //
+ // /**
+ // * A list of property descriptors (element type:
+ // * {@link StructuralPropertyDescriptor}),
+ // * or null if uninitialized.
+ // * @since 3.0
+ // */
+ // private static final List PROPERTY_DESCRIPTORS;
+ //
+ // static {
+ // createPropertyList(CompilationUnit.class);
+ // addProperty(PACKAGE_PROPERTY);
+ // addProperty(IMPORTS_PROPERTY);
+ // addProperty(TYPES_PROPERTY);
+ // PROPERTY_DESCRIPTORS = reapPropertyList();
+ // }
+ //
+ // /**
+ // * Returns a list of structural property descriptors for this node type.
+ // * Clients must not modify the result.
+ // *
+ // * @param apiLevel the API level; one of the
+ // * AST.JLS* constants
+ //
+ // * @return a list of property descriptors (element type:
+ // * {@link StructuralPropertyDescriptor})
+ // * @since 3.0
+ // */
+ // public static List propertyDescriptors(int apiLevel) {
+ // return PROPERTY_DESCRIPTORS;
+ // }
+ //
+ // /**
+ // * The comment table, or null if none; initially
+ // * null. This array is the storage underlying
+ // * the optionalCommentList ArrayList.
+ // * @since 3.0
+ // */
+ // Comment[] optionalCommentTable = null;
+ //
+ // /**
+ // * The comment list (element type: Comment,
+ // * or null if none; initially null.
+ // * @since 3.0
+ // */
+ // private List optionalCommentList = null;
+ //
+ // /**
+ // * The package declaration, or null if none; initially
+ // * null.
+ // */
+ // private PackageDeclaration optionalPackageDeclaration = null;
+ //
+ // /**
+ // * The list of import declarations in textual order order;
+ // * initially none (elementType: ImportDeclaration).
+ // */
+ // private ASTNode.NodeList imports =
+ // new ASTNode.NodeList(IMPORTS_PROPERTY);
+ //
+ // /**
+ // * The list of type declarations in textual order order;
+ // * initially none (elementType: AbstractTypeDeclaration)
+ // */
+ // private ASTNode.NodeList types =
+ // new ASTNode.NodeList(TYPES_PROPERTY);
+ //
+ // /**
+ // * Line end table. If lineEndTable[i] == p then the
+ // * line number i+1 ends at character position
+ // * p. Except for the last line, the positions are that
+ // * of the last character of the line delimiter.
+ // * For example, the source string A\nB\nC has
+ // * line end table {1, 3} (if \n is one character).
+ // */
+ // private int[] lineEndTable = new int[0];
+ //
+ // /**
+ // * Canonical empty list of messages.
+ // */
+ // private static final Message[] EMPTY_MESSAGES = new Message[0];
+ //
+ // /**
+ // * Canonical empty list of problems.
+ // */
+ // private static final IProblem[] EMPTY_PROBLEMS = new IProblem[0];
+ //
+ // /**
+ // * Messages reported by the compiler during parsing or name resolution.
+ // */
+ // private Message[] messages;
+ //
+ // /**
+ // * Problems reported by the compiler during parsing or name resolution.
+ // */
+ // private IProblem[] problems = EMPTY_PROBLEMS;
+ //
+ // /**
+ // * The comment mapper, or null in none;
+ // * initially null.
+ // * @since 3.0
+ // */
+ // private DefaultCommentMapper commentMapper = null;
+ //
+ // /**
+ // * Sets the line end table for this compilation unit.
+ // * If lineEndTable[i] == p then line number i+1
+ // * ends at character position p. Except for the last line,
+ // the
+ // * positions are that of (the last character of) the line delimiter.
+ // * For example, the source string A\nB\nC has
+ // * line end table {1, 3, 4}.
+ // *
+ // * @param lineEndtable the line end table
+ // */
+ // void setLineEndTable(int[] lineEndTable) {
+ // if (lineEndTable == null) {
+ // throw new NullPointerException();
+ // }
+ // // alternate root is *not* considered a structural property
+ // // but we protect them nevertheless
+ // checkModifiable();
+ // this.lineEndTable = lineEndTable;
+ // }
+ //
+ // /**
+ // * Creates a new AST node for a compilation owned by the given AST.
+ // * The compilation unit initially has no package declaration, no
+ // * import declarations, and no type declarations.
+ // *
+ // * N.B. This constructor is package-private; all subclasses must be
+ // * declared in the same package; clients are unable to declare
+ // * additional subclasses.
+ // *
+ // *
+ // * @param ast the AST that is to own this node
+ // */
+ // CompilationUnit(AST ast) {
+ // super(ast);
+ // }
+ //
+ // /* (omit javadoc for this method)
+ // * Method declared on ASTNode.
+ // * @since 3.0
+ // */
+ // final List internalStructuralPropertiesForType(int apiLevel) {
+ // return propertyDescriptors(apiLevel);
+ // }
+ //
+ // /* (omit javadoc for this method)
+ // * Method declared on ASTNode.
+ // */
+ // final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor
+ // property, boolean get, ASTNode child) {
+ // if (property == PACKAGE_PROPERTY) {
+ // if (get) {
+ // return getPackage();
+ // } else {
+ // setPackage((PackageDeclaration) child);
+ // return null;
+ // }
+ // }
+ // // allow default implementation to flag the error
+ // return super.internalGetSetChildProperty(property, get, child);
+ // }
+ //
+ // /* (omit javadoc for this method)
+ // * Method declared on ASTNode.
+ // */
+ // final List internalGetChildListProperty(ChildListPropertyDescriptor
+ // property) {
+ // if (property == IMPORTS_PROPERTY) {
+ // return imports();
+ // }
+ // if (property == TYPES_PROPERTY) {
+ // return types();
+ // }
+ // // allow default implementation to flag the error
+ // return super.internalGetChildListProperty(property);
+ // }
+ //
+ // /* (omit javadoc for this method)
+ // * Method declared on ASTNode.
+ // */
+ // final int getNodeType0() {
+ // return COMPILATION_UNIT;
+ // }
+ //
+ // /* (omit javadoc for this method)
+ // * Method declared on ASTNode.
+ // */
+ // ASTNode clone0(AST target) {
+ // CompilationUnit result = new CompilationUnit(target);
+ // // n.b do not copy line number table or messages
+ // result.setSourceRange(this.getStartPosition(), this.getLength());
+ // result.setPackage(
+ // (PackageDeclaration) ASTNode.copySubtree(target, getPackage()));
+ // result.imports().addAll(ASTNode.copySubtrees(target, imports()));
+ // result.types().addAll(ASTNode.copySubtrees(target, types()));
+ // return result;
+ // }
+ //
+ // /* (omit javadoc for this method)
+ // * Method declared on ASTNode.
+ // */
+ // final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
+ // // dispatch to correct overloaded match method
+ // return matcher.match(this, other);
+ // }
+ //
+ // /* (omit javadoc for this method)
+ // * Method declared on ASTNode.
+ // */
+ // void accept0(ASTVisitor visitor) {
+ // boolean visitChildren = visitor.visit(this);
+ // if (visitChildren) {
+ // // visit children in normal left to right reading order
+ // acceptChild(visitor, getPackage());
+ // acceptChildren(visitor, this.imports);
+ // acceptChildren(visitor, this.types);
+ // }
+ // visitor.endVisit(this);
+ // }
+ //
+ // /**
+ // * Returns the node for the package declaration of this compilation
+ // * unit, or null if this compilation unit is in the
+ // * default package.
+ // *
+ // * @return the package declaration node, or null if none
+ // */
+ // public PackageDeclaration getPackage() {
+ // return this.optionalPackageDeclaration;
+ // }
+ //
+ // /**
+ // * Sets or clears the package declaration of this compilation unit
+ // * node to the given package declaration node.
+ // *
+ // * @param pkgDecl the new package declaration node, or
+ // * null if this compilation unit does not have a package
+ // * declaration (that is in the default package)
+ // * @exception IllegalArgumentException if:
+ // *
+ // *
the node belongs to a different AST
+ // *
the node already has a parent
+ // *
+ // */
+ // public void setPackage(PackageDeclaration pkgDecl) {
+ // ASTNode oldChild = this.optionalPackageDeclaration;
+ // preReplaceChild(oldChild, pkgDecl, PACKAGE_PROPERTY);
+ // this.optionalPackageDeclaration = pkgDecl;
+ // postReplaceChild(oldChild, pkgDecl, PACKAGE_PROPERTY);
+ // }
+ //
+ // /**
+ // * Returns the live list of nodes for the import declarations of this
+ // * compilation unit, in order of appearance.
+ // *
+ // * @return the live list of import declaration nodes
+ // * (elementType: ImportDeclaration)
+ // */
+ // public List imports() {
+ // return this.imports;
+ // }
+ //
+ // /**
+ // * Returns the live list of nodes for the top-level type declarations of
+ // this
+ // * compilation unit, in order of appearance.
+ // *
+ // * Note that in JLS3, the types may include both enum declarations
+ // * and annotation type declarations introduced in J2SE 1.5.
+ // * For JLS2, the elements are always TypeDeclaration.
+ // *
+ // *
+ // * @return the live list of top-level type declaration
+ // * nodes (elementType: AbstractTypeDeclaration)
+ // */
+ // public List types() {
+ // return this.types;
+ // }
+ //
+ // /**
+ // * Finds the corresponding AST node in the given compilation unit from
+ // * which the given binding originated. Returns null if the
+ // * binding does not correspond to any node in this compilation unit.
+ // * This method always returns null if bindings were not
+ // requested
+ // * when this AST was built.
+ // *
+ // * The following table indicates the expected node type for the various
+ // * different kinds of bindings:
+ // *
+ // *
+ // *
package - a PackageDeclaration
+ // *
class or interface - a TypeDeclaration or a
+ // * AnonymousClassDeclaration (for anonymous classes)
+ // *
primitive type - none
+ // *
array type - none
+ // *
field - a VariableDeclarationFragment in a
+ // * FieldDeclaration
+ // *
local variable - a SingleVariableDeclaration, or
+ // * a VariableDeclarationFragment in a
+ // * VariableDeclarationStatement or
+ // * VariableDeclarationExpression
+ // *
method - a MethodDeclaration
+ // *
constructor - a MethodDeclaration
+ // *
annotation type - an AnnotationTypeDeclaration
+ // *
annotation type member - an
+ // AnnotationTypeMemberDeclaration
+ // *
enum type - an EnumDeclaration
+ // *
enum constant - an EnumConstantDeclaration
+ // *
+ // *
+ // *
+ // * Each call to {@link ASTParser#createAST(IProgressMonitor)} with a
+ // request for bindings
+ // * gives rise to separate universe of binding objects. This method always
+ // returns
+ // * null when the binding object comes from a different AST.
+ // * Use findDeclaringNode(binding.getKey()) when the binding
+ // comes
+ // * from a different AST.
+ // *
+ // *
+ // * @param binding the binding
+ // * @return the corresponding node where the given binding is declared,
+ // * or null if the binding does not correspond to a node in
+ // this
+ // * compilation unit or if bindings were not requested when this AST was
+ // built
+ // * @see #findDeclaringNode(String)
+ // */
+ // public ASTNode findDeclaringNode(IBinding binding) {
+ // return this.ast.getBindingResolver().findDeclaringNode(binding);
+ // }
+ //
+ // /**
+ // * Finds the corresponding AST node in the given compilation unit from
+ // * which the binding with the given key originated. Returns
+ // * null if the corresponding node cannot be determined.
+ // * This method always returns null if bindings were not
+ // requested
+ // * when this AST was built.
+ // *
+ // * The following table indicates the expected node type for the various
+ // * different kinds of binding keys:
+ // *
+ // *
+ // *
package - a PackageDeclaration
+ // *
class or interface - a TypeDeclaration or a
+ // * AnonymousClassDeclaration (for anonymous classes)
+ // *
primitive type - none
+ // *
array type - none
+ // *
field - a VariableDeclarationFragment in a
+ // * FieldDeclaration
+ // *
local variable - a SingleVariableDeclaration, or
+ // * a VariableDeclarationFragment in a
+ // * VariableDeclarationStatement or
+ // * VariableDeclarationExpression
+ // *
method - a MethodDeclaration
+ // *
constructor - a MethodDeclaration
+ // *
annotation type - an AnnotationTypeDeclaration
+ // *
annotation type member - an
+ // AnnotationTypeMemberDeclaration
+ // *
enum type - an EnumDeclaration
+ // *
enum constant - an EnumConstantDeclaration
+ // *
+ // *
+ // *
+ // * Note that as explained in {@link IBinding#getKey() IBinding.getkey}
+ // * there may be no keys for finding the declaring node for local
+ // variables,
+ // * local or anonymous classes, etc.
+ // *
+ // *
+ // * @param key the binding key, or null
+ // * @return the corresponding node where a binding with the given
+ // * key is declared, or null if the key is null
+ // * or if the key does not correspond to a node in this compilation unit
+ // * or if bindings were not requested when this AST was built
+ // * @see IBinding#getKey()
+ // * @since 2.1
+ // */
+ // public ASTNode findDeclaringNode(String key) {
+ // return this.ast.getBindingResolver().findDeclaringNode(key);
+ // }
+ //
+ // /**
+ // * Returns the internal comment mapper.
+ // *
+ // * @return the comment mapper, or null if none.
+ // * @since 3.0
+ // */
+ // DefaultCommentMapper getCommentMapper() {
+ // return this.commentMapper;
+ // }
+ //
+ // /**
+ // * Initializes the internal comment mapper with the given
+ // * scanner.
+ // *
+ // * @param scanner the scanner
+ // * @since 3.0
+ // */
+ // void initCommentMapper(Scanner scanner) {
+ // this.commentMapper = new DefaultCommentMapper(this.optionalCommentTable);
+ // this.commentMapper.initialize(this, scanner);
+ // }
+ //
+ // /**
+ // * Returns the extended start position of the given node. Unlike
+ // * {@link ASTNode#getStartPosition()} and {@link ASTNode#getLength()()},
+ // * the extended source range may include comments and whitespace
+ // * immediately before or after the normal source range for the node.
+ // *
+ // * @param node the node
+ // * @return the 0-based character index, or -1
+ // * if no source position information is recorded for this node
+ // * @see #getExtendedLength(ASTNode)
+ // * @since 3.0
+ // */
+ // public int getExtendedStartPosition(ASTNode node) {
+ // if (this.commentMapper == null) {
+ // return -1;
+ // } else {
+ // return this.commentMapper.getExtendedStartPosition(node);
+ // }
+ // }
+ //
+ // /**
+ // * Returns the extended source length of the given node. Unlike
+ // * {@link ASTNode#getStartPosition()} and {@link ASTNode#getLength()()},
+ // * the extended source range may include comments and whitespace
+ // * immediately before or after the normal source range for the node.
+ // *
+ // * @param node the node
+ // * @return a (possibly 0) length, or 0
+ // * if no source position information is recorded for this node
+ // * @see #getExtendedStartPosition(ASTNode)
+ // * @since 3.0
+ // */
+ // public int getExtendedLength(ASTNode node) {
+ // if (this.commentMapper == null) {
+ // return 0;
+ // } else {
+ // return this.commentMapper.getExtendedLength(node);
+ // }
+ // }
+ //
+ // /**
+ // * Returns the line number corresponding to the given source character
+ // * position in the original source string. The initial line of the
+ // * compilation unit is numbered 1, and each line extends through the
+ // * last character of the end-of-line delimiter. The very last line extends
+ // * through the end of the source string and has no line delimiter.
+ // * For example, the source string class A\n{\n} has 3 lines
+ // * corresponding to inclusive character ranges [0,7], [8,9], and [10,10].
+ // * Returns 1 for a character position that does not correspond to any
+ // * source line, or if no line number information is available for this
+ // * compilation unit.
+ // *
+ // * @param position a 0-based character position, possibly
+ // * negative or out of range
+ // * @return the 1-based line number, or 1 if the character
+ // * position does not correspond to a source line in the original
+ // * source file or if line number information is not known for this
+ // * compilation unit
+ // * @see ASTParser
+ // */
+ // public int lineNumber(int position) {
+ // int length = lineEndTable.length;
+ // if (length == 0) {
+ // // no line number info
+ // return 1;
+ // }
+ // int low = 0;
+ // if (position <= lineEndTable[low]) {
+ // // position illegal or before the first line delimiter
+ // return 1;
+ // }
+ // // assert position > lineEndTable[low+1] && low == 0
+ // int hi = length - 1;
+ // if (position > lineEndTable[hi]) {
+ // // position beyond the last line separator
+ // if (position >= getStartPosition() + getLength()) {
+ // // this is beyond the end of the source length
+ // return 1;
+ // } else {
+ // return length + 1;
+ // }
+ // }
+ // // assert lineEndTable[low] < position <= lineEndTable[hi]
+ // // && low == 0 && hi == length - 1 && low < hi
+ //
+ // // binary search line end table
+ // while (true) {
+ // // invariant lineEndTable[low] < position <= lineEndTable[hi]
+ // // && 0 <= low < hi <= length - 1
+ // // reducing measure hi - low
+ // if (low + 1 == hi) {
+ // // assert lineEndTable[low] < position <= lineEndTable[low+1]
+ // // position is on line low+1 (line number is low+2)
+ // return low + 2;
+ // }
+ // // assert hi - low >= 2, so average is truly in between
+ // int mid = (low + hi) / 2;
+ // // assert 0 <= low < mid < hi <= length - 1
+ // if (position <= lineEndTable[mid]) {
+ // // assert lineEndTable[low] < position <= lineEndTable[mid]
+ // // && 0 <= low < mid < hi <= length - 1
+ // hi = mid;
+ // } else {
+ // // position > lineEndTable[mid]
+ // // assert lineEndTable[mid] < position <= lineEndTable[hi]
+ // // && 0 <= low < mid < hi <= length - 1
+ // low = mid;
+ // }
+ // // in both cases, invariant reachieved with reduced measure
+ // }
+ // }
+ //
+ // /**
+ // * Returns the list of messages reported by the compiler during the
+ // parsing
+ // * or the type checking of this compilation unit. This list might be a
+ // subset of
+ // * errors detected and reported by a Java compiler.
+ // *
+ // * This list of messages is suitable for simple clients that do little
+ // * more than log the messages or display them to the user. Clients that
+ // * need further details should call getProblems to get
+ // * compiler problem objects.
+ // *
+ // *
+ // * @return the list of messages, possibly empty
+ // * @see #getProblems()
+ // * @see ASTParser
+ // */
+ // public Message[] getMessages() {
+ // if (this.messages == null) {
+ // int problemLength = this.problems.length;
+ // if (problemLength == 0) {
+ // this.messages = EMPTY_MESSAGES;
+ // } else {
+ // this.messages = new Message[problemLength];
+ // for (int i = 0; i < problemLength; i++) {
+ // IProblem problem = this.problems[i];
+ // int start = problem.getSourceStart();
+ // int end = problem.getSourceEnd();
+ // messages[i] = new Message(problem.getMessage(), start, end - start + 1);
+ // }
+ // }
+ // }
+ // return this.messages;
+ // }
+ //
+ // /**
+ // * Returns the list of detailed problem reports noted by the compiler
+ // * during the parsing or the type checking of this compilation unit. This
+ // * list might be a subset of errors detected and reported by a Java
+ // * compiler.
+ // *
+ // * Simple clients that do little more than log the messages or display
+ // * them to the user should probably call getMessages instead.
+ // *
+ // *
+ // * @return the list of detailed problem objects, possibly empty
+ // * @see #getMessages()
+ // * @see ASTParser
+ // * @since 2.1
+ // */
+ // public IProblem[] getProblems() {
+ // return this.problems;
+ // }
+ //
+ // /**
+ // * Sets the array of problems reported by the compiler during the parsing
+ // or
+ // * name resolution of this compilation unit.
+ // *
+ // * @param problems the list of problems
+ // */
+ // void setProblems(IProblem[] problems) {
+ // if (problems == null) {
+ // throw new IllegalArgumentException();
+ // }
+ // this.problems = problems;
+ // }
+ //
+ // /**
+ // * Returns a list of the comments encountered while parsing
+ // * this compilation unit.
+ // *
+ // * Since the Java language allows comments to appear most anywhere
+ // * in the source text, it is problematic to locate comments in relation
+ // * to the structure of an AST. The one exception is doc comments
+ // * which, by convention, immediately precede type, field, and
+ // * method declarations; these comments are located in the AST
+ // * by {@link BodyDeclaration#getJavadoc BodyDeclaration.getJavadoc}.
+ // * Other comments do not show up in the AST. The table of comments
+ // * is provided for clients that need to find the source ranges of
+ // * all comments in the original source string. It includes entries
+ // * for comments of all kinds (line, block, and doc), arranged in order
+ // * of increasing source position.
+ // *
+ // * Note on comment parenting: The {@link ASTNode#getParent() getParent()}
+ // * of a doc comment associated with a body declaration is the body
+ // * declaration node; for these comment nodes
+ // * {@link ASTNode#getRoot() getRoot()} will return the compilation unit
+ // * (assuming an unmodified AST) reflecting the fact that these nodes
+ // * are property located in the AST for the compilation unit.
+ // * However, for other comment nodes, {@link ASTNode#getParent()
+ // getParent()}
+ // * will return null, and {@link ASTNode#getRoot() getRoot()}
+ // * will return the comment node itself, indicating that these comment
+ // nodes
+ // * are not directly connected to the AST for the compilation unit. The
+ // * {@link Comment#getAlternateRoot Comment.getAlternateRoot}
+ // * method provides a way to navigate from a comment to its compilation
+ // * unit.
+ // *
+ // *
+ // * A note on visitors: The only comment nodes that will be visited when
+ // * visiting a compilation unit are the doc comments parented by body
+ // * declarations. To visit all comments in normal reading order, iterate
+ // * over the comment table and call {@link ASTNode#accept(ASTVisitor)
+ // accept}
+ // * on each element.
+ // *
+ // *
+ // * @return an unmodifiable list of comments in increasing order of source
+ // * start position, or null if comment information
+ // * for this compilation unit is not available
+ // * @see ASTParser
+ // * @since 3.0
+ // */
+ // public List getCommentList() {
+ // return this.optionalCommentList;
+ // }
+ //
+ // /**
+ // * Sets the list of the comments encountered while parsing
+ // * this compilation unit.
+ // *
+ // * @param commentTable a list of comments in increasing order
+ // * of source start position, or null if comment
+ // * information for this compilation unit is not available
+ // * @exception IllegalArgumentException if the comment table is
+ // * not in increasing order of source position
+ // * @see #getCommentList()
+ // * @see ASTParser
+ // * @since 3.0
+ // */
+ // void setCommentTable(Comment[] commentTable) {
+ // // double check table to ensure that all comments have
+ // // source positions and are in strictly increasing order
+ // if (commentTable == null) {
+ // this.optionalCommentList = null;
+ // this.optionalCommentTable = null;
+ // } else {
+ // int nextAvailablePosition = 0;
+ // for (int i = 0; i < commentTable.length; i++) {
+ // Comment comment = commentTable[i];
+ // if (comment == null) {
+ // throw new IllegalArgumentException();
+ // }
+ // int start = comment.getStartPosition();
+ // int length = comment.getLength();
+ // if (start < 0 || length < 0 || start < nextAvailablePosition) {
+ // throw new IllegalArgumentException();
+ // }
+ // nextAvailablePosition = comment.getStartPosition() + comment.getLength();
+ // }
+ // this.optionalCommentTable = commentTable;
+ // List commentList = Arrays.asList(commentTable);
+ // // protect the list from further modification
+ // this.optionalCommentList = Collections.unmodifiableList(commentList);
+ // }
+ // }
+ //
+ //
+ // /* (omit javadoc for this method)
+ // * Method declared on ASTNode.
+ // */
+ // void appendDebugString(StringBuffer buffer) {
+ // buffer.append("CompilationUnit"); //$NON-NLS-1$
+ // // include the type names
+ // buffer.append("["); //$NON-NLS-1$
+ // for (Iterator it = types().iterator(); it.hasNext(); ) {
+ // AbstractTypeDeclaration d = (AbstractTypeDeclaration) it.next();
+ // buffer.append(d.getName().getIdentifier());
+ // if (it.hasNext()) {
+ // buffer.append(","); //$NON-NLS-1$
+ // }
+ // }
+ // buffer.append("]"); //$NON-NLS-1$
+ // }
+ //
+ // /* (omit javadoc for this method)
+ // * Method declared on ASTNode.
+ // */
+ // int memSize() {
+ // int size = BASE_NODE_SIZE + 8 * 4;
+ // if (this.lineEndTable != null) {
+ // size += HEADERS + 4 * this.lineEndTable.length;
+ // }
+ // if (this.optionalCommentTable != null) {
+ // size += HEADERS + 4 * this.optionalCommentTable.length;
+ // }
+ // // ignore the space taken up by optionalCommentList
+ // return size;
+ // }
+ //
+ // /* (omit javadoc for this method)
+ // * Method declared on ASTNode.
+ // */
+ // int treeSize() {
+ // int size = memSize();
+ // if (this.optionalPackageDeclaration != null) {
+ // size += getPackage().treeSize();
+ // }
+ // size += this.imports.listSize();
+ // size += this.types.listSize();
+ // // include disconnected comments
+ // if (this.optionalCommentList != null) {
+ // for (int i = 0; i < this.optionalCommentList.size(); i++) {
+ // Comment comment = (Comment) this.optionalCommentList.get(i);
+ // if (comment != null && comment.getParent() == null) {
+ // size += comment.treeSize();
+ // }
+ // }
+ // }
+ // return size;
+ // }
+ //
+ // /**
+ // * Enables the recording of changes to this compilation
+ // * unit and its descendents. The compilation unit must have
+ // * been created by ASTParser and still be in
+ // * its original state. Once recording is on,
+ // * arbitrary changes to the subtree rooted at this compilation
+ // * unit are recorded internally. Once the modification has
+ // * been completed, call rewrite to get an object
+ // * representing the corresponding edits to the original
+ // * source code string.
+ // *
+ // * @exception IllegalArgumentException if this compilation unit is
+ // * marked as unmodifiable, or if this compilation unit has already
+ // * been tampered with, or recording has already been enabled
+ // * @since 3.0
+ // */
+ // public void recordModifications() {
+ // getAST().recordModifications(this);
+ // }
+ //
+ // /**
+ // * Converts all modifications recorded for this compilation
+ // * unit into an object representing the corresponding text
+ // * edits to the given document containing the original source
+ // * code for this compilation unit.
+ // *
+ // * The compilation unit must have been created by
+ // * ASTParser from the source code string in the
+ // * given document, and recording must have been turned
+ // * on with a prior call to recordModifications
+ // * while the AST was still in its original state.
+ // *
+ // *
+ // * Calling this methods does not discard the modifications
+ // * on record. Subsequence modifications made to the AST
+ // * are added to the ones already on record. If this method
+ // * is called again later, the resulting text edit object will
+ // * accurately reflect the net cumulative affect of all those
+ // * changes.
+ // *
+ // *
+ // * @param document original document containing source code
+ // * for this compilation unit
+ // * @param options the table of formatter options
+ // * (key type: String; value type: String);
+ // * or null to use the standard global options
+ // * {@link JavaCore#getOptions() JavaCore.getOptions()}.
+ // * @return text edit object describing the changes to the
+ // * document corresponding to the recorded AST modifications
+ // * @exception IllegalArgumentException if the document passed is
+ // * null or does not correspond to this AST
+ // * @exception IllegalStateException if recordModifications
+ // * was not called to enable recording
+ // * @see #recordModifications()
+ // * @since 3.0
+ // */
+ // public TextEdit rewrite(IDocument document, Map options) {
+ // return getAST().rewrite(document, options);
+ // }
}
-
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/formatter/CodeFormatter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/formatter/CodeFormatter.java
index d977c00..4e20db0 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/formatter/CodeFormatter.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/formatter/CodeFormatter.java
@@ -28,43 +28,54 @@ public abstract class CodeFormatter {
* Kind used to format an expression
*/
public static final int K_EXPRESSION = 0x01;
-
+
/**
* Kind used to format a set of statements
*/
public static final int K_STATEMENTS = 0x02;
-
+
/**
* Kind used to format a set of class body declarations
*/
public static final int K_CLASS_BODY_DECLARATIONS = 0x04;
-
+
/**
* Kind used to format a compilation unit
*/
public static final int K_COMPILATION_UNIT = 0x08;
- /**
- * Format source,
- * and returns a text edit that correspond to the difference between the given string and the formatted string.
- * It returns null if the given string cannot be formatted.
+ /**
+ * Format source, and returns a text edit that correspond to
+ * the difference between the given string and the formatted string. It
+ * returns null if the given string cannot be formatted.
*
- * If the offset position is matching a whitespace, the result can include whitespaces. It would be up to the
- * caller to get rid of preceeding whitespaces.
+ * If the offset position is matching a whitespace, the result can include
+ * whitespaces. It would be up to the caller to get rid of preceeding
+ * whitespaces.
*
- * @param kind Use to specify the kind of the code snippet to format. It can be any of these:
- * K_EXPRESSION, K_STATEMENTS, K_CLASS_BODY_DECLARATIONS, K_COMPILATION_UNIT, K_UNKNOWN
- * @param source the source to format
- * @param offset the given offset to start recording the edits (inclusive).
- * @param length the given length to stop recording the edits (exclusive).
- * @param indentationLevel the initial indentation level, used
- * to shift left/right the entire source fragment. An initial indentation
- * level of zero or below has no effect.
- * @param lineSeparator the line separator to use in formatted source,
- * if set to null, then the platform default one will be used.
+ * @param kind
+ * Use to specify the kind of the code snippet to format. It can
+ * be any of these: K_EXPRESSION, K_STATEMENTS,
+ * K_CLASS_BODY_DECLARATIONS, K_COMPILATION_UNIT, K_UNKNOWN
+ * @param source
+ * the source to format
+ * @param offset
+ * the given offset to start recording the edits (inclusive).
+ * @param length
+ * the given length to stop recording the edits (exclusive).
+ * @param indentationLevel
+ * the initial indentation level, used to shift left/right the
+ * entire source fragment. An initial indentation level of zero
+ * or below has no effect.
+ * @param lineSeparator
+ * the line separator to use in formatted source, if set to
+ * null, then the platform default one will be
+ * used.
* @return the text edit
- * @throws IllegalArgumentException if offset is lower than 0, length is lower than 0 or
- * length is greater than source length.
+ * @throws IllegalArgumentException
+ * if offset is lower than 0, length is lower than 0 or length
+ * is greater than source length.
*/
- public abstract TextEdit format(int kind, String source, int offset, int length, int indentationLevel, String lineSeparator);
+ public abstract TextEdit format(int kind, String source, int offset,
+ int length, int indentationLevel, String lineSeparator);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/formatter/DefaultCodeFormatterConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/formatter/DefaultCodeFormatterConstants.java
index fcdd29c..6ab235d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/formatter/DefaultCodeFormatterConstants.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/formatter/DefaultCodeFormatterConstants.java
@@ -10,11 +10,9 @@
*******************************************************************************/
package net.sourceforge.phpdt.core.formatter;
-//import java.util.Map;
+// import java.util.Map;
import net.sourceforge.phpdt.core.JavaCore;
-//import net.sourceforge.phpdt.internal.formatter.DefaultCodeFormatterOptions;
-//import net.sourceforge.phpdt.internal.formatter.align.Alignment;
/**
* Constants used to set up the options of the code formatter.
@@ -30,2235 +28,2833 @@ public class DefaultCodeFormatterConstants {
/**
*
- * FORMATTER / Value to set a brace location at the end of a line.
+ * FORMATTER / Value to set a brace location at the end of a line.
*
- * FORMATTER / Value to set a brace location at the start of the next line with
- * the right indentation.
+ * FORMATTER / Value to set a brace location at the start of the next line with
+ * the right indentation.
*
- * FORMATTER / Value to set a brace location at the start of the next line with
- * an extra indentation.
+ * FORMATTER / Value to set a brace location at the start of the next line with
+ * an extra indentation.
*
- * FORMATTER / Value to set a brace location at the start of the next line if a wrapping
- * occured.
+ * FORMATTER / Value to set a brace location at the start of the next line if a wrapping
+ * occured.
*
- * FORMATTER / Value to set an option to true.
+ * FORMATTER / Value to set an option to true.
*
+ *
* @since 3.0
*/
- public static final String FALSE = "false"; //$NON-NLS-1$
+ public static final String FALSE = "false"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Value to set an option to false.
+ * FORMATTER / Value to set an option to false.
*
+ *
* @since 3.0
*/
public static final String TRUE = "true"; //$NON-NLS-1$
/**
*
- * FORMATTER / Value to disable alignment.
+ * FORMATTER / Value to disable alignment.
*
+ *
* @since 3.0
*/
- public static final int WRAP_NO_SPLIT= 0;
+ public static final int WRAP_NO_SPLIT = 0;
+
/**
*
- * FORMATTER / The wrapping is done using as few lines as possible.
+ * FORMATTER / The wrapping is done using as few lines as possible.
*
+ *
* @since 3.0
*/
- public static final int WRAP_COMPACT= 1;
+ public static final int WRAP_COMPACT = 1;
+
/**
*
- * FORMATTER / The wrapping is done putting the first element on a new
- * line and then wrapping next elements using as few lines as possible.
+ * FORMATTER / The wrapping is done putting the first element on a new
+ * line and then wrapping next elements using as few lines as possible.
*
+ *
* @since 3.0
*/
- public static final int WRAP_COMPACT_FIRST_BREAK= 2;
+ public static final int WRAP_COMPACT_FIRST_BREAK = 2;
+
/**
*
- * FORMATTER / The wrapping is done by putting each element on its own line.
+ * FORMATTER / The wrapping is done by putting each element on its own line.
*
+ *
* @since 3.0
*/
- public static final int WRAP_ONE_PER_LINE= 3;
+ public static final int WRAP_ONE_PER_LINE = 3;
+
/**
*
- * FORMATTER / The wrapping is done by putting each element on its own line.
- * All elements are indented by one except the first element.
+ * FORMATTER / The wrapping is done by putting each element on its own line.
+ * All elements are indented by one except the first element.
*
+ *
* @since 3.0
*/
- public static final int WRAP_NEXT_SHIFTED= 4;
+ public static final int WRAP_NEXT_SHIFTED = 4;
+
/**
*
- * FORMATTER / The wrapping is done by putting each element on its own line
- * except the first element.
+ * FORMATTER / The wrapping is done by putting each element on its own line
+ * except the first element.
*
+ *
* @since 3.0
*/
- public static final int WRAP_NEXT_PER_LINE= 5;
-
+ public static final int WRAP_NEXT_PER_LINE = 5;
+
/**
*
- * FORMATTER / The wrapping is done by using the current indentation.
+ * FORMATTER / The wrapping is done by using the current indentation.
*
+ *
* @since 3.0
*/
- public static final int INDENT_DEFAULT= 0;
+ public static final int INDENT_DEFAULT = 0;
+
/**
*
- * FORMATTER / The wrapping is done by indenting on column under the splitting location.
+ * FORMATTER / The wrapping is done by indenting on column under the splitting location.
*
+ *
* @since 3.0
*/
public static final int INDENT_ON_COLUMN = 1;
+
/**
*
- * FORMATTER / The wrapping is done by indenting by one compare to the current indentation.
+ * FORMATTER / The wrapping is done by indenting by one compare to the current indentation.
*
+ *
* @since 3.0
*/
- public static final int INDENT_BY_ONE= 2;
-
+ public static final int INDENT_BY_ONE = 2;
+
/**
*
- * FORMATTER / Option for alignment of arguments in allocation expression
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_arguments_in_allocation_expression"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of arguments in allocation expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_arguments_in_allocation_expression"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_arguments_in_allocation_expression"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_arguments_in_allocation_expression"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of arguments in explicit constructor call
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of arguments in explicit constructor call
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL = JavaCore.PLUGIN_ID + ".formatter.alignment_for_arguments_in_explicit_constructor_call"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_arguments_in_explicit_constructor_call"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of arguments in method invocation
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_arguments_in_method_invocation"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of arguments in method invocation
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_arguments_in_method_invocation"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_arguments_in_method_invocation"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_arguments_in_method_invocation"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of arguments in qualified allocation expression
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of arguments in qualified allocation expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_arguments_in_qualified_allocation_expression"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_arguments_in_qualified_allocation_expression"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of binary expression
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_binary_expression"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of binary expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_binary_expression"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_binary_expression"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_binary_expression"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of compact if
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_compact_if"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_BY_ONE)
+ * FORMATTER / Option for alignment of compact if
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_compact_if"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_BY_ONE)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_COMPACT_IF = JavaCore.PLUGIN_ID + ".formatter.alignment_for_compact_if"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_COMPACT_IF = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_compact_if"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of conditional expression
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_conditional_expression"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of conditional expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_conditional_expression"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_conditional_expression"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_conditional_expression"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of expressions in array initializer
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_expressions_in_array_initializer"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of expressions in array initializer
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_expressions_in_array_initializer"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.alignment_for_expressions_in_array_initializer"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_expressions_in_array_initializer"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of multiple fields
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_multiple_fields"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of multiple fields
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_multiple_fields"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS = JavaCore.PLUGIN_ID + ".formatter.alignment_for_multiple_fields";//$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_multiple_fields";//$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of parameters in constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_parameters_in_constructor_declaration"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of parameters in constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_parameters_in_constructor_declaration"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_parameters_in_constructor_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_parameters_in_constructor_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of parameters in method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_parameters_in_method_declaration"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of parameters in method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_parameters_in_method_declaration"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_parameters_in_method_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_parameters_in_method_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of selector in method invocation
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_selector_in_method_invocation"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of selector in method invocation
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_selector_in_method_invocation"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_selector_in_method_invocation"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_selector_in_method_invocation"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of superclass in type declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_superclass_in_type_declaration"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of superclass in type declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_superclass_in_type_declaration"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_superclass_in_type_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_superclass_in_type_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of superinterfaces in type declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_superinterfaces_in_type_declaration"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of superinterfaces in type declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_superinterfaces_in_type_declaration"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_superinterfaces_in_type_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_superinterfaces_in_type_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of throws clause in constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of throws clause in constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_throws_clause_in_constructor_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_throws_clause_in_constructor_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option for alignment of throws clause in method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option for alignment of throws clause in method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.alignment_for_throws_clause_in_method_declaration"; //$NON-NLS-1$
-
+ public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.alignment_for_throws_clause_in_method_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to align type members of a type declaration on column
- * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
- * - possible values: values returned by createAlignmentValue(boolean, int, int) call
- * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ * FORMATTER / Option to align type members of a type declaration on column
+ * - option id: "net.sourceforge.phpdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
+ * - possible values: values returned by
+ *
+ * createAlignmentValue(boolean, int, int)
+ *
+ * call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
*
+ *
* @see #createAlignmentValue(boolean, int, int)
* @since 3.0
*/
- public static final String FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS = JavaCore.PLUGIN_ID + ".formatter.align_type_members_on_columns"; //$NON-NLS-1$
-
+ public static final String FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS = JavaCore.PLUGIN_ID
+ + ".formatter.align_type_members_on_columns"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to position the braces of a anonymous type declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.brace_position_for_anonymous_type_declaration"
- * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
- * - default: END_OF_LINE
+ * FORMATTER / Option to position the braces of a anonymous type declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.brace_position_for_anonymous_type_declaration"
+ * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
+ * - default: END_OF_LINE
*
- * FORMATTER / Option to position the braces of a block in a case statement when the block is the first statement following
- * the case
- * - option id: "net.sourceforge.phpdt.core.formatter.brace_position_for_block_in_case"
- * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
- * - default: END_OF_LINE
+ * FORMATTER / Option to position the braces of a block in a case statement when the block is the first statement following
+ * the case
+ * - option id: "net.sourceforge.phpdt.core.formatter.brace_position_for_block_in_case"
+ * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
+ * - default: END_OF_LINE
*
- * FORMATTER / Option to set the continuation indentation
- * - option id: "net.sourceforge.phpdt.core.formatter.continuation_indentation"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "2"
+ * FORMATTER / Option to set the continuation indentation
+ * - option id: "net.sourceforge.phpdt.core.formatter.continuation_indentation"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "2"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_CONTINUATION_INDENTATION = JavaCore.PLUGIN_ID + ".formatter.continuation_indentation"; //$NON-NLS-1$
+ public static final String FORMATTER_CONTINUATION_INDENTATION = JavaCore.PLUGIN_ID
+ + ".formatter.continuation_indentation"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to set the continuation indentation inside array initializer
- * - option id: "net.sourceforge.phpdt.core.formatter.continuation_indentation_for_array_initializer"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "2"
+ * FORMATTER / Option to set the continuation indentation inside array initializer
+ * - option id: "net.sourceforge.phpdt.core.formatter.continuation_indentation_for_array_initializer"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "2"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.continuation_indentation_for_array_initializer"; //$NON-NLS-1$
+ public static final String FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID
+ + ".formatter.continuation_indentation_for_array_initializer"; //$NON-NLS-1$
/**
*
- * FORMATTER / Option to add blank lines after the imports declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_after_imports"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines after the imports declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_after_imports"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_AFTER_IMPORTS = JavaCore.PLUGIN_ID + ".formatter.blank_lines_after_imports"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_AFTER_IMPORTS = JavaCore.PLUGIN_ID
+ + ".formatter.blank_lines_after_imports"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to add blank lines after the package declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_after_package"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines after the package declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_after_package"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_AFTER_PACKAGE = JavaCore.PLUGIN_ID + ".formatter.blank_lines_after_package"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_AFTER_PACKAGE = JavaCore.PLUGIN_ID
+ + ".formatter.blank_lines_after_package"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to add blank lines before a field declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_field"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines before a field declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_field"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_BEFORE_FIELD = JavaCore.PLUGIN_ID + ".formatter.blank_lines_before_field"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_BEFORE_FIELD = JavaCore.PLUGIN_ID
+ + ".formatter.blank_lines_before_field"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to add blank lines before the first class body declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_first_class_body_declaration"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines before the first class body declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_first_class_body_declaration"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.blank_lines_before_first_class_body_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.blank_lines_before_first_class_body_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to add blank lines before the imports declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_imports"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines before the imports declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_imports"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_BEFORE_IMPORTS = JavaCore.PLUGIN_ID + ".formatter.blank_lines_before_imports"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_BEFORE_IMPORTS = JavaCore.PLUGIN_ID
+ + ".formatter.blank_lines_before_imports"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to add blank lines before a member type declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_member_type"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines before a member type declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_member_type"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE = JavaCore.PLUGIN_ID + ".formatter.blank_lines_before_member_type"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE = JavaCore.PLUGIN_ID
+ + ".formatter.blank_lines_before_member_type"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to add blank lines before a method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_method"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines before a method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_method"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_BEFORE_METHOD = JavaCore.PLUGIN_ID + ".formatter.blank_lines_before_method"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_BEFORE_METHOD = JavaCore.PLUGIN_ID
+ + ".formatter.blank_lines_before_method"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to add blank lines before a new chunk
- * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_new_chunk"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines before a new chunk
+ * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_new_chunk"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK = JavaCore.PLUGIN_ID + ".formatter.blank_lines_before_new_chunk"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK = JavaCore.PLUGIN_ID
+ + ".formatter.blank_lines_before_new_chunk"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to add blank lines before the package declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_package"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines before the package declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_before_package"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_BEFORE_PACKAGE = JavaCore.PLUGIN_ID + ".formatter.blank_lines_before_package"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_BEFORE_PACKAGE = JavaCore.PLUGIN_ID
+ + ".formatter.blank_lines_before_package"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to add blank lines between type declarations
- * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_between_type_declarations"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines between type declarations
+ * - option id: "net.sourceforge.phpdt.core.formatter.blank_lines_between_type_declarations"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS = JavaCore.PLUGIN_ID + ".formatter.blank_lines_between_type_declarations"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS = JavaCore.PLUGIN_ID
+ + ".formatter.blank_lines_between_type_declarations"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to add blank lines at the beginning of the method body
- * - option id: "net.sourceforge.phpdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to add blank lines at the beginning of the method body
+ * - option id: "net.sourceforge.phpdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY = JavaCore.PLUGIN_ID + ".formatter.number_of_blank_lines_at_beginning_of_method_body"; //$NON-NLS-1$
+ public static final String FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY = JavaCore.PLUGIN_ID
+ + ".formatter.number_of_blank_lines_at_beginning_of_method_body"; //$NON-NLS-1$
/**
*
- * FORMATTER / Option to indent body declarations compare to its enclosing type header
- * - option id: "net.sourceforge.phpdt.core.formatter.indent_body_declarations_compare_to_type_header"
- * - possible values: { TRUE, FALSE }
- * - default: TRUE
+ * FORMATTER / Option to indent body declarations compare to its enclosing type header
+ * - option id: "net.sourceforge.phpdt.core.formatter.indent_body_declarations_compare_to_type_header"
+ * - possible values: { TRUE, FALSE }
+ * - default: TRUE
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER = JavaCore.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_type_header"; //$NON-NLS-1$
+ public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER = JavaCore.PLUGIN_ID
+ + ".formatter.indent_body_declarations_compare_to_type_header"; //$NON-NLS-1$
+
/**
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK = JavaCore.PLUGIN_ID + ".formatter.indent_statements_compare_to_block"; //$NON-NLS-1$
+ public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK = JavaCore.PLUGIN_ID
+ + ".formatter.indent_statements_compare_to_block"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to indent statements inside the body of a method or a constructor
- * - option id: "net.sourceforge.phpdt.core.formatter.indent_statements_compare_to_body"
- * - possible values: { TRUE, FALSE }
- * - default: TRUE
+ * FORMATTER / Option to indent statements inside the body of a method or a constructor
+ * - option id: "net.sourceforge.phpdt.core.formatter.indent_statements_compare_to_body"
+ * - possible values: { TRUE, FALSE }
+ * - default: TRUE
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY = JavaCore.PLUGIN_ID + ".formatter.indent_statements_compare_to_body"; //$NON-NLS-1$
+ public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY = JavaCore.PLUGIN_ID
+ + ".formatter.indent_statements_compare_to_body"; //$NON-NLS-1$
+
/**
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH = JavaCore.PLUGIN_ID + ".formatter.indent_switchstatements_compare_to_switch"; //$NON-NLS-1$
+ public static final String FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH = JavaCore.PLUGIN_ID
+ + ".formatter.indent_switchstatements_compare_to_switch"; //$NON-NLS-1$
/**
*
- * FORMATTER / Option to insert a new line after the opening brace in an array initializer
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a new line after the opening brace in an array initializer
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_after_opening_brace_in_array_initializer";//$NON-NLS-1$
+ public static final String FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID
+ + ".formatter.insert_new_line_after_opening_brace_in_array_initializer";//$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a new line before the catch keyword in try statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_before_catch_in_try_statement"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a new line before the catch keyword in try statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_before_catch_in_try_statement"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_before_catch_in_try_statement"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT = JavaCore.PLUGIN_ID
+ + ".formatter.insert_new_line_before_catch_in_try_statement"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a new line before the closing brace in an array initializer
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a new line before the closing brace in an array initializer
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_before_closing_brace_in_array_initializer";//$NON-NLS-1$
+ public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID
+ + ".formatter.insert_new_line_before_closing_brace_in_array_initializer";//$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a new line before the else keyword in if statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_before_else_in_if_statement"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a new line before the else keyword in if statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_before_else_in_if_statement"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_before_else_in_if_statement"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT = JavaCore.PLUGIN_ID
+ + ".formatter.insert_new_line_before_else_in_if_statement"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a new line before the finally keyword in try statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_before_finally_in_try_statement"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a new line before the finally keyword in try statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_before_finally_in_try_statement"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_before_finally_in_try_statement"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT = JavaCore.PLUGIN_ID
+ + ".formatter.insert_new_line_before_finally_in_try_statement"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a new line before while in do statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_before_while_in_do_statement"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a new line before while in do statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_before_while_in_do_statement"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_before_while_in_do_statement"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT = JavaCore.PLUGIN_ID
+ + ".formatter.insert_new_line_before_while_in_do_statement"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a new line in an empty anonymous type declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a new line in an empty anonymous type declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANONYMOUS_TYPE_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_in_empty_anonymous_type_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANONYMOUS_TYPE_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_new_line_in_empty_anonymous_type_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a new line in an empty block
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_in_empty_block"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a new line in an empty block
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_in_empty_block"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_in_empty_block"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK = JavaCore.PLUGIN_ID
+ + ".formatter.insert_new_line_in_empty_block"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a new line in an empty method body
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_in_empty_method_body"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a new line in an empty method body
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_in_empty_method_body"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_in_empty_method_body"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY = JavaCore.PLUGIN_ID
+ + ".formatter.insert_new_line_in_empty_method_body"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a new line in an empty type declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_in_empty_type_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a new line in an empty type declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_new_line_in_empty_type_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_in_empty_type_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_new_line_in_empty_type_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after an assignment operator
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_assignment_operator"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after an assignment operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_assignment_operator"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_assignment_operator"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_assignment_operator"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after a binary operator
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_binary_operator"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after a binary operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_binary_operator"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_binary_operator"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_binary_operator"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the closing parenthesis of a cast expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_closing_paren_in_cast"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the closing parenthesis of a cast expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_closing_paren_in_cast"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_closing_paren_in_cast"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_closing_paren_in_cast"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the closing brace of a block
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_closing_brace_in_block"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the closing brace of a block
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_closing_brace_in_block"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_closing_brace_in_block"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_closing_brace_in_block"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the colon in an assert statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_colon_in_assert"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the colon in an assert statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_colon_in_assert"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_ASSERT = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_colon_in_assert"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_ASSERT = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_colon_in_assert"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after colon in a case statement when a opening brace follows the colon
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_colon_in_case"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after colon in a case statement when a opening brace follows the colon
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_colon_in_case"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_colon_in_case"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_colon_in_case"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the colon in a conditional expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_colon_in_conditional"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the colon in a conditional expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_colon_in_conditional"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_colon_in_conditional"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_colon_in_conditional"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the colon in a labeled statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_colon_in_labeled_statement"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the colon in a labeled statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_colon_in_labeled_statement"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_colon_in_labeled_statement"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_colon_in_labeled_statement"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in an allocation expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_allocation_expression"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in an allocation expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_allocation_expression"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_allocation_expression"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_allocation_expression"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in an array initializer
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in an array initializer
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_array_initializer"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_array_initializer"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_array_initializer"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in the parameters of a constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in the parameters of a constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_constructor_declaration_parameters"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_constructor_declaration_parameters"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_constructor_declaration_throws"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_constructor_declaration_throws"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in the arguments of an explicit constructor call
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in the arguments of an explicit constructor call
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in the increments of a for statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_for_increments"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in the increments of a for statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_for_increments"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_for_increments"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_for_increments"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in the initializations of a for statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_for_inits"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in the initializations of a for statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_for_inits"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_for_inits"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_for_inits"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in the arguments of a method invocation
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in the arguments of a method invocation
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_invocation_arguments"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_method_invocation_arguments"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in the parameters of a method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in the parameters of a method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_parameters"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_method_declaration_parameters"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_method_declaration_throws"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_method_declaration_throws"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_throws"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_method_declaration_throws"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in multiple field declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in multiple field declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_multiple_field_declarations"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_multiple_field_declarations"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in multiple local declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in multiple local declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_multiple_local_declarations"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_multiple_local_declarations"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the comma in superinterfaces names of a type header
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_superinterfaces"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after the comma in superinterfaces names of a type header
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_comma_in_superinterfaces"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_comma_in_superinterfaces"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_comma_in_superinterfaces"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening bracket inside an array allocation expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening bracket inside an array allocation expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_bracket_in_array_allocation_expression";//$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_bracket_in_array_allocation_expression";//$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening bracket inside an array reference
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_bracket_in_array_reference"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening bracket inside an array reference
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_bracket_in_array_reference"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_bracket_in_array_reference";//$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_bracket_in_array_reference";//$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening brace in an array initializer
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_brace_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening brace in an array initializer
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_brace_in_array_initializer"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_brace_in_array_initializer"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_brace_in_array_initializer"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in a cast expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_cast"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in a cast expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_cast"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_cast"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_cast"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in a catch
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_catch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in a catch
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_catch"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_catch"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_catch"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in a constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in a constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_constructor_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_constructor_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in a for statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_for"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in a for statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_for"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_for"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_for"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in an if statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_if"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in an if statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_if"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_if"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_if"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in a method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_method_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in a method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_method_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_method_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_method_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in a method invocation
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_method_invocation"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in a method invocation
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_method_invocation"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_method_invocation"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_method_invocation"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in a parenthesized expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in a parenthesized expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in a switch statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_switch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in a switch statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_switch"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_switch"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_switch"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in a synchronized statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_synchronized"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in a synchronized statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_synchronized"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SYNCHRONIZED = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_synchronized"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SYNCHRONIZED = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_synchronized"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after the opening parenthesis in a while statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_while"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after the opening parenthesis in a while statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_opening_paren_in_while"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_while"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_opening_paren_in_while"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after a postfix operator
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_postfix_operator"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after a postfix operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_postfix_operator"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_postfix_operator"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_postfix_operator"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after a prefix operator
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_prefix_operator"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after a prefix operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_prefix_operator"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_prefix_operator"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_prefix_operator"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after question mark in a conditional expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_question_in_conditional"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after question mark in a conditional expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_question_in_conditional"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_question_in_conditional"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_question_in_conditional"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after semicolon in a for statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_semicolon_in_for"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space after semicolon in a for statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_semicolon_in_for"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_semicolon_in_for"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_semicolon_in_for"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space after an unary operator
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_unary_operator"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space after an unary operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_after_unary_operator"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_unary_operator"; //$NON-NLS-1$
-
+ public static final String FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_after_unary_operator"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before an assignment operator
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_assignment_operator"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before an assignment operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_assignment_operator"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_assignment_operator"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_assignment_operator"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before an binary operator
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_binary_operator"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before an binary operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_binary_operator"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_binary_operator"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_binary_operator"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing brace in an array initializer
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_brace_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing brace in an array initializer
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_brace_in_array_initializer"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_brace_in_array_initializer"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_brace_in_array_initializer"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing bracket in an array allocation expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing bracket in an array allocation expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_bracket_in_array_allocation_expression";//$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_bracket_in_array_allocation_expression";//$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing bracket in an array reference
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_bracket_in_array_reference"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing bracket in an array reference
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_bracket_in_array_reference"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_bracket_in_array_reference";//$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_bracket_in_array_reference";//$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in a cast expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_cast"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in a cast expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_cast"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_cast"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_cast"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in a catch
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_catch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in a catch
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_catch"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_catch"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_catch"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in a constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in a constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_constructor_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_constructor_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in a for statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_for"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in a for statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_for"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_for"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_for"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in an if statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_if"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in an if statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_if"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_if"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_if"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in a method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_method_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in a method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_method_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_method_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_method_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in a method invocation
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_method_invocation"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in a method invocation
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_method_invocation"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_method_invocation"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_method_invocation"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in a parenthesized expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in a parenthesized expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_parenthesized_expression"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_parenthesized_expression"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in a switch statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_switch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in a switch statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_switch"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_switch"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_switch"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in a synchronized statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_synchronized"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in a synchronized statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_synchronized"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SYNCHRONIZED = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_synchronized"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SYNCHRONIZED = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_synchronized"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the closing parenthesis in a while statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_while"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the closing parenthesis in a while statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_closing_paren_in_while"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_while"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_closing_paren_in_while"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before colon in an assert statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_colon_in_assert"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before colon in an assert statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_colon_in_assert"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_ASSERT = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_colon_in_assert"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_ASSERT = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_colon_in_assert"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before colon in a case statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_colon_in_case"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before colon in a case statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_colon_in_case"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_colon_in_case"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_colon_in_case"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before colon in a conditional expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_colon_in_conditional"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before colon in a conditional expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_colon_in_conditional"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_colon_in_conditional"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_colon_in_conditional"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before colon in a default statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_colon_in_default"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before colon in a default statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_colon_in_default"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_colon_in_default"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_colon_in_default"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before colon in a labeled statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_colon_in_labeled_statement"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before colon in a labeled statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_colon_in_labeled_statement"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_colon_in_labeled_statement"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_colon_in_labeled_statement"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in an allocation expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_allocation_expression"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in an allocation expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_allocation_expression"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_allocation_expression"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_allocation_expression"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in an array initializer
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in an array initializer
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_array_initializer"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_array_initializer"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_array_initializer"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in the parameters of a constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in the parameters of a constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_constructor_declaration_parameters"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_constructor_declaration_parameters"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_constructor_declaration_throws"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_constructor_declaration_throws"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in the arguments of an explicit constructor call
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in the arguments of an explicit constructor call
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in the increments of a for statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_for_increments"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in the increments of a for statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_for_increments"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_for_increments"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_for_increments"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in the initializations of a for statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_for_inits"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in the initializations of a for statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_for_inits"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_for_inits"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_for_inits"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in the arguments of a method invocation
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in the arguments of a method invocation
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_invocation_arguments"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_method_invocation_arguments"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in the parameters of a method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in the parameters of a method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_parameters"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_method_declaration_parameters"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_method_declaration_throws"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_method_declaration_throws"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_throws"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_method_declaration_throws"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in a multiple field declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in a multiple field declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_multiple_field_declarations"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_multiple_field_declarations"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in a multiple local declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in a multiple local declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_multiple_local_declarations"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_multiple_local_declarations"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before comma in the superinterfaces names in a type header
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_superinterfaces"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before comma in the superinterfaces names in a type header
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_comma_in_superinterfaces"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_comma_in_superinterfaces"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_comma_in_superinterfaces"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening brace in an anonymous type declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening brace in an anonymous type declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANONYMOUS_TYPE_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANONYMOUS_TYPE_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening brace in an array initializer
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the opening brace in an array initializer
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_array_initializer"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_array_initializer"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_brace_in_array_initializer"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening brace in a block
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_block"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening brace in a block
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_block"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_block"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_brace_in_block"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening brace in a constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening brace in a constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_constructor_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_brace_in_constructor_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening brace in a method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_method_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening brace in a method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_method_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_method_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_brace_in_method_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening brace in a switch statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_switch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening brace in a switch statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_switch"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_switch"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_brace_in_switch"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening brace in a type declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_type_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening brace in a type declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_brace_in_type_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_type_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_brace_in_type_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening bracket in an array allocation expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the opening bracket in an array allocation expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_allocation_expression";//$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_bracket_in_array_allocation_expression";//$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening bracket in an array reference
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_bracket_in_array_reference"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the opening bracket in an array reference
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_bracket_in_array_reference"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_reference";//$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_bracket_in_array_reference";//$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening bracket in an array type reference
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the opening bracket in an array type reference
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_type_reference"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_bracket_in_array_type_reference"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening parenthesis in a catch
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_catch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening parenthesis in a catch
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_catch"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_catch"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_paren_in_catch"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening parenthesis in a constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the opening parenthesis in a constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_constructor_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_paren_in_constructor_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening parenthesis in a for statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_for"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening parenthesis in a for statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_for"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_for"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_paren_in_for"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening parenthesis in an if statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_if"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening parenthesis in an if statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_if"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_if"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_paren_in_if"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening parenthesis in a method invocation
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_method_invocation"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the opening parenthesis in a method invocation
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_method_invocation"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_method_invocation"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_paren_in_method_invocation"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening parenthesis in a method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_method_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the opening parenthesis in a method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_method_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_method_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_paren_in_method_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening parenthesis in a switch statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_switch"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening parenthesis in a switch statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_switch"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_switch"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_paren_in_switch"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening parenthesis in a synchronized statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_synchronized"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening parenthesis in a synchronized statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_synchronized"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SYNCHRONIZED = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_synchronized"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SYNCHRONIZED = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_paren_in_synchronized"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening parenthesis in a parenthesized expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before the opening parenthesis in a parenthesized expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before the opening parenthesis in a while statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_while"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before the opening parenthesis in a while statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_opening_paren_in_while"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_while"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_opening_paren_in_while"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before a postfix operator
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_postfix_operator"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before a postfix operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_postfix_operator"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_postfix_operator"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_postfix_operator"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before a prefix operator
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_prefix_operator"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before a prefix operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_prefix_operator"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_prefix_operator"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_prefix_operator"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before question mark in a conditional expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_question_in_conditional"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: INSERT
+ * FORMATTER / Option to insert a space before question mark in a conditional expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_question_in_conditional"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_question_in_conditional"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_question_in_conditional"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before semicolon
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_semicolon"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before semicolon
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_semicolon"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_semicolon"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_semicolon"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before semicolon in for statement
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_semicolon_in_for"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before semicolon in for statement
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_semicolon_in_for"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_semicolon_in_for"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_semicolon_in_for"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space before unary operator
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_unary_operator"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space before unary operator
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_before_unary_operator"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_unary_operator"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_before_unary_operator"; //$NON-NLS-1$
/**
*
- * FORMATTER / Option to insert a space between brackets in an array type reference
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_brackets_in_array_type_reference"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space between brackets in an array type reference
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_brackets_in_array_type_reference"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE = JavaCore.PLUGIN_ID + ".formatter.insert_space_between_brackets_in_array_type_reference"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_between_brackets_in_array_type_reference"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space between empty braces in an array initializer
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_empty_braces_in_array_initializer"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space between empty braces in an array initializer
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_empty_braces_in_array_initializer"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.insert_space_between_empty_braces_in_array_initializer"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_between_empty_braces_in_array_initializer"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space between empty brackets in an array allocation expression
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space between empty brackets in an array allocation expression
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID + ".formatter.insert_space_between_empty_brackets_in_array_allocation_expression"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_between_empty_brackets_in_array_allocation_expression"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space between empty parenthesis in a constructor declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space between empty parenthesis in a constructor declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_constructor_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_between_empty_parens_in_constructor_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space between empty parenthesis in a method declaration
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_empty_parens_in_method_declaration"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space between empty parenthesis in a method declaration
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_empty_parens_in_method_declaration"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_method_declaration"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_between_empty_parens_in_method_declaration"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to insert a space between empty parenthesis in a method invocation
- * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_empty_parens_in_method_invocation"
- * - possible values: { INSERT, DO_NOT_INSERT }
- * - default: DO_NOT_INSERT
+ * FORMATTER / Option to insert a space between empty parenthesis in a method invocation
+ * - option id: "net.sourceforge.phpdt.core.formatter.insert_space_between_empty_parens_in_method_invocation"
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
*
+ *
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
* @since 3.0
*/
- public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_method_invocation"; //$NON-NLS-1$
+ public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION = JavaCore.PLUGIN_ID
+ + ".formatter.insert_space_between_empty_parens_in_method_invocation"; //$NON-NLS-1$
/**
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_COMPACT_ELSE_IF = JavaCore.PLUGIN_ID + ".formatter.compact_else_if"; //$NON-NLS-1$
+ public static final String FORMATTER_COMPACT_ELSE_IF = JavaCore.PLUGIN_ID
+ + ".formatter.compact_else_if"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to keep guardian clause on one line
- * - option id: "net.sourceforge.phpdt.core.formatter.format_guardian_clause_on_one_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
+ * FORMATTER / Option to keep guardian clause on one line
+ * - option id: "net.sourceforge.phpdt.core.formatter.format_guardian_clause_on_one_line"
+ * - possible values: { TRUE, FALSE }
+ * - default: FALSE
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE = JavaCore.PLUGIN_ID + ".formatter.format_guardian_clause_on_one_line"; //$NON-NLS-1$
+ public static final String FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE = JavaCore.PLUGIN_ID
+ + ".formatter.format_guardian_clause_on_one_line"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to keep else statement on the same line
- * - option id: "net.sourceforge.phpdt.core.formatter.keep_else_statement_on_same_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
+ * FORMATTER / Option to keep else statement on the same line
+ * - option id: "net.sourceforge.phpdt.core.formatter.keep_else_statement_on_same_line"
+ * - possible values: { TRUE, FALSE }
+ * - default: FALSE
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE = JavaCore.PLUGIN_ID + ".formatter.keep_else_statement_on_same_line"; //$NON-NLS-1$
+ public static final String FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE = JavaCore.PLUGIN_ID
+ + ".formatter.keep_else_statement_on_same_line"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to keep empty array initializer one one line
- * - option id: "net.sourceforge.phpdt.core.formatter.keep_empty_array_initializer_on_one_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
+ * FORMATTER / Option to keep empty array initializer one one line
+ * - option id: "net.sourceforge.phpdt.core.formatter.keep_empty_array_initializer_on_one_line"
+ * - possible values: { TRUE, FALSE }
+ * - default: FALSE
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE = JavaCore.PLUGIN_ID + ".formatter.keep_empty_array_initializer_on_one_line"; //$NON-NLS-1$
+ public static final String FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE = JavaCore.PLUGIN_ID
+ + ".formatter.keep_empty_array_initializer_on_one_line"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to keep simple if statement on the one line
- * - option id: "net.sourceforge.phpdt.core.formatter.keep_imple_if_on_one_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
+ * FORMATTER / Option to keep simple if statement on the one line
+ * - option id: "net.sourceforge.phpdt.core.formatter.keep_imple_if_on_one_line"
+ * - possible values: { TRUE, FALSE }
+ * - default: FALSE
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE = JavaCore.PLUGIN_ID + ".formatter.keep_imple_if_on_one_line"; //$NON-NLS-1$
+ public static final String FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE = JavaCore.PLUGIN_ID
+ + ".formatter.keep_imple_if_on_one_line"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to keep then statement on the same line
- * - option id: "net.sourceforge.phpdt.core.formatter.keep_then_statement_on_same_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
+ * FORMATTER / Option to keep then statement on the same line
+ * - option id: "net.sourceforge.phpdt.core.formatter.keep_then_statement_on_same_line"
+ * - possible values: { TRUE, FALSE }
+ * - default: FALSE
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE = JavaCore.PLUGIN_ID + ".formatter.keep_then_statement_on_same_line";//$NON-NLS-1$
+ public static final String FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE = JavaCore.PLUGIN_ID
+ + ".formatter.keep_then_statement_on_same_line";//$NON-NLS-1$
/**
*
- * FORMATTER / Option to specify the number of empty lines to preserve
- * - option id: "net.sourceforge.phpdt.core.formatter.number_of_empty_lines_to_preserve"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "0"
+ * FORMATTER / Option to specify the number of empty lines to preserve
+ * - option id: "net.sourceforge.phpdt.core.formatter.number_of_empty_lines_to_preserve"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "0"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE = JavaCore.PLUGIN_ID + ".formatter.number_of_empty_lines_to_preserve"; //$NON-NLS-1$
+ public static final String FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE = JavaCore.PLUGIN_ID
+ + ".formatter.number_of_empty_lines_to_preserve"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to specify whether or not empty statement should be on a new line
- * - option id: "net.sourceforge.phpdt.core.formatter.put_empty_statement_on_new_line"
- * - possible values: { TRUE, FALSE }
- * - default: FALSE
+ * FORMATTER / Option to specify whether or not empty statement should be on a new line
+ * - option id: "net.sourceforge.phpdt.core.formatter.put_empty_statement_on_new_line"
+ * - possible values: { TRUE, FALSE }
+ * - default: FALSE
*
+ *
* @see #TRUE
* @see #FALSE
* @since 3.0
*/
- public static final String FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE = JavaCore.PLUGIN_ID + ".formatter.put_empty_statement_on_new_line"; //$NON-NLS-1$
+ public static final String FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE = JavaCore.PLUGIN_ID
+ + ".formatter.put_empty_statement_on_new_line"; //$NON-NLS-1$
/**
*
- * FORMATTER / Option to specify the length of the page. Beyond this length, the formatter will try to split the code
- * - option id: "net.sourceforge.phpdt.core.formatter.lineSplit"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "80"
+ * FORMATTER / Option to specify the length of the page. Beyond this length, the formatter will try to split the code
+ * - option id: "net.sourceforge.phpdt.core.formatter.lineSplit"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "80"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_LINE_SPLIT = JavaCore.PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$
+ public static final String FORMATTER_LINE_SPLIT = JavaCore.PLUGIN_ID
+ + ".formatter.lineSplit"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to specify the tabulation size
- * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.size"
- * - possible values: { TAB, SPACE }
- * - default: TAB
+ * FORMATTER / Option to specify the tabulation size
+ * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.size"
+ * - possible values: { TAB, SPACE }
+ * - default: TAB
*
+ *
* @see JavaCore#TAB
* @see JavaCore#SPACE
* @since 3.0
*/
- public static final String FORMATTER_TAB_CHAR = JavaCore.PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$
+ public static final String FORMATTER_TAB_CHAR = JavaCore.PLUGIN_ID
+ + ".formatter.tabulation.char"; //$NON-NLS-1$
+
/**
*
- * FORMATTER / Option to specify the tabulation size
- * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.size"
- * - possible values: "<n>", where n is zero or a positive integer
- * - default: "4"
+ * FORMATTER / Option to specify the tabulation size
+ * - option id: "net.sourceforge.phpdt.core.formatter.tabulation.size"
+ * - possible values: "<n>", where n is zero or a positive integer
+ * - default: "4"
*
+ *
* @since 3.0
*/
- public static final String FORMATTER_TAB_SIZE = JavaCore.PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$
+ public static final String FORMATTER_TAB_SIZE = JavaCore.PLUGIN_ID
+ + ".formatter.tabulation.size"; //$NON-NLS-1$
/**
- * Returns the formatter settings that most closely approximate
- * the default formatter settings of Eclipse version 2.1.
+ * Returns the formatter settings that most closely approximate the default
+ * formatter settings of Eclipse version 2.1.
*
* @return the Eclipse 2.1 settings
* @since 3.0
*/
-// public static Map getEclipse21Settings() {
-// return DefaultCodeFormatterOptions.getDefaultSettings().getMap();
-// }
-
+ // public static Map getEclipse21Settings() {
+ // return DefaultCodeFormatterOptions.getDefaultSettings().getMap();
+ // }
/**
* Returns the settings according to the Java conventions.
*
* @return the settings according to the Java conventions
* @since 3.0
*/
-// public static Map getJavaConventionsSettings() {
-// return DefaultCodeFormatterOptions.getJavaConventionsSettings().getMap();
-// }
-
+ // public static Map getJavaConventionsSettings() {
+ // return DefaultCodeFormatterOptions.getJavaConventionsSettings().getMap();
+ // }
/**
- *
Return the force value of the given alignment value.
- * The given alignment value should be created using the createAlignmentValue(boolean, int, int)
- * API.
+ *
+ * Return the force value of the given alignment value. The given alignment
+ * value should be created using the
+ * createAlignmentValue(boolean, int, int) API.
*
- *
- * @param value the given alignment value
+ *
+ * @param value
+ * the given alignment value
* @return the force value of the given alignment value
* @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, or if it
- * doesn't have a valid format.
- */
-// public static boolean getForceWrapping(String value) {
-// if (value == null) {
-// throw WRONG_ARGUMENT;
-// }
-// try {
-// int existingValue = Integer.parseInt(value);
-// return (existingValue & Alignment.M_FORCE) != 0;
-// } catch (NumberFormatException e) {
-// throw WRONG_ARGUMENT;
-// }
-// }
-
- /**
- *
Return the indentation style of the given alignment value.
- * The given alignment value should be created using the createAlignmentValue(boolean, int, int)
- * API.
+ * @exception IllegalArgumentException
+ * if the given alignment value is null, or if it doesn't
+ * have a valid format.
+ */
+ // public static boolean getForceWrapping(String value) {
+ // if (value == null) {
+ // throw WRONG_ARGUMENT;
+ // }
+ // try {
+ // int existingValue = Integer.parseInt(value);
+ // return (existingValue & Alignment.M_FORCE) != 0;
+ // } catch (NumberFormatException e) {
+ // throw WRONG_ARGUMENT;
+ // }
+ // }
+ /**
+ *
+ * Return the indentation style of the given alignment value. The given
+ * alignment value should be created using the
+ * createAlignmentValue(boolean, int, int) API.
*
- *
- * @param value the given alignment value
+ *
+ * @param value
+ * the given alignment value
* @return the indentation style of the given alignment value
* @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, or if it
- * doesn't have a valid format.
+ * @exception IllegalArgumentException
+ * if the given alignment value is null, or if it doesn't
+ * have a valid format.
*/
public static int getIndentStyle(String value) {
if (value == null) {
@@ -2266,136 +2862,151 @@ public class DefaultCodeFormatterConstants {
}
try {
int existingValue = Integer.parseInt(value);
-// if ((existingValue & Alignment.M_INDENT_BY_ONE) != 0) {
-// return INDENT_BY_ONE;
-// } else if ((existingValue & Alignment.M_INDENT_ON_COLUMN) != 0) {
-// return INDENT_ON_COLUMN;
-// } else {
- return INDENT_DEFAULT;
-// }
+ // if ((existingValue & Alignment.M_INDENT_BY_ONE) != 0) {
+ // return INDENT_BY_ONE;
+ // } else if ((existingValue & Alignment.M_INDENT_ON_COLUMN) != 0) {
+ // return INDENT_ON_COLUMN;
+ // } else {
+ return INDENT_DEFAULT;
+ // }
} catch (NumberFormatException e) {
throw WRONG_ARGUMENT;
}
}
/**
- *
Return the wrapping style of the given alignment value.
- * The given alignment value should be created using the createAlignmentValue(boolean, int, int)
- * API.
+ *
+ * Return the wrapping style of the given alignment value. The given
+ * alignment value should be created using the
+ * createAlignmentValue(boolean, int, int) API.
*
- *
- * @param value the given alignment value
+ *
+ * @param value
+ * the given alignment value
* @return the wrapping style of the given alignment value
* @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, or if it
- * doesn't have a valid format.
- */
-// public static int getWrappingStyle(String value) {
-// if (value == null) {
-// throw WRONG_ARGUMENT;
-// }
-// try {
-// int existingValue = Integer.parseInt(value) & Alignment.SPLIT_MASK;
-// switch(existingValue) {
-// case Alignment.M_COMPACT_SPLIT :
-// return WRAP_COMPACT;
-// case Alignment.M_COMPACT_FIRST_BREAK_SPLIT :
-// return WRAP_COMPACT_FIRST_BREAK;
-// case Alignment.M_NEXT_PER_LINE_SPLIT :
-// return WRAP_NEXT_PER_LINE;
-// case Alignment.M_NEXT_SHIFTED_SPLIT :
-// return WRAP_NEXT_SHIFTED;
-// case Alignment.M_ONE_PER_LINE_SPLIT :
-// return WRAP_ONE_PER_LINE;
-// default:
-// return WRAP_NO_SPLIT;
-// }
-// } catch (NumberFormatException e) {
-// throw WRONG_ARGUMENT;
-// }
-// }
-
- /**
- *
Set the indentation style of the given alignment value and return the new value.
- * The given value should be created using the createAlignmentValue(boolean, int, int)
- * API.
+ * @exception IllegalArgumentException
+ * if the given alignment value is null, or if it doesn't
+ * have a valid format.
+ */
+ // public static int getWrappingStyle(String value) {
+ // if (value == null) {
+ // throw WRONG_ARGUMENT;
+ // }
+ // try {
+ // int existingValue = Integer.parseInt(value) & Alignment.SPLIT_MASK;
+ // switch(existingValue) {
+ // case Alignment.M_COMPACT_SPLIT :
+ // return WRAP_COMPACT;
+ // case Alignment.M_COMPACT_FIRST_BREAK_SPLIT :
+ // return WRAP_COMPACT_FIRST_BREAK;
+ // case Alignment.M_NEXT_PER_LINE_SPLIT :
+ // return WRAP_NEXT_PER_LINE;
+ // case Alignment.M_NEXT_SHIFTED_SPLIT :
+ // return WRAP_NEXT_SHIFTED;
+ // case Alignment.M_ONE_PER_LINE_SPLIT :
+ // return WRAP_ONE_PER_LINE;
+ // default:
+ // return WRAP_NO_SPLIT;
+ // }
+ // } catch (NumberFormatException e) {
+ // throw WRONG_ARGUMENT;
+ // }
+ // }
+ /**
+ *
+ * Set the indentation style of the given alignment value and return the new
+ * value. The given value should be created using the
+ * createAlignmentValue(boolean, int, int) API.
*
- *
- * @param value the given alignment value
- * @param indentStyle the given indentation style
+ *
+ * @param value
+ * the given alignment value
+ * @param indentStyle
+ * the given indentation style
* @return the new alignment value
* @see #INDENT_BY_ONE
* @see #INDENT_DEFAULT
* @see #INDENT_ON_COLUMN
* @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, if the given
- * indentation style is not one of the possible indentation styles, or if the given
- * alignment value doesn't have a valid format.
- */
-// public static String setIndentStyle(String value, int indentStyle) {
-// if (value == null) {
-// throw WRONG_ARGUMENT;
-// }
-// switch(indentStyle) {
-// case INDENT_BY_ONE :
-// case INDENT_DEFAULT :
-// case INDENT_ON_COLUMN :
-// break;
-// default :
-// throw WRONG_ARGUMENT;
-// }
-// try {
-// int existingValue = Integer.parseInt(value);
-// // clear existing indent bits
-// existingValue &= ~(Alignment.M_INDENT_BY_ONE | Alignment.M_INDENT_ON_COLUMN);
-// switch(indentStyle) {
-// case INDENT_BY_ONE :
-// existingValue |= Alignment.M_INDENT_BY_ONE;
-// break;
-// case INDENT_ON_COLUMN :
-// existingValue |= Alignment.M_INDENT_ON_COLUMN;
-// }
-// return String.valueOf(existingValue);
-// } catch (NumberFormatException e) {
-// throw WRONG_ARGUMENT;
-// }
-// }
- /**
- *
Set the force value of the given alignment value and return the new value.
- * The given alignment value should be created using the createAlignmentValue(boolean, int, int)
- * API.
+ * @exception IllegalArgumentException
+ * if the given alignment value is null, if the given
+ * indentation style is not one of the possible indentation
+ * styles, or if the given alignment value doesn't have a
+ * valid format.
+ */
+ // public static String setIndentStyle(String value, int indentStyle) {
+ // if (value == null) {
+ // throw WRONG_ARGUMENT;
+ // }
+ // switch(indentStyle) {
+ // case INDENT_BY_ONE :
+ // case INDENT_DEFAULT :
+ // case INDENT_ON_COLUMN :
+ // break;
+ // default :
+ // throw WRONG_ARGUMENT;
+ // }
+ // try {
+ // int existingValue = Integer.parseInt(value);
+ // // clear existing indent bits
+ // existingValue &= ~(Alignment.M_INDENT_BY_ONE |
+ // Alignment.M_INDENT_ON_COLUMN);
+ // switch(indentStyle) {
+ // case INDENT_BY_ONE :
+ // existingValue |= Alignment.M_INDENT_BY_ONE;
+ // break;
+ // case INDENT_ON_COLUMN :
+ // existingValue |= Alignment.M_INDENT_ON_COLUMN;
+ // }
+ // return String.valueOf(existingValue);
+ // } catch (NumberFormatException e) {
+ // throw WRONG_ARGUMENT;
+ // }
+ // }
+ /**
+ *
+ * Set the force value of the given alignment value and return the new
+ * value. The given alignment value should be created using the
+ * createAlignmentValue(boolean, int, int) API.
*
- *
- * @param value the given alignment value
- * @param force the given force value
+ *
+ * @param value
+ * the given alignment value
+ * @param force
+ * the given force value
* @return the new alignment value
* @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, or if it
- * doesn't have a valid format.
- */
-// public static String setForceWrapping(String value, boolean force) {
-// if (value == null) {
-// throw WRONG_ARGUMENT;
-// }
-// try {
-// int existingValue = Integer.parseInt(value);
-// // clear existing force bit
-// existingValue &= ~Alignment.M_FORCE;
-// if (force) {
-// existingValue |= Alignment.M_FORCE;
-// }
-// return String.valueOf(existingValue);
-// } catch (NumberFormatException e) {
-// throw WRONG_ARGUMENT;
-// }
-// }
- /**
- *
Set the wrapping style of the given alignment value and return the new value.
- * The given value should be created using the createAlignmentValue(boolean, int, int)
- * API.
+ * @exception IllegalArgumentException
+ * if the given alignment value is null, or if it doesn't
+ * have a valid format.
+ */
+ // public static String setForceWrapping(String value, boolean force) {
+ // if (value == null) {
+ // throw WRONG_ARGUMENT;
+ // }
+ // try {
+ // int existingValue = Integer.parseInt(value);
+ // // clear existing force bit
+ // existingValue &= ~Alignment.M_FORCE;
+ // if (force) {
+ // existingValue |= Alignment.M_FORCE;
+ // }
+ // return String.valueOf(existingValue);
+ // } catch (NumberFormatException e) {
+ // throw WRONG_ARGUMENT;
+ // }
+ // }
+ /**
+ *
+ * Set the wrapping style of the given alignment value and return the new
+ * value. The given value should be created using the
+ * createAlignmentValue(boolean, int, int) API.
*
- *
- * @param value the given alignment value
- * @param wrappingStyle the given wrapping style
+ *
+ * @param value
+ * the given alignment value
+ * @param wrappingStyle
+ * the given wrapping style
* @return the new alignment value
* @see #WRAP_COMPACT
* @see #WRAP_COMPACT_FIRST_BREAK
@@ -2404,90 +3015,96 @@ public class DefaultCodeFormatterConstants {
* @see #WRAP_NO_SPLIT
* @see #WRAP_ONE_PER_LINE
* @see #createAlignmentValue(boolean, int, int)
- * @exception IllegalArgumentException if the given alignment value is null, if the given
- * wrapping style is not one of the possible wrapping styles, or if the given
- * alignment value doesn't have a valid format.
- */
-// public static String setWrappingStyle(String value, int wrappingStyle) {
-// if (value == null) {
-// throw WRONG_ARGUMENT;
-// }
-// switch(wrappingStyle) {
-// case WRAP_COMPACT :
-// case WRAP_COMPACT_FIRST_BREAK :
-// case WRAP_NEXT_PER_LINE :
-// case WRAP_NEXT_SHIFTED :
-// case WRAP_NO_SPLIT :
-// case WRAP_ONE_PER_LINE :
-// break;
-// default:
-// throw WRONG_ARGUMENT;
-// }
-// try {
-// int existingValue = Integer.parseInt(value);
-// // clear existing split bits
-// existingValue &= ~(Alignment.SPLIT_MASK);
-// switch(wrappingStyle) {
-// case WRAP_COMPACT :
-// existingValue |= Alignment.M_COMPACT_SPLIT;
-// break;
-// case WRAP_COMPACT_FIRST_BREAK :
-// existingValue |= Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
-// break;
-// case WRAP_NEXT_PER_LINE :
-// existingValue |= Alignment.M_NEXT_PER_LINE_SPLIT;
-// break;
-// case WRAP_NEXT_SHIFTED :
-// existingValue |= Alignment.M_NEXT_SHIFTED_SPLIT;
-// break;
-// case WRAP_ONE_PER_LINE :
-// existingValue |= Alignment.M_ONE_PER_LINE_SPLIT;
-// break;
-// }
-// return String.valueOf(existingValue);
-// } catch (NumberFormatException e) {
-// throw WRONG_ARGUMENT;
-// }
-// }
- /**
- * Create a new alignment value according to the given values. This must be used to set up
- * the alignment options.
- *
- * @param forceSplit the given force value
- * @param wrapStyle the given wrapping style
- * @param indentStyle the given indent style
+ * @exception IllegalArgumentException
+ * if the given alignment value is null, if the given
+ * wrapping style is not one of the possible wrapping styles,
+ * or if the given alignment value doesn't have a valid
+ * format.
+ */
+ // public static String setWrappingStyle(String value, int wrappingStyle) {
+ // if (value == null) {
+ // throw WRONG_ARGUMENT;
+ // }
+ // switch(wrappingStyle) {
+ // case WRAP_COMPACT :
+ // case WRAP_COMPACT_FIRST_BREAK :
+ // case WRAP_NEXT_PER_LINE :
+ // case WRAP_NEXT_SHIFTED :
+ // case WRAP_NO_SPLIT :
+ // case WRAP_ONE_PER_LINE :
+ // break;
+ // default:
+ // throw WRONG_ARGUMENT;
+ // }
+ // try {
+ // int existingValue = Integer.parseInt(value);
+ // // clear existing split bits
+ // existingValue &= ~(Alignment.SPLIT_MASK);
+ // switch(wrappingStyle) {
+ // case WRAP_COMPACT :
+ // existingValue |= Alignment.M_COMPACT_SPLIT;
+ // break;
+ // case WRAP_COMPACT_FIRST_BREAK :
+ // existingValue |= Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
+ // break;
+ // case WRAP_NEXT_PER_LINE :
+ // existingValue |= Alignment.M_NEXT_PER_LINE_SPLIT;
+ // break;
+ // case WRAP_NEXT_SHIFTED :
+ // existingValue |= Alignment.M_NEXT_SHIFTED_SPLIT;
+ // break;
+ // case WRAP_ONE_PER_LINE :
+ // existingValue |= Alignment.M_ONE_PER_LINE_SPLIT;
+ // break;
+ // }
+ // return String.valueOf(existingValue);
+ // } catch (NumberFormatException e) {
+ // throw WRONG_ARGUMENT;
+ // }
+ // }
+ /**
+ * Create a new alignment value according to the given values. This must be
+ * used to set up the alignment options.
+ *
+ * @param forceSplit
+ * the given force value
+ * @param wrapStyle
+ * the given wrapping style
+ * @param indentStyle
+ * the given indent style
*
* @return the new alignement value
*/
-// public static String createAlignmentValue(boolean forceSplit, int wrapStyle, int indentStyle) {
-// int alignmentValue = 0;
-// switch(wrapStyle) {
-// case WRAP_COMPACT :
-// alignmentValue |= Alignment.M_COMPACT_SPLIT;
-// break;
-// case WRAP_COMPACT_FIRST_BREAK :
-// alignmentValue |= Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
-// break;
-// case WRAP_NEXT_PER_LINE :
-// alignmentValue |= Alignment.M_NEXT_PER_LINE_SPLIT;
-// break;
-// case WRAP_NEXT_SHIFTED :
-// alignmentValue |= Alignment.M_NEXT_SHIFTED_SPLIT;
-// break;
-// case WRAP_ONE_PER_LINE :
-// alignmentValue |= Alignment.M_ONE_PER_LINE_SPLIT;
-// break;
-// }
-// if (forceSplit) {
-// alignmentValue |= Alignment.M_FORCE;
-// }
-// switch(indentStyle) {
-// case INDENT_BY_ONE :
-// alignmentValue |= Alignment.M_INDENT_BY_ONE;
-// break;
-// case INDENT_ON_COLUMN :
-// alignmentValue |= Alignment.M_INDENT_ON_COLUMN;
-// }
-// return String.valueOf(alignmentValue);
-// }
+ // public static String createAlignmentValue(boolean forceSplit, int
+ // wrapStyle, int indentStyle) {
+ // int alignmentValue = 0;
+ // switch(wrapStyle) {
+ // case WRAP_COMPACT :
+ // alignmentValue |= Alignment.M_COMPACT_SPLIT;
+ // break;
+ // case WRAP_COMPACT_FIRST_BREAK :
+ // alignmentValue |= Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
+ // break;
+ // case WRAP_NEXT_PER_LINE :
+ // alignmentValue |= Alignment.M_NEXT_PER_LINE_SPLIT;
+ // break;
+ // case WRAP_NEXT_SHIFTED :
+ // alignmentValue |= Alignment.M_NEXT_SHIFTED_SPLIT;
+ // break;
+ // case WRAP_ONE_PER_LINE :
+ // alignmentValue |= Alignment.M_ONE_PER_LINE_SPLIT;
+ // break;
+ // }
+ // if (forceSplit) {
+ // alignmentValue |= Alignment.M_FORCE;
+ // }
+ // switch(indentStyle) {
+ // case INDENT_BY_ONE :
+ // alignmentValue |= Alignment.M_INDENT_BY_ONE;
+ // break;
+ // case INDENT_ON_COLUMN :
+ // alignmentValue |= Alignment.M_INDENT_ON_COLUMN;
+ // }
+ // return String.valueOf(alignmentValue);
+ // }
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/DOMException.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/DOMException.java
index 79b002a..815016e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/DOMException.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/DOMException.java
@@ -11,22 +11,25 @@
package net.sourceforge.phpdt.core.jdom;
/**
- * Unchecked exception thrown when an illegal manipulation of the JDOM is
- * performed, or when an attempt is made to access/set an attribute of a
- * JDOM node that source indexes cannot be determined for (in case the source
- * was syntactically incorrect).
+ * Unchecked exception thrown when an illegal manipulation of the JDOM is
+ * performed, or when an attempt is made to access/set an attribute of a JDOM
+ * node that source indexes cannot be determined for (in case the source was
+ * syntactically incorrect).
*/
public class DOMException extends RuntimeException {
-/**
- * Creates a new exception with no detail message.
- */
-public DOMException() {}
-/**
- * Creates a new exception with the given detail message.
- *
- * @param message the detail message
- */
-public DOMException(String message) {
- super(message);
-}
+ /**
+ * Creates a new exception with no detail message.
+ */
+ public DOMException() {
+ }
+
+ /**
+ * Creates a new exception with the given detail message.
+ *
+ * @param message
+ * the detail message
+ */
+ public DOMException(String message) {
+ super(message);
+ }
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/DOMFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/DOMFactory.java
index a803c26..179b6a6 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/DOMFactory.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/DOMFactory.java
@@ -13,144 +13,159 @@ package net.sourceforge.phpdt.core.jdom;
import net.sourceforge.phpdt.internal.core.jdom.DOMBuilder;
import net.sourceforge.phpdt.internal.core.jdom.SimpleDOMBuilder;
-
-
/**
- * Standard implementation of IDOMFactory, and the only means
- * of creating JDOMs and document fragments.
+ * Standard implementation of IDOMFactory, and the only means of
+ * creating JDOMs and document fragments.
*
* This class may be instantiated; it is not intended to be subclassed.
*
* This interface is not intended to be implemented by clients.
*
*/
public interface IDOMCompilationUnit extends IDOMNode {
-/**
- * Returns the header comment for this compilation unit. The header comment
- * appears before the first declaration in a compilation unit.
- * The syntax for a comment corresponds to Comments (JLS2 3.7), including
- * comment delimiters.
- *
- * @return the header comment for this compilation unit, or null if
- * no header comment is present
- */
-public String getHeader();
-/**
- * The IDOMCompilationNode refinement of this IDOMNode
- * method returns the name of this compilation unit.
- *
- *
The name of a compilation unit is the name of the first top-level public type
- * defined in the compilation unit, suffixed with ".java". For example, if the first
- * top-level public type defined in this compilation unit has the name "Hanoi",
- * then name of this compilation unit is "Hanoi.java".
- *
- *
In the absence of a public top-level type, the name of the first top-level
- * type is used. In the absence of any type, the name of the compilation unit
- * is null.
- *
- * @return the name of this compilation unit, or null if none
- */
-public String getName();
-/**
- * Sets the header comment for this compilation unit. The header comment
- * appears before the first declaration in a compilation unit.
- * The syntax for a comment corresponds to Comments (JLS2 3.7), including
- * comment delimiters.
- *
- * @param comment the header comment for this compilation unit, or null if
- * indicating no header comment
- */
-public void setHeader(String comment);
-/**
- * The IDOMCompilationNode refinement of this IDOMNode
- * method has no effect (the name is computed from the types declared within it).
- */
-public void setName(String name);
+ /**
+ * Returns the header comment for this compilation unit. The header comment
+ * appears before the first declaration in a compilation unit. The syntax
+ * for a comment corresponds to Comments (JLS2 3.7), including
+ * comment delimiters.
+ *
+ * @return the header comment for this compilation unit, or
+ * null if no header comment is present
+ */
+ public String getHeader();
+
+ /**
+ * The IDOMCompilationNode refinement of this
+ * IDOMNode method returns the name of this compilation unit.
+ *
+ *
+ * The name of a compilation unit is the name of the first top-level public
+ * type defined in the compilation unit, suffixed with ".java". For example,
+ * if the first top-level public type defined in this compilation unit has
+ * the name "Hanoi", then name of this compilation unit is "Hanoi.java".
+ *
+ *
+ *
+ * In the absence of a public top-level type, the name of the first
+ * top-level type is used. In the absence of any type, the name of the
+ * compilation unit is null.
+ *
+ *
+ * @return the name of this compilation unit, or null if none
+ */
+ public String getName();
+
+ /**
+ * Sets the header comment for this compilation unit. The header comment
+ * appears before the first declaration in a compilation unit. The syntax
+ * for a comment corresponds to Comments (JLS2 3.7), including
+ * comment delimiters.
+ *
+ * @param comment
+ * the header comment for this compilation unit, or
+ * null if indicating no header comment
+ */
+ public void setHeader(String comment);
+
+ /**
+ * The IDOMCompilationNode refinement of this
+ * IDOMNode method has no effect (the name is computed from
+ * the types declared within it).
+ */
+ public void setName(String name);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMFactory.java
index eea0df1..19c58b2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMFactory.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMFactory.java
@@ -11,32 +11,32 @@
package net.sourceforge.phpdt.core.jdom;
/**
- * A factory used to create document fragment (DF) nodes. An
- * IDOMCompilationUnit represents the root of a complete JDOM (that
- * is, a ".java" file). Other node types represent fragments of a compilation
- * unit.
+ * A factory used to create document fragment (DF) nodes. An
+ * IDOMCompilationUnit represents the root of a complete JDOM
+ * (that is, a ".java" file). Other node types represent fragments of a
+ * compilation unit.
*
* The factory can be used to create empty DFs or it can create DFs from source
* strings. All DFs created empty are assigned default values as required, such
- * that a call to IDOMNode.getContents will generate a valid source
- * string. See individual create methods for details on the default
- * values supplied. The factory does its best to recognize Java structures in
- * the source provided. If the factory is completely unable to recognize source
- * constructs, the factory method returns null.
+ * that a call to IDOMNode.getContents will generate a valid
+ * source string. See individual create methods for details on
+ * the default values supplied. The factory does its best to recognize Java
+ * structures in the source provided. If the factory is completely unable to
+ * recognize source constructs, the factory method returns null.
*
*
* Even if a DF is created successfully from source code, it does not guarantee
* that the source code will compile error free. Similarly, the contents of a DF
- * are not guaranteed to compile error free. However, syntactically correct
+ * are not guaranteed to compile error free. However, syntactically correct
* source code is guaranteed to be recognized and successfully generate a DF.
* Similarly, if all of the fragments of a JDOM are syntactically correct, the
* contents of the entire document will be correct too.
*
*
- * The factory does not perform or provide any code formatting. Document
+ * The factory does not perform or provide any code formatting. Document
* fragments created on source strings must be pre-formatted. The JDOM attempts
* to maintain the formatting of documents as best as possible. For this reason,
- * document fragments created for nodes that are to be strung together should
+ * document fragments created for nodes that are to be strung together should
* end with a new-line character. Failing to do so will result in a document
* that has elements strung together on the same line. This is especially
* important if a source string ends with a // comment. In this case, it would
@@ -45,153 +45,174 @@ package net.sourceforge.phpdt.core.jdom;
*
* This interface is not intended to be implemented by clients.
*
- *
+ *
* @see IDOMNode
*/
public interface IDOMFactory {
-/**
- * Creates and return an empty JDOM. The initial content is an empty string.
- *
- * @return the new compilation unit
- */
-public IDOMCompilationUnit createCompilationUnit();
-/**
- * Creates a JDOM on the given source code. The syntax for the given source
- * code corresponds to CompilationUnit (JLS2 7.3).
- *
- * @param sourceCode the source code character array, or null
- * @param name the name of the compilation unit
- * @return the new compilation unit, or null if unable to recognize
- * the source code, or if the source code is null
- */
-public IDOMCompilationUnit createCompilationUnit(char[] sourceCode, String name);
-/**
- * Creates a JDOM on the given source code. The syntax for the given source
- * code corresponds to CompilationUnit (JLS2 7.3).
- *
- * @param sourceCode the source code string, or null
- * @param name the name of the compilation unit
- * @return the new compilation unit, or null if unable to recognize
- * the source code, or if the source code is null
- */
-public IDOMCompilationUnit createCompilationUnit(String sourceCode, String name);
-/**
- * Creates a default field document fragment. Initially the field will have
- * default protection, type "Object", name "aField",
- * no comment, and no initializer.
- *
- * @return the new field
- */
-//public IDOMField createField();
-/**
- * Creates a field document fragment on the given source code. The given source
- * string corresponds to FieldDeclaration (JLS2 8.3) and ConstantDeclaration
- * (JLS2 9.3) restricted to a single VariableDeclarator clause.
- *
- * @param sourceCode the source code
- * @return the new field, or null if unable to recognize
- * the source code, if the source code is null, or when the source
- * contains more than one VariableDeclarator clause
- */
-//public IDOMField createField(String sourceCode);
-/**
- * Creates an empty import document fragment. Initially the import will have
- * name "java.lang.*".
- *
- * @return the new import
- */
-//public IDOMImport createImport();
-/**
- * Creates an import document fragment on the given source code. The syntax for
- * the given source string corresponds to ImportDeclaration (JLS2 7.5).
- *
- * @param sourceCode the source code
- * @return the new import, or null if unable to recognize
- * the source code, or if the source code is null
- */
-//public IDOMImport createImport(String sourceCode);
-/**
- * Creates an empty initializer document fragment. Initially the initializer
- * will be static and have no body or comment.
- *
- * @return the new initializer
- */
-//public IDOMInitializer createInitializer();
-/**
- * Creates an initializer document fragment from the given source code. The
- * syntax for the given source string corresponds to InstanceInitializer
- * (JLS2 8.6) and StaticDeclaration (JLS2 8.7).
- *
- * @param sourceCode the source code
- * @return the new initializer, or null if unable to recognize
- * the source code, or if the source code is null
- */
-//public IDOMInitializer createInitializer(String sourceCode);
-/**
- * Creates a default method document fragment. Initially the method
- * will have public visibility, return type "void", be named
- * "newMethod", have no parameters, no comment, and an empty body.
- *
- * @return the new method
- */
-//public IDOMMethod createMethod();
-/**
- * Creates a method document fragment on the given source code. The syntax for
- * the given source string corresponds to MethodDeclaration (JLS2 8.4),
- * ConstructorDeclaration (JLS2 8.8), and AbstractMethodDeclaration (JLS2 9.4).
- *
- * @param sourceCode the source code
- * @return the new method, or null if unable to recognize
- * the source code, or if the source code is null
- */
-//public IDOMMethod createMethod(String sourceCode);
-/**
- * Creates an empty package document fragment. Initially the package
- * declaration will have no name.
- *
- * @return the new package
- */
-//public IDOMPackage createPackage();
-/**
- * Creates a package document fragment on the given source code. The syntax for
- * the given source string corresponds to PackageDeclaration (JLS2 7.4).
- *
- * @param sourceCode the source code
- * @return the new package, or null if unable to recognize
- * the source code, or if the source code is null
- */
-//public IDOMPackage createPackage(String sourceCode);
-/**
- * Creates a default type document fragment. Initially the type will be
- * a public class named "AClass", with no members or comment.
- *
- * @return the new type
- */
-//public IDOMType createType();
-/**
- * Creates a default type document fragment. Initially the type will be
- * a public class named "AClass", with no members or comment.
- *
- * @return the new class
- * @since 2.0
- */
-//public IDOMType createClass();
-/**
- * Creates a default type document fragment. Initially the type will be
- * a public interface named "AnInterface", with no members or comment.
- *
- * @return the new interface
- * @since 2.0
- */
-//public IDOMType createInterface();
-/**
- * Creates a type document fragment on the given source code. The syntax for the
- * given source string corresponds to ClassDeclaration (JLS2 8.1) and
- * InterfaceDeclaration (JLS2 9.1).
- *
- * @param sourceCode the source code
- * @return the new type, or null if unable to recognize
- * the source code, or if the source code is null
- */
-//public IDOMType createType(String sourceCode);
+ /**
+ * Creates and return an empty JDOM. The initial content is an empty string.
+ *
+ * @return the new compilation unit
+ */
+ public IDOMCompilationUnit createCompilationUnit();
+
+ /**
+ * Creates a JDOM on the given source code. The syntax for the given source
+ * code corresponds to CompilationUnit (JLS2 7.3).
+ *
+ * @param sourceCode
+ * the source code character array, or null
+ * @param name
+ * the name of the compilation unit
+ * @return the new compilation unit, or null if unable to
+ * recognize the source code, or if the source code is
+ * null
+ */
+ public IDOMCompilationUnit createCompilationUnit(char[] sourceCode,
+ String name);
+
+ /**
+ * Creates a JDOM on the given source code. The syntax for the given source
+ * code corresponds to CompilationUnit (JLS2 7.3).
+ *
+ * @param sourceCode
+ * the source code string, or null
+ * @param name
+ * the name of the compilation unit
+ * @return the new compilation unit, or null if unable to
+ * recognize the source code, or if the source code is
+ * null
+ */
+ public IDOMCompilationUnit createCompilationUnit(String sourceCode,
+ String name);
+ /**
+ * Creates a default field document fragment. Initially the field will have
+ * default protection, type "Object", name
+ * "aField", no comment, and no initializer.
+ *
+ * @return the new field
+ */
+ // public IDOMField createField();
+ /**
+ * Creates a field document fragment on the given source code. The given
+ * source string corresponds to FieldDeclaration (JLS2 8.3) and
+ * ConstantDeclaration (JLS2 9.3) restricted to a single VariableDeclarator
+ * clause.
+ *
+ * @param sourceCode
+ * the source code
+ * @return the new field, or null if unable to recognize the
+ * source code, if the source code is null, or when
+ * the source contains more than one VariableDeclarator clause
+ */
+ // public IDOMField createField(String sourceCode);
+ /**
+ * Creates an empty import document fragment. Initially the import will have
+ * name "java.lang.*".
+ *
+ * @return the new import
+ */
+ // public IDOMImport createImport();
+ /**
+ * Creates an import document fragment on the given source code. The syntax
+ * for the given source string corresponds to ImportDeclaration (JLS2 7.5).
+ *
+ * @param sourceCode
+ * the source code
+ * @return the new import, or null if unable to recognize the
+ * source code, or if the source code is null
+ */
+ // public IDOMImport createImport(String sourceCode);
+ /**
+ * Creates an empty initializer document fragment. Initially the initializer
+ * will be static and have no body or comment.
+ *
+ * @return the new initializer
+ */
+ // public IDOMInitializer createInitializer();
+ /**
+ * Creates an initializer document fragment from the given source code. The
+ * syntax for the given source string corresponds to InstanceInitializer
+ * (JLS2 8.6) and StaticDeclaration (JLS2 8.7).
+ *
+ * @param sourceCode
+ * the source code
+ * @return the new initializer, or null if unable to
+ * recognize the source code, or if the source code is
+ * null
+ */
+ // public IDOMInitializer createInitializer(String sourceCode);
+ /**
+ * Creates a default method document fragment. Initially the method will
+ * have public visibility, return type "void", be named
+ * "newMethod", have no parameters, no comment, and an empty
+ * body.
+ *
+ * @return the new method
+ */
+ // public IDOMMethod createMethod();
+ /**
+ * Creates a method document fragment on the given source code. The syntax
+ * for the given source string corresponds to MethodDeclaration (JLS2 8.4),
+ * ConstructorDeclaration (JLS2 8.8), and AbstractMethodDeclaration (JLS2
+ * 9.4).
+ *
+ * @param sourceCode
+ * the source code
+ * @return the new method, or null if unable to recognize the
+ * source code, or if the source code is null
+ */
+ // public IDOMMethod createMethod(String sourceCode);
+ /**
+ * Creates an empty package document fragment. Initially the package
+ * declaration will have no name.
+ *
+ * @return the new package
+ */
+ // public IDOMPackage createPackage();
+ /**
+ * Creates a package document fragment on the given source code. The syntax
+ * for the given source string corresponds to PackageDeclaration (JLS2 7.4).
+ *
+ * @param sourceCode
+ * the source code
+ * @return the new package, or null if unable to recognize
+ * the source code, or if the source code is null
+ */
+ // public IDOMPackage createPackage(String sourceCode);
+ /**
+ * Creates a default type document fragment. Initially the type will be a
+ * public class named "AClass", with no members or comment.
+ *
+ * @return the new type
+ */
+ // public IDOMType createType();
+ /**
+ * Creates a default type document fragment. Initially the type will be a
+ * public class named "AClass", with no members or comment.
+ *
+ * @return the new class
+ * @since 2.0
+ */
+ // public IDOMType createClass();
+ /**
+ * Creates a default type document fragment. Initially the type will be a
+ * public interface named "AnInterface", with no members or
+ * comment.
+ *
+ * @return the new interface
+ * @since 2.0
+ */
+ // public IDOMType createInterface();
+ /**
+ * Creates a type document fragment on the given source code. The syntax for
+ * the given source string corresponds to ClassDeclaration (JLS2 8.1) and
+ * InterfaceDeclaration (JLS2 9.1).
+ *
+ * @param sourceCode
+ * the source code
+ * @return the new type, or null if unable to recognize the
+ * source code, or if the source code is null
+ */
+ // public IDOMType createType(String sourceCode);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMField.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMField.java
index 72de2a6..2c59e19 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMField.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMField.java
@@ -11,66 +11,76 @@
package net.sourceforge.phpdt.core.jdom;
/**
- * Represents a field declaration. The corresponding
- * syntactic units are FieldDeclaration (JLS2 8.3) and ConstantDeclaration
- * (JLS2 9.3) restricted to a single VariableDeclarator clause.
- * A field has no children. The parent of a field is a type.
+ * Represents a field declaration. The corresponding syntactic units are
+ * FieldDeclaration (JLS2 8.3) and ConstantDeclaration (JLS2 9.3) restricted to
+ * a single VariableDeclarator clause. A field has no children. The parent of a
+ * field is a type.
*
* This interface is not intended to be implemented by clients.
*
*/
public interface IDOMField extends IDOMMember {
-/**
- * Returns the initializer expression for this field.
- * The syntax for an initializer corresponds to VariableInitializer (JLS2 8.3).
- *
- * Note: The expression does not include a "=".
- *
- *
- * @return the initializer expression, or null if this field does
- * not have an initializer
- */
-public String getInitializer();
-/**
- * The IDOMField refinement of this IDOMNode
- * method returns the name of this field. The syntax for the name of a field
- * corresponds to VariableDeclaratorId (JLS2 8.3).
- */
-public String getName();
-/**
- * Returns the type name of this field. The syntax for a type name of a field
- * corresponds to Type in Field Declaration (JLS2 8.3).
- *
- * @return the type name
- */
-public String getType();
-/**
- * Sets the initializer expression for this field.
- * The syntax for an initializer corresponds to VariableInitializer (JLS2 8.3).
- *
- * Note: The expression does not include a "=".
- *
- *
- * @param initializer the initializer expression, or null indicating
- * the field does not have an initializer
- */
-public void setInitializer(String initializer);
-/**
- * The IDOMField refinement of this IDOMNode
- * method sets the name of this field. The syntax for the name of a field
- * corresponds to VariableDeclaratorId (JLS2 8.3).
- *
- * @exception IllegalArgumentException if null is specified
- */
-public void setName(String name) throws IllegalArgumentException;
-/**
- * Sets the type name of this field. The syntax for a type name of a field
- * corresponds to Type in Field Declaration (JLS2 8.3). Type names must be
- * specified as they should appear in source code. For example:
- * "String", "int[]", or "java.io.File".
- *
- * @param typeName the type name
- * @exception IllegalArgumentException if null is specified
- */
-public void setType(String typeName) throws IllegalArgumentException;
+ /**
+ * Returns the initializer expression for this field. The syntax for an
+ * initializer corresponds to VariableInitializer (JLS2 8.3).
+ *
+ * Note: The expression does not include a "=".
+ *
+ *
+ * @return the initializer expression, or null if this field
+ * does not have an initializer
+ */
+ public String getInitializer();
+
+ /**
+ * The IDOMField refinement of this IDOMNode
+ * method returns the name of this field. The syntax for the name of a field
+ * corresponds to VariableDeclaratorId (JLS2 8.3).
+ */
+ public String getName();
+
+ /**
+ * Returns the type name of this field. The syntax for a type name of a
+ * field corresponds to Type in Field Declaration (JLS2 8.3).
+ *
+ * @return the type name
+ */
+ public String getType();
+
+ /**
+ * Sets the initializer expression for this field. The syntax for an
+ * initializer corresponds to VariableInitializer (JLS2 8.3).
+ *
+ * Note: The expression does not include a "=".
+ *
+ *
+ * @param initializer
+ * the initializer expression, or null indicating
+ * the field does not have an initializer
+ */
+ public void setInitializer(String initializer);
+
+ /**
+ * The IDOMField refinement of this IDOMNode
+ * method sets the name of this field. The syntax for the name of a field
+ * corresponds to VariableDeclaratorId (JLS2 8.3).
+ *
+ * @exception IllegalArgumentException
+ * if null is specified
+ */
+ public void setName(String name) throws IllegalArgumentException;
+
+ /**
+ * Sets the type name of this field. The syntax for a type name of a field
+ * corresponds to Type in Field Declaration (JLS2 8.3). Type names must be
+ * specified as they should appear in source code. For example:
+ * "String", "int[]", or
+ * "java.io.File".
+ *
+ * @param typeName
+ * the type name
+ * @exception IllegalArgumentException
+ * if null is specified
+ */
+ public void setType(String typeName) throws IllegalArgumentException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMImport.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMImport.java
index 47a6ffa..67c64c3 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMImport.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMImport.java
@@ -11,34 +11,37 @@
package net.sourceforge.phpdt.core.jdom;
/**
- * Represents an import declaration.
- * The corresponding syntactic unit is ImportDeclaration (JLS2 7.5).
- * An import has no children and its parent is a compilation unit.
+ * Represents an import declaration. The corresponding syntactic unit is
+ * ImportDeclaration (JLS2 7.5). An import has no children and its parent is a
+ * compilation unit.
*
* This interface is not intended to be implemented by clients.
*
*/
public interface IDOMImport extends IDOMNode {
-/**
- * The IDOMImport refinement of this IDOMNode
- * method returns the name of this import. The syntax for an import name
- * corresponds to a fully qualified type name, or to an on-demand package name
- * as defined by ImportDeclaration (JLS2 7.5).
- */
-public String getName();
-/**
- * Returns whether this import declaration ends with ".*".
- *
- * @return true if this in an on-demand import
- */
-public boolean isOnDemand();
-/**
- * The IDOMImport refinement of this IDOMNode
- * method sets the name of this import. The syntax for an import name
- * corresponds to a fully qualified type name, or to an on-demand package name
- * as defined by ImportDeclaration (JLS2 7.5).
- *
- * @exception IllegalArgumentException if null is specified
- */
-public void setName(String name);
+ /**
+ * The IDOMImport refinement of this IDOMNode
+ * method returns the name of this import. The syntax for an import name
+ * corresponds to a fully qualified type name, or to an on-demand package
+ * name as defined by ImportDeclaration (JLS2 7.5).
+ */
+ public String getName();
+
+ /**
+ * Returns whether this import declaration ends with ".*".
+ *
+ * @return true if this in an on-demand import
+ */
+ public boolean isOnDemand();
+
+ /**
+ * The IDOMImport refinement of this IDOMNode
+ * method sets the name of this import. The syntax for an import name
+ * corresponds to a fully qualified type name, or to an on-demand package
+ * name as defined by ImportDeclaration (JLS2 7.5).
+ *
+ * @exception IllegalArgumentException
+ * if null is specified
+ */
+ public void setName(String name);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMInitializer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMInitializer.java
index 96c612e..d021d03 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMInitializer.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMInitializer.java
@@ -11,39 +11,45 @@
package net.sourceforge.phpdt.core.jdom;
/**
- * Represents an initializer. The corresponding syntactic
- * units are InstanceInitializer (JLS2 8.6) and StaticDeclaration (JLS2 8.7).
- * An initializer has no children and its parent is a type.
+ * Represents an initializer. The corresponding syntactic units are
+ * InstanceInitializer (JLS2 8.6) and StaticDeclaration (JLS2 8.7). An
+ * initializer has no children and its parent is a type.
*
* This interface is not intended to be implemented by clients.
*
*/
public interface IDOMInitializer extends IDOMMember {
-/**
- * Returns the body of this initializer. The syntax for a body corresponds to
- * InstanceInitializer (JLS2 8.6) and StaticDeclaration (JLS2 8.7).
- *
- * @return an initializer body, including braces, or null if
- * no body is present
- */
-public String getBody();
-/**
- * The IDOMInitializer refinement of this IDOMNode
- * method returns null. An initializer does not have a name.
- */
-public String getName();
-/**
- * Sets the body of this initializer. The syntax for a body corresponds to
- * InstanceInitializer (JLS2 8.6) and StaticDeclaration (JLS2 8.7). No formatting
- * or syntax checking is performed on the body. Braces must be included.
- *
- * @param body an initializer body, including braces, or null
- * indicating no body
- */
-public void setBody(String body);
-/**
- * The IDOMInitializer refinement of this IDOMNode
- * method does nothing.
- */
-public void setName(String name);
+ /**
+ * Returns the body of this initializer. The syntax for a body corresponds
+ * to InstanceInitializer (JLS2 8.6) and StaticDeclaration (JLS2 8.7).
+ *
+ * @return an initializer body, including braces, or null if
+ * no body is present
+ */
+ public String getBody();
+
+ /**
+ * The IDOMInitializer refinement of this
+ * IDOMNode method returns null. An
+ * initializer does not have a name.
+ */
+ public String getName();
+
+ /**
+ * Sets the body of this initializer. The syntax for a body corresponds to
+ * InstanceInitializer (JLS2 8.6) and StaticDeclaration (JLS2 8.7). No
+ * formatting or syntax checking is performed on the body. Braces must
+ * be included.
+ *
+ * @param body
+ * an initializer body, including braces, or null
+ * indicating no body
+ */
+ public void setBody(String body);
+
+ /**
+ * The IDOMInitializer refinement of this
+ * IDOMNode method does nothing.
+ */
+ public void setName(String name);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMember.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMember.java
index cd4d327..ff16067 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMember.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMember.java
@@ -11,51 +11,58 @@
package net.sourceforge.phpdt.core.jdom;
/**
- * An IDOMMember defines functionality common to nodes, which
- * can be members of types.
+ * An IDOMMember defines functionality common to nodes, which can
+ * be members of types.
*
* This interface is not intended to be implemented by clients.
*
- *
+ *
* @see IDOMType
* @see IDOMMethod
* @see IDOMField
* @see IDOMInitializer
*/
public interface IDOMMember extends IDOMNode {
-/**
- * Returns the comment associated with this member (including comment delimiters).
- *
- * @return the comment, or null if this member has no associated
- * comment
- */
-public String getComment();
-/**
- * Returns the flags for this member. The flags can be examined using the
- * Flags class.
- *
- * @return the flags
- * @see net.sourceforge.phpdt.core.Flags
- */
-public int getFlags();
-/**
- * Sets the comment associated with this member. The comment will appear
- * before the member in the source. The comment must be properly formatted, including
- * delimiters. A null comment indicates no comment. This member's
- * deprecated flag is automatically set to reflect the deprecated tag in the
- * comment.
- *
- * @param comment the comment, including comment delimiters, or
- * null indicating this member should have no associated comment
- * @see #setFlags
- */
-public void setComment(String comment);
-/**
- * Sets the flags for this member. The flags can be examined using the
- * Flags class. The deprecated flag passed in is ignored.
- *
- * @param flags the flags
- * @see net.sourceforge.phpdt.core.Flags
- */
-public void setFlags(int flags);
+ /**
+ * Returns the comment associated with this member (including comment
+ * delimiters).
+ *
+ * @return the comment, or null if this member has no
+ * associated comment
+ */
+ public String getComment();
+
+ /**
+ * Returns the flags for this member. The flags can be examined using the
+ * Flags class.
+ *
+ * @return the flags
+ * @see net.sourceforge.phpdt.core.Flags
+ */
+ public int getFlags();
+
+ /**
+ * Sets the comment associated with this member. The comment will appear
+ * before the member in the source. The comment must be properly formatted,
+ * including delimiters. A null comment indicates no comment.
+ * This member's deprecated flag is automatically set to reflect the
+ * deprecated tag in the comment.
+ *
+ * @param comment
+ * the comment, including comment delimiters, or
+ * null indicating this member should have no
+ * associated comment
+ * @see #setFlags
+ */
+ public void setComment(String comment);
+
+ /**
+ * Sets the flags for this member. The flags can be examined using the
+ * Flags class. The deprecated flag passed in is ignored.
+ *
+ * @param flags
+ * the flags
+ * @see net.sourceforge.phpdt.core.Flags
+ */
+ public void setFlags(int flags);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMethod.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMethod.java
index 4845a80..d2b3419 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMethod.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMMethod.java
@@ -11,172 +11,204 @@
package net.sourceforge.phpdt.core.jdom;
/**
- * Represents a method declaration.
- * The corresponding syntactic units are MethodDeclaration (JLS2 8.4),
- * ConstructorDeclaration (JLS2 8.8), and AbstractMethodDeclaration (JLS2 9.4).
- * A method has no children and its parent is a type.
- * Local classes are considered to be part of the body of a method, not a child.
+ * Represents a method declaration. The corresponding syntactic units are
+ * MethodDeclaration (JLS2 8.4), ConstructorDeclaration (JLS2 8.8), and
+ * AbstractMethodDeclaration (JLS2 9.4). A method has no children and its parent
+ * is a type. Local classes are considered to be part of the body of a method,
+ * not a child.
*
* This interface is not intended to be implemented by clients.
*
*/
public interface IDOMMethod extends IDOMMember {
-/**
- * Adds the given exception to the end of the list of exceptions this method
- * is declared to throw.
- * The syntax for an exception type name is defined by Method Throws (JLS2 8.4.4).
- * Type names must be specified as they would appear in source code. For
- * example: "IOException" or "java.io.IOException".
- * This is a convenience method for setExceptions.
- *
- * @param exceptionType the exception type
- * @exception IllegalArgumentException if null is specified
- * @see #setExceptions
- */
-public void addException(String exceptionType) throws IllegalArgumentException;
-/**
- * Adds the given parameter to the end of the parameter list.
- * This is a convenience method for setParameters.
- * The syntax for parameter names is defined by Formal Parameters (JLS2 8.4.1).
- * The syntax for type names is defined by Formal Parameters (JLS2 8.4.1).
- * Type names must be specified as they would appear in source code. For
- * example: "File", "java.io.File", or
- * "int[]".
- *
- * @param type the type name
- * @param name the parameter name
- * @exception IllegalArgumentException if null is specified for
- * either the type or the name
- * @see #setParameters
- */
-public void addParameter(String type, String name) throws IllegalArgumentException;
-/**
- * Returns the body of this method. The method body includes all code following
- * the method declaration, including the enclosing braces.
- *
- * @return the body, or null if the method has no body (for
- * example, for an abstract or native method)
- */
-public String getBody();
-/**
- * Returns the names of the exception types this method throws
- * in the order in which they are declared in the source, or an empty array
- * if this method declares no exception types.
- * The syntax for an exception type name is defined by Method Throws (JLS2 8.4.4).
- * Type names appear as they would in source code. For example:
- * "IOException" or "java.io.IOException".
- *
- * @return the list of exception types
- */
-public String[] getExceptions();
-/**
- * The IDOMMethod refinement of this IDOMNode
- * method returns the name of this method. Returns null for
- * constructors. The syntax for a method name is defined by Identifier
- * of MethodDeclarator (JLS2 8.4).
- */
-public String getName();
-/**
- * Returns the names of parameters in this method in the order they are declared,
- * or null if no parameters are declared.
- * The syntax for parameter names is defined by Formal Parameters (JLS2 8.4.1).
- *
- * @return the list of parameter names, or null if no parameters
- * are declared
- */
-public String[] getParameterNames();
-/**
- * Returns the type names for the parameters of this method in the order they are declared,
- * or null if no parameters are declared.
- * The syntax for type names is defined by Formal Parameters (JLS2 8.4.1).
- * Type names must be specified as they would appear in source code. For
- * example: "File", "java.io.File", or
- * "int[]".
- *
- * @return the list of parameter types, or null if no parameters
- * are declared
- */
-public String[] getParameterTypes();
-/**
- * Returns the return type name, or null.
- * Returns null for constructors.
- * The syntax for return type name corresponds to ReturnType in
- * MethodDeclaration (JLS2 8.4). Names are returned as they appear in the source
- * code; for example: "File", "java.io.File",
- * "int[]", or "void".
- *
- * @return the return type
- */
-public String getReturnType();
-/**
- * Returns whether this method is a constructor.
- *
- * @return true for constructors, and false for methods
- */
-public boolean isConstructor();
-/**
- * Sets the body of this method. The method body includes all code following
- * the method declaration, including the enclosing braces. No formatting or
- * syntax checking is performed on the body.
- *
- * @return the body, or null indicating the method has no body (for
- * example, for an abstract or native method)
- */
-public void setBody(String body);
-/**
- * Sets whether this method represents a constructor.
- *
- * @param b true for constructors, and false for methods
- */
-public void setConstructor(boolean b);
-/**
- * Sets the names of the exception types this method throws,
- * in the order in which they are declared in the source. An empty array
- * indicates this method declares no exception types.
- * The syntax for an exception type name is defined by Method Throws (JLS2 8.4.4).
- * Type names must be specified as they would appear in source code. For
- * example: "IOException" or "java.io.IOException".
- *
- * @param exceptionTypes the list of exception types
- */
-public void setExceptions(String[] exceptionTypes);
-/**
- * The IDOMMethod refinement of this IDOMNode
- * method sets the name of this method. The syntax for a method
- * name is defined by Identifer of MethodDeclarator (JLS2 8.4).
- *
- * The name of a constructor is always null and thus it
- * must not be set.
- *
- *
- * @exception IllegalArgumentException if null is specified
- */
-public void setName(String name) throws IllegalArgumentException;
-/**
- * Sets the types and names of parameters in this method in the order they are
- * to be declared. If both types and names are null
- * this indicates that this method has no parameters.
- * The syntax for parameter names is defined by Formal Parameters (JLS2 8.4.1).
- * The syntax for type names is defined by Formal Parameters (JLS2 8.4.1).
- * Type names must be specified as they would appear in source code. For
- * example: "File", "java.io.File", or
- * "int[]".
- *
- * @param types the list of type names
- * @param names the list of parameter name
- * @exception IllegalArgumentException if the number of types and names do not
- * match, or if either argument is null
- */
-public void setParameters(String[] types, String[] names) throws IllegalArgumentException;
-/**
- * Sets the return type name. This has no effect on constructors.
- * The syntax for return type name corresponds to ReturnType in
- * MethodDeclaration (JLS2 8.4). Type names are specified as they appear in the
- * source code; for example: "File", "java.io.File",
- * "int[]", or "void".
- *
- * @param type the return type
- * @exception IllegalArgumentException if null is specified
- */
-public void setReturnType(String type) throws IllegalArgumentException;
+ /**
+ * Adds the given exception to the end of the list of exceptions this method
+ * is declared to throw. The syntax for an exception type name is defined by
+ * Method Throws (JLS2 8.4.4). Type names must be specified as they would
+ * appear in source code. For example: "IOException" or
+ * "java.io.IOException". This is a convenience method for
+ * setExceptions.
+ *
+ * @param exceptionType
+ * the exception type
+ * @exception IllegalArgumentException
+ * if null is specified
+ * @see #setExceptions
+ */
+ public void addException(String exceptionType)
+ throws IllegalArgumentException;
+
+ /**
+ * Adds the given parameter to the end of the parameter list. This is a
+ * convenience method for setParameters. The syntax for
+ * parameter names is defined by Formal Parameters (JLS2 8.4.1). The syntax
+ * for type names is defined by Formal Parameters (JLS2 8.4.1). Type names
+ * must be specified as they would appear in source code. For example:
+ * "File", "java.io.File", or
+ * "int[]".
+ *
+ * @param type
+ * the type name
+ * @param name
+ * the parameter name
+ * @exception IllegalArgumentException
+ * if null is specified for either the type or
+ * the name
+ * @see #setParameters
+ */
+ public void addParameter(String type, String name)
+ throws IllegalArgumentException;
+
+ /**
+ * Returns the body of this method. The method body includes all code
+ * following the method declaration, including the enclosing braces.
+ *
+ * @return the body, or null if the method has no body (for
+ * example, for an abstract or native method)
+ */
+ public String getBody();
+
+ /**
+ * Returns the names of the exception types this method throws in the order
+ * in which they are declared in the source, or an empty array if this
+ * method declares no exception types. The syntax for an exception type name
+ * is defined by Method Throws (JLS2 8.4.4). Type names appear as they would
+ * in source code. For example: "IOException" or
+ * "java.io.IOException".
+ *
+ * @return the list of exception types
+ */
+ public String[] getExceptions();
+
+ /**
+ * The IDOMMethod refinement of this IDOMNode
+ * method returns the name of this method. Returns null for
+ * constructors. The syntax for a method name is defined by Identifier of
+ * MethodDeclarator (JLS2 8.4).
+ */
+ public String getName();
+
+ /**
+ * Returns the names of parameters in this method in the order they are
+ * declared, or null if no parameters are declared. The
+ * syntax for parameter names is defined by Formal Parameters (JLS2 8.4.1).
+ *
+ * @return the list of parameter names, or null if no
+ * parameters are declared
+ */
+ public String[] getParameterNames();
+
+ /**
+ * Returns the type names for the parameters of this method in the order
+ * they are declared, or null if no parameters are declared.
+ * The syntax for type names is defined by Formal Parameters (JLS2 8.4.1).
+ * Type names must be specified as they would appear in source code. For
+ * example: "File", "java.io.File", or
+ * "int[]".
+ *
+ * @return the list of parameter types, or null if no
+ * parameters are declared
+ */
+ public String[] getParameterTypes();
+
+ /**
+ * Returns the return type name, or null. Returns
+ * null for constructors. The syntax for return type name
+ * corresponds to ReturnType in MethodDeclaration (JLS2 8.4). Names are
+ * returned as they appear in the source code; for example:
+ * "File", "java.io.File",
+ * "int[]", or "void".
+ *
+ * @return the return type
+ */
+ public String getReturnType();
+
+ /**
+ * Returns whether this method is a constructor.
+ *
+ * @return true for constructors, and false
+ * for methods
+ */
+ public boolean isConstructor();
+
+ /**
+ * Sets the body of this method. The method body includes all code following
+ * the method declaration, including the enclosing braces. No formatting or
+ * syntax checking is performed on the body.
+ *
+ * @return the body, or null indicating the method has no
+ * body (for example, for an abstract or native method)
+ */
+ public void setBody(String body);
+
+ /**
+ * Sets whether this method represents a constructor.
+ *
+ * @param b
+ * true for constructors, and false
+ * for methods
+ */
+ public void setConstructor(boolean b);
+
+ /**
+ * Sets the names of the exception types this method throws, in the order in
+ * which they are declared in the source. An empty array indicates this
+ * method declares no exception types. The syntax for an exception type name
+ * is defined by Method Throws (JLS2 8.4.4). Type names must be specified as
+ * they would appear in source code. For example: "IOException"
+ * or "java.io.IOException".
+ *
+ * @param exceptionTypes
+ * the list of exception types
+ */
+ public void setExceptions(String[] exceptionTypes);
+
+ /**
+ * The IDOMMethod refinement of this IDOMNode
+ * method sets the name of this method. The syntax for a method name is
+ * defined by Identifer of MethodDeclarator (JLS2 8.4).
+ *
+ * The name of a constructor is always null and thus it must
+ * not be set.
+ *
+ *
+ * @exception IllegalArgumentException
+ * if null is specified
+ */
+ public void setName(String name) throws IllegalArgumentException;
+
+ /**
+ * Sets the types and names of parameters in this method in the order they
+ * are to be declared. If both types and names
+ * are null this indicates that this method has no
+ * parameters. The syntax for parameter names is defined by Formal
+ * Parameters (JLS2 8.4.1). The syntax for type names is defined by Formal
+ * Parameters (JLS2 8.4.1). Type names must be specified as they would
+ * appear in source code. For example: "File",
+ * "java.io.File", or "int[]".
+ *
+ * @param types
+ * the list of type names
+ * @param names
+ * the list of parameter name
+ * @exception IllegalArgumentException
+ * if the number of types and names do not match, or if
+ * either argument is null
+ */
+ public void setParameters(String[] types, String[] names)
+ throws IllegalArgumentException;
+
+ /**
+ * Sets the return type name. This has no effect on constructors. The syntax
+ * for return type name corresponds to ReturnType in MethodDeclaration (JLS2
+ * 8.4). Type names are specified as they appear in the source code; for
+ * example: "File", "java.io.File",
+ * "int[]", or "void".
+ *
+ * @param type
+ * the return type
+ * @exception IllegalArgumentException
+ * if null is specified
+ */
+ public void setReturnType(String type) throws IllegalArgumentException;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMNode.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMNode.java
index 9c61412..10a162b 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMNode.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMNode.java
@@ -14,265 +14,321 @@ import java.util.Enumeration;
import net.sourceforge.phpdt.core.IJavaElement;
-
/**
- * Nodes represent structural fragments of a Java source file, also known as document fragments. Their implementation
- * is known as a DOM (Document Object Model) - in this case a JDOM (Java DOM). A root node (node
- * with no parent or siblings) represents the root of a document fragment (DF). A complete Java document is
- * represented by a compilation unit node (IDOMCompilationUnit). In this way, a DF is
- * comprised of DFs, and a document itself (compilation unit) is also a DF.
+ * Nodes represent structural fragments of a Java source file, also known as
+ * document fragments. Their implementation is known as a DOM (Document Object
+ * Model) - in this case a JDOM (Java DOM). A root node (node with no parent or
+ * siblings) represents the root of a document fragment (DF). A complete Java
+ * document is represented by a compilation unit node (IDOMCompilationUnit).
+ * In this way, a DF is comprised of DFs, and a document itself (compilation
+ * unit) is also a DF.
*
- * A DF may be created empty and programmatically filled, or it may be created from
- * a source code string. The IDOMFactory allows the creation of all kinds
- * of nodes from source code strings. Manipulations performed on a DF are immediately
- * reflected in the DF's contents.
+ * A DF may be created empty and programmatically filled, or it may be created
+ * from a source code string. The IDOMFactory allows the creation
+ * of all kinds of nodes from source code strings. Manipulations performed on a
+ * DF are immediately reflected in the DF's contents.
*
*
- * Children fragments are represented as a linked list of nodes. Children are inserted via their parent node, and
- * are automatically linked up with previous and next nodes.
+ * Children fragments are represented as a linked list of nodes. Children are
+ * inserted via their parent node, and are automatically linked up with previous
+ * and next nodes.
*
*
- * The contents of any node (DF) may be retrieved at any time. In this way it is possible to retrieve
- * source code representing fragments of the compilation unit (for example, a type or a method), since
- * the contents of any node (not just the root node) may be obtained.
+ * The contents of any node (DF) may be retrieved at any time. In this way it is
+ * possible to retrieve source code representing fragments of the compilation
+ * unit (for example, a type or a method), since the contents of any node (not
+ * just the root node) may be obtained.
*
*
* The following manipulations on DFs are distinct:
*
- *
clone - this creates a stand-alone copy of the DF that is in no way dependent on the DF that it was cloned from
- *
remove - this orphans a DF from its host DF. The removed DF may still be dependent on its previous host
- * (perhaps to generate its contents), and hanging onto the fragment means that its previous host is also
- * retained in memory.
- *
add/insert - this splices an un-parented DF (one that has been cloned, removed, or created stand-alone),
- * into an existing DF such that the newly inserted DF is only dependent on its new host.
+ *
clone - this creates a stand-alone copy of the DF that is in no way
+ * dependent on the DF that it was cloned from
+ *
remove - this orphans a DF from its host DF. The removed DF may still be
+ * dependent on its previous host (perhaps to generate its contents), and
+ * hanging onto the fragment means that its previous host is also retained in
+ * memory.
+ *
add/insert - this splices an un-parented DF (one that has been cloned,
+ * removed, or created stand-alone), into an existing DF such that the newly
+ * inserted DF is only dependent on its new host.
*
*
*
- * Wherever types are specified in DOM APIs, type names must be specified as they would appear
- * in source code. The DOM does not have a notion of type signatures, only raw text. Example type
- * names are "Object", "java.io.File", and "int[]".
+ * Wherever types are specified in DOM APIs, type names must be specified as
+ * they would appear in source code. The DOM does not have a notion of type
+ * signatures, only raw text. Example type names are "Object",
+ * "java.io.File", and "int[]".
*
*
* This interface is not intended to be implemented by clients.
*
*/
-public interface IDOMNode extends Cloneable {
+public interface IDOMNode extends Cloneable {
/**
- * Node type constant indicating a compilation unit.
- * Nodes of this type maybe by safely cast to IDOMCompilationUnit.
+ * Node type constant indicating a compilation unit. Nodes of this type
+ * maybe by safely cast to IDOMCompilationUnit.
+ *
* @see #getNodeType
*/
- public static int COMPILATION_UNIT= 1;
-
+ public static int COMPILATION_UNIT = 1;
+
/**
- * Node type constant indicating a package declaration.
- * Nodes of this type maybe by safely cast to IDOMPackage.
- * @see #getNodeType
+ * Node type constant indicating a package declaration. Nodes of this type
+ * maybe by safely cast to IDOMPackage.
+ *
+ * @see #getNodeType
*/
- public static int PACKAGE= 2;
-
+ public static int PACKAGE = 2;
+
/**
- * Node type constant indicating an import declaration.
- * Nodes of this type maybe by safely cast to IDOMImport.
+ * Node type constant indicating an import declaration. Nodes of this type
+ * maybe by safely cast to IDOMImport.
+ *
* @see #getNodeType
*/
- public static int IMPORT= 3;
-
+ public static int IMPORT = 3;
+
/**
- * Node type constant indicating a type declaration.
- * Nodes of this type maybe by safely cast to IDOMType.
+ * Node type constant indicating a type declaration. Nodes of this type
+ * maybe by safely cast to IDOMType.
+ *
* @see #getNodeType
*/
- public static int TYPE= 4;
-
+ public static int TYPE = 4;
+
/**
- * Node type constant indicating a field declaration.
- * Nodes of this type maybe by safely cast to IDOMField.
+ * Node type constant indicating a field declaration. Nodes of this type
+ * maybe by safely cast to IDOMField.
+ *
* @see #getNodeType
*/
- public static int FIELD= 5;
-
+ public static int FIELD = 5;
+
/**
* Node type constant indicating a method (or constructor) declaration.
* Nodes of this type maybe by safely cast to IDOMMethod.
+ *
* @see #getNodeType
*/
- public static int METHOD= 6;
-
+ public static int METHOD = 6;
+
/**
- * Node type constant indicating an initializer declaration.
- * Nodes of this type maybe by safely cast to IDOMInitializer.
+ * Node type constant indicating an initializer declaration. Nodes of this
+ * type maybe by safely cast to IDOMInitializer.
+ *
* @see #getNodeType
*/
- public static int INITIALIZER= 7;
-
-/**
- * Adds the given un-parented node (document fragment) as the last child of this node.
- *
- * @param child the new child node
- * @exception DOMException if any of the following conditions hold:
- *
this node is not allowed to have children,
- *
the child is not of an allowable type
- *
the child already has a parent
- *
the child is an ancestor of this node
- *
- * @exception IllegalArgumentException if the child is null
- *
- * @see #insertSibling
- * @see #remove
- */
-public void addChild(IDOMNode child) throws DOMException, IllegalArgumentException;
-/**
- * Returns whether this node is allowed to have children.
- *
- * @return true if this node can have children
- */
-public boolean canHaveChildren();
-/**
- * Returns a stand-alone copy of the document fragment represented by this node that
- * is in no way dependent on the document this node is part of.
- *
- * @return a copy of type IDOMNode
- * @see #addChild
- * @see #insertSibling
- * @see #remove
- */
-public Object clone();
-/**
- * Returns the current contents of this document fragment as a character array.
- *
- * Note: To obtain complete source for the ".java" file, ask a compilation unit
- * node for its contents.
- *
- *
- * @return the contents, or null if this node has no contents
- */
-public char[] getCharacters();
-/**
- * Returns the first named child of this node with the given name.
- *
- * @param name the name
- * @return the child node, or null if no such child exists
- */
-public IDOMNode getChild(String name);
-/**
- * Returns an enumeration of children of this node. Returns an empty enumeration
- * if this node has no children (including nodes that cannot have children).
- * Children appear in the order in which they are declared in the source code.
- *
- * @return an enumeration of the children
- */
-public Enumeration getChildren();
-/**
- * Returns the current contents of this document fragment.
- *
- * Note: To obtain complete source for the ".java" file, ask a compilation unit
- * node for its contents.
- *
- *
- * @return the contents, or null if this node has no contents
- */
-public String getContents();
-/**
- * Returns the first child of this node.
- * Children appear in the order in which they exist in the source code.
- *
- * @return the first child, or null if this node has no children
- * @see #getChildren
- */
-public IDOMNode getFirstChild();
-/**
- * Returns a handle for the Java element associated with this
- * document fragment, based on the parent Java element.
- *
- * @param parent the parent Java element
- * @exception IllegalArgumentException if the parent element is not
- * of a valid parent type for this node
- */
-public IJavaElement getJavaElement(IJavaElement parent) throws IllegalArgumentException;
-/**
- * Returns the name of this node.
- * More details are provided in each of the subtypes.
- *
- * @return the name, or null if it has no name
- */
-public String getName();
-/**
- * Returns the sibling node immediately following this node.
- *
- * @return the next node, or null if there is no following node
- */
-public IDOMNode getNextNode();
-/**
- * Returns the type of this node.
- *
- * @return one of the node type constants defined in IDOMNode
- */
-public int getNodeType();
-/**
- * Returns the parent of this node.
- *
- * @return the parent node, or null if this node does not have a
- * parent
- */
-public IDOMNode getParent();
-/**
- * Returns the sibling node immediately preceding this node.
- *
- * @return the previous node, or null if there is no preceding node
- */
-public IDOMNode getPreviousNode();
-/**
- * Inserts the given un-parented node as a sibling of this node, immediately before
- * this node.
- *
- * @param sibling the new sibling node
- * @exception DOMException if any of the following conditions hold:
- *
this node is a document fragment root
- *
the sibling is not of the correct type
- *
the sibling already has a parent
- *
this sibling is an ancestor of this node
- *
- * @exception IllegalArgumentException if the sibling is null
- *
- * @see #addChild
- * @see #clone
- * @see #remove
- */
-public void insertSibling(IDOMNode sibling) throws DOMException, IllegalArgumentException;
-/**
- * Returns whether the given node is an allowable child for this node.
- *
- * @param node the potential child node
- * @return true if the given node is an allowable child
- */
-public boolean isAllowableChild(IDOMNode node);
-/**
- * Returns whether this node's signature is equivalent to the given
- * node's signature. In other words, if the nodes were siblings,
- * would the declarations collide because they represent the same declaration.
- *
- * @param node the other node
- * @return true if the nodes have equivalent signatures
- */
-public boolean isSignatureEqual(IDOMNode node);
-/**
- * Separates this node from its parent and siblings, maintaining any ties that this node
- * has to the underlying document fragment. A document fragment that is removed
- * from its host document may still be dependent on that host document until it is
- * inserted into a different document. Removing a root node has no effect.
- *
- * @see #addChild
- * @see #clone
- * @see #insertSibling
- */
-public void remove();
-/**
- * Sets the name of this node. Name format depends on node type.
- * More details are provided in each of the subtypes.
- *
- * @param name the name, or null to clear the name
- */
-public void setName(String name);
+ public static int INITIALIZER = 7;
+
+ /**
+ * Adds the given un-parented node (document fragment) as the last child of
+ * this node.
+ *
+ * @param child
+ * the new child node
+ * @exception DOMException
+ * if any of the following conditions hold:
+ *
+ *
this node is not allowed to have children,
+ *
the child is not of an allowable type
+ *
the child already has a parent
+ *
the child is an ancestor of this node
+ *
+ * @exception IllegalArgumentException
+ * if the child is null
+ *
+ * @see #insertSibling
+ * @see #remove
+ */
+ public void addChild(IDOMNode child) throws DOMException,
+ IllegalArgumentException;
+
+ /**
+ * Returns whether this node is allowed to have children.
+ *
+ * @return true if this node can have children
+ */
+ public boolean canHaveChildren();
+
+ /**
+ * Returns a stand-alone copy of the document fragment represented by this
+ * node that is in no way dependent on the document this node is part of.
+ *
+ * @return a copy of type IDOMNode
+ * @see #addChild
+ * @see #insertSibling
+ * @see #remove
+ */
+ public Object clone();
+
+ /**
+ * Returns the current contents of this document fragment as a character
+ * array.
+ *
+ * Note: To obtain complete source for the ".java" file, ask a compilation
+ * unit node for its contents.
+ *
+ *
+ * @return the contents, or null if this node has no contents
+ */
+ public char[] getCharacters();
+
+ /**
+ * Returns the first named child of this node with the given name.
+ *
+ * @param name
+ * the name
+ * @return the child node, or null if no such child exists
+ */
+ public IDOMNode getChild(String name);
+
+ /**
+ * Returns an enumeration of children of this node. Returns an empty
+ * enumeration if this node has no children (including nodes that cannot
+ * have children). Children appear in the order in which they are declared
+ * in the source code.
+ *
+ * @return an enumeration of the children
+ */
+ public Enumeration getChildren();
+
+ /**
+ * Returns the current contents of this document fragment.
+ *
+ * Note: To obtain complete source for the ".java" file, ask a compilation
+ * unit node for its contents.
+ *
+ *
+ * @return the contents, or null if this node has no contents
+ */
+ public String getContents();
+
+ /**
+ * Returns the first child of this node. Children appear in the order in
+ * which they exist in the source code.
+ *
+ * @return the first child, or null if this node has no
+ * children
+ * @see #getChildren
+ */
+ public IDOMNode getFirstChild();
+
+ /**
+ * Returns a handle for the Java element associated with this document
+ * fragment, based on the parent Java element.
+ *
+ * @param parent
+ * the parent Java element
+ * @exception IllegalArgumentException
+ * if the parent element is not of a valid parent type for
+ * this node
+ */
+ public IJavaElement getJavaElement(IJavaElement parent)
+ throws IllegalArgumentException;
+
+ /**
+ * Returns the name of this node. More details are provided in each of the
+ * subtypes.
+ *
+ * @return the name, or null if it has no name
+ */
+ public String getName();
+
+ /**
+ * Returns the sibling node immediately following this node.
+ *
+ * @return the next node, or null if there is no following
+ * node
+ */
+ public IDOMNode getNextNode();
+
+ /**
+ * Returns the type of this node.
+ *
+ * @return one of the node type constants defined in IDOMNode
+ */
+ public int getNodeType();
+
+ /**
+ * Returns the parent of this node.
+ *
+ * @return the parent node, or null if this node does not
+ * have a parent
+ */
+ public IDOMNode getParent();
+
+ /**
+ * Returns the sibling node immediately preceding this node.
+ *
+ * @return the previous node, or null if there is no
+ * preceding node
+ */
+ public IDOMNode getPreviousNode();
+
+ /**
+ * Inserts the given un-parented node as a sibling of this node, immediately
+ * before this node.
+ *
+ * @param sibling
+ * the new sibling node
+ * @exception DOMException
+ * if any of the following conditions hold:
+ *
+ *
this node is a document fragment root
+ *
the sibling is not of the correct type
+ *
the sibling already has a parent
+ *
this sibling is an ancestor of this node
+ *
+ * @exception IllegalArgumentException
+ * if the sibling is null
+ *
+ * @see #addChild
+ * @see #clone
+ * @see #remove
+ */
+ public void insertSibling(IDOMNode sibling) throws DOMException,
+ IllegalArgumentException;
+
+ /**
+ * Returns whether the given node is an allowable child for this node.
+ *
+ * @param node
+ * the potential child node
+ * @return true if the given node is an allowable child
+ */
+ public boolean isAllowableChild(IDOMNode node);
+
+ /**
+ * Returns whether this node's signature is equivalent to the given node's
+ * signature. In other words, if the nodes were siblings, would the
+ * declarations collide because they represent the same declaration.
+ *
+ * @param node
+ * the other node
+ * @return true if the nodes have equivalent signatures
+ */
+ public boolean isSignatureEqual(IDOMNode node);
+
+ /**
+ * Separates this node from its parent and siblings, maintaining any ties
+ * that this node has to the underlying document fragment. A document
+ * fragment that is removed from its host document may still be dependent on
+ * that host document until it is inserted into a different document.
+ * Removing a root node has no effect.
+ *
+ * @see #addChild
+ * @see #clone
+ * @see #insertSibling
+ */
+ public void remove();
+
+ /**
+ * Sets the name of this node. Name format depends on node type. More
+ * details are provided in each of the subtypes.
+ *
+ * @param name
+ * the name, or null to clear the name
+ */
+ public void setName(String name);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMPackage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMPackage.java
index 49333c8..c085d3a 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMPackage.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMPackage.java
@@ -9,28 +9,31 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package net.sourceforge.phpdt.core.jdom;
+
/**
- * Represents a package declaration.
- * The corresponding syntactic unit is PackageDeclaration (JLS2 7.4).
- * A Package has no children, and its parent is a compilation unit.
+ * Represents a package declaration. The corresponding syntactic unit is
+ * PackageDeclaration (JLS2 7.4). A Package has no children, and its parent is a
+ * compilation unit.
*
* This interface is not intended to be implemented by clients.
*
*/
public interface IDOMPackage extends IDOMNode {
-/**
- * The IDOMPackage refinement of this IDOMNode
- * method returns the name of this package declaration, or null
- * if it has none. The syntax for a package name corresponds to PackageName
- * as defined by PackageDeclaration (JLS2 7.4).
- */
-public String getName();
-/**
- * The IDOMPackage refinement of this IDOMNode
- * method sets the name of this package declaration. The syntax for a package
- * name corresponds to PackageName as defined by PackageDeclaration (JLS2 7.4).
- * A null name indicates an empty package declaration; that is,
- * getContents returns the empty string.
- */
-public void setName(String name);
+ /**
+ * The IDOMPackage refinement of this IDOMNode
+ * method returns the name of this package declaration, or null
+ * if it has none. The syntax for a package name corresponds to PackageName
+ * as defined by PackageDeclaration (JLS2 7.4).
+ */
+ public String getName();
+
+ /**
+ * The IDOMPackage refinement of this IDOMNode
+ * method sets the name of this package declaration. The syntax for a
+ * package name corresponds to PackageName as defined by PackageDeclaration
+ * (JLS2 7.4). A null name indicates an empty package
+ * declaration; that is, getContents returns the empty
+ * string.
+ */
+ public void setName(String name);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMType.java
index 5a4c62e..ef4c0ed 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMType.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/jdom/IDOMType.java
@@ -11,117 +11,142 @@
package net.sourceforge.phpdt.core.jdom;
/**
- * Represents a source type in a compilation unit, either as a top-level type or a member type.
- * The corresponding syntactic units are ClassDeclaration (JLS2 8.1) and InterfaceDeclaration (JLS2 9.1).
+ * Represents a source type in a compilation unit, either as a top-level type or
+ * a member type. The corresponding syntactic units are ClassDeclaration (JLS2
+ * 8.1) and InterfaceDeclaration (JLS2 9.1).
*
- * Allowable child types for a type are IDOMType, IDOMField,
- * IDOMMethod, and IDOMInitializer.
- * Children are listed in the order in which they appear in the source. The parent of a type
- * is a type (in the case of a member type) or a compilation unit (in the case of a top-level type).
+ * Allowable child types for a type are IDOMType,
+ * IDOMField, IDOMMethod, and
+ * IDOMInitializer. Children are listed in the order in which
+ * they appear in the source. The parent of a type is a type (in the case of a
+ * member type) or a compilation unit (in the case of a top-level type).
*
*
* This interface is not intended to be implemented by clients.
*
*/
public interface IDOMType extends IDOMMember {
-/**
- * Adds the given interface name to the names of interfaces that this type implements or extends
- * (the name will be added after the existing interface names). This is a convenience method.
- *
- * For classes, this represents the interfaces that this class implements.
- * For interfaces, this represents the interfaces that this interface extends.
- * The name may or may not be fully qualified.
- *
- * @param interfaceName the syntax for an interface name is defined by
- * Interfaces in ClassDeclaration (JLS2 8.1). Type names must be specified as they would
- * appear in source code. For example: "Cloneable", "java.io.Serializable".
- *
- * @exception IllegalArgumentException if null is specified
- */
-public void addSuperInterface(String interfaceName) throws IllegalArgumentException;
-/**
- * The IDOMType refinement of this IDOMNode
- * method returns the name of this type. The name of a class is defined by
- * ClassDeclaration (JLS2 8.1); the name of an interface is defined by
- * InterfaceDeclaration (JLS2 9.1).
- */
-public String getName();
-/**
- * Returns the name of this type's superclass. The syntax for a superclass name
- * is specified by Super in ClassDeclaration (JLS2 8.1). Type names must be
- * specified as they would appear in source code. For example:
- * "Object", or "java.io.File".
- *
- * @return the superclass name, or null if this type represents
- * an interface or if no superclass has been assigned to this class
- */
-public String getSuperclass();
-/**
- * Returns the names of interfaces that this type implements or extends,
- * in the order in which they are listed in the source, or an empty array
- * if no superinterfaces are present. The syntax for interface names is
- * defined by Interfaces in ClassDeclaration (JLS2 8.1). Type names appear
- * as they would in source code. For example: "Cloneable",
- * or "java.io.Serializable".
- *
- * For classes, this method returns the interfaces that this class implements.
- * For interfaces, this method returns the interfaces that this interface extends.
- *
- *
- * @return the list of interface names
- */
-public String[] getSuperInterfaces();
-/**
- * Returns whether this type is a class.
- *
- * @return true for classes, and false for interfaces
- */
-public boolean isClass();
-/**
- * Sets whether this type is a class or an interface. If this type is
- * a class, and is changed to an interface, this type's superclass
- * becomes null. When a class becomes an interface or an
- * interface becomes a class, superinterfaces remain (as part of an
- * implements clause for classes, or an extends
- * clause for interfaces).
- *
- * @param b true for classes, and false for interfaces
- */
-public void setClass(boolean b);
-/**
- * The IDOMType refinement of this IDOMNode
- * method sets the name of this type. The name of a class is defined by
- * ClassDeclaration (JLS2 8.1); the name of an interface is defined by
- * InterfaceDeclaration (JLS2 9.1).
- *
- * @exception IllegalArgumentException if null is specified
- */
-public void setName(String name) throws IllegalArgumentException;
-/**
- * Sets the name of this type's superclass. Has no effect if this type
- * represents an interface. A null name indicates that no
- * superclass name (extends clause) should appear in the source code.
- * The syntax for a superclass name is specified by Super in ClassDeclaration
- * (JLS2 8.1). Type names must be specified as they would appear in source code.
- * For example: "Object", or "java.io.File".
- *
- * @param superclassName the superclass name, or null if this type
- * should have to no explicitly specified superclass
- */
-public void setSuperclass(String superclassName);
-/**
- * Sets the names of interfaces that this type implements or extends,
- * in the order in which they are to be listed in the source. An empty array
- * parameter indicates that no superinterfaces are present. The syntax for
- * interface names is defined by Interfaces in ClassDeclaration (JLS2 8.1).
- * Type names appear as they would in source code. For example:
- * "Cloneable", or "java.io.Serializable".
- *
- * For classes, this method sets the interfaces that this class implements.
- * For interfaces, this method sets the interfaces that this interface extends.
- *
- *
- * @param interfaceNames the list of interface names
- */
-public void setSuperInterfaces(String[] interfaceNames);
+ /**
+ * Adds the given interface name to the names of interfaces that this type
+ * implements or extends (the name will be added after the existing
+ * interface names). This is a convenience method.
+ *
+ * For classes, this represents the interfaces that this class implements.
+ * For interfaces, this represents the interfaces that this interface
+ * extends. The name may or may not be fully qualified.
+ *
+ * @param interfaceName
+ * the syntax for an interface name is defined by Interfaces in
+ * ClassDeclaration (JLS2 8.1). Type names must be specified as
+ * they would appear in source code. For example: "Cloneable",
+ * "java.io.Serializable".
+ *
+ * @exception IllegalArgumentException
+ * if null is specified
+ */
+ public void addSuperInterface(String interfaceName)
+ throws IllegalArgumentException;
+
+ /**
+ * The IDOMType refinement of this IDOMNode
+ * method returns the name of this type. The name of a class is defined by
+ * ClassDeclaration (JLS2 8.1); the name of an interface is defined by
+ * InterfaceDeclaration (JLS2 9.1).
+ */
+ public String getName();
+
+ /**
+ * Returns the name of this type's superclass. The syntax for a superclass
+ * name is specified by Super in ClassDeclaration (JLS2 8.1). Type names
+ * must be specified as they would appear in source code. For example:
+ * "Object", or "java.io.File".
+ *
+ * @return the superclass name, or null if this type
+ * represents an interface or if no superclass has been assigned to
+ * this class
+ */
+ public String getSuperclass();
+
+ /**
+ * Returns the names of interfaces that this type implements or extends, in
+ * the order in which they are listed in the source, or an empty array if no
+ * superinterfaces are present. The syntax for interface names is defined by
+ * Interfaces in ClassDeclaration (JLS2 8.1). Type names appear as they
+ * would in source code. For example: "Cloneable", or
+ * "java.io.Serializable".
+ *
+ * For classes, this method returns the interfaces that this class
+ * implements. For interfaces, this method returns the interfaces that this
+ * interface extends.
+ *
+ *
+ * @return the list of interface names
+ */
+ public String[] getSuperInterfaces();
+
+ /**
+ * Returns whether this type is a class.
+ *
+ * @return true for classes, and false for
+ * interfaces
+ */
+ public boolean isClass();
+
+ /**
+ * Sets whether this type is a class or an interface. If this type is a
+ * class, and is changed to an interface, this type's superclass becomes
+ * null. When a class becomes an interface or an interface
+ * becomes a class, superinterfaces remain (as part of an
+ * implements clause for classes, or an extends
+ * clause for interfaces).
+ *
+ * @param b
+ * true for classes, and false for
+ * interfaces
+ */
+ public void setClass(boolean b);
+
+ /**
+ * The IDOMType refinement of this IDOMNode
+ * method sets the name of this type. The name of a class is defined by
+ * ClassDeclaration (JLS2 8.1); the name of an interface is defined by
+ * InterfaceDeclaration (JLS2 9.1).
+ *
+ * @exception IllegalArgumentException
+ * if null is specified
+ */
+ public void setName(String name) throws IllegalArgumentException;
+
+ /**
+ * Sets the name of this type's superclass. Has no effect if this type
+ * represents an interface. A null name indicates that no
+ * superclass name (extends clause) should appear in the source code. The
+ * syntax for a superclass name is specified by Super in ClassDeclaration
+ * (JLS2 8.1). Type names must be specified as they would appear in source
+ * code. For example: "Object", or
+ * "java.io.File".
+ *
+ * @param superclassName
+ * the superclass name, or null if this type
+ * should have to no explicitly specified superclass
+ */
+ public void setSuperclass(String superclassName);
+
+ /**
+ * Sets the names of interfaces that this type implements or extends, in the
+ * order in which they are to be listed in the source. An empty array
+ * parameter indicates that no superinterfaces are present. The syntax for
+ * interface names is defined by Interfaces in ClassDeclaration (JLS2 8.1).
+ * Type names appear as they would in source code. For example:
+ * "Cloneable", or "java.io.Serializable".
+ *
+ * For classes, this method sets the interfaces that this class implements.
+ * For interfaces, this method sets the interfaces that this interface
+ * extends.
+ *
+ *
+ * @param interfaceNames
+ * the list of interface names
+ */
+ public void setSuperInterfaces(String[] interfaceNames);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/IJavaSearchConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/IJavaSearchConstants.java
index 6c3a8ea..edf7402 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/IJavaSearchConstants.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/IJavaSearchConstants.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package net.sourceforge.phpdt.core.search;
-//import net.sourceforge.phpdt.internal.core.search.processing.*;
+// import net.sourceforge.phpdt.internal.core.search.processing.*;
/**
*
* This interface declares constants only; it is not intended to be implemented.
*
+ *
* @see org.eclipse.jdt.core.search.SearchEngine
*/
public interface IJavaSearchConstants {
/**
- * The nature of searched element or the nature
- * of match in unknown.
+ * The nature of searched element or the nature of match in unknown.
*/
int UNKNOWN = -1;
-
+
/* Nature of searched element */
-
+
/**
* The searched element is a type.
*/
- int TYPE= 0;
+ int TYPE = 0;
/**
* The searched element is a method.
*/
- int METHOD= 1;
+ int METHOD = 1;
/**
* The searched element is a package.
*/
- int PACKAGE= 2;
+ int PACKAGE = 2;
/**
* The searched element is a constructor.
*/
- int CONSTRUCTOR= 3;
+ int CONSTRUCTOR = 3;
/**
* The searched element is a field.
*/
- int FIELD= 4;
+ int FIELD = 4;
/**
- * The searched element is a class.
- * More selective than using TYPE
+ * The searched element is a class. More selective than using TYPE
*/
- int CLASS= 5;
+ int CLASS = 5;
/**
- * The searched element is an interface.
- * More selective than using TYPE
+ * The searched element is an interface. More selective than using TYPE
*/
- int INTERFACE= 6;
+ int INTERFACE = 6;
/* Nature of match */
-
+
/**
- * The search result is a declaration.
- * Can be used in conjunction with any of the nature of searched elements
- * so as to better narrow down the search.
+ * The search result is a declaration. Can be used in conjunction with any
+ * of the nature of searched elements so as to better narrow down the
+ * search.
*/
- int DECLARATIONS= 0;
+ int DECLARATIONS = 0;
/**
- * The search result is a type that implements an interface.
- * Used in conjunction with either TYPE or CLASS or INTERFACE, it will
- * respectively search for any type implementing/extending an interface, or
- * rather exclusively search for classes implementing an interface, or interfaces
+ * The search result is a type that implements an interface. Used in
+ * conjunction with either TYPE or CLASS or INTERFACE, it will respectively
+ * search for any type implementing/extending an interface, or rather
+ * exclusively search for classes implementing an interface, or interfaces
* extending an interface.
*/
- int IMPLEMENTORS= 1;
+ int IMPLEMENTORS = 1;
/**
- * The search result is a reference.
- * Can be used in conjunction with any of the nature of searched elements
- * so as to better narrow down the search.
- * References can contain implementers since they are more generic kind
- * of matches.
+ * The search result is a reference. Can be used in conjunction with any of
+ * the nature of searched elements so as to better narrow down the search.
+ * References can contain implementers since they are more generic kind of
+ * matches.
*/
- int REFERENCES= 2;
+ int REFERENCES = 2;
/**
- * The search result is a declaration, a reference, or an implementer
- * of an interface.
- * Can be used in conjunction with any of the nature of searched elements
- * so as to better narrow down the search.
+ * The search result is a declaration, a reference, or an implementer of an
+ * interface. Can be used in conjunction with any of the nature of searched
+ * elements so as to better narrow down the search.
*/
- int ALL_OCCURRENCES= 3;
+ int ALL_OCCURRENCES = 3;
/**
- * When searching for field matches, it will exclusively find read accesses, as
- * opposed to write accesses. Note that some expressions are considered both
- * as field read/write accesses: for example, x++; x+= 1;
+ * When searching for field matches, it will exclusively find read accesses,
+ * as opposed to write accesses. Note that some expressions are considered
+ * both as field read/write accesses: for example, x++; x+= 1;
*
* @since 2.0
*/
int READ_ACCESSES = 4;
-
+
/**
- * When searching for field matches, it will exclusively find write accesses, as
- * opposed to read accesses. Note that some expressions are considered both
- * as field read/write accesses: for example, x++; x+= 1;
+ * When searching for field matches, it will exclusively find write
+ * accesses, as opposed to read accesses. Note that some expressions are
+ * considered both as field read/write accesses: for example, x++; x+= 1;
*
* @since 2.0
*/
int WRITE_ACCESSES = 5;
-
+
/* Syntactic match modes */
-
+
/**
- * The search pattern matches exactly the search result,
- * that is, the source of the search result equals the search pattern.
+ * The search pattern matches exactly the search result, that is, the source
+ * of the search result equals the search pattern.
+ *
* @deprecated Use {@link SearchPattern#R_EXACT_MATCH} instead.
*/
int EXACT_MATCH = 0;
+
/**
* The search pattern is a prefix of the search result.
+ *
* @deprecated Use {@link SearchPattern#R_PREFIX_MATCH} instead.
*/
int PREFIX_MATCH = 1;
+
/**
- * The search pattern contains one or more wild cards ('*') where a
+ * The search pattern contains one or more wild cards ('*') where a
* wild-card can replace 0 or more characters in the search result.
+ *
* @deprecated Use {@link SearchPattern#R_PATTERN_MATCH} instead.
*/
int PATTERN_MATCH = 2;
-
/* Case sensitivity */
-
+
/**
- * The search pattern matches the search result only
- * if cases are the same.
- * @deprecated Use the methods that take the matchMode
- * with {@link SearchPattern#R_CASE_SENSITIVE} as a matchRule instead.
+ * The search pattern matches the search result only if cases are the same.
+ *
+ * @deprecated Use the methods that take the matchMode with
+ * {@link SearchPattern#R_CASE_SENSITIVE} as a matchRule
+ * instead.
*/
boolean CASE_SENSITIVE = true;
+
/**
* The search pattern ignores cases in the search result.
- * @deprecated Use the methods that take the matchMode
- * without {@link SearchPattern#R_CASE_SENSITIVE} as a matchRule instead.
+ *
+ * @deprecated Use the methods that take the matchMode without
+ * {@link SearchPattern#R_CASE_SENSITIVE} as a matchRule
+ * instead.
*/
boolean CASE_INSENSITIVE = false;
-
/* Waiting policies */
-
+
/**
* The search operation starts immediately, even if the underlying indexer
- * has not finished indexing the workspace. Results will more likely
- * not contain all the matches.
+ * has not finished indexing the workspace. Results will more likely not
+ * contain all the matches.
*/
-// int FORCE_IMMEDIATE_SEARCH = IJob.ForceImmediate;
+ // int FORCE_IMMEDIATE_SEARCH = IJob.ForceImmediate;
/**
- * The search operation throws an org.eclipse.core.runtime.OperationCanceledException
- * if the underlying indexer has not finished indexing the workspace.
+ * The search operation throws an
+ * org.eclipse.core.runtime.OperationCanceledException if the
+ * underlying indexer has not finished indexing the workspace.
*/
-// int CANCEL_IF_NOT_READY_TO_SEARCH = IJob.CancelIfNotReady;
+ // int CANCEL_IF_NOT_READY_TO_SEARCH = IJob.CancelIfNotReady;
/**
- * The search operation waits for the underlying indexer to finish indexing
+ * The search operation waits for the underlying indexer to finish indexing
* the workspace before starting the search.
*/
-// int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady;
-
-
+ // int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady;
+
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/ITypeNameRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/ITypeNameRequestor.java
index 776560a..28da0ca 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/ITypeNameRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/search/ITypeNameRequestor.java
@@ -11,51 +11,71 @@
package net.sourceforge.phpdt.core.search;
/**
- * A ITypeNameRequestor collects search results from a searchAllTypeNames
- * query to a SearchEngine. Clients must implement this interface and pass
- * an instance to the searchAllTypeNames(...) method. Only top-level and
- * member types are reported. Local types are not reported.
+ * A ITypeNameRequestor collects search results from a
+ * searchAllTypeNames query to a SearchEngine.
+ * Clients must implement this interface and pass an instance to the
+ * searchAllTypeNames(...) method. Only top-level and member
+ * types are reported. Local types are not reported.
*
* This interface may be implemented by clients.
*
*/
public interface ITypeNameRequestor {
-/**
- * Accepts a top-level or a member class.
- *
- * @param packageName the dot-separated name of the package of the class
- * @param simpleTypeName the simple name of the class
- * @param enclosingTypeNames if the class is a member type,
- * the simple names of the enclosing types from the outer-most to the
- * direct parent of the class (for example, if the class is x.y.A$B$C then
- * the enclosing types are [A, B]. This is an empty array if the class
- * is a top-level type.
- * @param path the full path to the resource containing the class. If the resource is a .class file
- * or a .java file, this is the full path in the workspace to this resource. If the
- * resource is an archive (that is, a .zip or .jar file), the path is composed of 2 paths separated
- * by IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR:
- * the first path is the full OS path to the archive (if it is an external archive),
- * or the workspace relative IPath to the archive (if it is an internal archive),
- * the second path is the path to the resource inside the archive.
- */
-void acceptClass(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path);
-/**
- * Accepts a top-level or a member interface.
- *
- * @param packageName the dot-separated name of the package of the interface
- * @param simpleTypeName the simple name of the interface
- * @param enclosingTypeNames if the interface is a member type,
- * the simple names of the enclosing types from the outer-most to the
- * direct parent of the interface (for example, if the interface is x.y.A$B$I then
- * the enclosing types are [A, B]. This is an empty array if the interface
- * is a top-level type.
- * @param path the full path to the resource containing the interface. If the resource is a .class file
- * or a .java file, this is the full path in the workspace to this resource. If the
- * resource is an archive (that is, a .zip or .jar file), the path is composed of 2 paths separated
- * by IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR:
- * the first path is the full OS path to the archive (if it is an external archive),
- * or the workspace relative IPath to the archive (if it is an internal archive),
- * the second path is the path to the resource inside the archive.
- * */
-void acceptInterface(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path);
+ /**
+ * Accepts a top-level or a member class.
+ *
+ * @param packageName
+ * the dot-separated name of the package of the class
+ * @param simpleTypeName
+ * the simple name of the class
+ * @param enclosingTypeNames
+ * if the class is a member type, the simple names of the
+ * enclosing types from the outer-most to the direct parent of
+ * the class (for example, if the class is x.y.A$B$C then the
+ * enclosing types are [A, B]. This is an empty array if the
+ * class is a top-level type.
+ * @param path
+ * the full path to the resource containing the class. If the
+ * resource is a .class file or a .java file, this is the full
+ * path in the workspace to this resource. If the resource is an
+ * archive (that is, a .zip or .jar file), the path is composed
+ * of 2 paths separated by
+ * IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR: the
+ * first path is the full OS path to the archive (if it is an
+ * external archive), or the workspace relative
+ * IPath to the archive (if it is an internal
+ * archive), the second path is the path to the resource inside
+ * the archive.
+ */
+ void acceptClass(char[] packageName, char[] simpleTypeName,
+ char[][] enclosingTypeNames, String path);
+
+ /**
+ * Accepts a top-level or a member interface.
+ *
+ * @param packageName
+ * the dot-separated name of the package of the interface
+ * @param simpleTypeName
+ * the simple name of the interface
+ * @param enclosingTypeNames
+ * if the interface is a member type, the simple names of the
+ * enclosing types from the outer-most to the direct parent of
+ * the interface (for example, if the interface is x.y.A$B$I then
+ * the enclosing types are [A, B]. This is an empty array if the
+ * interface is a top-level type.
+ * @param path
+ * the full path to the resource containing the interface. If the
+ * resource is a .class file or a .java file, this is the full
+ * path in the workspace to this resource. If the resource is an
+ * archive (that is, a .zip or .jar file), the path is composed
+ * of 2 paths separated by
+ * IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR: the
+ * first path is the full OS path to the archive (if it is an
+ * external archive), or the workspace relative
+ * IPath to the archive (if it is an internal
+ * archive), the second path is the path to the resource inside
+ * the archive.
+ */
+ void acceptInterface(char[] packageName, char[] simpleTypeName,
+ char[][] enclosingTypeNames, String path);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSElement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSElement.java
index 11bbf94..992ce02 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSElement.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSElement.java
@@ -15,13 +15,17 @@ import org.eclipse.jface.util.Assert;
public class NLSElement {
- public static final String TAG_PREFIX= "//$NON-NLS-"; //$NON-NLS-1$
- public static final int TAG_PREFIX_LENGTH= TAG_PREFIX.length();
- public static final String TAG_POSTFIX= "$"; //$NON-NLS-1$
- public static final int TAG_POSTFIX_LENGTH= TAG_POSTFIX.length();
+ public static final String TAG_PREFIX = "//$NON-NLS-"; //$NON-NLS-1$
+
+ public static final int TAG_PREFIX_LENGTH = TAG_PREFIX.length();
+
+ public static final String TAG_POSTFIX = "$"; //$NON-NLS-1$
+
+ public static final int TAG_POSTFIX_LENGTH = TAG_POSTFIX.length();
/** The original string denoted by the position */
private String fValue;
+
/** The position of the original string */
private Region fPosition;
@@ -35,14 +39,15 @@ public class NLSElement {
* Creates a new NLS element for the given string and position.
*/
public NLSElement(String value, int start, int length, int index) {
- fValue= value;
- fIndex= index;
+ fValue = value;
+ fIndex = index;
Assert.isNotNull(fValue);
- fPosition= new Region(start, length);
+ fPosition = new Region(start, length);
}
/**
* Returns the position of the string to be NLSed.
+ *
* @return Returns the position of the string to be NLSed
*/
public Region getPosition() {
@@ -51,6 +56,7 @@ public class NLSElement {
/**
* Returns the actual string value.
+ *
* @return the actual string value
*/
public String getValue() {
@@ -61,27 +67,28 @@ public class NLSElement {
* Sets the actual string value.
*/
public void setValue(String value) {
- fValue= value;
+ fValue = value;
}
/**
* Sets the tag position if one is associated with the NLS element.
*/
public void setTagPosition(int start, int length) {
- fTagPosition= new Region(start, length);
+ fTagPosition = new Region(start, length);
}
/**
- * Returns the tag position for this element. The method can return null.
- * In this case no tag has been found for this NLS element.
+ * Returns the tag position for this element. The method can return
+ * null. In this case no tag has been found for this NLS
+ * element.
*/
public Region getTagPosition() {
return fTagPosition;
}
/**
- * Returns true if the NLS element has an assicated $NON-NLS-*$ tag.
- * Otherwise false is returned.
+ * Returns true if the NLS element has an assicated
+ * $NON-NLS-*$ tag. Otherwise false is returned.
*/
public boolean hasTag() {
return fTagPosition != null && fTagPosition.getLength() > 0;
@@ -95,13 +102,11 @@ public class NLSElement {
return TAG_PREFIX + (fIndex + 1) + TAG_POSTFIX;
}
- /* (Non-Javadoc)
- * Method declared in Object.
- * only for debugging
+ /*
+ * (Non-Javadoc) Method declared in Object. only for debugging
*/
public String toString() {
return fPosition + ": " + fValue + " Tag position: " + //$NON-NLS-2$ //$NON-NLS-1$
(hasTag() ? fTagPosition.toString() : "no tag found"); //$NON-NLS-1$
}
}
-
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSLine.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSLine.java
index 92e1df2..0dc8095 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSLine.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/corext/refactoring/nls/NLSLine.java
@@ -19,18 +19,19 @@ import org.eclipse.jface.util.Assert;
public class NLSLine {
private int fLineNumber;
+
private List fElements;
public NLSLine(int lineNumber) {
- fLineNumber= lineNumber;
+ fLineNumber = lineNumber;
Assert.isTrue(fLineNumber >= 0);
- fElements= new ArrayList();
+ fElements = new ArrayList();
}
-
+
public int getLineNumber() {
return fLineNumber;
}
-
+
/**
* Adds a NLS element to this line.
*/
@@ -38,31 +39,33 @@ public class NLSLine {
Assert.isNotNull(element);
fElements.add(element);
}
-
+
public NLSElement[] getElements() {
- return (NLSElement[]) fElements.toArray(new NLSElement[fElements.size()]);
+ return (NLSElement[]) fElements
+ .toArray(new NLSElement[fElements.size()]);
}
-
+
public NLSElement get(int index) {
- return (NLSElement)fElements.get(index);
+ return (NLSElement) fElements.get(index);
}
-
+
public boolean exists(int index) {
return index >= 0 && index < fElements.size();
}
-
- public int size(){
+
+ public int size() {
return fElements.size();
}
-
- /* non javaDoc
- * only for debugging
+
+ /*
+ * non javaDoc only for debugging
+ *
* @see Object#toString()
*/
public String toString() {
- StringBuffer result= new StringBuffer();
+ StringBuffer result = new StringBuffer();
result.append("Line: " + fLineNumber + "\n"); //$NON-NLS-2$ //$NON-NLS-1$
- for (Iterator iter= fElements.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = fElements.iterator(); iter.hasNext();) {
result.append("\t"); //$NON-NLS-1$
result.append(iter.next().toString());
result.append("\n"); //$NON-NLS-1$
@@ -70,4 +73,3 @@ public class NLSLine {
return result.toString();
}
}
-
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/ISearchRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/ISearchRequestor.java
index e430c5b..c2ae18c 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/ISearchRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/ISearchRequestor.java
@@ -11,50 +11,51 @@
package net.sourceforge.phpdt.internal.codeassist;
/**
- * This is the internal requestor passed to the searchable name environment
- * so as to process the multiple search results as they are discovered.
- *
- * It is used to allow the code assist engine to add some more information
- * to the raw name environment results before answering them to the UI.
+ * This is the internal requestor passed to the searchable name environment so
+ * as to process the multiple search results as they are discovered.
+ *
+ * It is used to allow the code assist engine to add some more information to
+ * the raw name environment results before answering them to the UI.
*/
public interface ISearchRequestor {
-
+
/**
* One result of the search consists of a new class.
- *
+ *
* NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
+ * Package names are in the form "a.b.c". Nested type names are in the
+ * qualified form "A.M". The default package is represented by an empty
+ * array.
*/
public void acceptClass(char[] packageName, char[] typeName, int modifiers);
/**
* One result of the search consists of a new interface.
- *
+ *
* NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Nested type names are in the qualified form "A.I".
- * The default package is represented by an empty array.
+ * Package names are in the form "a.b.c". Nested type names are in the
+ * qualified form "A.I". The default package is represented by an empty
+ * array.
*/
- public void acceptInterface(char[] packageName, char[] typeName, int modifiers);
+ public void acceptInterface(char[] packageName, char[] typeName,
+ int modifiers);
/**
* One result of the search consists of a new package.
- *
- * NOTE - All package names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * The default package is represented by an empty array.
+ *
+ * NOTE - All package names are presented in their readable form: Package
+ * names are in the form "a.b.c". The default package is represented by an
+ * empty array.
*/
public void acceptPackage(char[] packageName);
/**
* One result of the search consists of a new type.
- *
+ *
* NOTE - All package and type names are presented in their readable form:
- * Package names are in the form "a.b.c".
- * Nested type names are in the qualified form "A.M".
- * The default package is represented by an empty array.
+ * Package names are in the form "a.b.c". Nested type names are in the
+ * qualified form "A.M". The default package is represented by an empty
+ * array.
*/
public void acceptType(char[] packageName, char[] typeName);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/ISearchableNameEnvironment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/ISearchableNameEnvironment.java
index 57cfbd5..e981f01 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/ISearchableNameEnvironment.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/ISearchableNameEnvironment.java
@@ -13,36 +13,35 @@ package net.sourceforge.phpdt.internal.codeassist;
import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment;
/**
- * This interface defines the API that may be used to implement any
- * search-based tool (such as a CodeAssist, a Finder, ...).
- * It is mainly used to hide from the search tool the implementation
- * of the underlying environment and its constructions.
+ * This interface defines the API that may be used to implement any search-based
+ * tool (such as a CodeAssist, a Finder, ...). It is mainly used to hide from
+ * the search tool the implementation of the underlying environment and its
+ * constructions.
*/
public interface ISearchableNameEnvironment extends INameEnvironment {
/**
- * Find the packages that start with the given prefix.
- * A valid prefix is a qualified name separated by periods
- * (ex. java.util).
- * The packages found are passed to:
- * ISearchRequestor.acceptPackage(char[][] packageName)
+ * Find the packages that start with the given prefix. A valid prefix is a
+ * qualified name separated by periods (ex. java.util). The packages found
+ * are passed to: ISearchRequestor.acceptPackage(char[][] packageName)
*/
void findPackages(char[] prefix, ISearchRequestor requestor);
/**
- * Find the top-level types (classes and interfaces) that are defined
- * in the current environment and whose name starts with the
- * given prefix. The prefix is a qualified name separated by periods
- * or a simple name (ex. java.util.V or V).
- *
+ * Find the top-level types (classes and interfaces) that are defined in the
+ * current environment and whose name starts with the given prefix. The
+ * prefix is a qualified name separated by periods or a simple name (ex.
+ * java.util.V or V).
+ *
* The types found are passed to one of the following methods (if additional
* information is known about the types):
- * ISearchRequestor.acceptType(char[][] packageName, char[] typeName)
- * ISearchRequestor.acceptClass(char[][] packageName, char[] typeName, int modifiers)
- * ISearchRequestor.acceptInterface(char[][] packageName, char[] typeName, int modifiers)
- *
- * This method can not be used to find member types... member
- * types are found relative to their enclosing type.
+ * ISearchRequestor.acceptType(char[][] packageName, char[] typeName)
+ * ISearchRequestor.acceptClass(char[][] packageName, char[] typeName, int
+ * modifiers) ISearchRequestor.acceptInterface(char[][] packageName, char[]
+ * typeName, int modifiers)
+ *
+ * This method can not be used to find member types... member types are
+ * found relative to their enclosing type.
*/
void findTypes(char[] prefix, ISearchRequestor requestor);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/impl/AssistOptions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/impl/AssistOptions.java
index 3244c02..46d07d4 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/impl/AssistOptions.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/codeassist/impl/AssistOptions.java
@@ -18,48 +18,58 @@ public class AssistOptions {
/**
* Option IDs
*/
- public static final String OPTION_PerformVisibilityCheck =
- "net.sourceforge.phpdt.core.codeComplete.visibilityCheck"; //$NON-NLS-1$
- public static final String OPTION_ForceImplicitQualification =
- "net.sourceforge.phpdt.core.codeComplete.forceImplicitQualification"; //$NON-NLS-1$
- public static final String OPTION_FieldPrefixes =
- "net.sourceforge.phpdt.core.codeComplete.fieldPrefixes"; //$NON-NLS-1$
- public static final String OPTION_StaticFieldPrefixes =
- "net.sourceforge.phpdt.core.codeComplete.staticFieldPrefixes"; //$NON-NLS-1$
- public static final String OPTION_LocalPrefixes =
- "net.sourceforge.phpdt.core.codeComplete.localPrefixes"; //$NON-NLS-1$
- public static final String OPTION_ArgumentPrefixes =
- "net.sourceforge.phpdt.core.codeComplete.argumentPrefixes"; //$NON-NLS-1$
- public static final String OPTION_FieldSuffixes =
- "net.sourceforge.phpdt.core.codeComplete.fieldSuffixes"; //$NON-NLS-1$
- public static final String OPTION_StaticFieldSuffixes =
- "net.sourceforge.phpdt.core.codeComplete.staticFieldSuffixes"; //$NON-NLS-1$
- public static final String OPTION_LocalSuffixes =
- "net.sourceforge.phpdt.core.codeComplete.localSuffixes"; //$NON-NLS-1$
- public static final String OPTION_ArgumentSuffixes =
- "net.sourceforge.phpdt.core.codeComplete.argumentSuffixes"; //$NON-NLS-1$
+ public static final String OPTION_PerformVisibilityCheck = "net.sourceforge.phpdt.core.codeComplete.visibilityCheck"; //$NON-NLS-1$
+
+ public static final String OPTION_ForceImplicitQualification = "net.sourceforge.phpdt.core.codeComplete.forceImplicitQualification"; //$NON-NLS-1$
+
+ public static final String OPTION_FieldPrefixes = "net.sourceforge.phpdt.core.codeComplete.fieldPrefixes"; //$NON-NLS-1$
+
+ public static final String OPTION_StaticFieldPrefixes = "net.sourceforge.phpdt.core.codeComplete.staticFieldPrefixes"; //$NON-NLS-1$
+
+ public static final String OPTION_LocalPrefixes = "net.sourceforge.phpdt.core.codeComplete.localPrefixes"; //$NON-NLS-1$
+
+ public static final String OPTION_ArgumentPrefixes = "net.sourceforge.phpdt.core.codeComplete.argumentPrefixes"; //$NON-NLS-1$
+
+ public static final String OPTION_FieldSuffixes = "net.sourceforge.phpdt.core.codeComplete.fieldSuffixes"; //$NON-NLS-1$
+
+ public static final String OPTION_StaticFieldSuffixes = "net.sourceforge.phpdt.core.codeComplete.staticFieldSuffixes"; //$NON-NLS-1$
+
+ public static final String OPTION_LocalSuffixes = "net.sourceforge.phpdt.core.codeComplete.localSuffixes"; //$NON-NLS-1$
+
+ public static final String OPTION_ArgumentSuffixes = "net.sourceforge.phpdt.core.codeComplete.argumentSuffixes"; //$NON-NLS-1$
+
public static final String ENABLED = "enabled"; //$NON-NLS-1$
+
public static final String DISABLED = "disabled"; //$NON-NLS-1$
public boolean checkVisibility = false;
+
public boolean forceImplicitQualification = false;
+
public char[][] fieldPrefixes = null;
+
public char[][] staticFieldPrefixes = null;
+
public char[][] localPrefixes = null;
+
public char[][] argumentPrefixes = null;
+
public char[][] fieldSuffixes = null;
+
public char[][] staticFieldSuffixes = null;
+
public char[][] localSuffixes = null;
+
public char[][] argumentSuffixes = null;
- /**
+ /**
* Initializing the assist options with default settings
*/
public AssistOptions() {
// Initializing the assist options with default settings
}
- /**
+ /**
* Initializing the assist options with external settings
*/
public AssistOptions(Map settings) {
@@ -68,6 +78,7 @@ public class AssistOptions {
set(settings);
}
+
public void set(Map optionsMap) {
Object optionValue;
@@ -88,8 +99,9 @@ public class AssistOptions {
if ((optionValue = optionsMap.get(OPTION_FieldPrefixes)) != null) {
if (optionValue instanceof String) {
String stringValue = (String) optionValue;
- if (stringValue.length() > 0){
- this.fieldPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ if (stringValue.length() > 0) {
+ this.fieldPrefixes = CharOperation.splitAndTrimOn(',',
+ stringValue.toCharArray());
} else {
this.fieldPrefixes = null;
}
@@ -98,8 +110,9 @@ public class AssistOptions {
if ((optionValue = optionsMap.get(OPTION_StaticFieldPrefixes)) != null) {
if (optionValue instanceof String) {
String stringValue = (String) optionValue;
- if (stringValue.length() > 0){
- this.staticFieldPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ if (stringValue.length() > 0) {
+ this.staticFieldPrefixes = CharOperation.splitAndTrimOn(
+ ',', stringValue.toCharArray());
} else {
this.staticFieldPrefixes = null;
}
@@ -108,8 +121,9 @@ public class AssistOptions {
if ((optionValue = optionsMap.get(OPTION_LocalPrefixes)) != null) {
if (optionValue instanceof String) {
String stringValue = (String) optionValue;
- if (stringValue.length() > 0){
- this.localPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ if (stringValue.length() > 0) {
+ this.localPrefixes = CharOperation.splitAndTrimOn(',',
+ stringValue.toCharArray());
} else {
this.localPrefixes = null;
}
@@ -118,8 +132,9 @@ public class AssistOptions {
if ((optionValue = optionsMap.get(OPTION_ArgumentPrefixes)) != null) {
if (optionValue instanceof String) {
String stringValue = (String) optionValue;
- if (stringValue.length() > 0){
- this.argumentPrefixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ if (stringValue.length() > 0) {
+ this.argumentPrefixes = CharOperation.splitAndTrimOn(',',
+ stringValue.toCharArray());
} else {
this.argumentPrefixes = null;
}
@@ -128,8 +143,9 @@ public class AssistOptions {
if ((optionValue = optionsMap.get(OPTION_FieldSuffixes)) != null) {
if (optionValue instanceof String) {
String stringValue = (String) optionValue;
- if (stringValue.length() > 0){
- this.fieldSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ if (stringValue.length() > 0) {
+ this.fieldSuffixes = CharOperation.splitAndTrimOn(',',
+ stringValue.toCharArray());
} else {
this.fieldSuffixes = null;
}
@@ -138,8 +154,9 @@ public class AssistOptions {
if ((optionValue = optionsMap.get(OPTION_StaticFieldSuffixes)) != null) {
if (optionValue instanceof String) {
String stringValue = (String) optionValue;
- if (stringValue.length() > 0){
- this.staticFieldSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ if (stringValue.length() > 0) {
+ this.staticFieldSuffixes = CharOperation.splitAndTrimOn(
+ ',', stringValue.toCharArray());
} else {
this.staticFieldSuffixes = null;
}
@@ -148,8 +165,9 @@ public class AssistOptions {
if ((optionValue = optionsMap.get(OPTION_LocalSuffixes)) != null) {
if (optionValue instanceof String) {
String stringValue = (String) optionValue;
- if (stringValue.length() > 0){
- this.localSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ if (stringValue.length() > 0) {
+ this.localSuffixes = CharOperation.splitAndTrimOn(',',
+ stringValue.toCharArray());
} else {
this.localSuffixes = null;
}
@@ -158,8 +176,9 @@ public class AssistOptions {
if ((optionValue = optionsMap.get(OPTION_ArgumentSuffixes)) != null) {
if (optionValue instanceof String) {
String stringValue = (String) optionValue;
- if (stringValue.length() > 0){
- this.argumentSuffixes = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
+ if (stringValue.length() > 0) {
+ this.argumentSuffixes = CharOperation.splitAndTrimOn(',',
+ stringValue.toCharArray());
} else {
this.argumentSuffixes = null;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java
index cdf1f49..ed54e23 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ASTVisitor.java
@@ -80,7 +80,7 @@ import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-/**
+/**
* A visitor for iterating through the parse tree.
*/
public abstract class ASTVisitor {
@@ -88,578 +88,687 @@ public abstract class ASTVisitor {
public void acceptProblem(IProblem problem) {
// do nothing by default
}
- public void endVisit(
- AllocationExpression allocationExpression,
- BlockScope scope) {
+
+ public void endVisit(AllocationExpression allocationExpression,
+ BlockScope scope) {
// do nothing by default
}
+
public void endVisit(AND_AND_Expression and_and_Expression, BlockScope scope) {
// do nothing by default
}
-// public void endVisit(JavadocArrayQualifiedTypeReference typeRef, BlockScope scope) {
-// // do nothing by default
-// }
-// public void endVisit(JavadocArraySingleTypeReference typeRef, BlockScope scope) {
-// // do nothing by default
-// }
-// public void endVisit(JavadocArgumentExpression expression, BlockScope scope) {
-// // do nothing by default
-// }
-// public void endVisit(JavadocFieldReference fieldRef, BlockScope scope) {
-// // do nothing by default
-// }
-// public void endVisit(JavadocMessageSend messageSend, BlockScope scope) {
-// // do nothing by default
-// }
-// public void endVisit(JavadocQualifiedTypeReference typeRef, BlockScope scope) {
-// // do nothing by default
-// }
-// public void endVisit(JavadocReturnStatement statement, BlockScope scope) {
-// // do nothing by default
-// }
-// public void endVisit(JavadocSingleNameReference argument, BlockScope scope) {
-// // do nothing by default
-// }
-// public void endVisit(JavadocSingleTypeReference typeRef, BlockScope scope) {
-// // do nothing by default
-// }
+
+ // public void endVisit(JavadocArrayQualifiedTypeReference typeRef,
+ // BlockScope scope) {
+ // // do nothing by default
+ // }
+ // public void endVisit(JavadocArraySingleTypeReference typeRef, BlockScope
+ // scope) {
+ // // do nothing by default
+ // }
+ // public void endVisit(JavadocArgumentExpression expression, BlockScope
+ // scope) {
+ // // do nothing by default
+ // }
+ // public void endVisit(JavadocFieldReference fieldRef, BlockScope scope) {
+ // // do nothing by default
+ // }
+ // public void endVisit(JavadocMessageSend messageSend, BlockScope scope) {
+ // // do nothing by default
+ // }
+ // public void endVisit(JavadocQualifiedTypeReference typeRef, BlockScope
+ // scope) {
+ // // do nothing by default
+ // }
+ // public void endVisit(JavadocReturnStatement statement, BlockScope scope)
+ // {
+ // // do nothing by default
+ // }
+ // public void endVisit(JavadocSingleNameReference argument, BlockScope
+ // scope) {
+ // // do nothing by default
+ // }
+ // public void endVisit(JavadocSingleTypeReference typeRef, BlockScope
+ // scope) {
+ // // do nothing by default
+ // }
public void endVisit(Argument argument, BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- ArrayAllocationExpression arrayAllocationExpression,
- BlockScope scope) {
+
+ public void endVisit(ArrayAllocationExpression arrayAllocationExpression,
+ BlockScope scope) {
// do nothing by default
}
+
public void endVisit(ArrayInitializer arrayInitializer, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(
- ArrayQualifiedTypeReference arrayQualifiedTypeReference,
- BlockScope scope) {
+ ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ BlockScope scope) {
// do nothing by default
}
+
public void endVisit(
- ArrayQualifiedTypeReference arrayQualifiedTypeReference,
- ClassScope scope) {
+ ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ ClassScope scope) {
// do nothing by default
}
+
public void endVisit(ArrayReference arrayReference, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(ArrayTypeReference arrayTypeReference, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(ArrayTypeReference arrayTypeReference, ClassScope scope) {
// do nothing by default
}
+
public void endVisit(Assignment assignment, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(AssertStatement assertStatement, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(BinaryExpression binaryExpression, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(Block block, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(BreakStatement breakStatement, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(CaseStatement caseStatement, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(CastExpression castExpression, BlockScope scope) {
// do nothing by default
}
-
+
public void endVisit(Clinit clinit, ClassScope scope) {
// do nothing by default
}
- public void endVisit(
- CompilationUnitDeclaration compilationUnitDeclaration,
- CompilationUnitScope scope) {
+
+ public void endVisit(CompilationUnitDeclaration compilationUnitDeclaration,
+ CompilationUnitScope scope) {
// do nothing by default
}
+
public void endVisit(CompoundAssignment compoundAssignment, BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- ConditionalExpression conditionalExpression,
- BlockScope scope) {
+
+ public void endVisit(ConditionalExpression conditionalExpression,
+ BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- ConstructorDeclaration constructorDeclaration,
- ClassScope scope) {
+
+ public void endVisit(ConstructorDeclaration constructorDeclaration,
+ ClassScope scope) {
// do nothing by default
}
+
public void endVisit(ContinueStatement continueStatement, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(DoStatement doStatement, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(DoubleLiteral doubleLiteral, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(EqualExpression equalExpression, BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- ExplicitConstructorCall explicitConstructor,
- BlockScope scope) {
+
+ public void endVisit(ExplicitConstructorCall explicitConstructor,
+ BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- ExtendedStringLiteral extendedStringLiteral,
- BlockScope scope) {
+
+ public void endVisit(ExtendedStringLiteral extendedStringLiteral,
+ BlockScope scope) {
// do nothing by default
}
+
public void endVisit(FalseLiteral falseLiteral, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(FieldDeclaration fieldDeclaration, MethodScope scope) {
// do nothing by default
}
+
public void endVisit(FieldReference fieldReference, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(FloatLiteral floatLiteral, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(EmptyStatement emptyStatement, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(ForStatement forStatement, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(IfStatement ifStatement, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(ImportReference importRef, CompilationUnitScope scope) {
// do nothing by default
}
+
public void endVisit(Initializer initializer, MethodScope scope) {
// do nothing by default
}
- public void endVisit(
- InstanceOfExpression instanceOfExpression,
- BlockScope scope) {
+
+ public void endVisit(InstanceOfExpression instanceOfExpression,
+ BlockScope scope) {
// do nothing by default
}
+
public void endVisit(IntLiteral intLiteral, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(LabeledStatement labeledStatement, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(LocalDeclaration localDeclaration, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(LongLiteral longLiteral, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(MessageSend messageSend, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(MethodDeclaration methodDeclaration, ClassScope scope) {
// do nothing by default
}
-// public void endVisit(StringLiteralConcatenation literal, BlockScope scope) {
-// // do nothing by default
-// }
+
+ // public void endVisit(StringLiteralConcatenation literal, BlockScope
+ // scope) {
+ // // do nothing by default
+ // }
public void endVisit(NullLiteral nullLiteral, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(OR_OR_Expression or_or_Expression, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(PostfixExpression postfixExpression, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(PrefixExpression prefixExpression, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(
- QualifiedAllocationExpression qualifiedAllocationExpression,
- BlockScope scope) {
+ QualifiedAllocationExpression qualifiedAllocationExpression,
+ BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- QualifiedNameReference qualifiedNameReference,
- BlockScope scope) {
+
+ public void endVisit(QualifiedNameReference qualifiedNameReference,
+ BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- QualifiedSuperReference qualifiedSuperReference,
- BlockScope scope) {
+
+ public void endVisit(QualifiedSuperReference qualifiedSuperReference,
+ BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- QualifiedThisReference qualifiedThisReference,
- BlockScope scope) {
+
+ public void endVisit(QualifiedThisReference qualifiedThisReference,
+ BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- QualifiedTypeReference qualifiedTypeReference,
- BlockScope scope) {
+
+ public void endVisit(QualifiedTypeReference qualifiedTypeReference,
+ BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- QualifiedTypeReference qualifiedTypeReference,
- ClassScope scope) {
+
+ public void endVisit(QualifiedTypeReference qualifiedTypeReference,
+ ClassScope scope) {
// do nothing by default
}
+
public void endVisit(ReturnStatement returnStatement, BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- SingleNameReference singleNameReference,
- BlockScope scope) {
+
+ public void endVisit(SingleNameReference singleNameReference,
+ BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- SingleTypeReference singleTypeReference,
- BlockScope scope) {
+
+ public void endVisit(SingleTypeReference singleTypeReference,
+ BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- SingleTypeReference singleTypeReference,
- ClassScope scope) {
+
+ public void endVisit(SingleTypeReference singleTypeReference,
+ ClassScope scope) {
// do nothing by default
}
+
public void endVisit(StringLiteral stringLiteral, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(SuperReference superReference, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(SwitchStatement switchStatement, BlockScope scope) {
// do nothing by default
}
-
+
public void endVisit(ThisReference thisReference, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(ThrowStatement throwStatement, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(TrueLiteral trueLiteral, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(TryStatement tryStatement, BlockScope scope) {
// do nothing by default
}
- public void endVisit(
- TypeDeclaration localTypeDeclaration,
- BlockScope scope) {
+
+ public void endVisit(TypeDeclaration localTypeDeclaration, BlockScope scope) {
// do nothing by default
- }
- public void endVisit(
- TypeDeclaration memberTypeDeclaration,
- ClassScope scope) {
+ }
+
+ public void endVisit(TypeDeclaration memberTypeDeclaration, ClassScope scope) {
// do nothing by default
}
- public void endVisit(
- TypeDeclaration typeDeclaration,
- CompilationUnitScope scope) {
+
+ public void endVisit(TypeDeclaration typeDeclaration,
+ CompilationUnitScope scope) {
// do nothing by default
- }
+ }
+
public void endVisit(UnaryExpression unaryExpression, BlockScope scope) {
// do nothing by default
}
+
public void endVisit(WhileStatement whileStatement, BlockScope scope) {
// do nothing by default
}
- public boolean visit(
- AllocationExpression allocationExpression,
- BlockScope scope) {
+
+ public boolean visit(AllocationExpression allocationExpression,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
// do nothing by default
}
+
public boolean visit(AND_AND_Expression and_and_Expression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
-// public boolean visit(JavadocArrayQualifiedTypeReference typeRef, BlockScope scope) {
-// return true; // do nothing by default, keep traversing
-// }
-// public boolean visit(JavadocArraySingleTypeReference typeRef, BlockScope scope) {
-// return true; // do nothing by default, keep traversing
-// }
-// public boolean visit(JavadocArgumentExpression expression, BlockScope scope) {
-// return true; // do nothing by default, keep traversing
-// }
-// public boolean visit(JavadocFieldReference fieldRef, BlockScope scope) {
-// return true; // do nothing by default, keep traversing
-// }
-// public boolean visit(JavadocMessageSend messageSend, BlockScope scope) {
-// return true; // do nothing by default, keep traversing
-// }
-// public boolean visit(JavadocQualifiedTypeReference typeRef, BlockScope scope) {
-// return true; // do nothing by default, keep traversing
-// }
-// public boolean visit(JavadocReturnStatement statement, BlockScope scope) {
-// return true; // do nothing by default, keep traversing
-// }
-// public boolean visit(JavadocSingleNameReference argument, BlockScope scope) {
-// return true; // do nothing by default, keep traversing
-// }
-// public boolean visit(JavadocSingleTypeReference typeRef, BlockScope scope) {
-// return true; // do nothing by default, keep traversing
-// }
+
+ // public boolean visit(JavadocArrayQualifiedTypeReference typeRef,
+ // BlockScope scope) {
+ // return true; // do nothing by default, keep traversing
+ // }
+ // public boolean visit(JavadocArraySingleTypeReference typeRef, BlockScope
+ // scope) {
+ // return true; // do nothing by default, keep traversing
+ // }
+ // public boolean visit(JavadocArgumentExpression expression, BlockScope
+ // scope) {
+ // return true; // do nothing by default, keep traversing
+ // }
+ // public boolean visit(JavadocFieldReference fieldRef, BlockScope scope) {
+ // return true; // do nothing by default, keep traversing
+ // }
+ // public boolean visit(JavadocMessageSend messageSend, BlockScope scope) {
+ // return true; // do nothing by default, keep traversing
+ // }
+ // public boolean visit(JavadocQualifiedTypeReference typeRef, BlockScope
+ // scope) {
+ // return true; // do nothing by default, keep traversing
+ // }
+ // public boolean visit(JavadocReturnStatement statement, BlockScope scope)
+ // {
+ // return true; // do nothing by default, keep traversing
+ // }
+ // public boolean visit(JavadocSingleNameReference argument, BlockScope
+ // scope) {
+ // return true; // do nothing by default, keep traversing
+ // }
+ // public boolean visit(JavadocSingleTypeReference typeRef, BlockScope
+ // scope) {
+ // return true; // do nothing by default, keep traversing
+ // }
public boolean visit(Argument argument, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- ArrayAllocationExpression arrayAllocationExpression,
- BlockScope scope) {
+
+ public boolean visit(ArrayAllocationExpression arrayAllocationExpression,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(ArrayInitializer arrayInitializer, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(
- ArrayQualifiedTypeReference arrayQualifiedTypeReference,
- BlockScope scope) {
+ ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(
- ArrayQualifiedTypeReference arrayQualifiedTypeReference,
- ClassScope scope) {
+ ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ ClassScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(ArrayReference arrayReference, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(ArrayTypeReference arrayTypeReference, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(ArrayTypeReference arrayTypeReference, ClassScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(Assignment assignment, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(AssertStatement assertStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(BinaryExpression binaryExpression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(Block block, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(BreakStatement breakStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(CaseStatement caseStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(CastExpression castExpression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
-
+
public boolean visit(Clinit clinit, ClassScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- CompilationUnitDeclaration compilationUnitDeclaration,
- CompilationUnitScope scope) {
+
+ public boolean visit(CompilationUnitDeclaration compilationUnitDeclaration,
+ CompilationUnitScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(CompoundAssignment compoundAssignment, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- ConditionalExpression conditionalExpression,
- BlockScope scope) {
+
+ public boolean visit(ConditionalExpression conditionalExpression,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- ConstructorDeclaration constructorDeclaration,
- ClassScope scope) {
+
+ public boolean visit(ConstructorDeclaration constructorDeclaration,
+ ClassScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(ContinueStatement continueStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(DoStatement doStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(DoubleLiteral doubleLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(EqualExpression equalExpression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(EmptyStatement emptyStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- ExplicitConstructorCall explicitConstructor,
- BlockScope scope) {
+
+ public boolean visit(ExplicitConstructorCall explicitConstructor,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- ExtendedStringLiteral extendedStringLiteral,
- BlockScope scope) {
+
+ public boolean visit(ExtendedStringLiteral extendedStringLiteral,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(FalseLiteral falseLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(FieldReference fieldReference, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(FloatLiteral floatLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(ForStatement forStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(IfStatement ifStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(ImportReference importRef, CompilationUnitScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(Initializer initializer, MethodScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- InstanceOfExpression instanceOfExpression,
- BlockScope scope) {
+
+ public boolean visit(InstanceOfExpression instanceOfExpression,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(IntLiteral intLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(LabeledStatement labeledStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(LocalDeclaration localDeclaration, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(LongLiteral longLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(MessageSend messageSend, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
return true; // do nothing by default, keep traversing
}
-// public boolean visit(
-// StringLiteralConcatenation literal,
-// BlockScope scope) {
-// return true; // do nothing by default, keep traversing
-// }
+
+ // public boolean visit(
+ // StringLiteralConcatenation literal,
+ // BlockScope scope) {
+ // return true; // do nothing by default, keep traversing
+ // }
public boolean visit(NullLiteral nullLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(PostfixExpression postfixExpression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(PrefixExpression prefixExpression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(
- QualifiedAllocationExpression qualifiedAllocationExpression,
- BlockScope scope) {
+ QualifiedAllocationExpression qualifiedAllocationExpression,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- QualifiedNameReference qualifiedNameReference,
- BlockScope scope) {
+
+ public boolean visit(QualifiedNameReference qualifiedNameReference,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- QualifiedSuperReference qualifiedSuperReference,
- BlockScope scope) {
+
+ public boolean visit(QualifiedSuperReference qualifiedSuperReference,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- QualifiedThisReference qualifiedThisReference,
- BlockScope scope) {
+
+ public boolean visit(QualifiedThisReference qualifiedThisReference,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- QualifiedTypeReference qualifiedTypeReference,
- BlockScope scope) {
+
+ public boolean visit(QualifiedTypeReference qualifiedTypeReference,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- QualifiedTypeReference qualifiedTypeReference,
- ClassScope scope) {
+
+ public boolean visit(QualifiedTypeReference qualifiedTypeReference,
+ ClassScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(ReturnStatement returnStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- SingleNameReference singleNameReference,
- BlockScope scope) {
+
+ public boolean visit(SingleNameReference singleNameReference,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- SingleTypeReference singleTypeReference,
- BlockScope scope) {
+
+ public boolean visit(SingleTypeReference singleTypeReference,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- SingleTypeReference singleTypeReference,
- ClassScope scope) {
+
+ public boolean visit(SingleTypeReference singleTypeReference,
+ ClassScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(StringLiteral stringLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(SuperReference superReference, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(SwitchStatement switchStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
-
+
public boolean visit(ThisReference thisReference, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(ThrowStatement throwStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(TrueLiteral trueLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(TryStatement tryStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- TypeDeclaration localTypeDeclaration,
- BlockScope scope) {
+
+ public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(
- TypeDeclaration memberTypeDeclaration,
- ClassScope scope) {
+
+ public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) {
return true; // do nothing by default, keep traversing
- }
- public boolean visit(
- TypeDeclaration typeDeclaration,
- CompilationUnitScope scope) {
+ }
+
+ public boolean visit(TypeDeclaration typeDeclaration,
+ CompilationUnitScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(UnaryExpression unaryExpression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+
public boolean visit(WhileStatement whileStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java
index 8be0b3f..b5cf9d2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/AbstractSyntaxTreeVisitorAdapter.java
@@ -84,467 +84,571 @@ import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-
/**
* An adapter class for interating through the parse tree.
*/
-public class AbstractSyntaxTreeVisitorAdapter implements IAbstractSyntaxTreeVisitor {
+public class AbstractSyntaxTreeVisitorAdapter implements
+ IAbstractSyntaxTreeVisitor {
- public void acceptProblem(IProblem problem) {}
- public void endVisit(
- AllocationExpression allocationExpression,
- BlockScope scope) {
+ public void acceptProblem(IProblem problem) {
+ }
+
+ public void endVisit(AllocationExpression allocationExpression,
+ BlockScope scope) {
}
+
public void endVisit(AND_AND_Expression and_and_Expression, BlockScope scope) {
}
+
public void endVisit(
- AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
- BlockScope scope) {
+ AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
+ BlockScope scope) {
}
+
public void endVisit(Argument argument, BlockScope scope) {
}
- public void endVisit(
- ArrayAllocationExpression arrayAllocationExpression,
- BlockScope scope) {
+
+ public void endVisit(ArrayAllocationExpression arrayAllocationExpression,
+ BlockScope scope) {
}
+
public void endVisit(ArrayInitializer arrayInitializer, BlockScope scope) {
}
+
public void endVisit(
- ArrayQualifiedTypeReference arrayQualifiedTypeReference,
- BlockScope scope) {
+ ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ BlockScope scope) {
}
+
public void endVisit(
- ArrayQualifiedTypeReference arrayQualifiedTypeReference,
- ClassScope scope) {
+ ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ ClassScope scope) {
}
+
public void endVisit(ArrayReference arrayReference, BlockScope scope) {
}
+
public void endVisit(ArrayTypeReference arrayTypeReference, BlockScope scope) {
}
+
public void endVisit(ArrayTypeReference arrayTypeReference, ClassScope scope) {
}
+
public void endVisit(Assignment assignment, BlockScope scope) {
}
+
public void endVisit(AssertStatement assertStatement, BlockScope scope) {
}
+
public void endVisit(BinaryExpression binaryExpression, BlockScope scope) {
}
+
public void endVisit(Block block, BlockScope scope) {
}
+
public void endVisit(BreakStatement breakStatement, BlockScope scope) {
}
+
public void endVisit(CaseStatement caseStatement, BlockScope scope) {
}
+
public void endVisit(CastExpression castExpression, BlockScope scope) {
}
+
public void endVisit(Clinit clinit, ClassScope scope) {
}
- public void endVisit(
- CompilationUnitDeclaration compilationUnitDeclaration,
- CompilationUnitScope scope) {
+
+ public void endVisit(CompilationUnitDeclaration compilationUnitDeclaration,
+ CompilationUnitScope scope) {
}
+
public void endVisit(CompoundAssignment compoundAssignment, BlockScope scope) {
}
- public void endVisit(
- ConditionalExpression conditionalExpression,
- BlockScope scope) {
+
+ public void endVisit(ConditionalExpression conditionalExpression,
+ BlockScope scope) {
}
- public void endVisit(
- ConstructorDeclaration constructorDeclaration,
- ClassScope scope) {
+
+ public void endVisit(ConstructorDeclaration constructorDeclaration,
+ ClassScope scope) {
}
+
public void endVisit(ContinueStatement continueStatement, BlockScope scope) {
}
+
public void endVisit(DefaultCase defaultCaseStatement, BlockScope scope) {
}
+
public void endVisit(DoStatement doStatement, BlockScope scope) {
}
+
public void endVisit(DoubleLiteral doubleLiteral, BlockScope scope) {
}
+
public void endVisit(EqualExpression equalExpression, BlockScope scope) {
}
- public void endVisit(
- ExplicitConstructorCall explicitConstructor,
- BlockScope scope) {
+
+ public void endVisit(ExplicitConstructorCall explicitConstructor,
+ BlockScope scope) {
}
- public void endVisit(
- ExtendedStringLiteral extendedStringLiteral,
- BlockScope scope) {
+
+ public void endVisit(ExtendedStringLiteral extendedStringLiteral,
+ BlockScope scope) {
}
+
public void endVisit(FalseLiteral falseLiteral, BlockScope scope) {
}
+
public void endVisit(FieldDeclaration fieldDeclaration, MethodScope scope) {
}
+
public void endVisit(FieldReference fieldReference, BlockScope scope) {
}
+
public void endVisit(FloatLiteral floatLiteral, BlockScope scope) {
}
+
public void endVisit(EmptyStatement emptyStatement, BlockScope scope) {
}
+
public void endVisit(ForStatement forStatement, BlockScope scope) {
}
+
public void endVisit(IfStatement ifStatement, BlockScope scope) {
}
+
public void endVisit(ImportReference importRef, CompilationUnitScope scope) {
}
+
public void endVisit(Initializer initializer, MethodScope scope) {
}
- public void endVisit(
- InstanceOfExpression instanceOfExpression,
- BlockScope scope) {
+
+ public void endVisit(InstanceOfExpression instanceOfExpression,
+ BlockScope scope) {
}
+
public void endVisit(IntLiteral intLiteral, BlockScope scope) {
}
+
public void endVisit(LabeledStatement labeledStatement, BlockScope scope) {
}
+
public void endVisit(LocalDeclaration localDeclaration, BlockScope scope) {
}
+
public void endVisit(LongLiteral longLiteral, BlockScope scope) {
}
- public void endVisit(
- MemberTypeDeclaration memberTypeDeclaration,
- ClassScope scope) {
+
+ public void endVisit(MemberTypeDeclaration memberTypeDeclaration,
+ ClassScope scope) {
}
+
public void endVisit(MessageSend messageSend, BlockScope scope) {
}
+
public void endVisit(MethodDeclaration methodDeclaration, ClassScope scope) {
}
+
public void endVisit(NullLiteral nullLiteral, BlockScope scope) {
}
+
public void endVisit(OR_OR_Expression or_or_Expression, BlockScope scope) {
}
+
public void endVisit(PostfixExpression postfixExpression, BlockScope scope) {
}
+
public void endVisit(PrefixExpression prefixExpression, BlockScope scope) {
}
+
public void endVisit(
- QualifiedAllocationExpression qualifiedAllocationExpression,
- BlockScope scope) {
+ QualifiedAllocationExpression qualifiedAllocationExpression,
+ BlockScope scope) {
}
- public void endVisit(
- QualifiedNameReference qualifiedNameReference,
- BlockScope scope) {
+
+ public void endVisit(QualifiedNameReference qualifiedNameReference,
+ BlockScope scope) {
}
- public void endVisit(
- QualifiedSuperReference qualifiedSuperReference,
- BlockScope scope) {
+
+ public void endVisit(QualifiedSuperReference qualifiedSuperReference,
+ BlockScope scope) {
}
- public void endVisit(
- QualifiedThisReference qualifiedThisReference,
- BlockScope scope) {
+
+ public void endVisit(QualifiedThisReference qualifiedThisReference,
+ BlockScope scope) {
}
- public void endVisit(
- QualifiedTypeReference qualifiedTypeReference,
- BlockScope scope) {
+
+ public void endVisit(QualifiedTypeReference qualifiedTypeReference,
+ BlockScope scope) {
}
- public void endVisit(
- QualifiedTypeReference qualifiedTypeReference,
- ClassScope scope) {
+
+ public void endVisit(QualifiedTypeReference qualifiedTypeReference,
+ ClassScope scope) {
}
+
public void endVisit(ReturnStatement returnStatement, BlockScope scope) {
}
- public void endVisit(
- SingleNameReference singleNameReference,
- BlockScope scope) {
+
+ public void endVisit(SingleNameReference singleNameReference,
+ BlockScope scope) {
}
- public void endVisit(
- SingleTypeReference singleTypeReference,
- BlockScope scope) {
+
+ public void endVisit(SingleTypeReference singleTypeReference,
+ BlockScope scope) {
}
- public void endVisit(
- SingleTypeReference singleTypeReference,
- ClassScope scope) {
+
+ public void endVisit(SingleTypeReference singleTypeReference,
+ ClassScope scope) {
}
+
public void endVisit(StringLiteral stringLiteral, BlockScope scope) {
}
+
public void endVisit(SuperReference superReference, BlockScope scope) {
}
+
public void endVisit(SwitchStatement switchStatement, BlockScope scope) {
}
-
+
public void endVisit(ThisReference thisReference, BlockScope scope) {
}
+
public void endVisit(ThrowStatement throwStatement, BlockScope scope) {
}
+
public void endVisit(TrueLiteral trueLiteral, BlockScope scope) {
}
+
public void endVisit(TryStatement tryStatement, BlockScope scope) {
}
- public void endVisit(
- TypeDeclaration typeDeclaration,
- CompilationUnitScope scope) {
+
+ public void endVisit(TypeDeclaration typeDeclaration,
+ CompilationUnitScope scope) {
}
+
public void endVisit(UnaryExpression unaryExpression, BlockScope scope) {
}
+
public void endVisit(WhileStatement whileStatement, BlockScope scope) {
}
- public boolean visit(
- AllocationExpression allocationExpression,
- BlockScope scope) {
+
+ public boolean visit(AllocationExpression allocationExpression,
+ BlockScope scope) {
return true;
}
+
public boolean visit(AND_AND_Expression and_and_Expression, BlockScope scope) {
return true;
}
+
public boolean visit(
- AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
- BlockScope scope) {
+ AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
+ BlockScope scope) {
return true;
}
+
public boolean visit(Argument argument, BlockScope scope) {
return true;
}
- public boolean visit(
- ArrayAllocationExpression arrayAllocationExpression,
- BlockScope scope) {
+
+ public boolean visit(ArrayAllocationExpression arrayAllocationExpression,
+ BlockScope scope) {
return true;
}
+
public boolean visit(ArrayInitializer arrayInitializer, BlockScope scope) {
return true;
}
+
public boolean visit(
- ArrayQualifiedTypeReference arrayQualifiedTypeReference,
- BlockScope scope) {
+ ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ BlockScope scope) {
return true;
}
+
public boolean visit(
- ArrayQualifiedTypeReference arrayQualifiedTypeReference,
- ClassScope scope) {
+ ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ ClassScope scope) {
return true;
}
+
public boolean visit(ArrayReference arrayReference, BlockScope scope) {
return true;
}
+
public boolean visit(ArrayTypeReference arrayTypeReference, BlockScope scope) {
return true;
}
+
public boolean visit(ArrayTypeReference arrayTypeReference, ClassScope scope) {
return true;
}
+
public boolean visit(Assignment assignment, BlockScope scope) {
return true;
}
+
public boolean visit(AssertStatement assertStatement, BlockScope scope) {
return true;
}
+
public boolean visit(BinaryExpression binaryExpression, BlockScope scope) {
return true;
}
+
public boolean visit(Block block, BlockScope scope) {
return true;
}
+
public boolean visit(BreakStatement breakStatement, BlockScope scope) {
return true;
}
+
public boolean visit(CaseStatement caseStatement, BlockScope scope) {
return true;
}
+
public boolean visit(CastExpression castExpression, BlockScope scope) {
return true;
}
-
+
public boolean visit(Clinit clinit, ClassScope scope) {
return true;
}
- public boolean visit(
- CompilationUnitDeclaration compilationUnitDeclaration,
- CompilationUnitScope scope) {
+
+ public boolean visit(CompilationUnitDeclaration compilationUnitDeclaration,
+ CompilationUnitScope scope) {
return true;
}
+
public boolean visit(CompoundAssignment compoundAssignment, BlockScope scope) {
return true;
}
- public boolean visit(
- ConditionalExpression conditionalExpression,
- BlockScope scope) {
+
+ public boolean visit(ConditionalExpression conditionalExpression,
+ BlockScope scope) {
return true;
}
- public boolean visit(
- ConstructorDeclaration constructorDeclaration,
- ClassScope scope) {
+
+ public boolean visit(ConstructorDeclaration constructorDeclaration,
+ ClassScope scope) {
return true;
}
+
public boolean visit(ContinueStatement continueStatement, BlockScope scope) {
return true;
}
+
public boolean visit(DefaultCase defaultCaseStatement, BlockScope scope) {
return true;
}
+
public boolean visit(DoStatement doStatement, BlockScope scope) {
return true;
}
+
public boolean visit(DoubleLiteral doubleLiteral, BlockScope scope) {
return true;
}
+
public boolean visit(EqualExpression equalExpression, BlockScope scope) {
return true;
}
+
public boolean visit(EmptyStatement emptyStatement, BlockScope scope) {
return true;
}
- public boolean visit(
- ExplicitConstructorCall explicitConstructor,
- BlockScope scope) {
+
+ public boolean visit(ExplicitConstructorCall explicitConstructor,
+ BlockScope scope) {
return true;
}
- public boolean visit(
- ExtendedStringLiteral extendedStringLiteral,
- BlockScope scope) {
+
+ public boolean visit(ExtendedStringLiteral extendedStringLiteral,
+ BlockScope scope) {
return true;
}
+
public boolean visit(FalseLiteral falseLiteral, BlockScope scope) {
return true;
}
+
public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) {
return true;
}
+
public boolean visit(FieldReference fieldReference, BlockScope scope) {
return true;
}
+
public boolean visit(FloatLiteral floatLiteral, BlockScope scope) {
return true;
}
+
public boolean visit(ForStatement forStatement, BlockScope scope) {
return true;
}
+
public boolean visit(IfStatement ifStatement, BlockScope scope) {
return true;
}
+
public boolean visit(ImportReference importRef, CompilationUnitScope scope) {
return true;
}
+
public boolean visit(Initializer initializer, MethodScope scope) {
return true;
}
- public boolean visit(
- InstanceOfExpression instanceOfExpression,
- BlockScope scope) {
+
+ public boolean visit(InstanceOfExpression instanceOfExpression,
+ BlockScope scope) {
return true;
}
+
public boolean visit(IntLiteral intLiteral, BlockScope scope) {
return true;
}
+
public boolean visit(LabeledStatement labeledStatement, BlockScope scope) {
return true;
}
+
public boolean visit(LocalDeclaration localDeclaration, BlockScope scope) {
return true;
}
+
public boolean visit(LongLiteral longLiteral, BlockScope scope) {
return true;
}
- public boolean visit(
- MemberTypeDeclaration memberTypeDeclaration,
- ClassScope scope) {
+
+ public boolean visit(MemberTypeDeclaration memberTypeDeclaration,
+ ClassScope scope) {
return true;
}
+
public boolean visit(MessageSend messageSend, BlockScope scope) {
return true;
}
+
public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
return true;
}
+
public boolean visit(NullLiteral nullLiteral, BlockScope scope) {
return true;
}
+
public boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope) {
return true;
}
+
public boolean visit(PostfixExpression postfixExpression, BlockScope scope) {
return true;
}
+
public boolean visit(PrefixExpression prefixExpression, BlockScope scope) {
return true;
}
+
public boolean visit(
- QualifiedAllocationExpression qualifiedAllocationExpression,
- BlockScope scope) {
+ QualifiedAllocationExpression qualifiedAllocationExpression,
+ BlockScope scope) {
return true;
}
- public boolean visit(
- QualifiedNameReference qualifiedNameReference,
- BlockScope scope) {
+
+ public boolean visit(QualifiedNameReference qualifiedNameReference,
+ BlockScope scope) {
return true;
}
- public boolean visit(
- QualifiedSuperReference qualifiedSuperReference,
- BlockScope scope) {
+
+ public boolean visit(QualifiedSuperReference qualifiedSuperReference,
+ BlockScope scope) {
return true;
}
- public boolean visit(
- QualifiedThisReference qualifiedThisReference,
- BlockScope scope) {
+
+ public boolean visit(QualifiedThisReference qualifiedThisReference,
+ BlockScope scope) {
return true;
}
- public boolean visit(
- QualifiedTypeReference qualifiedTypeReference,
- BlockScope scope) {
+
+ public boolean visit(QualifiedTypeReference qualifiedTypeReference,
+ BlockScope scope) {
return true;
}
- public boolean visit(
- QualifiedTypeReference qualifiedTypeReference,
- ClassScope scope) {
+
+ public boolean visit(QualifiedTypeReference qualifiedTypeReference,
+ ClassScope scope) {
return true;
}
+
public boolean visit(ReturnStatement returnStatement, BlockScope scope) {
return true;
}
- public boolean visit(
- SingleNameReference singleNameReference,
- BlockScope scope) {
+
+ public boolean visit(SingleNameReference singleNameReference,
+ BlockScope scope) {
return true;
}
- public boolean visit(
- SingleTypeReference singleTypeReference,
- BlockScope scope) {
+
+ public boolean visit(SingleTypeReference singleTypeReference,
+ BlockScope scope) {
return true;
}
- public boolean visit(
- SingleTypeReference singleTypeReference,
- ClassScope scope) {
+
+ public boolean visit(SingleTypeReference singleTypeReference,
+ ClassScope scope) {
return true;
}
+
public boolean visit(StringLiteral stringLiteral, BlockScope scope) {
return true;
}
+
public boolean visit(SuperReference superReference, BlockScope scope) {
return true;
}
+
public boolean visit(SwitchStatement switchStatement, BlockScope scope) {
return true;
}
-
+
public boolean visit(ThisReference thisReference, BlockScope scope) {
return true;
}
+
public boolean visit(ThrowStatement throwStatement, BlockScope scope) {
return true;
}
+
public boolean visit(TrueLiteral trueLiteral, BlockScope scope) {
return true;
}
+
public boolean visit(TryStatement tryStatement, BlockScope scope) {
return true;
}
- public boolean visit(
- TypeDeclaration typeDeclaration,
- CompilationUnitScope scope) {
+
+ public boolean visit(TypeDeclaration typeDeclaration,
+ CompilationUnitScope scope) {
return true;
}
+
public boolean visit(UnaryExpression unaryExpression, BlockScope scope) {
return true;
}
+
public boolean visit(WhileStatement whileStatement, BlockScope scope) {
return true;
}
- public boolean visit(
- LocalTypeDeclaration localTypeDeclaration,
- BlockScope scope) {
+
+ public boolean visit(LocalTypeDeclaration localTypeDeclaration,
+ BlockScope scope) {
return true;
}
- public void endVisit(
- LocalTypeDeclaration localTypeDeclaration,
- BlockScope scope) {
+
+ public void endVisit(LocalTypeDeclaration localTypeDeclaration,
+ BlockScope scope) {
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/CompilationResult.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/CompilationResult.java
index 90d5434..4d0704c 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/CompilationResult.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/CompilationResult.java
@@ -11,29 +11,30 @@
package net.sourceforge.phpdt.internal.compiler;
/**
- * A compilation result consists of all information returned by the compiler for
- * a single compiled compilation source unit. This includes:
+ * A compilation result consists of all information returned by the compiler for
+ * a single compiled compilation source unit. This includes:
*
*
the compilation unit that was compiled
- *
for each type produced by compiling the compilation unit, its binary and optionally its principal structure
+ *
for each type produced by compiling the compilation unit, its binary and
+ * optionally its principal structure
*
any problems (errors or warnings) produced
*
dependency info
*
- *
- * The principle structure and binary may be null if the compiler could not produce them.
- * If neither could be produced, there is no corresponding entry for the type.
- *
- * The dependency info includes type references such as supertypes, field types, method
- * parameter and return types, local variable types, types of intermediate expressions, etc.
- * It also includes the namespaces (packages) in which names were looked up.
- * It does not include finer grained dependencies such as information about
- * specific fields and methods which were referenced, but does contain their
- * declaring types and any other types used to locate such fields or methods.
+ *
+ * The principle structure and binary may be null if the compiler could not
+ * produce them. If neither could be produced, there is no corresponding entry
+ * for the type.
+ *
+ * The dependency info includes type references such as supertypes, field types,
+ * method parameter and return types, local variable types, types of
+ * intermediate expressions, etc. It also includes the namespaces (packages) in
+ * which names were looked up. It does not include finer grained
+ * dependencies such as information about specific fields and methods which were
+ * referenced, but does contain their declaring types and any other types used
+ * to locate such fields or methods.
*/
-
-
-//import java.util.Enumeration;
+// import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Map;
@@ -42,42 +43,48 @@ import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
public class CompilationResult {
-
+
public IProblem problems[];
+
public IProblem tasks[];
+
public int problemCount;
+
public int taskCount;
+
public ICompilationUnit compilationUnit;
+
private Map problemsMap;
+
private Map firstErrorsMap;
+
private int maxProblemPerUnit;
+
public char[][][] qualifiedReferences;
+
public char[][] simpleNameReferences;
public int lineSeparatorPositions[];
-// public Hashtable compiledTypes = new Hashtable(11);
+
+ // public Hashtable compiledTypes = new Hashtable(11);
public int unitIndex, totalUnitsKnown;
+
public boolean hasBeenAccepted = false;
+
public char[] fileName;
-
- public CompilationResult(
- char[] fileName,
- int unitIndex,
- int totalUnitsKnown,
- int maxProblemPerUnit){
-
+
+ public CompilationResult(char[] fileName, int unitIndex,
+ int totalUnitsKnown, int maxProblemPerUnit) {
+
this.fileName = fileName;
this.unitIndex = unitIndex;
this.totalUnitsKnown = totalUnitsKnown;
this.maxProblemPerUnit = maxProblemPerUnit;
}
-
- public CompilationResult(
- ICompilationUnit compilationUnit,
- int unitIndex,
- int totalUnitsKnown,
- int maxProblemPerUnit){
-
+
+ public CompilationResult(ICompilationUnit compilationUnit, int unitIndex,
+ int totalUnitsKnown, int maxProblemPerUnit) {
+
this.fileName = compilationUnit.getFileName();
this.compilationUnit = compilationUnit;
this.unitIndex = unitIndex;
@@ -85,38 +92,42 @@ public class CompilationResult {
this.maxProblemPerUnit = maxProblemPerUnit;
}
- private int computePriority(IProblem problem){
-
+ private int computePriority(IProblem problem) {
+
final int P_STATIC = 1000;
final int P_OUTSIDE_METHOD = 4000;
final int P_FIRST_ERROR = 2000;
final int P_ERROR = 10000;
-
- int priority = 1000 - problem.getSourceLineNumber(); // early problems first
- if (priority < 0) priority = 0;
- if (problem.isError()){
+
+ int priority = 1000 - problem.getSourceLineNumber(); // early
+ // problems
+ // first
+ if (priority < 0)
+ priority = 0;
+ if (problem.isError()) {
priority += P_ERROR;
}
- ReferenceContext context = problemsMap == null ? null : (ReferenceContext) problemsMap.get(problem);
- if (context != null){
-// if (context instanceof AbstractMethodDeclaration){
-// AbstractMethodDeclaration method = (AbstractMethodDeclaration) context;
-// if (method.isStatic()) {
-// priority += P_STATIC;
-// }
-// } else {
+ ReferenceContext context = problemsMap == null ? null
+ : (ReferenceContext) problemsMap.get(problem);
+ if (context != null) {
+ // if (context instanceof AbstractMethodDeclaration){
+ // AbstractMethodDeclaration method = (AbstractMethodDeclaration)
+ // context;
+ // if (method.isStatic()) {
+ // priority += P_STATIC;
+ // }
+ // } else {
priority += P_OUTSIDE_METHOD;
-// }
+ // }
} else {
priority += P_OUTSIDE_METHOD;
}
- if (firstErrorsMap.containsKey(problem)){
+ if (firstErrorsMap.containsKey(problem)) {
priority += P_FIRST_ERROR;
}
return priority;
}
-
public IProblem[] getAllProblems() {
IProblem[] problems = this.getProblems();
int problemCount = problems != null ? problems.length : 0;
@@ -147,7 +158,8 @@ public class CompilationResult {
IProblem currentProblem = null;
if (nextProblem != null) {
if (nextTask != null) {
- if (nextProblem.getSourceStart() < nextTask.getSourceStart()) {
+ if (nextProblem.getSourceStart() < nextTask
+ .getSourceStart()) {
currentProblem = nextProblem;
problemIndex++;
} else {
@@ -168,100 +180,109 @@ public class CompilationResult {
}
return allProblems;
}
-
-// public ClassFile[] getClassFiles() {
-// Enumeration enum = compiledTypes.elements();
-// ClassFile[] classFiles = new ClassFile[compiledTypes.size()];
-// int index = 0;
-// while (enum.hasMoreElements()){
-// classFiles[index++] = (ClassFile)enum.nextElement();
-// }
-// return classFiles;
-// }
+
+ // public ClassFile[] getClassFiles() {
+ // Enumeration enum = compiledTypes.elements();
+ // ClassFile[] classFiles = new ClassFile[compiledTypes.size()];
+ // int index = 0;
+ // while (enum.hasMoreElements()){
+ // classFiles[index++] = (ClassFile)enum.nextElement();
+ // }
+ // return classFiles;
+ // }
/**
- * Answer the initial compilation unit corresponding to the present compilation result
+ * Answer the initial compilation unit corresponding to the present
+ * compilation result
*/
- public ICompilationUnit getCompilationUnit(){
+ public ICompilationUnit getCompilationUnit() {
return compilationUnit;
}
/**
* Answer the initial file name
*/
- public char[] getFileName(){
+ public char[] getFileName() {
return fileName;
}
-
+
/**
* Answer the errors encountered during compilation.
*/
public IProblem[] getErrors() {
-
+
IProblem[] problems = getProblems();
int errorCount = 0;
for (int i = 0; i < this.problemCount; i++) {
- if (problems[i].isError()) errorCount++;
+ if (problems[i].isError())
+ errorCount++;
}
- if (errorCount == this.problemCount) return problems;
+ if (errorCount == this.problemCount)
+ return problems;
IProblem[] errors = new IProblem[errorCount];
int index = 0;
for (int i = 0; i < this.problemCount; i++) {
- if (problems[i].isError()) errors[index++] = problems[i];
+ if (problems[i].isError())
+ errors[index++] = problems[i];
}
return errors;
}
-
+
/**
* Answer the problems (errors and warnings) encountered during compilation.
- *
- * This is not a compiler internal API - it has side-effects !
- * It is intended to be used only once all problems have been detected,
- * and makes sure the problems slot as the exact size of the number of
- * problems.
+ *
+ * This is not a compiler internal API - it has side-effects ! It is
+ * intended to be used only once all problems have been detected, and makes
+ * sure the problems slot as the exact size of the number of problems.
*/
public IProblem[] getProblems() {
-
+
// Re-adjust the size of the problems if necessary.
if (problems != null) {
-
+
if (this.problemCount != problems.length) {
- System.arraycopy(problems, 0, (problems = new IProblem[problemCount]), 0, problemCount);
+ System.arraycopy(problems, 0,
+ (problems = new IProblem[problemCount]), 0,
+ problemCount);
}
-
- if (this.maxProblemPerUnit > 0 && this.problemCount > this.maxProblemPerUnit){
+
+ if (this.maxProblemPerUnit > 0
+ && this.problemCount > this.maxProblemPerUnit) {
quickPrioritize(problems, 0, problemCount - 1);
this.problemCount = this.maxProblemPerUnit;
- System.arraycopy(problems, 0, (problems = new IProblem[problemCount]), 0, problemCount);
+ System.arraycopy(problems, 0,
+ (problems = new IProblem[problemCount]), 0,
+ problemCount);
}
-
+
// Sort problems per source positions.
- quickSort(problems, 0, problems.length-1);
+ quickSort(problems, 0, problems.length - 1);
}
return problems;
}
/**
* Answer the tasks (TO-DO, ...) encountered during compilation.
- *
- * This is not a compiler internal API - it has side-effects !
- * It is intended to be used only once all problems have been detected,
- * and makes sure the problems slot as the exact size of the number of
- * problems.
+ *
+ * This is not a compiler internal API - it has side-effects ! It is
+ * intended to be used only once all problems have been detected, and makes
+ * sure the problems slot as the exact size of the number of problems.
*/
public IProblem[] getTasks() {
-
+
// Re-adjust the size of the tasks if necessary.
if (this.tasks != null) {
-
+
if (this.taskCount != this.tasks.length) {
- System.arraycopy(this.tasks, 0, (this.tasks = new IProblem[this.taskCount]), 0, this.taskCount);
+ System.arraycopy(this.tasks, 0,
+ (this.tasks = new IProblem[this.taskCount]), 0,
+ this.taskCount);
}
- quickSort(tasks, 0, tasks.length-1);
+ quickSort(tasks, 0, tasks.length - 1);
}
return this.tasks;
}
-
+
public boolean hasErrors() {
if (problems != null)
@@ -277,12 +298,13 @@ public class CompilationResult {
return problemCount != 0;
}
- public boolean hasSyntaxError(){
+ public boolean hasSyntaxError() {
if (problems != null)
for (int i = 0; i < problemCount; i++) {
IProblem problem = problems[i];
- if ((problem.getID() & IProblem.Syntax) != 0 && problem.isError())
+ if ((problem.getID() & IProblem.Syntax) != 0
+ && problem.isError())
return true;
}
return false;
@@ -291,7 +313,7 @@ public class CompilationResult {
public boolean hasTasks() {
return this.taskCount != 0;
}
-
+
public boolean hasWarnings() {
if (problems != null)
@@ -301,11 +323,12 @@ public class CompilationResult {
}
return false;
}
-
+
private static void quickSort(IProblem[] list, int left, int right) {
- if (left >= right) return;
-
+ if (left >= right)
+ return;
+
// sort the problems by their source start position... starting with 0
int original_left = left;
int original_right = right;
@@ -328,12 +351,14 @@ public class CompilationResult {
if (left < original_right)
quickSort(list, left, original_right);
}
-
+
private void quickPrioritize(IProblem[] list, int left, int right) {
-
- if (left >= right) return;
-
- // sort the problems by their priority... starting with the highest priority
+
+ if (left >= right)
+ return;
+
+ // sort the problems by their priority... starting with the highest
+ // priority
int original_left = left;
int original_right = right;
int mid = computePriority(list[(left + right) / 2]);
@@ -355,15 +380,14 @@ public class CompilationResult {
if (left < original_right)
quickPrioritize(list, left, original_right);
}
-
+
/**
* For now, remember the compiled type using its compound name.
*/
-// public void record(char[] typeName, ClassFile classFile) {
-//
-// compiledTypes.put(typeName, classFile);
-// }
-
+ // public void record(char[] typeName, ClassFile classFile) {
+ //
+ // compiledTypes.put(typeName, classFile);
+ // }
public void record(IProblem newProblem, ReferenceContext referenceContext) {
if (newProblem.getID() == IProblem.Task) {
@@ -373,13 +397,18 @@ public class CompilationResult {
if (problemCount == 0) {
problems = new IProblem[5];
} else if (problemCount == problems.length) {
- System.arraycopy(problems, 0, (problems = new IProblem[problemCount * 2]), 0, problemCount);
+ System.arraycopy(problems, 0,
+ (problems = new IProblem[problemCount * 2]), 0,
+ problemCount);
}
problems[problemCount++] = newProblem;
- if (referenceContext != null){
- if (problemsMap == null) problemsMap = new Hashtable(5);
- if (firstErrorsMap == null) firstErrorsMap = new Hashtable(5);
- if (newProblem.isError() && !referenceContext.hasErrors()) firstErrorsMap.put(newProblem, newProblem);
+ if (referenceContext != null) {
+ if (problemsMap == null)
+ problemsMap = new Hashtable(5);
+ if (firstErrorsMap == null)
+ firstErrorsMap = new Hashtable(5);
+ if (newProblem.isError() && !referenceContext.hasErrors())
+ firstErrorsMap.put(newProblem, newProblem);
problemsMap.put(newProblem, referenceContext);
}
}
@@ -388,43 +417,45 @@ public class CompilationResult {
if (this.taskCount == 0) {
this.tasks = new IProblem[5];
} else if (this.taskCount == this.tasks.length) {
- System.arraycopy(this.tasks, 0, (this.tasks = new IProblem[this.taskCount * 2]), 0, this.taskCount);
+ System.arraycopy(this.tasks, 0,
+ (this.tasks = new IProblem[this.taskCount * 2]), 0,
+ this.taskCount);
}
this.tasks[this.taskCount++] = newProblem;
}
-
- public CompilationResult tagAsAccepted(){
+
+ public CompilationResult tagAsAccepted() {
this.hasBeenAccepted = true;
this.problemsMap = null; // flush
return this;
}
-
- public String toString(){
+
+ public String toString() {
StringBuffer buffer = new StringBuffer();
- if (this.fileName != null){
+ if (this.fileName != null) {
buffer.append("Filename : ").append(this.fileName).append('\n'); //$NON-NLS-1$
}
-// if (this.compiledTypes != null){
-// buffer.append("COMPILED type(s) \n"); //$NON-NLS-1$
-// Enumeration typeNames = this.compiledTypes.keys();
-// while (typeNames.hasMoreElements()) {
-// char[] typeName = (char[]) typeNames.nextElement();
-// buffer.append("\t - ").append(typeName).append('\n'); //$NON-NLS-1$
-//
-// }
-// } else {
-// buffer.append("No COMPILED type\n"); //$NON-NLS-1$
-// }
- if (problems != null){
+ // if (this.compiledTypes != null){
+ // buffer.append("COMPILED type(s) \n"); //$NON-NLS-1$
+ // Enumeration typeNames = this.compiledTypes.keys();
+ // while (typeNames.hasMoreElements()) {
+ // char[] typeName = (char[]) typeNames.nextElement();
+ // buffer.append("\t - ").append(typeName).append('\n'); //$NON-NLS-1$
+ //
+ // }
+ // } else {
+ // buffer.append("No COMPILED type\n"); //$NON-NLS-1$
+ // }
+ if (problems != null) {
buffer.append(this.problemCount).append(" PROBLEM(s) detected \n"); //$NON-NLS-1$//$NON-NLS-2$
- for (int i = 0; i < this.problemCount; i++){
+ for (int i = 0; i < this.problemCount; i++) {
buffer.append("\t - ").append(this.problems[i]).append('\n'); //$NON-NLS-1$
}
} else {
buffer.append("No PROBLEM\n"); //$NON-NLS-1$
- }
+ }
return buffer.toString();
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java
index a360dae..76286a7 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/Compiler.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler;
+
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
@@ -32,481 +33,534 @@ import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
import net.sourceforge.phpdt.internal.compiler.util.Util;
public class Compiler implements ITypeRequestor, ProblemSeverities {
- public UnitParser parser;
- public ICompilerRequestor requestor;
- public CompilerOptions options;
- public ProblemReporter problemReporter;
- // management of unit to be processed
- //public CompilationUnitResult currentCompilationUnitResult;
- public CompilationUnitDeclaration[] unitsToProcess;
- public int totalUnits; // (totalUnits-1) gives the last unit in unitToProcess
- // name lookup
- public LookupEnvironment lookupEnvironment;
- // ONCE STABILIZED, THESE SHOULD RETURN TO A FINAL FIELD
- public static boolean DEBUG = false;
- public int parseThreshold = -1;
- // number of initial units parsed at once (-1: none)
- /*
- * Static requestor reserved to listening compilation results in debug mode,
- * so as for example to monitor compiler activity independantly from a
- * particular builder implementation. It is reset at the end of compilation,
- * and should not persist any information after having been reset.
- */
- // public static IDebugRequestor DebugRequestor = null;
- /**
- * Answer a new compiler using the given name environment and compiler
- * options. The environment and options will be in effect for the lifetime of
- * the compiler. When the compiler is run, compilation results are sent to
- * the given requestor.
- *
- * @param environment
- * org.eclipse.jdt.internal.compiler.api.env.INameEnvironment
- * Environment used by the compiler in order to resolve type and
- * package names. The name environment implements the actual
- * connection of the compiler to the outside world (e.g. in batch
- * mode the name environment is performing pure file accesses,
- * reuse previous build state or connection to repositories).
- * Note: the name environment is responsible for implementing the
- * actual classpath rules.
- *
- * @param policy
- * org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy
- * Configurable part for problem handling, allowing the compiler
- * client to specify the rules for handling problems (stop on
- * first error or accumulate them all) and at the same time
- * perform some actions such as opening a dialog in UI when
- * compiling interactively.
- * @see org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies
- *
- * @param requestor
- * org.eclipse.jdt.internal.compiler.api.ICompilerRequestor
- * Component which will receive and persist all compilation
- * results and is intended to consume them as they are produced.
- * Typically, in a batch compiler, it is responsible for writing
- * out the actual .class files to the file system.
- * @see org.eclipse.jdt.internal.compiler.CompilationResult
- *
- * @param problemFactory
- * org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory
- * Factory used inside the compiler to create problem descriptors.
- * It allows the compiler client to supply its own representation
- * of compilation problems in order to avoid object conversions.
- * Note that the factory is not supposed to accumulate the created
- * problems, the compiler will gather them all and hand them back
- * as part of the compilation unit result.
- */
- public Compiler(INameEnvironment environment, IErrorHandlingPolicy policy,
- Map settings, final ICompilerRequestor requestor,
- IProblemFactory problemFactory) {
- // create a problem handler given a handling policy
- this.options = new CompilerOptions(settings);
- // wrap requestor in DebugRequestor if one is specified
- // if(DebugRequestor == null) {
- this.requestor = requestor;
- // } else {
- // this.requestor = new ICompilerRequestor(){
- // public void acceptResult(CompilationResult result){
- // if (DebugRequestor.isActive()){
- // DebugRequestor.acceptDebugResult(result);
- // }
- // requestor.acceptResult(result);
- // }
- // };
- // }
- this.problemReporter = new ProblemReporter(policy, this.options,
- problemFactory);
- this.lookupEnvironment = new LookupEnvironment(this, problemReporter,
- environment); //options, problemReporter, environment);
- this.parser = new UnitParser(problemReporter);
- // this.options.parseLiteralExpressionsAsConstants,
- // options.sourceLevel >= CompilerOptions.JDK1_4);
- }
- /**
- * Answer a new compiler using the given name environment and compiler
- * options. The environment and options will be in effect for the lifetime of
- * the compiler. When the compiler is run, compilation results are sent to
- * the given requestor.
- *
- * @param environment
- * org.eclipse.jdt.internal.compiler.api.env.INameEnvironment
- * Environment used by the compiler in order to resolve type and
- * package names. The name environment implements the actual
- * connection of the compiler to the outside world (e.g. in batch
- * mode the name environment is performing pure file accesses,
- * reuse previous build state or connection to repositories).
- * Note: the name environment is responsible for implementing the
- * actual classpath rules.
- *
- * @param policy
- * org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy
- * Configurable part for problem handling, allowing the compiler
- * client to specify the rules for handling problems (stop on
- * first error or accumulate them all) and at the same time
- * perform some actions such as opening a dialog in UI when
- * compiling interactively.
- * @see org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies
- *
- * @param requestor
- * org.eclipse.jdt.internal.compiler.api.ICompilerRequestor
- * Component which will receive and persist all compilation
- * results and is intended to consume them as they are produced.
- * Typically, in a batch compiler, it is responsible for writing
- * out the actual .class files to the file system.
- * @see org.eclipse.jdt.internal.compiler.CompilationResult
- *
- * @param problemFactory
- * org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory
- * Factory used inside the compiler to create problem descriptors.
- * It allows the compiler client to supply its own representation
- * of compilation problems in order to avoid object conversions.
- * Note that the factory is not supposed to accumulate the created
- * problems, the compiler will gather them all and hand them back
- * as part of the compilation unit result.
- * @param parseLiteralExpressionsAsConstants
- * boolean This parameter is used to optimize the
- * literals or leave them as they are in the source. If you put
- * true, "Hello" . " world" will be converted to "Hello world".
- */
- public Compiler(INameEnvironment environment, IErrorHandlingPolicy policy,
- Map settings, final ICompilerRequestor requestor,
- IProblemFactory problemFactory, boolean parseLiteralExpressionsAsConstants) {
- // create a problem handler given a handling policy
- this.options = new CompilerOptions(settings);
- // wrap requestor in DebugRequestor if one is specified
- // if(DebugRequestor == null) {
- this.requestor = requestor;
- // } else {
- // this.requestor = new ICompilerRequestor(){
- // public void acceptResult(CompilationResult result){
- // if (DebugRequestor.isActive()){
- // DebugRequestor.acceptDebugResult(result);
- // }
- // requestor.acceptResult(result);
- // }
- // };
- // }
- this.problemReporter = new ProblemReporter(policy, this.options,
- problemFactory);
- this.lookupEnvironment = new LookupEnvironment(this, problemReporter,
- environment);//options, problemReporter, environment);
- this.parser = new UnitParser(problemReporter);
- // parseLiteralExpressionsAsConstants,
- // this.options.sourceLevel >= CompilerOptions.JDK1_4);
- }
- /**
- * Add an additional binary type
- */
- public void accept(IBinaryType binaryType, PackageBinding packageBinding) {
- lookupEnvironment.createBinaryTypeFrom(binaryType, packageBinding);
- }
- /**
- * Add an additional compilation unit into the loop -> build compilation unit
- * declarations, their bindings and record their results.
- */
- public void accept(ICompilationUnit sourceUnit) {
- // Switch the current policy and compilation result for this unit to the
- // requested one.
- CompilationResult unitResult = new CompilationResult(sourceUnit,
- totalUnits, totalUnits, this.options.maxProblemsPerUnit);
- try {
- // diet parsing for large collection of unit
- CompilationUnitDeclaration parsedUnit;
- if (totalUnits < parseThreshold) {
- parsedUnit = parser.parse(sourceUnit, unitResult, false);
- } else {
- parsedUnit = parser.dietParse(sourceUnit, unitResult);
- }
- if (options.verbose) {
- String count = String.valueOf(totalUnits + 1);
- System.out.println(Util.bind("compilation.request", //$NON-NLS-1$
- new String[]{count, count, new String(sourceUnit.getFileName())}));
- }
- // initial type binding creation
- lookupEnvironment.buildTypeBindings(parsedUnit);
- this.addCompilationUnit(sourceUnit, parsedUnit);
- // binding resolution
- lookupEnvironment.completeTypeBindings(parsedUnit);
- } catch (AbortCompilationUnit e) {
- // at this point, currentCompilationUnitResult may not be sourceUnit, but
- // some other
- // one requested further along to resolve sourceUnit.
- if (unitResult.compilationUnit == sourceUnit) { // only report once
- requestor.acceptResult(unitResult.tagAsAccepted());
- } else {
- throw e; // want to abort enclosing request to compile
- }
- }
- }
- /**
- * Add additional source types
- */
- public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding) {
- problemReporter.abortDueToInternalError(Util.bind(
- "abort.againstSourceModel ", //$NON-NLS-1$
- String.valueOf(sourceTypes[0].getName()), String.valueOf(sourceTypes[0]
- .getFileName())));
- }
- protected void addCompilationUnit(ICompilationUnit sourceUnit,
- CompilationUnitDeclaration parsedUnit) {
- // append the unit to the list of ones to process later on
- int size = unitsToProcess.length;
- if (totalUnits == size)
- // when growing reposition units starting at position 0
- System.arraycopy(unitsToProcess, 0,
- (unitsToProcess = new CompilationUnitDeclaration[size * 2]), 0,
- totalUnits);
- unitsToProcess[totalUnits++] = parsedUnit;
- }
- /**
- * Add the initial set of compilation units into the loop -> build
- * compilation unit declarations, their bindings and record their results.
- */
- protected void beginToCompile(ICompilationUnit[] sourceUnits) {
- int maxUnits = sourceUnits.length;
- totalUnits = 0;
- unitsToProcess = new CompilationUnitDeclaration[maxUnits];
- // Switch the current policy and compilation result for this unit to the
- // requested one.
- for (int i = 0; i < maxUnits; i++) {
- CompilationUnitDeclaration parsedUnit;
- CompilationResult unitResult = new CompilationResult(sourceUnits[i], i,
- maxUnits, this.options.maxProblemsPerUnit);
- try {
- // diet parsing for large collection of units
- if (totalUnits < parseThreshold) {
- parsedUnit = parser.parse(sourceUnits[i], unitResult, false);
- } else {
- parsedUnit = parser.dietParse(sourceUnits[i], unitResult);
- }
- if (options.verbose) {
- System.out.println(Util.bind("compilation.request", //$NON-NLS-1$
- new String[]{String.valueOf(i + 1), String.valueOf(maxUnits),
- new String(sourceUnits[i].getFileName())}));
- }
- // initial type binding creation
- // lookupEnvironment.buildTypeBindings(parsedUnit);
- this.addCompilationUnit(sourceUnits[i], parsedUnit);
- //} catch (AbortCompilationUnit e) {
- //requestor.acceptResult(unitResult.tagAsAccepted());
- } finally {
- sourceUnits[i] = null; // no longer hold onto the unit
- }
- }
- // binding resolution
- lookupEnvironment.completeTypeBindings();
- }
- /**
- * General API -> compile each of supplied files -> recompile any required
- * types for which we have an incomplete principle structure
- */
- public void compile(ICompilationUnit[] sourceUnits) {
- CompilationUnitDeclaration unit = null;
- int i = 0;
- try {
- // build and record parsed units
- beginToCompile(sourceUnits);
- // process all units (some more could be injected in the loop by the
- // lookup environment)
- for (; i < totalUnits; i++) {
- unit = unitsToProcess[i];
- try {
- if (options.verbose)
- System.out.println(Util.bind("compilation.process", //$NON-NLS-1$
- new String[]{String.valueOf(i + 1), String.valueOf(totalUnits),
- new String(unitsToProcess[i].getFileName())}));
- process(unit, i);
- } finally {
- // cleanup compilation unit result
- unit.cleanUp();
- if (options.verbose)
- System.out.println(Util.bind("compilation.done", //$NON-NLS-1$
- new String[]{String.valueOf(i + 1), String.valueOf(totalUnits),
- new String(unitsToProcess[i].getFileName())}));
- }
- unitsToProcess[i] = null; // release reference to processed unit
- // declaration
- requestor.acceptResult(unit.compilationResult.tagAsAccepted());
- }
- } catch (AbortCompilation e) {
- this.handleInternalException(e, unit);
- } catch (Error e) {
- this.handleInternalException(e, unit, null);
- throw e; // rethrow
- } catch (RuntimeException e) {
- this.handleInternalException(e, unit, null);
- throw e; // rethrow
- } finally {
- this.reset();
- }
- // if (options.verbose) {
- // if (totalUnits > 1) {
- // System.out.println(
- // ProjectPrefUtil.bind("compilation.units" , String.valueOf(totalUnits)));
- // //$NON-NLS-1$
- // } else {
- // System.out.println(
- // ProjectPrefUtil.bind("compilation.unit" , String.valueOf(totalUnits)));
- // //$NON-NLS-1$
- // }
- // }
- }
- protected void getMethodBodies(CompilationUnitDeclaration unit, int place) {
- //fill the methods bodies in order for the code to be generated
- if (unit.ignoreMethodBodies) {
- unit.ignoreFurtherInvestigation = true;
- return;
- // if initial diet parse did not work, no need to dig into method bodies.
- }
- if (place < parseThreshold)
- return; //work already done ...
- //real parse of the method....
- parser.scanner.setSource(unit.compilationResult.compilationUnit
- .getContents());
- if (unit.types != null) {
- for (int i = unit.types.size(); --i >= 0;)
- if (unit.types.get(i) instanceof TypeDeclaration) {
- ((TypeDeclaration) unit.types.get(i)).parseMethod(parser, unit);
- }
- }
- }
- /*
- * Compiler crash recovery in case of unexpected runtime exceptions
- */
- protected void handleInternalException(Throwable internalException,
- CompilationUnitDeclaration unit, CompilationResult result) {
- /* dump a stack trace to the console */
- internalException.printStackTrace();
- /* find a compilation result */
- if ((unit != null)) // basing result upon the current unit if available
- result = unit.compilationResult; // current unit being processed ?
- if ((result == null) && (unitsToProcess != null) && (totalUnits > 0))
- result = unitsToProcess[totalUnits - 1].compilationResult;
- // last unit in beginToCompile ?
- if (result != null) {
- /* create and record a compilation problem */
- StringWriter stringWriter = new StringWriter();
- PrintWriter writer = new PrintWriter(stringWriter);
- internalException.printStackTrace(writer);
- StringBuffer buffer = stringWriter.getBuffer();
- String[] pbArguments = new String[]{Util
- .bind("compilation.internalError")
- //$NON-NLS-1$
- + "\n" //$NON-NLS-1$
- + buffer.toString()};
- result.record(problemReporter.createProblem(result.getFileName(),
- IProblem.Unclassified, pbArguments, pbArguments, Error, // severity
- 0, // source start
- 0, // source end
- 0, // line number
- unit, result), unit);
- /* hand back the compilation result */
- if (!result.hasBeenAccepted) {
- requestor.acceptResult(result.tagAsAccepted());
- }
- }
- }
- /*
- * Compiler recovery in case of internal AbortCompilation event
- */
- protected void handleInternalException(AbortCompilation abortException,
- CompilationUnitDeclaration unit) {
- /*
- * special treatment for SilentAbort: silently cancelling the compilation
- * process
- */
- if (abortException.isSilent) {
- if (abortException.silentException == null) {
- return;
- } else {
- throw abortException.silentException;
- }
- }
- /* uncomment following line to see where the abort came from */
- // abortException.printStackTrace();
- // Exception may tell which compilation result it is related, and which
- // problem caused it
- CompilationResult result = abortException.compilationResult;
- if ((result == null) && (unit != null))
- result = unit.compilationResult; // current unit being processed ?
- if ((result == null) && (unitsToProcess != null) && (totalUnits > 0))
- result = unitsToProcess[totalUnits - 1].compilationResult;
- // last unit in beginToCompile ?
- if (result != null && !result.hasBeenAccepted) {
- /* distant problem which could not be reported back there */
- if (abortException.problemId != 0) {
- result.record(problemReporter.createProblem(result.getFileName(),
- abortException.problemId, abortException.problemArguments,
- abortException.messageArguments, Error, // severity
- 0, // source start
- 0, // source end
- 0, // line number
- unit, result), unit);
- } else {
- /* distant internal exception which could not be reported back there */
- if (abortException.exception != null) {
- this.handleInternalException(abortException.exception, null, result);
- return;
- }
- }
- /* hand back the compilation result */
- if (!result.hasBeenAccepted) {
- requestor.acceptResult(result.tagAsAccepted());
- }
- } else {
- /*
- * if (abortException.problemId != 0){ IProblem problem =
- * problemReporter.createProblem( "???".toCharArray(),
- * abortException.problemId, abortException.problemArguments, Error, //
- * severity 0, // source start 0, // source end 0); // line number
- * System.out.println(problem.getMessage()); }
- */
- abortException.printStackTrace();
- }
- }
- /**
- * Process a compilation unit already parsed and build.
- */
- public void process(CompilationUnitDeclaration unit, int i) {
- getMethodBodies(unit, i);
- // fault in fields & methods
- if (unit.scope != null)
- unit.scope.faultInTypes();
- // verify inherited methods
- // if (unit.scope != null)
- // unit.scope.verifyMethods(lookupEnvironment.methodVerifier());
- // type checking
- unit.resolve();
- // flow analysis
- unit.analyseCode();
- // code generation
- // unit.generateCode();
- // reference info
- // if (options.produceReferenceInfo && unit.scope != null)
- // unit.scope.storeDependencyInfo();
- // refresh the total number of units known at this stage
- unit.compilationResult.totalUnitsKnown = totalUnits;
- }
- public void reset() {
- lookupEnvironment.reset();
- parser.scanner.source = null;
- unitsToProcess = null;
- // if (DebugRequestor != null) DebugRequestor.reset();
- }
- /**
- * Internal API used to resolve a given compilation unit. Can run a subset of the compilation process
+ public UnitParser parser;
+
+ public ICompilerRequestor requestor;
+
+ public CompilerOptions options;
+
+ public ProblemReporter problemReporter;
+
+ // management of unit to be processed
+ // public CompilationUnitResult currentCompilationUnitResult;
+ public CompilationUnitDeclaration[] unitsToProcess;
+
+ public int totalUnits; // (totalUnits-1) gives the last unit in
+ // unitToProcess
+
+ // name lookup
+ public LookupEnvironment lookupEnvironment;
+
+ // ONCE STABILIZED, THESE SHOULD RETURN TO A FINAL FIELD
+ public static boolean DEBUG = false;
+
+ public int parseThreshold = -1;
+
+ // number of initial units parsed at once (-1: none)
+ /*
+ * Static requestor reserved to listening compilation results in debug mode,
+ * so as for example to monitor compiler activity independantly from a
+ * particular builder implementation. It is reset at the end of compilation,
+ * and should not persist any information after having been reset.
+ */
+ // public static IDebugRequestor DebugRequestor = null;
+ /**
+ * Answer a new compiler using the given name environment and compiler
+ * options. The environment and options will be in effect for the lifetime
+ * of the compiler. When the compiler is run, compilation results are sent
+ * to the given requestor.
+ *
+ * @param environment
+ * org.eclipse.jdt.internal.compiler.api.env.INameEnvironment
+ * Environment used by the compiler in order to resolve type and
+ * package names. The name environment implements the actual
+ * connection of the compiler to the outside world (e.g. in batch
+ * mode the name environment is performing pure file accesses,
+ * reuse previous build state or connection to repositories).
+ * Note: the name environment is responsible for implementing the
+ * actual classpath rules.
+ *
+ * @param policy
+ * org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy
+ * Configurable part for problem handling, allowing the compiler
+ * client to specify the rules for handling problems (stop on
+ * first error or accumulate them all) and at the same time
+ * perform some actions such as opening a dialog in UI when
+ * compiling interactively.
+ * @see org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies
+ *
+ * @param requestor
+ * org.eclipse.jdt.internal.compiler.api.ICompilerRequestor
+ * Component which will receive and persist all compilation
+ * results and is intended to consume them as they are produced.
+ * Typically, in a batch compiler, it is responsible for writing
+ * out the actual .class files to the file system.
+ * @see org.eclipse.jdt.internal.compiler.CompilationResult
+ *
+ * @param problemFactory
+ * org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory
+ * Factory used inside the compiler to create problem
+ * descriptors. It allows the compiler client to supply its own
+ * representation of compilation problems in order to avoid
+ * object conversions. Note that the factory is not supposed to
+ * accumulate the created problems, the compiler will gather them
+ * all and hand them back as part of the compilation unit result.
+ */
+ public Compiler(INameEnvironment environment, IErrorHandlingPolicy policy,
+ Map settings, final ICompilerRequestor requestor,
+ IProblemFactory problemFactory) {
+ // create a problem handler given a handling policy
+ this.options = new CompilerOptions(settings);
+ // wrap requestor in DebugRequestor if one is specified
+ // if(DebugRequestor == null) {
+ this.requestor = requestor;
+ // } else {
+ // this.requestor = new ICompilerRequestor(){
+ // public void acceptResult(CompilationResult result){
+ // if (DebugRequestor.isActive()){
+ // DebugRequestor.acceptDebugResult(result);
+ // }
+ // requestor.acceptResult(result);
+ // }
+ // };
+ // }
+ this.problemReporter = new ProblemReporter(policy, this.options,
+ problemFactory);
+ this.lookupEnvironment = new LookupEnvironment(this, problemReporter,
+ environment); // options, problemReporter, environment);
+ this.parser = new UnitParser(problemReporter);
+ // this.options.parseLiteralExpressionsAsConstants,
+ // options.sourceLevel >= CompilerOptions.JDK1_4);
+ }
+
+ /**
+ * Answer a new compiler using the given name environment and compiler
+ * options. The environment and options will be in effect for the lifetime
+ * of the compiler. When the compiler is run, compilation results are sent
+ * to the given requestor.
+ *
+ * @param environment
+ * org.eclipse.jdt.internal.compiler.api.env.INameEnvironment
+ * Environment used by the compiler in order to resolve type and
+ * package names. The name environment implements the actual
+ * connection of the compiler to the outside world (e.g. in batch
+ * mode the name environment is performing pure file accesses,
+ * reuse previous build state or connection to repositories).
+ * Note: the name environment is responsible for implementing the
+ * actual classpath rules.
+ *
+ * @param policy
+ * org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy
+ * Configurable part for problem handling, allowing the compiler
+ * client to specify the rules for handling problems (stop on
+ * first error or accumulate them all) and at the same time
+ * perform some actions such as opening a dialog in UI when
+ * compiling interactively.
+ * @see org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies
+ *
+ * @param requestor
+ * org.eclipse.jdt.internal.compiler.api.ICompilerRequestor
+ * Component which will receive and persist all compilation
+ * results and is intended to consume them as they are produced.
+ * Typically, in a batch compiler, it is responsible for writing
+ * out the actual .class files to the file system.
+ * @see org.eclipse.jdt.internal.compiler.CompilationResult
+ *
+ * @param problemFactory
+ * org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory
+ * Factory used inside the compiler to create problem
+ * descriptors. It allows the compiler client to supply its own
+ * representation of compilation problems in order to avoid
+ * object conversions. Note that the factory is not supposed to
+ * accumulate the created problems, the compiler will gather them
+ * all and hand them back as part of the compilation unit result.
+ * @param parseLiteralExpressionsAsConstants
+ * boolean This parameter is used to optimize the
+ * literals or leave them as they are in the source. If you put
+ * true, "Hello" . " world" will be converted to "Hello world".
+ */
+ public Compiler(INameEnvironment environment, IErrorHandlingPolicy policy,
+ Map settings, final ICompilerRequestor requestor,
+ IProblemFactory problemFactory,
+ boolean parseLiteralExpressionsAsConstants) {
+ // create a problem handler given a handling policy
+ this.options = new CompilerOptions(settings);
+ // wrap requestor in DebugRequestor if one is specified
+ // if(DebugRequestor == null) {
+ this.requestor = requestor;
+ // } else {
+ // this.requestor = new ICompilerRequestor(){
+ // public void acceptResult(CompilationResult result){
+ // if (DebugRequestor.isActive()){
+ // DebugRequestor.acceptDebugResult(result);
+ // }
+ // requestor.acceptResult(result);
+ // }
+ // };
+ // }
+ this.problemReporter = new ProblemReporter(policy, this.options,
+ problemFactory);
+ this.lookupEnvironment = new LookupEnvironment(this, problemReporter,
+ environment);// options, problemReporter, environment);
+ this.parser = new UnitParser(problemReporter);
+ // parseLiteralExpressionsAsConstants,
+ // this.options.sourceLevel >= CompilerOptions.JDK1_4);
+ }
+
+ /**
+ * Add an additional binary type
+ */
+ public void accept(IBinaryType binaryType, PackageBinding packageBinding) {
+ lookupEnvironment.createBinaryTypeFrom(binaryType, packageBinding);
+ }
+
+ /**
+ * Add an additional compilation unit into the loop -> build compilation
+ * unit declarations, their bindings and record their results.
+ */
+ public void accept(ICompilationUnit sourceUnit) {
+ // Switch the current policy and compilation result for this unit to the
+ // requested one.
+ CompilationResult unitResult = new CompilationResult(sourceUnit,
+ totalUnits, totalUnits, this.options.maxProblemsPerUnit);
+ try {
+ // diet parsing for large collection of unit
+ CompilationUnitDeclaration parsedUnit;
+ if (totalUnits < parseThreshold) {
+ parsedUnit = parser.parse(sourceUnit, unitResult, false);
+ } else {
+ parsedUnit = parser.dietParse(sourceUnit, unitResult);
+ }
+ if (options.verbose) {
+ String count = String.valueOf(totalUnits + 1);
+ System.out.println(Util.bind("compilation.request", //$NON-NLS-1$
+ new String[] { count, count,
+ new String(sourceUnit.getFileName()) }));
+ }
+ // initial type binding creation
+ lookupEnvironment.buildTypeBindings(parsedUnit);
+ this.addCompilationUnit(sourceUnit, parsedUnit);
+ // binding resolution
+ lookupEnvironment.completeTypeBindings(parsedUnit);
+ } catch (AbortCompilationUnit e) {
+ // at this point, currentCompilationUnitResult may not be
+ // sourceUnit, but
+ // some other
+ // one requested further along to resolve sourceUnit.
+ if (unitResult.compilationUnit == sourceUnit) { // only report once
+ requestor.acceptResult(unitResult.tagAsAccepted());
+ } else {
+ throw e; // want to abort enclosing request to compile
+ }
+ }
+ }
+
+ /**
+ * Add additional source types
*/
- public CompilationUnitDeclaration resolve(
- CompilationUnitDeclaration unit,
- ICompilationUnit sourceUnit,
- boolean verifyMethods,
+ public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding) {
+ problemReporter.abortDueToInternalError(Util.bind(
+ "abort.againstSourceModel ", //$NON-NLS-1$
+ String.valueOf(sourceTypes[0].getName()), String
+ .valueOf(sourceTypes[0].getFileName())));
+ }
+
+ protected void addCompilationUnit(ICompilationUnit sourceUnit,
+ CompilationUnitDeclaration parsedUnit) {
+ // append the unit to the list of ones to process later on
+ int size = unitsToProcess.length;
+ if (totalUnits == size)
+ // when growing reposition units starting at position 0
+ System
+ .arraycopy(
+ unitsToProcess,
+ 0,
+ (unitsToProcess = new CompilationUnitDeclaration[size * 2]),
+ 0, totalUnits);
+ unitsToProcess[totalUnits++] = parsedUnit;
+ }
+
+ /**
+ * Add the initial set of compilation units into the loop -> build
+ * compilation unit declarations, their bindings and record their results.
+ */
+ protected void beginToCompile(ICompilationUnit[] sourceUnits) {
+ int maxUnits = sourceUnits.length;
+ totalUnits = 0;
+ unitsToProcess = new CompilationUnitDeclaration[maxUnits];
+ // Switch the current policy and compilation result for this unit to the
+ // requested one.
+ for (int i = 0; i < maxUnits; i++) {
+ CompilationUnitDeclaration parsedUnit;
+ CompilationResult unitResult = new CompilationResult(
+ sourceUnits[i], i, maxUnits,
+ this.options.maxProblemsPerUnit);
+ try {
+ // diet parsing for large collection of units
+ if (totalUnits < parseThreshold) {
+ parsedUnit = parser
+ .parse(sourceUnits[i], unitResult, false);
+ } else {
+ parsedUnit = parser.dietParse(sourceUnits[i], unitResult);
+ }
+ if (options.verbose) {
+ System.out
+ .println(Util.bind("compilation.request", //$NON-NLS-1$
+ new String[] {
+ String.valueOf(i + 1),
+ String.valueOf(maxUnits),
+ new String(sourceUnits[i]
+ .getFileName()) }));
+ }
+ // initial type binding creation
+ // lookupEnvironment.buildTypeBindings(parsedUnit);
+ this.addCompilationUnit(sourceUnits[i], parsedUnit);
+ // } catch (AbortCompilationUnit e) {
+ // requestor.acceptResult(unitResult.tagAsAccepted());
+ } finally {
+ sourceUnits[i] = null; // no longer hold onto the unit
+ }
+ }
+ // binding resolution
+ lookupEnvironment.completeTypeBindings();
+ }
+
+ /**
+ * General API -> compile each of supplied files -> recompile any required
+ * types for which we have an incomplete principle structure
+ */
+ public void compile(ICompilationUnit[] sourceUnits) {
+ CompilationUnitDeclaration unit = null;
+ int i = 0;
+ try {
+ // build and record parsed units
+ beginToCompile(sourceUnits);
+ // process all units (some more could be injected in the loop by the
+ // lookup environment)
+ for (; i < totalUnits; i++) {
+ unit = unitsToProcess[i];
+ try {
+ if (options.verbose)
+ System.out.println(Util.bind("compilation.process", //$NON-NLS-1$
+ new String[] {
+ String.valueOf(i + 1),
+ String.valueOf(totalUnits),
+ new String(unitsToProcess[i]
+ .getFileName()) }));
+ process(unit, i);
+ } finally {
+ // cleanup compilation unit result
+ unit.cleanUp();
+ if (options.verbose)
+ System.out.println(Util.bind("compilation.done", //$NON-NLS-1$
+ new String[] {
+ String.valueOf(i + 1),
+ String.valueOf(totalUnits),
+ new String(unitsToProcess[i]
+ .getFileName()) }));
+ }
+ unitsToProcess[i] = null; // release reference to processed
+ // unit
+ // declaration
+ requestor.acceptResult(unit.compilationResult.tagAsAccepted());
+ }
+ } catch (AbortCompilation e) {
+ this.handleInternalException(e, unit);
+ } catch (Error e) {
+ this.handleInternalException(e, unit, null);
+ throw e; // rethrow
+ } catch (RuntimeException e) {
+ this.handleInternalException(e, unit, null);
+ throw e; // rethrow
+ } finally {
+ this.reset();
+ }
+ // if (options.verbose) {
+ // if (totalUnits > 1) {
+ // System.out.println(
+ // ProjectPrefUtil.bind("compilation.units" ,
+ // String.valueOf(totalUnits)));
+ // //$NON-NLS-1$
+ // } else {
+ // System.out.println(
+ // ProjectPrefUtil.bind("compilation.unit" ,
+ // String.valueOf(totalUnits)));
+ // //$NON-NLS-1$
+ // }
+ // }
+ }
+
+ protected void getMethodBodies(CompilationUnitDeclaration unit, int place) {
+ // fill the methods bodies in order for the code to be generated
+ if (unit.ignoreMethodBodies) {
+ unit.ignoreFurtherInvestigation = true;
+ return;
+ // if initial diet parse did not work, no need to dig into method
+ // bodies.
+ }
+ if (place < parseThreshold)
+ return; // work already done ...
+ // real parse of the method....
+ parser.scanner.setSource(unit.compilationResult.compilationUnit
+ .getContents());
+ if (unit.types != null) {
+ for (int i = unit.types.size(); --i >= 0;)
+ if (unit.types.get(i) instanceof TypeDeclaration) {
+ ((TypeDeclaration) unit.types.get(i)).parseMethod(parser,
+ unit);
+ }
+ }
+ }
+
+ /*
+ * Compiler crash recovery in case of unexpected runtime exceptions
+ */
+ protected void handleInternalException(Throwable internalException,
+ CompilationUnitDeclaration unit, CompilationResult result) {
+ /* dump a stack trace to the console */
+ internalException.printStackTrace();
+ /* find a compilation result */
+ if ((unit != null)) // basing result upon the current unit if available
+ result = unit.compilationResult; // current unit being processed
+ // ?
+ if ((result == null) && (unitsToProcess != null) && (totalUnits > 0))
+ result = unitsToProcess[totalUnits - 1].compilationResult;
+ // last unit in beginToCompile ?
+ if (result != null) {
+ /* create and record a compilation problem */
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter writer = new PrintWriter(stringWriter);
+ internalException.printStackTrace(writer);
+ StringBuffer buffer = stringWriter.getBuffer();
+ String[] pbArguments = new String[] { Util
+ .bind("compilation.internalError")
+ //$NON-NLS-1$
+ + "\n" //$NON-NLS-1$
+ + buffer.toString() };
+ result.record(problemReporter.createProblem(result.getFileName(),
+ IProblem.Unclassified, pbArguments, pbArguments, Error, // severity
+ 0, // source start
+ 0, // source end
+ 0, // line number
+ unit, result), unit);
+ /* hand back the compilation result */
+ if (!result.hasBeenAccepted) {
+ requestor.acceptResult(result.tagAsAccepted());
+ }
+ }
+ }
+
+ /*
+ * Compiler recovery in case of internal AbortCompilation event
+ */
+ protected void handleInternalException(AbortCompilation abortException,
+ CompilationUnitDeclaration unit) {
+ /*
+ * special treatment for SilentAbort: silently cancelling the
+ * compilation process
+ */
+ if (abortException.isSilent) {
+ if (abortException.silentException == null) {
+ return;
+ } else {
+ throw abortException.silentException;
+ }
+ }
+ /* uncomment following line to see where the abort came from */
+ // abortException.printStackTrace();
+ // Exception may tell which compilation result it is related, and which
+ // problem caused it
+ CompilationResult result = abortException.compilationResult;
+ if ((result == null) && (unit != null))
+ result = unit.compilationResult; // current unit being processed
+ // ?
+ if ((result == null) && (unitsToProcess != null) && (totalUnits > 0))
+ result = unitsToProcess[totalUnits - 1].compilationResult;
+ // last unit in beginToCompile ?
+ if (result != null && !result.hasBeenAccepted) {
+ /* distant problem which could not be reported back there */
+ if (abortException.problemId != 0) {
+ result.record(problemReporter.createProblem(result
+ .getFileName(), abortException.problemId,
+ abortException.problemArguments,
+ abortException.messageArguments, Error, // severity
+ 0, // source start
+ 0, // source end
+ 0, // line number
+ unit, result), unit);
+ } else {
+ /*
+ * distant internal exception which could not be reported back
+ * there
+ */
+ if (abortException.exception != null) {
+ this.handleInternalException(abortException.exception,
+ null, result);
+ return;
+ }
+ }
+ /* hand back the compilation result */
+ if (!result.hasBeenAccepted) {
+ requestor.acceptResult(result.tagAsAccepted());
+ }
+ } else {
+ /*
+ * if (abortException.problemId != 0){ IProblem problem =
+ * problemReporter.createProblem( "???".toCharArray(),
+ * abortException.problemId, abortException.problemArguments, Error, //
+ * severity 0, // source start 0, // source end 0); // line number
+ * System.out.println(problem.getMessage()); }
+ */
+ abortException.printStackTrace();
+ }
+ }
+
+ /**
+ * Process a compilation unit already parsed and build.
+ */
+ public void process(CompilationUnitDeclaration unit, int i) {
+ getMethodBodies(unit, i);
+ // fault in fields & methods
+ if (unit.scope != null)
+ unit.scope.faultInTypes();
+ // verify inherited methods
+ // if (unit.scope != null)
+ // unit.scope.verifyMethods(lookupEnvironment.methodVerifier());
+ // type checking
+ unit.resolve();
+ // flow analysis
+ unit.analyseCode();
+ // code generation
+ // unit.generateCode();
+ // reference info
+ // if (options.produceReferenceInfo && unit.scope != null)
+ // unit.scope.storeDependencyInfo();
+ // refresh the total number of units known at this stage
+ unit.compilationResult.totalUnitsKnown = totalUnits;
+ }
+
+ public void reset() {
+ lookupEnvironment.reset();
+ parser.scanner.source = null;
+ unitsToProcess = null;
+ // if (DebugRequestor != null) DebugRequestor.reset();
+ }
+
+ /**
+ * Internal API used to resolve a given compilation unit. Can run a subset
+ * of the compilation process
+ */
+ public CompilationUnitDeclaration resolve(CompilationUnitDeclaration unit,
+ ICompilationUnit sourceUnit, boolean verifyMethods,
boolean analyzeCode) {
-
+
try {
if (unit == null) {
// build and record parsed units
parseThreshold = 0; // will request a full parse
beginToCompile(new ICompilationUnit[] { sourceUnit });
- // process all units (some more could be injected in the loop by the lookup environment)
+ // process all units (some more could be injected in the loop by
+ // the lookup environment)
unit = unitsToProcess[0];
} else {
// initial type binding creation
@@ -516,27 +570,85 @@ public class Compiler implements ITypeRequestor, ProblemSeverities {
lookupEnvironment.completeTypeBindings();
}
// TODO : jsurfer check this
-// this.parser.getMethodBodies(unit);
+ // this.parser.getMethodBodies(unit);
getMethodBodies(unit, 0);
-
+
if (unit.scope != null) {
// fault in fields & methods
unit.scope.faultInTypes();
if (unit.scope != null && verifyMethods) {
// http://dev.eclipse.org/bugs/show_bug.cgi?id=23117
// verify inherited methods
- unit.scope.verifyMethods(lookupEnvironment.methodVerifier());
+ unit.scope
+ .verifyMethods(lookupEnvironment.methodVerifier());
}
// type checking
- unit.resolve();
+ unit.resolve();
+
+ // flow analysis
+ // if (analyzeCode) unit.analyseCode();
+ // code generation
+ // if (generateCode) unit.generateCode();
+ }
+ if (unitsToProcess != null)
+ unitsToProcess[0] = null; // release reference to processed
+ // unit declaration
+ requestor.acceptResult(unit.compilationResult.tagAsAccepted());
+ return unit;
+ } catch (AbortCompilation e) {
+ this.handleInternalException(e, unit);
+ return unit == null ? unitsToProcess[0] : unit;
+ } catch (Error e) {
+ this.handleInternalException(e, unit, null);
+ throw e; // rethrow
+ } catch (RuntimeException e) {
+ this.handleInternalException(e, unit, null);
+ throw e; // rethrow
+ } finally {
+ // No reset is performed there anymore since,
+ // within the CodeAssist (or related tools),
+ // the compiler may be called *after* a call
+ // to this resolve(...) method. And such a call
+ // needs to have a compiler with a non-empty
+ // environment.
+ // this.reset();
+ }
+ }
+
+ /**
+ * Internal API used to resolve a given compilation unit. Can run a subset
+ * of the compilation process
+ */
+ public CompilationUnitDeclaration resolve(ICompilationUnit sourceUnit,
+ boolean verifyMethods, boolean analyzeCode) {
+ // boolean generateCode) {
+ CompilationUnitDeclaration unit = null;
+ try {
+ // build and record parsed units
+ parseThreshold = 0; // will request a full parse
+ beginToCompile(new ICompilationUnit[] { sourceUnit });
+ // process all units (some more could be injected in the loop by the
+ // lookup environment)
+ unit = unitsToProcess[0];
+ getMethodBodies(unit, 0);
+ if (unit.scope != null) {
+ // // fault in fields & methods
+ // unit.scope.faultInTypes();
+ // if (unit.scope != null && verifyMethods) {
+ // // http://dev.eclipse.org/bugs/show_bug.cgi?id=23117
+ // // verify inherited methods
+ // unit.scope.verifyMethods(lookupEnvironment.methodVerifier());
+ // }
+ // // type checking
+ // unit.resolve();
// flow analysis
-// if (analyzeCode) unit.analyseCode();
-
+ // if (analyzeCode) unit.analyseCode();
// code generation
-// if (generateCode) unit.generateCode();
+ // if (generateCode) unit.generateCode();
}
- if (unitsToProcess != null) unitsToProcess[0] = null; // release reference to processed unit declaration
+ unitsToProcess[0] = null; // release reference to processed unit
+ // declaration
requestor.acceptResult(unit.compilationResult.tagAsAccepted());
return unit;
} catch (AbortCompilation e) {
@@ -558,59 +670,5 @@ public class Compiler implements ITypeRequestor, ProblemSeverities {
// this.reset();
}
}
- /**
- * Internal API used to resolve a given compilation unit. Can run a subset of
- * the compilation process
- */
- public CompilationUnitDeclaration resolve(ICompilationUnit sourceUnit,
- boolean verifyMethods, boolean analyzeCode) {
- // boolean generateCode) {
- CompilationUnitDeclaration unit = null;
- try {
- // build and record parsed units
- parseThreshold = 0; // will request a full parse
- beginToCompile(new ICompilationUnit[]{sourceUnit});
- // process all units (some more could be injected in the loop by the
- // lookup environment)
- unit = unitsToProcess[0];
- getMethodBodies(unit, 0);
- if (unit.scope != null) {
- // // fault in fields & methods
- // unit.scope.faultInTypes();
- // if (unit.scope != null && verifyMethods) {
- // // http://dev.eclipse.org/bugs/show_bug.cgi?id=23117
- // // verify inherited methods
- // unit.scope.verifyMethods(lookupEnvironment.methodVerifier());
- // }
- // // type checking
- // unit.resolve();
- // flow analysis
- // if (analyzeCode) unit.analyseCode();
- // code generation
- // if (generateCode) unit.generateCode();
- }
- unitsToProcess[0] = null; // release reference to processed unit
- // declaration
- requestor.acceptResult(unit.compilationResult.tagAsAccepted());
- return unit;
- } catch (AbortCompilation e) {
- this.handleInternalException(e, unit);
- return unit == null ? unitsToProcess[0] : unit;
- } catch (Error e) {
- this.handleInternalException(e, unit, null);
- throw e; // rethrow
- } catch (RuntimeException e) {
- this.handleInternalException(e, unit, null);
- throw e; // rethrow
- } finally {
- // No reset is performed there anymore since,
- // within the CodeAssist (or related tools),
- // the compiler may be called *after* a call
- // to this resolve(...) method. And such a call
- // needs to have a compiler with a non-empty
- // environment.
- // this.reset();
- }
- }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ConfigurableOption.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ConfigurableOption.java
index 624ed03..e9b77f2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ConfigurableOption.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ConfigurableOption.java
@@ -25,206 +25,234 @@ import java.util.StringTokenizer;
public class ConfigurableOption {
private String componentName;
+
private String optionName;
+
private int id;
private String category;
+
private String name;
+
private String description;
+
private int currentValueIndex;
+
private int defaultValueIndex;
+
private String[] possibleValues;
- // special value for indicating that
+ // special value for indicating that
// the is the actual value
- public final static String[] NoDiscreteValue = {};
-/**
- * INTERNAL USE ONLY
- *
- * Initialize an instance of this class according to a specific locale
- *
- * @param loc java.util.Locale
- */
-public ConfigurableOption(
- String componentName,
- String optionName,
- Locale loc,
- int currentValueIndex) {
-
- this.componentName = componentName;
- this.optionName = optionName;
- this.currentValueIndex = currentValueIndex;
-
- ResourceBundle resource = null;
- try {
- String location = componentName.substring(0, componentName.lastIndexOf('.'));
- resource = ResourceBundle.getBundle(location + ".Options", loc); //$NON-NLS-1$
- } catch (MissingResourceException e) {
- category = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
- name = "Missing ressources entries for"+ componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
- description = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
- possibleValues = new String[0];
- id = -1;
+ public final static String[] NoDiscreteValue = {};
+
+ /**
+ * INTERNAL USE ONLY
+ *
+ * Initialize an instance of this class according to a specific locale
+ *
+ * @param loc
+ * java.util.Locale
+ */
+ public ConfigurableOption(String componentName, String optionName,
+ Locale loc, int currentValueIndex) {
+
+ this.componentName = componentName;
+ this.optionName = optionName;
+ this.currentValueIndex = currentValueIndex;
+
+ ResourceBundle resource = null;
+ try {
+ String location = componentName.substring(0, componentName
+ .lastIndexOf('.'));
+ resource = ResourceBundle.getBundle(location + ".Options", loc); //$NON-NLS-1$
+ } catch (MissingResourceException e) {
+ category = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
+ name = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
+ description = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
+ possibleValues = new String[0];
+ id = -1;
+ }
+ if (resource == null)
+ return;
+ try {
+ id = Integer.parseInt(resource.getString(optionName + ".number")); //$NON-NLS-1$
+ } catch (MissingResourceException e) {
+ id = -1;
+ } catch (NumberFormatException e) {
+ id = -1;
+ }
+ try {
+ category = resource.getString(optionName + ".category"); //$NON-NLS-1$
+ } catch (MissingResourceException e) {
+ category = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ try {
+ name = resource.getString(optionName + ".name"); //$NON-NLS-1$
+ } catch (MissingResourceException e) {
+ name = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ try {
+ StringTokenizer tokenizer = new StringTokenizer(resource
+ .getString(optionName + ".possibleValues"), "|"); //$NON-NLS-1$ //$NON-NLS-2$
+ int numberOfValues = Integer.parseInt(tokenizer.nextToken());
+ if (numberOfValues == -1) {
+ possibleValues = NoDiscreteValue;
+ } else {
+ possibleValues = new String[numberOfValues];
+ int index = 0;
+ while (tokenizer.hasMoreTokens()) {
+ possibleValues[index] = tokenizer.nextToken();
+ index++;
+ }
+ }
+ } catch (MissingResourceException e) {
+ possibleValues = new String[0];
+ } catch (NoSuchElementException e) {
+ possibleValues = new String[0];
+ } catch (NumberFormatException e) {
+ possibleValues = new String[0];
+ }
+ try {
+ description = resource.getString(optionName + ".description"); //$NON-NLS-1$
+ } catch (MissingResourceException e) {
+ description = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
- if (resource == null) return;
- try {
- id = Integer.parseInt(resource.getString(optionName + ".number")); //$NON-NLS-1$
- } catch (MissingResourceException e) {
- id = -1;
- } catch (NumberFormatException e) {
- id = -1;
+
+ /**
+ * Return a String that represents the localized category of the receiver.
+ *
+ * @return java.lang.String
+ */
+ public String getCategory() {
+ return category;
}
- try {
- category = resource.getString(optionName + ".category"); //$NON-NLS-1$
- } catch (MissingResourceException e) {
- category = "Missing ressources entries for" + componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * Return a String that identifies the component owner (typically the
+ * qualified type name of the class which it corresponds to).
+ *
+ * e.g. "org.phpeclipse.phpdt.internal.compiler.api.Compiler"
+ *
+ * @return java.lang.String
+ */
+ public String getComponentName() {
+ return componentName;
}
- try {
- name = resource.getString(optionName + ".name"); //$NON-NLS-1$
- } catch (MissingResourceException e) {
- name = "Missing ressources entries for"+ componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * Answer the index (in possibleValues array) of the current setting for
+ * this particular option.
+ *
+ * In case the set of possibleValues is NoDiscreteValue, then this index is
+ * the actual value (e.g. max line lenght set to 80).
+ *
+ * @return int
+ */
+ public int getCurrentValueIndex() {
+ return currentValueIndex;
}
- try {
- StringTokenizer tokenizer = new StringTokenizer(resource.getString(optionName + ".possibleValues"), "|"); //$NON-NLS-1$ //$NON-NLS-2$
- int numberOfValues = Integer.parseInt(tokenizer.nextToken());
- if(numberOfValues == -1){
- possibleValues = NoDiscreteValue;
- } else {
- possibleValues = new String[numberOfValues];
- int index = 0;
- while (tokenizer.hasMoreTokens()) {
- possibleValues[index] = tokenizer.nextToken();
- index++;
- }
- }
- } catch (MissingResourceException e) {
- possibleValues = new String[0];
- } catch (NoSuchElementException e) {
- possibleValues = new String[0];
- } catch (NumberFormatException e) {
- possibleValues = new String[0];
+
+ /**
+ * Answer the index (in possibleValues array) of the default setting for
+ * this particular option.
+ *
+ * In case the set of possibleValues is NoDiscreteValue, then this index is
+ * the actual value (e.g. max line lenght set to 80).
+ *
+ * @return int
+ */
+ public int getDefaultValueIndex() {
+ return defaultValueIndex;
}
- try {
- description = resource.getString(optionName + ".description"); //$NON-NLS-1$
- } catch (MissingResourceException e) {
- description = "Missing ressources entries for"+ componentName + " options"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * Return an String that represents the localized description of the
+ * receiver.
+ *
+ * @return java.lang.String
+ */
+ public String getDescription() {
+ return description;
}
-}
-/**
- * Return a String that represents the localized category of the receiver.
- * @return java.lang.String
- */
-public String getCategory() {
- return category;
-}
-/**
- * Return a String that identifies the component owner (typically the qualified
- * type name of the class which it corresponds to).
- *
- * e.g. "org.phpeclipse.phpdt.internal.compiler.api.Compiler"
- *
- * @return java.lang.String
- */
-public String getComponentName() {
- return componentName;
-}
-/**
- * Answer the index (in possibleValues array) of the current setting for this
- * particular option.
- *
- * In case the set of possibleValues is NoDiscreteValue, then this index is the
- * actual value (e.g. max line lenght set to 80).
- *
- * @return int
- */
-public int getCurrentValueIndex() {
- return currentValueIndex;
-}
-/**
- * Answer the index (in possibleValues array) of the default setting for this
- * particular option.
- *
- * In case the set of possibleValues is NoDiscreteValue, then this index is the
- * actual value (e.g. max line lenght set to 80).
- *
- * @return int
- */
-public int getDefaultValueIndex() {
- return defaultValueIndex;
-}
-/**
- * Return an String that represents the localized description of the receiver.
- *
- * @return java.lang.String
- */
-public String getDescription() {
- return description;
-}
-/**
- * Internal ID which allows the configurable component to identify this particular option.
- *
- * @return int
- */
-public int getID() {
- return id;
-}
-/**
- * Return a String that represents the localized name of the receiver.
- * @return java.lang.String
- */
-public String getName() {
- return name;
-}
-/**
- * Return an array of String that represents the localized possible values of the receiver.
- * @return java.lang.String[]
- */
-public String[] getPossibleValues() {
- return possibleValues;
-}
-/**
- * Change the index (in possibleValues array) of the current setting for this
- * particular option.
- *
- * In case the set of possibleValues is NoDiscreteValue, then this index is the
- * actual value (e.g. max line lenght set to 80).
- *
- * @return int
- */
-public void setValueIndex(int newIndex) {
- currentValueIndex = newIndex;
-}
-public String toString() {
- StringBuffer buffer = new StringBuffer();
- buffer.append("Configurable option for "); //$NON-NLS-1$
- buffer.append(this.componentName).append("\n"); //$NON-NLS-1$
- buffer.append("- category: ").append(this.category).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
- buffer.append("- name: ").append(this.name).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
- /* display current value */
- buffer.append("- current value: "); //$NON-NLS-1$
- if (possibleValues == NoDiscreteValue){
- buffer.append(this.currentValueIndex);
- } else {
- buffer.append(this.possibleValues[this.currentValueIndex]);
+
+ /**
+ * Internal ID which allows the configurable component to identify this
+ * particular option.
+ *
+ * @return int
+ */
+ public int getID() {
+ return id;
+ }
+
+ /**
+ * Return a String that represents the localized name of the receiver.
+ *
+ * @return java.lang.String
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Return an array of String that represents the localized possible values
+ * of the receiver.
+ *
+ * @return java.lang.String[]
+ */
+ public String[] getPossibleValues() {
+ return possibleValues;
}
- buffer.append("\n"); //$NON-NLS-1$
-
- /* display possible values */
- if (possibleValues != NoDiscreteValue){
- buffer.append("- possible values: ["); //$NON-NLS-1$
- for (int i = 0, max = possibleValues.length; i < max; i++) {
- if (i != 0)
- buffer.append(", "); //$NON-NLS-1$
- buffer.append(possibleValues[i]);
+
+ /**
+ * Change the index (in possibleValues array) of the current setting for
+ * this particular option.
+ *
+ * In case the set of possibleValues is NoDiscreteValue, then this index is
+ * the actual value (e.g. max line lenght set to 80).
+ *
+ * @return int
+ */
+ public void setValueIndex(int newIndex) {
+ currentValueIndex = newIndex;
+ }
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Configurable option for "); //$NON-NLS-1$
+ buffer.append(this.componentName).append("\n"); //$NON-NLS-1$
+ buffer.append("- category: ").append(this.category).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append("- name: ").append(this.name).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ /* display current value */
+ buffer.append("- current value: "); //$NON-NLS-1$
+ if (possibleValues == NoDiscreteValue) {
+ buffer.append(this.currentValueIndex);
+ } else {
+ buffer.append(this.possibleValues[this.currentValueIndex]);
}
- buffer.append("]\n"); //$NON-NLS-1$
- buffer.append("- curr. val. index: ").append(currentValueIndex).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append("\n"); //$NON-NLS-1$
+
+ /* display possible values */
+ if (possibleValues != NoDiscreteValue) {
+ buffer.append("- possible values: ["); //$NON-NLS-1$
+ for (int i = 0, max = possibleValues.length; i < max; i++) {
+ if (i != 0)
+ buffer.append(", "); //$NON-NLS-1$
+ buffer.append(possibleValues[i]);
+ }
+ buffer.append("]\n"); //$NON-NLS-1$
+ buffer
+ .append("- curr. val. index: ").append(currentValueIndex).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ buffer.append("- description: ").append(description).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ return buffer.toString();
}
- buffer.append("- description: ").append(description).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
- return buffer.toString();
-}
+
/**
* Gets the optionName.
+ *
* @return Returns a String
*/
public String getOptionName() {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DefaultErrorHandlingPolicies.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DefaultErrorHandlingPolicies.java
index 19152b4..034dcec 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DefaultErrorHandlingPolicies.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DefaultErrorHandlingPolicies.java
@@ -11,65 +11,70 @@
package net.sourceforge.phpdt.internal.compiler;
public class DefaultErrorHandlingPolicies {
-
-/*
- * Accumulate all problems, then exit without proceeding.
- *
- * Typically, the #proceedWithProblems(Problem[]) should
- * show the problems.
- *
- */
-public static IErrorHandlingPolicy exitAfterAllProblems() {
- return new IErrorHandlingPolicy() {
- public boolean stopOnFirstError() {
- return false;
- }
- public boolean proceedOnErrors(){
- return false;
- }
- };
-}
-/*
- * Exit without proceeding on the first problem wich appears
- * to be an error.
- *
- */
-public static IErrorHandlingPolicy exitOnFirstError() {
- return new IErrorHandlingPolicy() {
- public boolean stopOnFirstError() {
- return true;
- }
- public boolean proceedOnErrors(){
- return false;
- }
- };
-}
-/*
- * Proceed on the first error met.
- *
- */
-public static IErrorHandlingPolicy proceedOnFirstError() {
- return new IErrorHandlingPolicy() {
- public boolean stopOnFirstError() {
- return true;
- }
- public boolean proceedOnErrors(){
- return true;
- }
- };
-}
-/*
- * Accumulate all problems, then proceed with them.
- *
- */
-public static IErrorHandlingPolicy proceedWithAllProblems() {
- return new IErrorHandlingPolicy() {
- public boolean stopOnFirstError() {
- return false;
- }
- public boolean proceedOnErrors(){
- return true;
- }
- };
-}
+
+ /*
+ * Accumulate all problems, then exit without proceeding.
+ *
+ * Typically, the #proceedWithProblems(Problem[]) should show the problems.
+ *
+ */
+ public static IErrorHandlingPolicy exitAfterAllProblems() {
+ return new IErrorHandlingPolicy() {
+ public boolean stopOnFirstError() {
+ return false;
+ }
+
+ public boolean proceedOnErrors() {
+ return false;
+ }
+ };
+ }
+
+ /*
+ * Exit without proceeding on the first problem wich appears to be an error.
+ *
+ */
+ public static IErrorHandlingPolicy exitOnFirstError() {
+ return new IErrorHandlingPolicy() {
+ public boolean stopOnFirstError() {
+ return true;
+ }
+
+ public boolean proceedOnErrors() {
+ return false;
+ }
+ };
+ }
+
+ /*
+ * Proceed on the first error met.
+ *
+ */
+ public static IErrorHandlingPolicy proceedOnFirstError() {
+ return new IErrorHandlingPolicy() {
+ public boolean stopOnFirstError() {
+ return true;
+ }
+
+ public boolean proceedOnErrors() {
+ return true;
+ }
+ };
+ }
+
+ /*
+ * Accumulate all problems, then proceed with them.
+ *
+ */
+ public static IErrorHandlingPolicy proceedWithAllProblems() {
+ return new IErrorHandlingPolicy() {
+ public boolean stopOnFirstError() {
+ return false;
+ }
+
+ public boolean proceedOnErrors() {
+ return true;
+ }
+ };
+ }
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java
index 80da79e..d68c7a2 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/DocumentElementParser.java
@@ -16,1287 +16,1340 @@ import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
/*
- * A document element parser extracts structural information from a piece of source, providing detailed source positions info.
+ * A document element parser extracts structural information from a piece of
+ * source, providing detailed source positions info.
*
* also see @IDocumentElementRequestor
*
- * The structural investigation includes: - the package statement - import statements - top-level types: package member, member
- * types (member types of member types...) - fields - methods
+ * The structural investigation includes: - the package statement - import
+ * statements - top-level types: package member, member types (member types of
+ * member types...) - fields - methods
*
* Any (parsing) problem encountered is also provided.
*/
public class DocumentElementParser extends UnitParser {
- IDocumentElementRequestor requestor;
+ IDocumentElementRequestor requestor;
- private int localIntPtr;
+ private int localIntPtr;
- private int lastFieldEndPosition;
+ private int lastFieldEndPosition;
- private int lastFieldBodyEndPosition;
+ private int lastFieldBodyEndPosition;
- private int typeStartPosition;
+ private int typeStartPosition;
- private long selectorSourcePositions;
+ private long selectorSourcePositions;
- private int typeDims;
+ private int typeDims;
- private int extendsDim;
+ private int extendsDim;
- private int declarationSourceStart;
+ private int declarationSourceStart;
- /* int[] stack for storing javadoc positions */
- int[][] intArrayStack;
+ /* int[] stack for storing javadoc positions */
+ int[][] intArrayStack;
- int intArrayPtr;
+ int intArrayPtr;
- // CompilerOptions options;
+ // CompilerOptions options;
- public DocumentElementParser(final IDocumentElementRequestor requestor, IProblemFactory problemFactory,
- CompilerOptions options) {
- super(new ProblemReporter(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) {
- public void record(IProblem problem, CompilationResult unitResult) {
- requestor.acceptProblem(problem);
- }
- });
- // false,
- // options.sourceLevel >= CompilerOptions.JDK1_4);
- this.requestor = requestor;
- intArrayStack = new int[30][];
- this.options = options;
- }
+ public DocumentElementParser(final IDocumentElementRequestor requestor,
+ IProblemFactory problemFactory, CompilerOptions options) {
+ super(new ProblemReporter(DefaultErrorHandlingPolicies
+ .exitAfterAllProblems(), options, problemFactory) {
+ public void record(IProblem problem, CompilationResult unitResult) {
+ requestor.acceptProblem(problem);
+ }
+ });
+ // false,
+ // options.sourceLevel >= CompilerOptions.JDK1_4);
+ this.requestor = requestor;
+ intArrayStack = new int[30][];
+ this.options = options;
+ }
- /**
- *
- * INTERNAL USE-ONLY
- */
- //protected void adjustInterfaceModifiers() {
- // intStack[intPtr - 2] |= AccInterface;
- //}
- /*
- * Will clear the comment stack when looking for a potential JavaDoc which might contain @deprecated.
- *
- * Additionally, before investigating for @deprecated, retrieve the positions of the JavaDoc comments so as to notify requestor
- * with them.
- */
- //public void checkAnnotation() {
- //
- // /* persisting javadoc positions */
- // pushOnIntArrayStack(this.getJavaDocPositions());
- // boolean deprecated = false;
- // int lastAnnotationIndex = -1;
- // int commentPtr = scanner.commentPtr;
- //
- // //since jdk1.2 look only in the last java doc comment...
- // nextComment : for (lastAnnotationIndex = scanner.commentPtr; lastAnnotationIndex >= 0; lastAnnotationIndex--){
- // //look for @deprecated into the first javadoc comment preceeding the declaration
- // int commentSourceStart = scanner.commentStarts[lastAnnotationIndex];
- // // javadoc only (non javadoc comment have negative end positions.)
- // if (modifiersSourceStart != -1 && modifiersSourceStart < commentSourceStart) {
- // continue nextComment;
- // }
- // if (scanner.commentStops[lastAnnotationIndex] < 0) {
- // continue nextComment;
- // }
- // int commentSourceEnd = scanner.commentStops[lastAnnotationIndex] - 1; //stop is one over
- // char[] comment = scanner.source;
- //
- // deprecated =
- // checkDeprecation(
- // commentSourceStart,
- // commentSourceEnd,
- // comment);
- // break nextComment;
- // }
- // if (deprecated) {
- // checkAndSetModifiers(AccDeprecated);
- // }
- // // modify the modifier source start to point at the first comment
- // if (commentPtr >= 0) {
- // declarationSourceStart = scanner.commentStarts[0];
- // }
- //}
- /**
- *
- * INTERNAL USE-ONLY
- */
- //protected void consumeClassBodyDeclaration() {
- // // ClassBodyDeclaration ::= Diet Block
- // //push an Initializer
- // //optimize the push/pop
- //
- // super.consumeClassBodyDeclaration();
- // Initializer initializer = (Initializer) astStack[astPtr];
- // requestor.acceptInitializer(
- // initializer.declarationSourceStart,
- // initializer.declarationSourceEnd,
- // intArrayStack[intArrayPtr--],
- // 0,
- // modifiersSourceStart,
- // initializer.block.sourceStart,
- // initializer.block.sourceEnd);
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeClassDeclaration() {
- // super.consumeClassDeclaration();
- // // we know that we have a TypeDeclaration on the top of the astStack
- // if (isLocalDeclaration()) {
- // // we ignore the local variable declarations
- // return;
- // }
- // requestor.exitClass(endStatementPosition, // '}' is the end of the body
- // ((TypeDeclaration) astStack[astPtr]).declarationSourceEnd);
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeClassHeader() {
- // //ClassHeader ::= $empty
- // super.consumeClassHeader();
- // if (isLocalDeclaration()) {
- // // we ignore the local variable declarations
- // intArrayPtr--;
- // return;
- // }
- // TypeDeclaration typeDecl = (TypeDeclaration) astStack[astPtr];
- // TypeReference[] superInterfaces = typeDecl.superInterfaces;
- // char[][] interfaceNames = null;
- // int[] interfaceNameStarts = null;
- // int[] interfaceNameEnds = null;
- // if (superInterfaces != null) {
- // int superInterfacesLength = superInterfaces.length;
- // interfaceNames = new char[superInterfacesLength][];
- // interfaceNameStarts = new int[superInterfacesLength];
- // interfaceNameEnds = new int[superInterfacesLength];
- // for (int i = 0; i < superInterfacesLength; i++) {
- // TypeReference superInterface = superInterfaces[i];
- // interfaceNames[i] = CharOperation.concatWith(superInterface.getTypeName(), '.');
- // interfaceNameStarts[i] = superInterface.sourceStart;
- // interfaceNameEnds[i] = superInterface.sourceEnd;
- // }
- // }
- // // flush the comments related to the class header
- // scanner.commentPtr = -1;
- // TypeReference superclass = typeDecl.superclass;
- // if (superclass == null) {
- // requestor.enterClass(
- // typeDecl.declarationSourceStart,
- // intArrayStack[intArrayPtr--],
- // typeDecl.modifiers,
- // typeDecl.modifiersSourceStart,
- // typeStartPosition,
- // typeDecl.name,
- // typeDecl.sourceStart,
- // typeDecl.sourceEnd,
- // null,
- // -1,
- // -1,
- // interfaceNames,
- // interfaceNameStarts,
- // interfaceNameEnds,
- // scanner.currentPosition - 1);
- // } else {
- // requestor.enterClass(
- // typeDecl.declarationSourceStart,
- // intArrayStack[intArrayPtr--],
- // typeDecl.modifiers,
- // typeDecl.modifiersSourceStart,
- // typeStartPosition,
- // typeDecl.name,
- // typeDecl.sourceStart,
- // typeDecl.sourceEnd,
- // CharOperation.concatWith(superclass.getTypeName(), '.'),
- // superclass.sourceStart,
- // superclass.sourceEnd,
- // interfaceNames,
- // interfaceNameStarts,
- // interfaceNameEnds,
- // scanner.currentPosition - 1);
- //
- // }
- //}
- //protected void consumeClassHeaderName() {
- // // ClassHeaderName ::= Modifiersopt 'class' 'Identifier'
- // TypeDeclaration typeDecl;
- // if (nestedMethod[nestedType] == 0) {
- // if (nestedType != 0) {
- // typeDecl = new MemberTypeDeclaration(this.compilationUnit.compilationResult);
- // } else {
- // typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
- // }
- // } else {
- // // Record that the block has a declaration for local types
- // typeDecl = new LocalTypeDeclaration(this.compilationUnit.compilationResult);
- // markEnclosingMemberWithLocalType();
- // blockReal();
- // }
- //
- // //highlight the name of the type
- // long pos = identifierPositionStack[identifierPtr];
- // typeDecl.sourceEnd = (int) pos;
- // typeDecl.sourceStart = (int) (pos >>> 32);
- // typeDecl.name = identifierStack[identifierPtr--];
- // identifierLengthPtr--;
- //
- // //compute the declaration source too
- // // 'class' and 'interface' push an int position
- // typeStartPosition = typeDecl.declarationSourceStart = intStack[intPtr--];
- // intPtr--;
- // int declarationSourceStart = intStack[intPtr--];
- // typeDecl.modifiersSourceStart = intStack[intPtr--];
- // typeDecl.modifiers = intStack[intPtr--];
- // if (typeDecl.declarationSourceStart > declarationSourceStart) {
- // typeDecl.declarationSourceStart = declarationSourceStart;
- // }
- // typeDecl.bodyStart = typeDecl.sourceEnd + 1;
- // pushOnAstStack(typeDecl);
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeCompilationUnit() {
- // // CompilationUnit ::= EnterCompilationUnit PackageDeclarationopt ImportDeclarationsopt
- // requestor.exitCompilationUnit(scanner.source.length - 1);
- //}
- /**
- *
- * INTERNAL USE-ONLY
- */
- //protected void consumeConstructorDeclaration() {
- // // ConstructorDeclaration ::= ConstructorHeader ConstructorBody
- // super.consumeConstructorDeclaration();
- // if (isLocalDeclaration()) {
- // // we ignore the local variable declarations
- // return;
- // }
- // ConstructorDeclaration cd = (ConstructorDeclaration) astStack[astPtr];
- // requestor.exitConstructor(endStatementPosition, cd.declarationSourceEnd);
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeConstructorHeader() {
- // // ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters MethodHeaderThrowsClauseopt
- // super.consumeConstructorHeader();
- // if (isLocalDeclaration()) {
- // // we ignore the local variable declarations
- // intArrayPtr--;
- // return;
- // }
- // ConstructorDeclaration cd = (ConstructorDeclaration) astStack[astPtr];
- // Argument[] arguments = cd.arguments;
- // char[][] argumentTypes = null;
- // char[][] argumentNames = null;
- // int[] argumentTypeStarts = null;
- // int[] argumentTypeEnds = null;
- // int[] argumentNameStarts = null;
- // int[] argumentNameEnds = null;
- // if (arguments != null) {
- // int argumentLength = arguments.length;
- // argumentTypes = new char[argumentLength][];
- // argumentNames = new char[argumentLength][];
- // argumentNameStarts = new int[argumentLength];
- // argumentNameEnds = new int[argumentLength];
- // argumentTypeStarts = new int[argumentLength];
- // argumentTypeEnds = new int[argumentLength];
- // for (int i = 0; i < argumentLength; i++) {
- // Argument argument = arguments[i];
- // TypeReference argumentType = argument.type;
- // argumentTypes[i] = returnTypeName(argumentType);
- // argumentNames[i] = argument.name;
- // argumentNameStarts[i] = argument.sourceStart;
- // argumentNameEnds[i] = argument.sourceEnd;
- // argumentTypeStarts[i] = argumentType.sourceStart;
- // argumentTypeEnds[i] = argumentType.sourceEnd;
- // }
- // }
- // TypeReference[] thrownExceptions = cd.thrownExceptions;
- // char[][] exceptionTypes = null;
- // int[] exceptionTypeStarts = null;
- // int[] exceptionTypeEnds = null;
- // if (thrownExceptions != null) {
- // int thrownExceptionLength = thrownExceptions.length;
- // exceptionTypes = new char[thrownExceptionLength][];
- // exceptionTypeStarts = new int[thrownExceptionLength];
- // exceptionTypeEnds = new int[thrownExceptionLength];
- // for (int i = 0; i < thrownExceptionLength; i++) {
- // TypeReference exception = thrownExceptions[i];
- // exceptionTypes[i] = CharOperation.concatWith(exception.getTypeName(), '.');
- // exceptionTypeStarts[i] = exception.sourceStart;
- // exceptionTypeEnds[i] = exception.sourceEnd;
- // }
- // }
- // requestor
- // .enterConstructor(
- // cd.declarationSourceStart,
- // intArrayStack[intArrayPtr--],
- // cd.modifiers,
- // cd.modifiersSourceStart,
- // cd.selector,
- // cd.sourceStart,
- // (int) (selectorSourcePositions & 0xFFFFFFFFL),
- // // retrieve the source end of the name
- // argumentTypes,
- // argumentTypeStarts,
- // argumentTypeEnds,
- // argumentNames,
- // argumentNameStarts,
- // argumentNameEnds,
- // rParenPos,
- // // right parenthesis
- // exceptionTypes,
- // exceptionTypeStarts,
- // exceptionTypeEnds,
- // scanner.currentPosition - 1);
- //}
- //protected void consumeConstructorHeaderName() {
- // // ConstructorHeaderName ::= Modifiersopt 'Identifier' '('
- // ConstructorDeclaration cd = new ConstructorDeclaration(this.compilationUnit.compilationResult);
- //
- // //name -- this is not really revelant but we do .....
- // cd.selector = identifierStack[identifierPtr];
- // selectorSourcePositions = identifierPositionStack[identifierPtr--];
- // identifierLengthPtr--;
- //
- // //modifiers
- // cd.declarationSourceStart = intStack[intPtr--];
- // cd.modifiersSourceStart = intStack[intPtr--];
- // cd.modifiers = intStack[intPtr--];
- //
- // //highlight starts at the selector starts
- // cd.sourceStart = (int) (selectorSourcePositions >>> 32);
- // pushOnAstStack(cd);
- //
- // cd.sourceEnd = lParenPos;
- // cd.bodyStart = lParenPos + 1;
- //}
- //protected void consumeDefaultModifiers() {
- // checkAnnotation(); // might update modifiers with AccDeprecated
- // pushOnIntStack(modifiers); // modifiers
- // pushOnIntStack(-1);
- // pushOnIntStack(
- // declarationSourceStart >= 0 ? declarationSourceStart : scanner.startPosition);
- // resetModifiers();
- //}
- //protected void consumeDiet() {
- // // Diet ::= $empty
- // super.consumeDiet();
- // /* persisting javadoc positions
- // * Will be consume in consumeClassBodyDeclaration
- // */
- // pushOnIntArrayStack(this.getJavaDocPositions());
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeEnterCompilationUnit() {
- // // EnterCompilationUnit ::= $empty
- // requestor.enterCompilationUnit();
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeEnterVariable() {
- // // EnterVariable ::= $empty
- // boolean isLocalDeclaration = isLocalDeclaration();
- // if (!isLocalDeclaration && (variablesCounter[nestedType] != 0)) {
- // requestor.exitField(lastFieldBodyEndPosition, lastFieldEndPosition);
- // }
- // char[] name = identifierStack[identifierPtr];
- // long namePosition = identifierPositionStack[identifierPtr--];
- // int extendedTypeDimension = intStack[intPtr--];
- //
- // AbstractVariableDeclaration declaration;
- // if (nestedMethod[nestedType] != 0) {
- // // create the local variable declarations
- // declaration =
- // new LocalDeclaration(null, name, (int) (namePosition >>> 32), (int) namePosition);
- // } else {
- // // create the field declaration
- // declaration =
- // new FieldDeclaration(null, name, (int) (namePosition >>> 32), (int) namePosition);
- // }
- // identifierLengthPtr--;
- // TypeReference type;
- // int variableIndex = variablesCounter[nestedType];
- // int typeDim = 0;
- // if (variableIndex == 0) {
- // // first variable of the declaration (FieldDeclaration or LocalDeclaration)
- // if (nestedMethod[nestedType] != 0) {
- // // local declaration
- // declaration.declarationSourceStart = intStack[intPtr--];
- // declaration.modifiersSourceStart = intStack[intPtr--];
- // declaration.modifiers = intStack[intPtr--];
- // type = getTypeReference(typeDim = intStack[intPtr--]); // type dimension
- // pushOnAstStack(type);
- // } else {
- // // field declaration
- // type = getTypeReference(typeDim = intStack[intPtr--]); // type dimension
- // pushOnAstStack(type);
- // declaration.declarationSourceStart = intStack[intPtr--];
- // declaration.modifiersSourceStart = intStack[intPtr--];
- // declaration.modifiers = intStack[intPtr--];
- // }
- // } else {
- // type = (TypeReference) astStack[astPtr - variableIndex];
- // typeDim = type.dimensions();
- // AbstractVariableDeclaration previousVariable =
- // (AbstractVariableDeclaration) astStack[astPtr];
- // declaration.declarationSourceStart = previousVariable.declarationSourceStart;
- // declaration.modifiers = previousVariable.modifiers;
- // declaration.modifiersSourceStart = previousVariable.modifiersSourceStart;
- // }
- //
- // localIntPtr = intPtr;
- //
- // if (extendedTypeDimension == 0) {
- // declaration.type = type;
- // } else {
- // int dimension = typeDim + extendedTypeDimension;
- // //on the identifierLengthStack there is the information about the type....
- // int baseType;
- // if ((baseType = identifierLengthStack[identifierLengthPtr + 1]) < 0) {
- // //it was a baseType
- // declaration.type = TypeReference.baseTypeReference(-baseType, dimension);
- // declaration.type.sourceStart = type.sourceStart;
- // declaration.type.sourceEnd = type.sourceEnd;
- // } else {
- // declaration.type = this.copyDims(type, dimension);
- // }
- // }
- // variablesCounter[nestedType]++;
- // nestedMethod[nestedType]++;
- // pushOnAstStack(declaration);
- //
- // int[] javadocPositions = intArrayStack[intArrayPtr];
- // if (!isLocalDeclaration) {
- // requestor
- // .enterField(
- // declaration.declarationSourceStart,
- // javadocPositions,
- // declaration.modifiers,
- // declaration.modifiersSourceStart,
- // returnTypeName(declaration.type),
- // type.sourceStart,
- // type.sourceEnd,
- // typeDims,
- // name,
- // (int) (namePosition >>> 32),
- // (int) namePosition,
- // extendedTypeDimension,
- // extendedTypeDimension == 0 ? -1 : endPosition);
- // }
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeExitVariableWithInitialization() {
- // // ExitVariableWithInitialization ::= $empty
- // // the scanner is located after the comma or the semi-colon.
- // // we want to include the comma or the semi-colon
- // super.consumeExitVariableWithInitialization();
- // nestedMethod[nestedType]--;
- // lastFieldEndPosition = scanner.currentPosition - 1;
- // lastFieldBodyEndPosition = ((AbstractVariableDeclaration) astStack[astPtr]).initialization.sourceEnd;
- //}
- //protected void consumeExitVariableWithoutInitialization() {
- // // ExitVariableWithoutInitialization ::= $empty
- // // do nothing by default
- // super.consumeExitVariableWithoutInitialization();
- // nestedMethod[nestedType]--;
- // lastFieldEndPosition = scanner.currentPosition - 1;
- // lastFieldBodyEndPosition = scanner.startPosition - 1;
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeFieldDeclaration() {
- // // See consumeLocalVariableDeclarationDefaultModifier() in case of change: duplicated code
- // // FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
- // // the super.consumeFieldDeclaration will reinitialize the variableCounter[nestedType]
- // int variableIndex = variablesCounter[nestedType];
- // super.consumeFieldDeclaration();
- // intArrayPtr--;
- // if (isLocalDeclaration())
- // return;
- // if (variableIndex != 0) {
- // requestor.exitField(lastFieldBodyEndPosition, lastFieldEndPosition);
- // }
- //}
- //protected void consumeFormalParameter() {
- // // FormalParameter ::= Type VariableDeclaratorId ==> false
- // // FormalParameter ::= Modifiers Type VariableDeclaratorId ==> true
- // /*
- // astStack :
- // identifierStack : type identifier
- // intStack : dim dim
- // ==>
- // astStack : Argument
- // identifierStack :
- // intStack :
- // */
- //
- // identifierLengthPtr--;
- // char[] name = identifierStack[identifierPtr];
- // long namePositions = identifierPositionStack[identifierPtr--];
- // TypeReference type = getTypeReference(intStack[intPtr--] + intStack[intPtr--]);
- // intPtr -= 3;
- // Argument arg =
- // new Argument(
- // name,
- // namePositions,
- // type,
- // intStack[intPtr + 1]); // modifiers
- // pushOnAstStack(arg);
- // intArrayPtr--;
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeInterfaceDeclaration() {
- // super.consumeInterfaceDeclaration();
- // // we know that we have a TypeDeclaration on the top of the astStack
- // if (isLocalDeclaration()) {
- // // we ignore the local variable declarations
- // return;
- // }
- // requestor.exitInterface(endStatementPosition, // the '}' is the end of the body
- // ((TypeDeclaration) astStack[astPtr]).declarationSourceEnd);
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeInterfaceHeader() {
- // //InterfaceHeader ::= $empty
- // super.consumeInterfaceHeader();
- // if (isLocalDeclaration()) {
- // // we ignore the local variable declarations
- // intArrayPtr--;
- // return;
- // }
- // TypeDeclaration typeDecl = (TypeDeclaration) astStack[astPtr];
- // TypeReference[] superInterfaces = typeDecl.superInterfaces;
- // char[][] interfaceNames = null;
- // int[] interfaceNameStarts = null;
- // int[] interfacenameEnds = null;
- // int superInterfacesLength = 0;
- // if (superInterfaces != null) {
- // superInterfacesLength = superInterfaces.length;
- // interfaceNames = new char[superInterfacesLength][];
- // interfaceNameStarts = new int[superInterfacesLength];
- // interfacenameEnds = new int[superInterfacesLength];
- // }
- // if (superInterfaces != null) {
- // for (int i = 0; i < superInterfacesLength; i++) {
- // TypeReference superInterface = superInterfaces[i];
- // interfaceNames[i] = CharOperation.concatWith(superInterface.getTypeName(), '.');
- // interfaceNameStarts[i] = superInterface.sourceStart;
- // interfacenameEnds[i] = superInterface.sourceEnd;
- // }
- // }
- // // flush the comments related to the interface header
- // scanner.commentPtr = -1;
- // requestor.enterInterface(
- // typeDecl.declarationSourceStart,
- // intArrayStack[intArrayPtr--],
- // typeDecl.modifiers,
- // typeDecl.modifiersSourceStart,
- // typeStartPosition,
- // typeDecl.name,
- // typeDecl.sourceStart,
- // typeDecl.sourceEnd,
- // interfaceNames,
- // interfaceNameStarts,
- // interfacenameEnds,
- // scanner.currentPosition - 1);
- //}
- //protected void consumeInterfaceHeaderName() {
- // // InterfaceHeaderName ::= Modifiersopt 'interface' 'Identifier'
- // TypeDeclaration typeDecl;
- // if (nestedMethod[nestedType] == 0) {
- // if (nestedType != 0) {
- // typeDecl = new MemberTypeDeclaration(this.compilationUnit.compilationResult);
- // } else {
- // typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
- // }
- // } else {
- // // Record that the block has a declaration for local types
- // typeDecl = new LocalTypeDeclaration(this.compilationUnit.compilationResult);
- // markEnclosingMemberWithLocalType();
- // blockReal();
- // }
- //
- // //highlight the name of the type
- // long pos = identifierPositionStack[identifierPtr];
- // typeDecl.sourceEnd = (int) pos;
- // typeDecl.sourceStart = (int) (pos >>> 32);
- // typeDecl.name = identifierStack[identifierPtr--];
- // identifierLengthPtr--;
- //
- // //compute the declaration source too
- // // 'class' and 'interface' push an int position
- // typeStartPosition = typeDecl.declarationSourceStart = intStack[intPtr--];
- // intPtr--;
- // int declarationSourceStart = intStack[intPtr--];
- // typeDecl.modifiersSourceStart = intStack[intPtr--];
- // typeDecl.modifiers = intStack[intPtr--];
- // if (typeDecl.declarationSourceStart > declarationSourceStart) {
- // typeDecl.declarationSourceStart = declarationSourceStart;
- // }
- // typeDecl.bodyStart = typeDecl.sourceEnd + 1;
- // pushOnAstStack(typeDecl);
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeLocalVariableDeclaration() {
- // // See consumeLocalVariableDeclarationDefaultModifier() in case of change: duplicated code
- // // FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
- //
- // super.consumeLocalVariableDeclaration();
- // intArrayPtr--;
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeMethodDeclaration(boolean isNotAbstract) {
- // // MethodDeclaration ::= MethodHeader MethodBody
- // // AbstractMethodDeclaration ::= MethodHeader ';'
- // super.consumeMethodDeclaration(isNotAbstract);
- // if (isLocalDeclaration()) {
- // // we ignore the local variable declarations
- // return;
- // }
- // MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
- // requestor.exitMethod(endStatementPosition, md.declarationSourceEnd);
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeMethodHeader() {
- // // MethodHeader ::= MethodHeaderName MethodHeaderParameters MethodHeaderExtendedDims ThrowsClauseopt
- // super.consumeMethodHeader();
- // if (isLocalDeclaration()) {
- // // we ignore the local variable declarations
- // intArrayPtr--;
- // return;
- // }
- // MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
- //
- // TypeReference returnType = md.returnType;
- // char[] returnTypeName = returnTypeName(returnType);
- // Argument[] arguments = md.arguments;
- // char[][] argumentTypes = null;
- // char[][] argumentNames = null;
- // int[] argumentTypeStarts = null;
- // int[] argumentTypeEnds = null;
- // int[] argumentNameStarts = null;
- // int[] argumentNameEnds = null;
- // if (arguments != null) {
- // int argumentLength = arguments.length;
- // argumentTypes = new char[argumentLength][];
- // argumentNames = new char[argumentLength][];
- // argumentNameStarts = new int[argumentLength];
- // argumentNameEnds = new int[argumentLength];
- // argumentTypeStarts = new int[argumentLength];
- // argumentTypeEnds = new int[argumentLength];
- // for (int i = 0; i < argumentLength; i++) {
- // Argument argument = arguments[i];
- // TypeReference argumentType = argument.type;
- // argumentTypes[i] = returnTypeName(argumentType);
- // argumentNames[i] = argument.name;
- // argumentNameStarts[i] = argument.sourceStart;
- // argumentNameEnds[i] = argument.sourceEnd;
- // argumentTypeStarts[i] = argumentType.sourceStart;
- // argumentTypeEnds[i] = argumentType.sourceEnd;
- // }
- // }
- // TypeReference[] thrownExceptions = md.thrownExceptions;
- // char[][] exceptionTypes = null;
- // int[] exceptionTypeStarts = null;
- // int[] exceptionTypeEnds = null;
- // if (thrownExceptions != null) {
- // int thrownExceptionLength = thrownExceptions.length;
- // exceptionTypeStarts = new int[thrownExceptionLength];
- // exceptionTypeEnds = new int[thrownExceptionLength];
- // exceptionTypes = new char[thrownExceptionLength][];
- // for (int i = 0; i < thrownExceptionLength; i++) {
- // TypeReference exception = thrownExceptions[i];
- // exceptionTypes[i] = CharOperation.concatWith(exception.getTypeName(), '.');
- // exceptionTypeStarts[i] = exception.sourceStart;
- // exceptionTypeEnds[i] = exception.sourceEnd;
- // }
- // }
- // requestor
- // .enterMethod(
- // md.declarationSourceStart,
- // intArrayStack[intArrayPtr--],
- // md.modifiers,
- // md.modifiersSourceStart,
- // returnTypeName,
- // returnType.sourceStart,
- // returnType.sourceEnd,
- // typeDims,
- // md.selector,
- // md.sourceStart,
- // (int) (selectorSourcePositions & 0xFFFFFFFFL),
- // argumentTypes,
- // argumentTypeStarts,
- // argumentTypeEnds,
- // argumentNames,
- // argumentNameStarts,
- // argumentNameEnds,
- // rParenPos,
- // extendsDim,
- // extendsDim == 0 ? -1 : endPosition,
- // exceptionTypes,
- // exceptionTypeStarts,
- // exceptionTypeEnds,
- // scanner.currentPosition - 1);
- //}
- //protected void consumeMethodHeaderExtendedDims() {
- // // MethodHeaderExtendedDims ::= Dimsopt
- // // now we update the returnType of the method
- // MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
- // int extendedDims = intStack[intPtr--];
- // extendsDim = extendedDims;
- // if (extendedDims != 0) {
- // TypeReference returnType = md.returnType;
- // md.sourceEnd = endPosition;
- // int dims = returnType.dimensions() + extendedDims;
- // int baseType;
- // if ((baseType = identifierLengthStack[identifierLengthPtr + 1]) < 0) {
- // //it was a baseType
- // int sourceStart = returnType.sourceStart;
- // int sourceEnd = returnType.sourceEnd;
- // returnType = TypeReference.baseTypeReference(-baseType, dims);
- // returnType.sourceStart = sourceStart;
- // returnType.sourceEnd = sourceEnd;
- // md.returnType = returnType;
- // } else {
- // md.returnType = this.copyDims(md.returnType, dims);
- // }
- // if (currentToken == TokenNameLBRACE) {
- // md.bodyStart = endPosition + 1;
- // }
- // }
- //}
- //protected void consumeMethodHeaderName() {
- // // MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
- // MethodDeclaration md = new MethodDeclaration(this.compilationUnit.compilationResult);
- //
- // //name
- // md.selector = identifierStack[identifierPtr];
- // selectorSourcePositions = identifierPositionStack[identifierPtr--];
- // identifierLengthPtr--;
- // //type
- // md.returnType = getTypeReference(typeDims = intStack[intPtr--]);
- // //modifiers
- // md.declarationSourceStart = intStack[intPtr--];
- // md.modifiersSourceStart = intStack[intPtr--];
- // md.modifiers = intStack[intPtr--];
- //
- // //highlight starts at selector start
- // md.sourceStart = (int) (selectorSourcePositions >>> 32);
- // pushOnAstStack(md);
- // md.bodyStart = scanner.currentPosition-1;
- //}
- //protected void consumeModifiers() {
- // checkAnnotation(); // might update modifiers with AccDeprecated
- // pushOnIntStack(modifiers); // modifiers
- // pushOnIntStack(modifiersSourceStart);
- // pushOnIntStack(
- // declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart);
- // resetModifiers();
- //}
- /**
- *
- * INTERNAL USE-ONLY
- */
- //protected void consumePackageDeclarationName() {
- // /* persisting javadoc positions */
- // pushOnIntArrayStack(this.getJavaDocPositions());
- //
- // super.consumePackageDeclarationName();
- // ImportReference importReference = compilationUnit.currentPackage;
- //
- // requestor.acceptPackage(
- // importReference.declarationSourceStart,
- // importReference.declarationSourceEnd,
- // intArrayStack[intArrayPtr--],
- // CharOperation.concatWith(importReference.getImportName(), '.'),
- // importReference.sourceStart);
- //}
- //protected void consumePushModifiers() {
- // checkAnnotation(); // might update modifiers with AccDeprecated
- // pushOnIntStack(modifiers); // modifiers
- // if (modifiersSourceStart < 0) {
- // pushOnIntStack(-1);
- // pushOnIntStack(
- // declarationSourceStart >= 0 ? declarationSourceStart : scanner.startPosition);
- // } else {
- // pushOnIntStack(modifiersSourceStart);
- // pushOnIntStack(
- // declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart);
- // }
- // resetModifiers();
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeSingleTypeImportDeclarationName() {
- // // SingleTypeImportDeclarationName ::= 'import' Name
- //
- // /* persisting javadoc positions */
- // pushOnIntArrayStack(this.getJavaDocPositions());
- //
- // super.consumeSingleTypeImportDeclarationName();
- // ImportReference importReference = (ImportReference) astStack[astPtr];
- // requestor.acceptImport(
- // importReference.declarationSourceStart,
- // importReference.declarationSourceEnd,
- // intArrayStack[intArrayPtr--],
- // CharOperation.concatWith(importReference.getImportName(), '.'),
- // importReference.sourceStart,
- // false);
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeStaticInitializer() {
- // // StaticInitializer ::= StaticOnly Block
- // //push an Initializer
- // //optimize the push/pop
- // super.consumeStaticInitializer();
- // Initializer initializer = (Initializer) astStack[astPtr];
- // requestor.acceptInitializer(
- // initializer.declarationSourceStart,
- // initializer.declarationSourceEnd,
- // intArrayStack[intArrayPtr--],
- // AccStatic,
- // intStack[intPtr--],
- // initializer.block.sourceStart,
- // initializer.declarationSourceEnd);
- //}
- //protected void consumeStaticOnly() {
- // // StaticOnly ::= 'static'
- // checkAnnotation(); // might update declaration source start
- // pushOnIntStack(modifiersSourceStart);
- // pushOnIntStack(
- // declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart);
- // jumpOverMethodBody();
- // nestedMethod[nestedType]++;
- // resetModifiers();
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeTypeImportOnDemandDeclarationName() {
- // // TypeImportOnDemandDeclarationName ::= 'import' Name '.' '*'
- //
- // /* persisting javadoc positions */
- // pushOnIntArrayStack(this.getJavaDocPositions());
- //
- // super.consumeTypeImportOnDemandDeclarationName();
- // ImportReference importReference = (ImportReference) astStack[astPtr];
- // requestor.acceptImport(
- // importReference.declarationSourceStart,
- // importReference.declarationSourceEnd,
- // intArrayStack[intArrayPtr--],
- // CharOperation.concatWith(importReference.getImportName(), '.'),
- // importReference.sourceStart,
- // true);
- //}
- public CompilationUnitDeclaration endParse(int act) {
- if (scanner.recordLineSeparator) {
- requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
- }
- return super.endParse(act);
- }
+ /**
+ *
+ * INTERNAL USE-ONLY
+ */
+ // protected void adjustInterfaceModifiers() {
+ // intStack[intPtr - 2] |= AccInterface;
+ // }
+ /*
+ * Will clear the comment stack when looking for a potential JavaDoc which
+ * might contain @deprecated.
+ *
+ * Additionally, before investigating for @deprecated, retrieve the
+ * positions of the JavaDoc comments so as to notify requestor with them.
+ */
+ // public void checkAnnotation() {
+ //
+ // /* persisting javadoc positions */
+ // pushOnIntArrayStack(this.getJavaDocPositions());
+ // boolean deprecated = false;
+ // int lastAnnotationIndex = -1;
+ // int commentPtr = scanner.commentPtr;
+ //
+ // //since jdk1.2 look only in the last java doc comment...
+ // nextComment : for (lastAnnotationIndex = scanner.commentPtr;
+ // lastAnnotationIndex >= 0; lastAnnotationIndex--){
+ // //look for @deprecated into the first javadoc comment preceeding the
+ // declaration
+ // int commentSourceStart = scanner.commentStarts[lastAnnotationIndex];
+ // // javadoc only (non javadoc comment have negative end positions.)
+ // if (modifiersSourceStart != -1 && modifiersSourceStart <
+ // commentSourceStart) {
+ // continue nextComment;
+ // }
+ // if (scanner.commentStops[lastAnnotationIndex] < 0) {
+ // continue nextComment;
+ // }
+ // int commentSourceEnd = scanner.commentStops[lastAnnotationIndex] - 1;
+ // //stop is one over
+ // char[] comment = scanner.source;
+ //
+ // deprecated =
+ // checkDeprecation(
+ // commentSourceStart,
+ // commentSourceEnd,
+ // comment);
+ // break nextComment;
+ // }
+ // if (deprecated) {
+ // checkAndSetModifiers(AccDeprecated);
+ // }
+ // // modify the modifier source start to point at the first comment
+ // if (commentPtr >= 0) {
+ // declarationSourceStart = scanner.commentStarts[0];
+ // }
+ // }
+ /**
+ *
+ * INTERNAL USE-ONLY
+ */
+ // protected void consumeClassBodyDeclaration() {
+ // // ClassBodyDeclaration ::= Diet Block
+ // //push an Initializer
+ // //optimize the push/pop
+ //
+ // super.consumeClassBodyDeclaration();
+ // Initializer initializer = (Initializer) astStack[astPtr];
+ // requestor.acceptInitializer(
+ // initializer.declarationSourceStart,
+ // initializer.declarationSourceEnd,
+ // intArrayStack[intArrayPtr--],
+ // 0,
+ // modifiersSourceStart,
+ // initializer.block.sourceStart,
+ // initializer.block.sourceEnd);
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeClassDeclaration() {
+ // super.consumeClassDeclaration();
+ // // we know that we have a TypeDeclaration on the top of the astStack
+ // if (isLocalDeclaration()) {
+ // // we ignore the local variable declarations
+ // return;
+ // }
+ // requestor.exitClass(endStatementPosition, // '}' is the end of the body
+ // ((TypeDeclaration) astStack[astPtr]).declarationSourceEnd);
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeClassHeader() {
+ // //ClassHeader ::= $empty
+ // super.consumeClassHeader();
+ // if (isLocalDeclaration()) {
+ // // we ignore the local variable declarations
+ // intArrayPtr--;
+ // return;
+ // }
+ // TypeDeclaration typeDecl = (TypeDeclaration) astStack[astPtr];
+ // TypeReference[] superInterfaces = typeDecl.superInterfaces;
+ // char[][] interfaceNames = null;
+ // int[] interfaceNameStarts = null;
+ // int[] interfaceNameEnds = null;
+ // if (superInterfaces != null) {
+ // int superInterfacesLength = superInterfaces.length;
+ // interfaceNames = new char[superInterfacesLength][];
+ // interfaceNameStarts = new int[superInterfacesLength];
+ // interfaceNameEnds = new int[superInterfacesLength];
+ // for (int i = 0; i < superInterfacesLength; i++) {
+ // TypeReference superInterface = superInterfaces[i];
+ // interfaceNames[i] =
+ // CharOperation.concatWith(superInterface.getTypeName(), '.');
+ // interfaceNameStarts[i] = superInterface.sourceStart;
+ // interfaceNameEnds[i] = superInterface.sourceEnd;
+ // }
+ // }
+ // // flush the comments related to the class header
+ // scanner.commentPtr = -1;
+ // TypeReference superclass = typeDecl.superclass;
+ // if (superclass == null) {
+ // requestor.enterClass(
+ // typeDecl.declarationSourceStart,
+ // intArrayStack[intArrayPtr--],
+ // typeDecl.modifiers,
+ // typeDecl.modifiersSourceStart,
+ // typeStartPosition,
+ // typeDecl.name,
+ // typeDecl.sourceStart,
+ // typeDecl.sourceEnd,
+ // null,
+ // -1,
+ // -1,
+ // interfaceNames,
+ // interfaceNameStarts,
+ // interfaceNameEnds,
+ // scanner.currentPosition - 1);
+ // } else {
+ // requestor.enterClass(
+ // typeDecl.declarationSourceStart,
+ // intArrayStack[intArrayPtr--],
+ // typeDecl.modifiers,
+ // typeDecl.modifiersSourceStart,
+ // typeStartPosition,
+ // typeDecl.name,
+ // typeDecl.sourceStart,
+ // typeDecl.sourceEnd,
+ // CharOperation.concatWith(superclass.getTypeName(), '.'),
+ // superclass.sourceStart,
+ // superclass.sourceEnd,
+ // interfaceNames,
+ // interfaceNameStarts,
+ // interfaceNameEnds,
+ // scanner.currentPosition - 1);
+ //
+ // }
+ // }
+ // protected void consumeClassHeaderName() {
+ // // ClassHeaderName ::= Modifiersopt 'class' 'Identifier'
+ // TypeDeclaration typeDecl;
+ // if (nestedMethod[nestedType] == 0) {
+ // if (nestedType != 0) {
+ // typeDecl = new
+ // MemberTypeDeclaration(this.compilationUnit.compilationResult);
+ // } else {
+ // typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
+ // }
+ // } else {
+ // // Record that the block has a declaration for local types
+ // typeDecl = new
+ // LocalTypeDeclaration(this.compilationUnit.compilationResult);
+ // markEnclosingMemberWithLocalType();
+ // blockReal();
+ // }
+ //
+ // //highlight the name of the type
+ // long pos = identifierPositionStack[identifierPtr];
+ // typeDecl.sourceEnd = (int) pos;
+ // typeDecl.sourceStart = (int) (pos >>> 32);
+ // typeDecl.name = identifierStack[identifierPtr--];
+ // identifierLengthPtr--;
+ //
+ // //compute the declaration source too
+ // // 'class' and 'interface' push an int position
+ // typeStartPosition = typeDecl.declarationSourceStart = intStack[intPtr--];
+ // intPtr--;
+ // int declarationSourceStart = intStack[intPtr--];
+ // typeDecl.modifiersSourceStart = intStack[intPtr--];
+ // typeDecl.modifiers = intStack[intPtr--];
+ // if (typeDecl.declarationSourceStart > declarationSourceStart) {
+ // typeDecl.declarationSourceStart = declarationSourceStart;
+ // }
+ // typeDecl.bodyStart = typeDecl.sourceEnd + 1;
+ // pushOnAstStack(typeDecl);
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeCompilationUnit() {
+ // // CompilationUnit ::= EnterCompilationUnit PackageDeclarationopt
+ // ImportDeclarationsopt
+ // requestor.exitCompilationUnit(scanner.source.length - 1);
+ // }
+ /**
+ *
+ * INTERNAL USE-ONLY
+ */
+ // protected void consumeConstructorDeclaration() {
+ // // ConstructorDeclaration ::= ConstructorHeader ConstructorBody
+ // super.consumeConstructorDeclaration();
+ // if (isLocalDeclaration()) {
+ // // we ignore the local variable declarations
+ // return;
+ // }
+ // ConstructorDeclaration cd = (ConstructorDeclaration) astStack[astPtr];
+ // requestor.exitConstructor(endStatementPosition, cd.declarationSourceEnd);
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeConstructorHeader() {
+ // // ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters
+ // MethodHeaderThrowsClauseopt
+ // super.consumeConstructorHeader();
+ // if (isLocalDeclaration()) {
+ // // we ignore the local variable declarations
+ // intArrayPtr--;
+ // return;
+ // }
+ // ConstructorDeclaration cd = (ConstructorDeclaration) astStack[astPtr];
+ // Argument[] arguments = cd.arguments;
+ // char[][] argumentTypes = null;
+ // char[][] argumentNames = null;
+ // int[] argumentTypeStarts = null;
+ // int[] argumentTypeEnds = null;
+ // int[] argumentNameStarts = null;
+ // int[] argumentNameEnds = null;
+ // if (arguments != null) {
+ // int argumentLength = arguments.length;
+ // argumentTypes = new char[argumentLength][];
+ // argumentNames = new char[argumentLength][];
+ // argumentNameStarts = new int[argumentLength];
+ // argumentNameEnds = new int[argumentLength];
+ // argumentTypeStarts = new int[argumentLength];
+ // argumentTypeEnds = new int[argumentLength];
+ // for (int i = 0; i < argumentLength; i++) {
+ // Argument argument = arguments[i];
+ // TypeReference argumentType = argument.type;
+ // argumentTypes[i] = returnTypeName(argumentType);
+ // argumentNames[i] = argument.name;
+ // argumentNameStarts[i] = argument.sourceStart;
+ // argumentNameEnds[i] = argument.sourceEnd;
+ // argumentTypeStarts[i] = argumentType.sourceStart;
+ // argumentTypeEnds[i] = argumentType.sourceEnd;
+ // }
+ // }
+ // TypeReference[] thrownExceptions = cd.thrownExceptions;
+ // char[][] exceptionTypes = null;
+ // int[] exceptionTypeStarts = null;
+ // int[] exceptionTypeEnds = null;
+ // if (thrownExceptions != null) {
+ // int thrownExceptionLength = thrownExceptions.length;
+ // exceptionTypes = new char[thrownExceptionLength][];
+ // exceptionTypeStarts = new int[thrownExceptionLength];
+ // exceptionTypeEnds = new int[thrownExceptionLength];
+ // for (int i = 0; i < thrownExceptionLength; i++) {
+ // TypeReference exception = thrownExceptions[i];
+ // exceptionTypes[i] = CharOperation.concatWith(exception.getTypeName(),
+ // '.');
+ // exceptionTypeStarts[i] = exception.sourceStart;
+ // exceptionTypeEnds[i] = exception.sourceEnd;
+ // }
+ // }
+ // requestor
+ // .enterConstructor(
+ // cd.declarationSourceStart,
+ // intArrayStack[intArrayPtr--],
+ // cd.modifiers,
+ // cd.modifiersSourceStart,
+ // cd.selector,
+ // cd.sourceStart,
+ // (int) (selectorSourcePositions & 0xFFFFFFFFL),
+ // // retrieve the source end of the name
+ // argumentTypes,
+ // argumentTypeStarts,
+ // argumentTypeEnds,
+ // argumentNames,
+ // argumentNameStarts,
+ // argumentNameEnds,
+ // rParenPos,
+ // // right parenthesis
+ // exceptionTypes,
+ // exceptionTypeStarts,
+ // exceptionTypeEnds,
+ // scanner.currentPosition - 1);
+ // }
+ // protected void consumeConstructorHeaderName() {
+ // // ConstructorHeaderName ::= Modifiersopt 'Identifier' '('
+ // ConstructorDeclaration cd = new
+ // ConstructorDeclaration(this.compilationUnit.compilationResult);
+ //
+ // //name -- this is not really revelant but we do .....
+ // cd.selector = identifierStack[identifierPtr];
+ // selectorSourcePositions = identifierPositionStack[identifierPtr--];
+ // identifierLengthPtr--;
+ //
+ // //modifiers
+ // cd.declarationSourceStart = intStack[intPtr--];
+ // cd.modifiersSourceStart = intStack[intPtr--];
+ // cd.modifiers = intStack[intPtr--];
+ //
+ // //highlight starts at the selector starts
+ // cd.sourceStart = (int) (selectorSourcePositions >>> 32);
+ // pushOnAstStack(cd);
+ //
+ // cd.sourceEnd = lParenPos;
+ // cd.bodyStart = lParenPos + 1;
+ // }
+ // protected void consumeDefaultModifiers() {
+ // checkAnnotation(); // might update modifiers with AccDeprecated
+ // pushOnIntStack(modifiers); // modifiers
+ // pushOnIntStack(-1);
+ // pushOnIntStack(
+ // declarationSourceStart >= 0 ? declarationSourceStart :
+ // scanner.startPosition);
+ // resetModifiers();
+ // }
+ // protected void consumeDiet() {
+ // // Diet ::= $empty
+ // super.consumeDiet();
+ // /* persisting javadoc positions
+ // * Will be consume in consumeClassBodyDeclaration
+ // */
+ // pushOnIntArrayStack(this.getJavaDocPositions());
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeEnterCompilationUnit() {
+ // // EnterCompilationUnit ::= $empty
+ // requestor.enterCompilationUnit();
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeEnterVariable() {
+ // // EnterVariable ::= $empty
+ // boolean isLocalDeclaration = isLocalDeclaration();
+ // if (!isLocalDeclaration && (variablesCounter[nestedType] != 0)) {
+ // requestor.exitField(lastFieldBodyEndPosition, lastFieldEndPosition);
+ // }
+ // char[] name = identifierStack[identifierPtr];
+ // long namePosition = identifierPositionStack[identifierPtr--];
+ // int extendedTypeDimension = intStack[intPtr--];
+ //
+ // AbstractVariableDeclaration declaration;
+ // if (nestedMethod[nestedType] != 0) {
+ // // create the local variable declarations
+ // declaration =
+ // new LocalDeclaration(null, name, (int) (namePosition >>> 32), (int)
+ // namePosition);
+ // } else {
+ // // create the field declaration
+ // declaration =
+ // new FieldDeclaration(null, name, (int) (namePosition >>> 32), (int)
+ // namePosition);
+ // }
+ // identifierLengthPtr--;
+ // TypeReference type;
+ // int variableIndex = variablesCounter[nestedType];
+ // int typeDim = 0;
+ // if (variableIndex == 0) {
+ // // first variable of the declaration (FieldDeclaration or
+ // LocalDeclaration)
+ // if (nestedMethod[nestedType] != 0) {
+ // // local declaration
+ // declaration.declarationSourceStart = intStack[intPtr--];
+ // declaration.modifiersSourceStart = intStack[intPtr--];
+ // declaration.modifiers = intStack[intPtr--];
+ // type = getTypeReference(typeDim = intStack[intPtr--]); // type dimension
+ // pushOnAstStack(type);
+ // } else {
+ // // field declaration
+ // type = getTypeReference(typeDim = intStack[intPtr--]); // type dimension
+ // pushOnAstStack(type);
+ // declaration.declarationSourceStart = intStack[intPtr--];
+ // declaration.modifiersSourceStart = intStack[intPtr--];
+ // declaration.modifiers = intStack[intPtr--];
+ // }
+ // } else {
+ // type = (TypeReference) astStack[astPtr - variableIndex];
+ // typeDim = type.dimensions();
+ // AbstractVariableDeclaration previousVariable =
+ // (AbstractVariableDeclaration) astStack[astPtr];
+ // declaration.declarationSourceStart =
+ // previousVariable.declarationSourceStart;
+ // declaration.modifiers = previousVariable.modifiers;
+ // declaration.modifiersSourceStart = previousVariable.modifiersSourceStart;
+ // }
+ //
+ // localIntPtr = intPtr;
+ //
+ // if (extendedTypeDimension == 0) {
+ // declaration.type = type;
+ // } else {
+ // int dimension = typeDim + extendedTypeDimension;
+ // //on the identifierLengthStack there is the information about the
+ // type....
+ // int baseType;
+ // if ((baseType = identifierLengthStack[identifierLengthPtr + 1]) < 0) {
+ // //it was a baseType
+ // declaration.type = TypeReference.baseTypeReference(-baseType, dimension);
+ // declaration.type.sourceStart = type.sourceStart;
+ // declaration.type.sourceEnd = type.sourceEnd;
+ // } else {
+ // declaration.type = this.copyDims(type, dimension);
+ // }
+ // }
+ // variablesCounter[nestedType]++;
+ // nestedMethod[nestedType]++;
+ // pushOnAstStack(declaration);
+ //
+ // int[] javadocPositions = intArrayStack[intArrayPtr];
+ // if (!isLocalDeclaration) {
+ // requestor
+ // .enterField(
+ // declaration.declarationSourceStart,
+ // javadocPositions,
+ // declaration.modifiers,
+ // declaration.modifiersSourceStart,
+ // returnTypeName(declaration.type),
+ // type.sourceStart,
+ // type.sourceEnd,
+ // typeDims,
+ // name,
+ // (int) (namePosition >>> 32),
+ // (int) namePosition,
+ // extendedTypeDimension,
+ // extendedTypeDimension == 0 ? -1 : endPosition);
+ // }
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeExitVariableWithInitialization() {
+ // // ExitVariableWithInitialization ::= $empty
+ // // the scanner is located after the comma or the semi-colon.
+ // // we want to include the comma or the semi-colon
+ // super.consumeExitVariableWithInitialization();
+ // nestedMethod[nestedType]--;
+ // lastFieldEndPosition = scanner.currentPosition - 1;
+ // lastFieldBodyEndPosition = ((AbstractVariableDeclaration)
+ // astStack[astPtr]).initialization.sourceEnd;
+ // }
+ // protected void consumeExitVariableWithoutInitialization() {
+ // // ExitVariableWithoutInitialization ::= $empty
+ // // do nothing by default
+ // super.consumeExitVariableWithoutInitialization();
+ // nestedMethod[nestedType]--;
+ // lastFieldEndPosition = scanner.currentPosition - 1;
+ // lastFieldBodyEndPosition = scanner.startPosition - 1;
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeFieldDeclaration() {
+ // // See consumeLocalVariableDeclarationDefaultModifier() in case of
+ // change: duplicated code
+ // // FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
+ // // the super.consumeFieldDeclaration will reinitialize the
+ // variableCounter[nestedType]
+ // int variableIndex = variablesCounter[nestedType];
+ // super.consumeFieldDeclaration();
+ // intArrayPtr--;
+ // if (isLocalDeclaration())
+ // return;
+ // if (variableIndex != 0) {
+ // requestor.exitField(lastFieldBodyEndPosition, lastFieldEndPosition);
+ // }
+ // }
+ // protected void consumeFormalParameter() {
+ // // FormalParameter ::= Type VariableDeclaratorId ==> false
+ // // FormalParameter ::= Modifiers Type VariableDeclaratorId ==> true
+ // /*
+ // astStack :
+ // identifierStack : type identifier
+ // intStack : dim dim
+ // ==>
+ // astStack : Argument
+ // identifierStack :
+ // intStack :
+ // */
+ //
+ // identifierLengthPtr--;
+ // char[] name = identifierStack[identifierPtr];
+ // long namePositions = identifierPositionStack[identifierPtr--];
+ // TypeReference type = getTypeReference(intStack[intPtr--] +
+ // intStack[intPtr--]);
+ // intPtr -= 3;
+ // Argument arg =
+ // new Argument(
+ // name,
+ // namePositions,
+ // type,
+ // intStack[intPtr + 1]); // modifiers
+ // pushOnAstStack(arg);
+ // intArrayPtr--;
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeInterfaceDeclaration() {
+ // super.consumeInterfaceDeclaration();
+ // // we know that we have a TypeDeclaration on the top of the astStack
+ // if (isLocalDeclaration()) {
+ // // we ignore the local variable declarations
+ // return;
+ // }
+ // requestor.exitInterface(endStatementPosition, // the '}' is the end of
+ // the body
+ // ((TypeDeclaration) astStack[astPtr]).declarationSourceEnd);
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeInterfaceHeader() {
+ // //InterfaceHeader ::= $empty
+ // super.consumeInterfaceHeader();
+ // if (isLocalDeclaration()) {
+ // // we ignore the local variable declarations
+ // intArrayPtr--;
+ // return;
+ // }
+ // TypeDeclaration typeDecl = (TypeDeclaration) astStack[astPtr];
+ // TypeReference[] superInterfaces = typeDecl.superInterfaces;
+ // char[][] interfaceNames = null;
+ // int[] interfaceNameStarts = null;
+ // int[] interfacenameEnds = null;
+ // int superInterfacesLength = 0;
+ // if (superInterfaces != null) {
+ // superInterfacesLength = superInterfaces.length;
+ // interfaceNames = new char[superInterfacesLength][];
+ // interfaceNameStarts = new int[superInterfacesLength];
+ // interfacenameEnds = new int[superInterfacesLength];
+ // }
+ // if (superInterfaces != null) {
+ // for (int i = 0; i < superInterfacesLength; i++) {
+ // TypeReference superInterface = superInterfaces[i];
+ // interfaceNames[i] =
+ // CharOperation.concatWith(superInterface.getTypeName(), '.');
+ // interfaceNameStarts[i] = superInterface.sourceStart;
+ // interfacenameEnds[i] = superInterface.sourceEnd;
+ // }
+ // }
+ // // flush the comments related to the interface header
+ // scanner.commentPtr = -1;
+ // requestor.enterInterface(
+ // typeDecl.declarationSourceStart,
+ // intArrayStack[intArrayPtr--],
+ // typeDecl.modifiers,
+ // typeDecl.modifiersSourceStart,
+ // typeStartPosition,
+ // typeDecl.name,
+ // typeDecl.sourceStart,
+ // typeDecl.sourceEnd,
+ // interfaceNames,
+ // interfaceNameStarts,
+ // interfacenameEnds,
+ // scanner.currentPosition - 1);
+ // }
+ // protected void consumeInterfaceHeaderName() {
+ // // InterfaceHeaderName ::= Modifiersopt 'interface' 'Identifier'
+ // TypeDeclaration typeDecl;
+ // if (nestedMethod[nestedType] == 0) {
+ // if (nestedType != 0) {
+ // typeDecl = new
+ // MemberTypeDeclaration(this.compilationUnit.compilationResult);
+ // } else {
+ // typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
+ // }
+ // } else {
+ // // Record that the block has a declaration for local types
+ // typeDecl = new
+ // LocalTypeDeclaration(this.compilationUnit.compilationResult);
+ // markEnclosingMemberWithLocalType();
+ // blockReal();
+ // }
+ //
+ // //highlight the name of the type
+ // long pos = identifierPositionStack[identifierPtr];
+ // typeDecl.sourceEnd = (int) pos;
+ // typeDecl.sourceStart = (int) (pos >>> 32);
+ // typeDecl.name = identifierStack[identifierPtr--];
+ // identifierLengthPtr--;
+ //
+ // //compute the declaration source too
+ // // 'class' and 'interface' push an int position
+ // typeStartPosition = typeDecl.declarationSourceStart = intStack[intPtr--];
+ // intPtr--;
+ // int declarationSourceStart = intStack[intPtr--];
+ // typeDecl.modifiersSourceStart = intStack[intPtr--];
+ // typeDecl.modifiers = intStack[intPtr--];
+ // if (typeDecl.declarationSourceStart > declarationSourceStart) {
+ // typeDecl.declarationSourceStart = declarationSourceStart;
+ // }
+ // typeDecl.bodyStart = typeDecl.sourceEnd + 1;
+ // pushOnAstStack(typeDecl);
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeLocalVariableDeclaration() {
+ // // See consumeLocalVariableDeclarationDefaultModifier() in case of
+ // change: duplicated code
+ // // FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
+ //
+ // super.consumeLocalVariableDeclaration();
+ // intArrayPtr--;
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeMethodDeclaration(boolean isNotAbstract) {
+ // // MethodDeclaration ::= MethodHeader MethodBody
+ // // AbstractMethodDeclaration ::= MethodHeader ';'
+ // super.consumeMethodDeclaration(isNotAbstract);
+ // if (isLocalDeclaration()) {
+ // // we ignore the local variable declarations
+ // return;
+ // }
+ // MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
+ // requestor.exitMethod(endStatementPosition, md.declarationSourceEnd);
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeMethodHeader() {
+ // // MethodHeader ::= MethodHeaderName MethodHeaderParameters
+ // MethodHeaderExtendedDims ThrowsClauseopt
+ // super.consumeMethodHeader();
+ // if (isLocalDeclaration()) {
+ // // we ignore the local variable declarations
+ // intArrayPtr--;
+ // return;
+ // }
+ // MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
+ //
+ // TypeReference returnType = md.returnType;
+ // char[] returnTypeName = returnTypeName(returnType);
+ // Argument[] arguments = md.arguments;
+ // char[][] argumentTypes = null;
+ // char[][] argumentNames = null;
+ // int[] argumentTypeStarts = null;
+ // int[] argumentTypeEnds = null;
+ // int[] argumentNameStarts = null;
+ // int[] argumentNameEnds = null;
+ // if (arguments != null) {
+ // int argumentLength = arguments.length;
+ // argumentTypes = new char[argumentLength][];
+ // argumentNames = new char[argumentLength][];
+ // argumentNameStarts = new int[argumentLength];
+ // argumentNameEnds = new int[argumentLength];
+ // argumentTypeStarts = new int[argumentLength];
+ // argumentTypeEnds = new int[argumentLength];
+ // for (int i = 0; i < argumentLength; i++) {
+ // Argument argument = arguments[i];
+ // TypeReference argumentType = argument.type;
+ // argumentTypes[i] = returnTypeName(argumentType);
+ // argumentNames[i] = argument.name;
+ // argumentNameStarts[i] = argument.sourceStart;
+ // argumentNameEnds[i] = argument.sourceEnd;
+ // argumentTypeStarts[i] = argumentType.sourceStart;
+ // argumentTypeEnds[i] = argumentType.sourceEnd;
+ // }
+ // }
+ // TypeReference[] thrownExceptions = md.thrownExceptions;
+ // char[][] exceptionTypes = null;
+ // int[] exceptionTypeStarts = null;
+ // int[] exceptionTypeEnds = null;
+ // if (thrownExceptions != null) {
+ // int thrownExceptionLength = thrownExceptions.length;
+ // exceptionTypeStarts = new int[thrownExceptionLength];
+ // exceptionTypeEnds = new int[thrownExceptionLength];
+ // exceptionTypes = new char[thrownExceptionLength][];
+ // for (int i = 0; i < thrownExceptionLength; i++) {
+ // TypeReference exception = thrownExceptions[i];
+ // exceptionTypes[i] = CharOperation.concatWith(exception.getTypeName(),
+ // '.');
+ // exceptionTypeStarts[i] = exception.sourceStart;
+ // exceptionTypeEnds[i] = exception.sourceEnd;
+ // }
+ // }
+ // requestor
+ // .enterMethod(
+ // md.declarationSourceStart,
+ // intArrayStack[intArrayPtr--],
+ // md.modifiers,
+ // md.modifiersSourceStart,
+ // returnTypeName,
+ // returnType.sourceStart,
+ // returnType.sourceEnd,
+ // typeDims,
+ // md.selector,
+ // md.sourceStart,
+ // (int) (selectorSourcePositions & 0xFFFFFFFFL),
+ // argumentTypes,
+ // argumentTypeStarts,
+ // argumentTypeEnds,
+ // argumentNames,
+ // argumentNameStarts,
+ // argumentNameEnds,
+ // rParenPos,
+ // extendsDim,
+ // extendsDim == 0 ? -1 : endPosition,
+ // exceptionTypes,
+ // exceptionTypeStarts,
+ // exceptionTypeEnds,
+ // scanner.currentPosition - 1);
+ // }
+ // protected void consumeMethodHeaderExtendedDims() {
+ // // MethodHeaderExtendedDims ::= Dimsopt
+ // // now we update the returnType of the method
+ // MethodDeclaration md = (MethodDeclaration) astStack[astPtr];
+ // int extendedDims = intStack[intPtr--];
+ // extendsDim = extendedDims;
+ // if (extendedDims != 0) {
+ // TypeReference returnType = md.returnType;
+ // md.sourceEnd = endPosition;
+ // int dims = returnType.dimensions() + extendedDims;
+ // int baseType;
+ // if ((baseType = identifierLengthStack[identifierLengthPtr + 1]) < 0) {
+ // //it was a baseType
+ // int sourceStart = returnType.sourceStart;
+ // int sourceEnd = returnType.sourceEnd;
+ // returnType = TypeReference.baseTypeReference(-baseType, dims);
+ // returnType.sourceStart = sourceStart;
+ // returnType.sourceEnd = sourceEnd;
+ // md.returnType = returnType;
+ // } else {
+ // md.returnType = this.copyDims(md.returnType, dims);
+ // }
+ // if (currentToken == TokenNameLBRACE) {
+ // md.bodyStart = endPosition + 1;
+ // }
+ // }
+ // }
+ // protected void consumeMethodHeaderName() {
+ // // MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
+ // MethodDeclaration md = new
+ // MethodDeclaration(this.compilationUnit.compilationResult);
+ //
+ // //name
+ // md.selector = identifierStack[identifierPtr];
+ // selectorSourcePositions = identifierPositionStack[identifierPtr--];
+ // identifierLengthPtr--;
+ // //type
+ // md.returnType = getTypeReference(typeDims = intStack[intPtr--]);
+ // //modifiers
+ // md.declarationSourceStart = intStack[intPtr--];
+ // md.modifiersSourceStart = intStack[intPtr--];
+ // md.modifiers = intStack[intPtr--];
+ //
+ // //highlight starts at selector start
+ // md.sourceStart = (int) (selectorSourcePositions >>> 32);
+ // pushOnAstStack(md);
+ // md.bodyStart = scanner.currentPosition-1;
+ // }
+ // protected void consumeModifiers() {
+ // checkAnnotation(); // might update modifiers with AccDeprecated
+ // pushOnIntStack(modifiers); // modifiers
+ // pushOnIntStack(modifiersSourceStart);
+ // pushOnIntStack(
+ // declarationSourceStart >= 0 ? declarationSourceStart :
+ // modifiersSourceStart);
+ // resetModifiers();
+ // }
+ /**
+ *
+ * INTERNAL USE-ONLY
+ */
+ // protected void consumePackageDeclarationName() {
+ // /* persisting javadoc positions */
+ // pushOnIntArrayStack(this.getJavaDocPositions());
+ //
+ // super.consumePackageDeclarationName();
+ // ImportReference importReference = compilationUnit.currentPackage;
+ //
+ // requestor.acceptPackage(
+ // importReference.declarationSourceStart,
+ // importReference.declarationSourceEnd,
+ // intArrayStack[intArrayPtr--],
+ // CharOperation.concatWith(importReference.getImportName(), '.'),
+ // importReference.sourceStart);
+ // }
+ // protected void consumePushModifiers() {
+ // checkAnnotation(); // might update modifiers with AccDeprecated
+ // pushOnIntStack(modifiers); // modifiers
+ // if (modifiersSourceStart < 0) {
+ // pushOnIntStack(-1);
+ // pushOnIntStack(
+ // declarationSourceStart >= 0 ? declarationSourceStart :
+ // scanner.startPosition);
+ // } else {
+ // pushOnIntStack(modifiersSourceStart);
+ // pushOnIntStack(
+ // declarationSourceStart >= 0 ? declarationSourceStart :
+ // modifiersSourceStart);
+ // }
+ // resetModifiers();
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeSingleTypeImportDeclarationName() {
+ // // SingleTypeImportDeclarationName ::= 'import' Name
+ //
+ // /* persisting javadoc positions */
+ // pushOnIntArrayStack(this.getJavaDocPositions());
+ //
+ // super.consumeSingleTypeImportDeclarationName();
+ // ImportReference importReference = (ImportReference) astStack[astPtr];
+ // requestor.acceptImport(
+ // importReference.declarationSourceStart,
+ // importReference.declarationSourceEnd,
+ // intArrayStack[intArrayPtr--],
+ // CharOperation.concatWith(importReference.getImportName(), '.'),
+ // importReference.sourceStart,
+ // false);
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeStaticInitializer() {
+ // // StaticInitializer ::= StaticOnly Block
+ // //push an Initializer
+ // //optimize the push/pop
+ // super.consumeStaticInitializer();
+ // Initializer initializer = (Initializer) astStack[astPtr];
+ // requestor.acceptInitializer(
+ // initializer.declarationSourceStart,
+ // initializer.declarationSourceEnd,
+ // intArrayStack[intArrayPtr--],
+ // AccStatic,
+ // intStack[intPtr--],
+ // initializer.block.sourceStart,
+ // initializer.declarationSourceEnd);
+ // }
+ // protected void consumeStaticOnly() {
+ // // StaticOnly ::= 'static'
+ // checkAnnotation(); // might update declaration source start
+ // pushOnIntStack(modifiersSourceStart);
+ // pushOnIntStack(
+ // declarationSourceStart >= 0 ? declarationSourceStart :
+ // modifiersSourceStart);
+ // jumpOverMethodBody();
+ // nestedMethod[nestedType]++;
+ // resetModifiers();
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeTypeImportOnDemandDeclarationName() {
+ // // TypeImportOnDemandDeclarationName ::= 'import' Name '.' '*'
+ //
+ // /* persisting javadoc positions */
+ // pushOnIntArrayStack(this.getJavaDocPositions());
+ //
+ // super.consumeTypeImportOnDemandDeclarationName();
+ // ImportReference importReference = (ImportReference) astStack[astPtr];
+ // requestor.acceptImport(
+ // importReference.declarationSourceStart,
+ // importReference.declarationSourceEnd,
+ // intArrayStack[intArrayPtr--],
+ // CharOperation.concatWith(importReference.getImportName(), '.'),
+ // importReference.sourceStart,
+ // true);
+ // }
+ public CompilationUnitDeclaration endParse(int act) {
+ if (scanner.recordLineSeparator) {
+ requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+ }
+ return super.endParse(act);
+ }
- /*
- * Flush annotations defined prior to a given positions.
- *
- * Note: annotations are stacked in syntactical order
- *
- * Either answer given , or the end position of a comment line immediately following the (same line)
- *
- * e.g. void foo(){ } // end of method foo
- */
+ /*
+ * Flush annotations defined prior to a given positions.
+ *
+ * Note: annotations are stacked in syntactical order
+ *
+ * Either answer given , or the end position of a comment line
+ * immediately following the (same line)
+ *
+ * e.g. void foo(){ } // end of method foo
+ */
- //public int flushAnnotationsDefinedPriorTo(int position) {
- //
- // return lastFieldEndPosition = super.flushAnnotationsDefinedPriorTo(position);
- //}
- //protected TypeReference getTypeReference(int dim) { /* build a Reference on a variable that may be qualified or not
- //This variable is a type reference and dim will be its dimensions*/
- //
- // int length;
- // TypeReference ref;
- // if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
- // // single variable reference
- // if (dim == 0) {
- // ref =
- // new SingleTypeReference(
- // identifierStack[identifierPtr],
- // identifierPositionStack[identifierPtr--]);
- // } else {
- // ref =
- // new ArrayTypeReference(
- // identifierStack[identifierPtr],
- // dim,
- // identifierPositionStack[identifierPtr--]);
- // ref.sourceEnd = endPosition;
- // }
- // } else {
- // if (length < 0) { //flag for precompiled type reference on base types
- // ref = TypeReference.baseTypeReference(-length, dim);
- // ref.sourceStart = intStack[intPtr--];
- // if (dim == 0) {
- // ref.sourceEnd = intStack[intPtr--];
- // } else {
- // intPtr--;
- // ref.sourceEnd = endPosition;
- // }
- // } else { //Qualified variable reference
- // char[][] tokens = new char[length][];
- // identifierPtr -= length;
- // long[] positions = new long[length];
- // System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
- // System.arraycopy(
- // identifierPositionStack,
- // identifierPtr + 1,
- // positions,
- // 0,
- // length);
- // if (dim == 0) {
- // ref = new QualifiedTypeReference(tokens, positions);
- // } else {
- // ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
- // ref.sourceEnd = endPosition;
- // }
- // }
- // };
- // return ref;
- //}
- public void initialize() {
- //positionning the parser for a new compilation unit
- //avoiding stack reallocation and all that....
- super.initialize(false);
- intArrayPtr = -1;
- }
+ // public int flushAnnotationsDefinedPriorTo(int position) {
+ //
+ // return lastFieldEndPosition =
+ // super.flushAnnotationsDefinedPriorTo(position);
+ // }
+ // protected TypeReference getTypeReference(int dim) { /* build a Reference
+ // on a variable that may be qualified or not
+ // This variable is a type reference and dim will be its dimensions*/
+ //
+ // int length;
+ // TypeReference ref;
+ // if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
+ // // single variable reference
+ // if (dim == 0) {
+ // ref =
+ // new SingleTypeReference(
+ // identifierStack[identifierPtr],
+ // identifierPositionStack[identifierPtr--]);
+ // } else {
+ // ref =
+ // new ArrayTypeReference(
+ // identifierStack[identifierPtr],
+ // dim,
+ // identifierPositionStack[identifierPtr--]);
+ // ref.sourceEnd = endPosition;
+ // }
+ // } else {
+ // if (length < 0) { //flag for precompiled type reference on base types
+ // ref = TypeReference.baseTypeReference(-length, dim);
+ // ref.sourceStart = intStack[intPtr--];
+ // if (dim == 0) {
+ // ref.sourceEnd = intStack[intPtr--];
+ // } else {
+ // intPtr--;
+ // ref.sourceEnd = endPosition;
+ // }
+ // } else { //Qualified variable reference
+ // char[][] tokens = new char[length][];
+ // identifierPtr -= length;
+ // long[] positions = new long[length];
+ // System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
+ // System.arraycopy(
+ // identifierPositionStack,
+ // identifierPtr + 1,
+ // positions,
+ // 0,
+ // length);
+ // if (dim == 0) {
+ // ref = new QualifiedTypeReference(tokens, positions);
+ // } else {
+ // ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
+ // ref.sourceEnd = endPosition;
+ // }
+ // }
+ // };
+ // return ref;
+ // }
+ public void initialize() {
+ // positionning the parser for a new compilation unit
+ // avoiding stack reallocation and all that....
+ super.initialize(false);
+ intArrayPtr = -1;
+ }
- /**
- *
- * INTERNAL USE-ONLY
- */
- //private boolean isLocalDeclaration() {
- // int nestedDepth = nestedType;
- // while (nestedDepth >= 0) {
- // if (nestedMethod[nestedDepth] != 0) {
- // return true;
- // }
- // nestedDepth--;
- // }
- // return false;
- //}
- /*
- * Investigate one entire unit.
- */
- public void parseCompilationUnit(ICompilationUnit unit) {
- char[] regionSource = unit.getContents();
- try {
- initialize();
- goForCompilationUnit();
- referenceContext = compilationUnit = new CompilationUnitDeclaration(problemReporter(),
- new CompilationResult(unit, 0, 0, 10), //this.options.maxProblemsPerUnit),
- regionSource.length);
- scanner.resetTo(0, regionSource.length);
- scanner.setSource(regionSource);
- parse();
- } catch (AbortCompilation ex) {
- }
- }
+ /**
+ *
+ * INTERNAL USE-ONLY
+ */
+ // private boolean isLocalDeclaration() {
+ // int nestedDepth = nestedType;
+ // while (nestedDepth >= 0) {
+ // if (nestedMethod[nestedDepth] != 0) {
+ // return true;
+ // }
+ // nestedDepth--;
+ // }
+ // return false;
+ // }
+ /*
+ * Investigate one entire unit.
+ */
+ public void parseCompilationUnit(ICompilationUnit unit) {
+ char[] regionSource = unit.getContents();
+ try {
+ initialize();
+ goForCompilationUnit();
+ referenceContext = compilationUnit = new CompilationUnitDeclaration(
+ problemReporter(), new CompilationResult(unit, 0, 0, 10), // this.options.maxProblemsPerUnit),
+ regionSource.length);
+ scanner.resetTo(0, regionSource.length);
+ scanner.setSource(regionSource);
+ parse();
+ } catch (AbortCompilation ex) {
+ }
+ }
- /*
- * Investigate one constructor declaration.
- */
- //public void parseConstructor(char[] regionSource) {
- // try {
- // initialize();
- // goForClassBodyDeclarations();
- // referenceContext =
- // compilationUnit =
- // compilationUnit =
- // new CompilationUnitDeclaration(
- // problemReporter(),
- // new CompilationResult(regionSource, 0, 0, 10), //this.options.maxProblemsPerUnit),
- // regionSource.length);
- // scanner.resetTo(0, regionSource.length);
- // scanner.setSource(regionSource);
- // parse();
- // } catch (AbortCompilation ex) {
- // }
- //}
- /*
- * Investigate one field declaration statement (might have multiple declarations in it).
- */
- //public void parseField(char[] regionSource) {
- // try {
- // initialize();
- // goForFieldDeclaration();
- // referenceContext =
- // compilationUnit =
- // compilationUnit =
- // new CompilationUnitDeclaration(
- // problemReporter(),
- // new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
- // regionSource.length);
- // scanner.resetTo(0, regionSource.length);
- // scanner.setSource(regionSource);
- // parse();
- // } catch (AbortCompilation ex) {
- // }
- //
- //}
- ///*
- // * Investigate one import statement declaration.
- // */
- //public void parseImport(char[] regionSource) {
- // try {
- // initialize();
- // goForImportDeclaration();
- // referenceContext =
- // compilationUnit =
- // compilationUnit =
- // new CompilationUnitDeclaration(
- // problemReporter(),
- // new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
- // regionSource.length);
- // scanner.resetTo(0, regionSource.length);
- // scanner.setSource(regionSource);
- // parse();
- // } catch (AbortCompilation ex) {
- // }
- //
- //}
- ///*
- // * Investigate one initializer declaration.
- // * regionSource need to content exactly an initializer declaration.
- // * e.g: static { i = 4; }
- // * { name = "test"; }
- // */
- //public void parseInitializer(char[] regionSource) {
- // try {
- // initialize();
- // goForInitializer();
- // referenceContext =
- // compilationUnit =
- // compilationUnit =
- // new CompilationUnitDeclaration(
- // problemReporter(),
- // new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
- // regionSource.length);
- // scanner.resetTo(0, regionSource.length);
- // scanner.setSource(regionSource);
- // parse();
- // } catch (AbortCompilation ex) {
- // }
- //
- //}
- ///*
- // * Investigate one method declaration.
- // */
- //public void parseMethod(char[] regionSource) {
- // try {
- // initialize();
- // goForGenericMethodDeclaration();
- // referenceContext =
- // compilationUnit =
- // compilationUnit =
- // new CompilationUnitDeclaration(
- // problemReporter(),
- // new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
- // regionSource.length);
- // scanner.resetTo(0, regionSource.length);
- // scanner.setSource(regionSource);
- // parse();
- // } catch (AbortCompilation ex) {
- // }
- //
- //}
- ///*
- // * Investigate one package statement declaration.
- // */
- //public void parsePackage(char[] regionSource) {
- // try {
- // initialize();
- // goForPackageDeclaration();
- // referenceContext =
- // compilationUnit =
- // compilationUnit =
- // new CompilationUnitDeclaration(
- // problemReporter(),
- // new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
- // regionSource.length);
- // scanner.resetTo(0, regionSource.length);
- // scanner.setSource(regionSource);
- // parse();
- // } catch (AbortCompilation ex) {
- // }
- //
- //}
- ///*
- // * Investigate one type declaration, its fields, methods and member types.
- // */
- //public void parseType(char[] regionSource) {
- // try {
- // initialize();
- // goForTypeDeclaration();
- // referenceContext =
- // compilationUnit =
- // compilationUnit =
- // new CompilationUnitDeclaration(
- // problemReporter(),
- // new CompilationResult(regionSource, 0, 0, this.options.maxProblemsPerUnit),
- // regionSource.length);
- // scanner.resetTo(0, regionSource.length);
- // scanner.setSource(regionSource);
- // parse();
- // } catch (AbortCompilation ex) {
- // }
- //
- //}
- /**
- * Returns this parser's problem reporter initialized with its reference context. Also it is assumed that a problem is going to be
- * reported, so initializes the compilation result's line positions.
- */
- public ProblemReporter problemReporter() {
- problemReporter.referenceContext = referenceContext;
- return problemReporter;
- }
+ /*
+ * Investigate one constructor declaration.
+ */
+ // public void parseConstructor(char[] regionSource) {
+ // try {
+ // initialize();
+ // goForClassBodyDeclarations();
+ // referenceContext =
+ // compilationUnit =
+ // compilationUnit =
+ // new CompilationUnitDeclaration(
+ // problemReporter(),
+ // new CompilationResult(regionSource, 0, 0, 10),
+ // //this.options.maxProblemsPerUnit),
+ // regionSource.length);
+ // scanner.resetTo(0, regionSource.length);
+ // scanner.setSource(regionSource);
+ // parse();
+ // } catch (AbortCompilation ex) {
+ // }
+ // }
+ /*
+ * Investigate one field declaration statement (might have multiple
+ * declarations in it).
+ */
+ // public void parseField(char[] regionSource) {
+ // try {
+ // initialize();
+ // goForFieldDeclaration();
+ // referenceContext =
+ // compilationUnit =
+ // compilationUnit =
+ // new CompilationUnitDeclaration(
+ // problemReporter(),
+ // new CompilationResult(regionSource, 0, 0,
+ // this.options.maxProblemsPerUnit),
+ // regionSource.length);
+ // scanner.resetTo(0, regionSource.length);
+ // scanner.setSource(regionSource);
+ // parse();
+ // } catch (AbortCompilation ex) {
+ // }
+ //
+ // }
+ // /*
+ // * Investigate one import statement declaration.
+ // */
+ // public void parseImport(char[] regionSource) {
+ // try {
+ // initialize();
+ // goForImportDeclaration();
+ // referenceContext =
+ // compilationUnit =
+ // compilationUnit =
+ // new CompilationUnitDeclaration(
+ // problemReporter(),
+ // new CompilationResult(regionSource, 0, 0,
+ // this.options.maxProblemsPerUnit),
+ // regionSource.length);
+ // scanner.resetTo(0, regionSource.length);
+ // scanner.setSource(regionSource);
+ // parse();
+ // } catch (AbortCompilation ex) {
+ // }
+ //
+ // }
+ // /*
+ // * Investigate one initializer declaration.
+ // * regionSource need to content exactly an initializer declaration.
+ // * e.g: static { i = 4; }
+ // * { name = "test"; }
+ // */
+ // public void parseInitializer(char[] regionSource) {
+ // try {
+ // initialize();
+ // goForInitializer();
+ // referenceContext =
+ // compilationUnit =
+ // compilationUnit =
+ // new CompilationUnitDeclaration(
+ // problemReporter(),
+ // new CompilationResult(regionSource, 0, 0,
+ // this.options.maxProblemsPerUnit),
+ // regionSource.length);
+ // scanner.resetTo(0, regionSource.length);
+ // scanner.setSource(regionSource);
+ // parse();
+ // } catch (AbortCompilation ex) {
+ // }
+ //
+ // }
+ // /*
+ // * Investigate one method declaration.
+ // */
+ // public void parseMethod(char[] regionSource) {
+ // try {
+ // initialize();
+ // goForGenericMethodDeclaration();
+ // referenceContext =
+ // compilationUnit =
+ // compilationUnit =
+ // new CompilationUnitDeclaration(
+ // problemReporter(),
+ // new CompilationResult(regionSource, 0, 0,
+ // this.options.maxProblemsPerUnit),
+ // regionSource.length);
+ // scanner.resetTo(0, regionSource.length);
+ // scanner.setSource(regionSource);
+ // parse();
+ // } catch (AbortCompilation ex) {
+ // }
+ //
+ // }
+ // /*
+ // * Investigate one package statement declaration.
+ // */
+ // public void parsePackage(char[] regionSource) {
+ // try {
+ // initialize();
+ // goForPackageDeclaration();
+ // referenceContext =
+ // compilationUnit =
+ // compilationUnit =
+ // new CompilationUnitDeclaration(
+ // problemReporter(),
+ // new CompilationResult(regionSource, 0, 0,
+ // this.options.maxProblemsPerUnit),
+ // regionSource.length);
+ // scanner.resetTo(0, regionSource.length);
+ // scanner.setSource(regionSource);
+ // parse();
+ // } catch (AbortCompilation ex) {
+ // }
+ //
+ // }
+ // /*
+ // * Investigate one type declaration, its fields, methods and member types.
+ // */
+ // public void parseType(char[] regionSource) {
+ // try {
+ // initialize();
+ // goForTypeDeclaration();
+ // referenceContext =
+ // compilationUnit =
+ // compilationUnit =
+ // new CompilationUnitDeclaration(
+ // problemReporter(),
+ // new CompilationResult(regionSource, 0, 0,
+ // this.options.maxProblemsPerUnit),
+ // regionSource.length);
+ // scanner.resetTo(0, regionSource.length);
+ // scanner.setSource(regionSource);
+ // parse();
+ // } catch (AbortCompilation ex) {
+ // }
+ //
+ // }
+ /**
+ * Returns this parser's problem reporter initialized with its reference
+ * context. Also it is assumed that a problem is going to be reported, so
+ * initializes the compilation result's line positions.
+ */
+ public ProblemReporter problemReporter() {
+ problemReporter.referenceContext = referenceContext;
+ return problemReporter;
+ }
- protected void pushOnIntArrayStack(int[] positions) {
+ protected void pushOnIntArrayStack(int[] positions) {
- try {
- intArrayStack[++intArrayPtr] = positions;
- } catch (IndexOutOfBoundsException e) {
- //intPtr is correct
- int oldStackLength = intArrayStack.length;
- int oldStack[][] = intArrayStack;
- intArrayStack = new int[oldStackLength + StackIncrement][];
- System.arraycopy(oldStack, 0, intArrayStack, 0, oldStackLength);
- intArrayStack[intArrayPtr] = positions;
- }
- }
+ try {
+ intArrayStack[++intArrayPtr] = positions;
+ } catch (IndexOutOfBoundsException e) {
+ // intPtr is correct
+ int oldStackLength = intArrayStack.length;
+ int oldStack[][] = intArrayStack;
+ intArrayStack = new int[oldStackLength + StackIncrement][];
+ System.arraycopy(oldStack, 0, intArrayStack, 0, oldStackLength);
+ intArrayStack[intArrayPtr] = positions;
+ }
+ }
- //protected void resetModifiers() {
- // super.resetModifiers();
- // declarationSourceStart = -1;
- //}
- /*
- * Syntax error was detected. Will attempt to perform some recovery action in order to resume to the regular parse loop.
- */
- protected boolean resumeOnSyntaxError() {
- return false;
- }
- /*
- * Answer a char array representation of the type name formatted like: - type name + dimensions Example: "A[][]".toCharArray()
- * "java.lang.String".toCharArray()
- */
- //private char[] returnTypeName(TypeReference type) {
- // int dimension = type.dimensions();
- // if (dimension != 0) {
- // char[] dimensionsArray = new char[dimension * 2];
- // for (int i = 0; i < dimension; i++) {
- // dimensionsArray[i*2] = '[';
- // dimensionsArray[(i*2) + 1] = ']';
- // }
- // return CharOperation.concat(
- // CharOperation.concatWith(type.getTypeName(), '.'),
- // dimensionsArray);
- // }
- // return CharOperation.concatWith(type.getTypeName(), '.');
- //}
- //public String toString() {
- // StringBuffer buffer = new StringBuffer();
- // buffer.append("intArrayPtr = " + intArrayPtr + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- // buffer.append(super.toString());
- // return buffer.toString();
- //}
- ///**
- // * INTERNAL USE ONLY
- // */
- //protected TypeReference typeReference(
- // int dim,
- // int localIdentifierPtr,
- // int localIdentifierLengthPtr) {
- // /* build a Reference on a variable that may be qualified or not
- // * This variable is a type reference and dim will be its dimensions.
- // * We don't have any side effect on the stacks' pointers.
- // */
- //
- // int length;
- // TypeReference ref;
- // if ((length = identifierLengthStack[localIdentifierLengthPtr]) == 1) {
- // // single variable reference
- // if (dim == 0) {
- // ref =
- // new SingleTypeReference(
- // identifierStack[localIdentifierPtr],
- // identifierPositionStack[localIdentifierPtr--]);
- // } else {
- // ref =
- // new ArrayTypeReference(
- // identifierStack[localIdentifierPtr],
- // dim,
- // identifierPositionStack[localIdentifierPtr--]);
- // ref.sourceEnd = endPosition;
- // }
- // } else {
- // if (length < 0) { //flag for precompiled type reference on base types
- // ref = TypeReference.baseTypeReference(-length, dim);
- // ref.sourceStart = intStack[localIntPtr--];
- // if (dim == 0) {
- // ref.sourceEnd = intStack[localIntPtr--];
- // } else {
- // localIntPtr--;
- // ref.sourceEnd = endPosition;
- // }
- // } else { //Qualified variable reference
- // char[][] tokens = new char[length][];
- // localIdentifierPtr -= length;
- // long[] positions = new long[length];
- // System.arraycopy(identifierStack, localIdentifierPtr + 1, tokens, 0, length);
- // System.arraycopy(
- // identifierPositionStack,
- // localIdentifierPtr + 1,
- // positions,
- // 0,
- // length);
- // if (dim == 0)
- // ref = new QualifiedTypeReference(tokens, positions);
- // else
- // ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
- // }
- // };
- // return ref;
- //}
+ // protected void resetModifiers() {
+ // super.resetModifiers();
+ // declarationSourceStart = -1;
+ // }
+ /*
+ * Syntax error was detected. Will attempt to perform some recovery action
+ * in order to resume to the regular parse loop.
+ */
+ protected boolean resumeOnSyntaxError() {
+ return false;
+ }
+ /*
+ * Answer a char array representation of the type name formatted like: -
+ * type name + dimensions Example: "A[][]".toCharArray()
+ * "java.lang.String".toCharArray()
+ */
+ // private char[] returnTypeName(TypeReference type) {
+ // int dimension = type.dimensions();
+ // if (dimension != 0) {
+ // char[] dimensionsArray = new char[dimension * 2];
+ // for (int i = 0; i < dimension; i++) {
+ // dimensionsArray[i*2] = '[';
+ // dimensionsArray[(i*2) + 1] = ']';
+ // }
+ // return CharOperation.concat(
+ // CharOperation.concatWith(type.getTypeName(), '.'),
+ // dimensionsArray);
+ // }
+ // return CharOperation.concatWith(type.getTypeName(), '.');
+ // }
+ // public String toString() {
+ // StringBuffer buffer = new StringBuffer();
+ // buffer.append("intArrayPtr = " + intArrayPtr + "\n"); //$NON-NLS-1$
+ // //$NON-NLS-2$
+ // buffer.append(super.toString());
+ // return buffer.toString();
+ // }
+ // /**
+ // * INTERNAL USE ONLY
+ // */
+ // protected TypeReference typeReference(
+ // int dim,
+ // int localIdentifierPtr,
+ // int localIdentifierLengthPtr) {
+ // /* build a Reference on a variable that may be qualified or not
+ // * This variable is a type reference and dim will be its dimensions.
+ // * We don't have any side effect on the stacks' pointers.
+ // */
+ //
+ // int length;
+ // TypeReference ref;
+ // if ((length = identifierLengthStack[localIdentifierLengthPtr]) == 1) {
+ // // single variable reference
+ // if (dim == 0) {
+ // ref =
+ // new SingleTypeReference(
+ // identifierStack[localIdentifierPtr],
+ // identifierPositionStack[localIdentifierPtr--]);
+ // } else {
+ // ref =
+ // new ArrayTypeReference(
+ // identifierStack[localIdentifierPtr],
+ // dim,
+ // identifierPositionStack[localIdentifierPtr--]);
+ // ref.sourceEnd = endPosition;
+ // }
+ // } else {
+ // if (length < 0) { //flag for precompiled type reference on base types
+ // ref = TypeReference.baseTypeReference(-length, dim);
+ // ref.sourceStart = intStack[localIntPtr--];
+ // if (dim == 0) {
+ // ref.sourceEnd = intStack[localIntPtr--];
+ // } else {
+ // localIntPtr--;
+ // ref.sourceEnd = endPosition;
+ // }
+ // } else { //Qualified variable reference
+ // char[][] tokens = new char[length][];
+ // localIdentifierPtr -= length;
+ // long[] positions = new long[length];
+ // System.arraycopy(identifierStack, localIdentifierPtr + 1, tokens, 0,
+ // length);
+ // System.arraycopy(
+ // identifierPositionStack,
+ // localIdentifierPtr + 1,
+ // positions,
+ // 0,
+ // length);
+ // if (dim == 0)
+ // ref = new QualifiedTypeReference(tokens, positions);
+ // else
+ // ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
+ // }
+ // };
+ // return ref;
+ // }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java
index be48825..f29b43b 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IAbstractSyntaxTreeVisitor.java
@@ -89,154 +89,324 @@ import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
*/
public interface IAbstractSyntaxTreeVisitor {
void acceptProblem(IProblem problem);
+
void endVisit(AllocationExpression allocationExpression, BlockScope scope);
+
void endVisit(AND_AND_Expression and_and_Expression, BlockScope scope);
- void endVisit(AnonymousLocalTypeDeclaration anonymousTypeDeclaration, BlockScope scope);
+
+ void endVisit(AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
+ BlockScope scope);
+
void endVisit(Argument argument, BlockScope scope);
- void endVisit(ArrayAllocationExpression arrayAllocationExpression, BlockScope scope);
+
+ void endVisit(ArrayAllocationExpression arrayAllocationExpression,
+ BlockScope scope);
+
void endVisit(ArrayInitializer arrayInitializer, BlockScope scope);
- void endVisit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, BlockScope scope);
- void endVisit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, ClassScope scope);
+
+ void endVisit(ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ BlockScope scope);
+
+ void endVisit(ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ ClassScope scope);
+
void endVisit(ArrayReference arrayReference, BlockScope scope);
+
void endVisit(ArrayTypeReference arrayTypeReference, BlockScope scope);
+
void endVisit(ArrayTypeReference arrayTypeReference, ClassScope scope);
+
void endVisit(AssertStatement assertStatement, BlockScope scope);
+
void endVisit(Assignment assignment, BlockScope scope);
+
void endVisit(BinaryExpression binaryExpression, BlockScope scope);
+
void endVisit(Block block, BlockScope scope);
+
void endVisit(BreakStatement breakStatement, BlockScope scope);
+
void endVisit(CaseStatement caseStatement, BlockScope scope);
+
void endVisit(CastExpression castExpression, BlockScope scope);
-// void endVisit(CharLiteral charLiteral, BlockScope scope);
-// void endVisit(ClassLiteralAccess classLiteral, BlockScope scope);
+
+ // void endVisit(CharLiteral charLiteral, BlockScope scope);
+ // void endVisit(ClassLiteralAccess classLiteral, BlockScope scope);
void endVisit(Clinit clinit, ClassScope scope);
- void endVisit(CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope);
+
+ void endVisit(CompilationUnitDeclaration compilationUnitDeclaration,
+ CompilationUnitScope scope);
+
void endVisit(CompoundAssignment compoundAssignment, BlockScope scope);
+
void endVisit(ConditionalExpression conditionalExpression, BlockScope scope);
- void endVisit(ConstructorDeclaration constructorDeclaration, ClassScope scope);
+
+ void endVisit(ConstructorDeclaration constructorDeclaration,
+ ClassScope scope);
+
void endVisit(ContinueStatement continueStatement, BlockScope scope);
+
void endVisit(DefaultCase defaultCaseStatement, BlockScope scope);
+
void endVisit(DoStatement doStatement, BlockScope scope);
+
void endVisit(DoubleLiteral doubleLiteral, BlockScope scope);
+
void endVisit(EqualExpression equalExpression, BlockScope scope);
+
void endVisit(EmptyStatement statement, BlockScope scope);
+
void endVisit(ExplicitConstructorCall explicitConstructor, BlockScope scope);
+
void endVisit(ExtendedStringLiteral extendedStringLiteral, BlockScope scope);
+
void endVisit(FalseLiteral falseLiteral, BlockScope scope);
+
void endVisit(FieldDeclaration fieldDeclaration, MethodScope scope);
+
void endVisit(FieldReference fieldReference, BlockScope scope);
+
void endVisit(FloatLiteral floatLiteral, BlockScope scope);
+
void endVisit(ForStatement forStatement, BlockScope scope);
+
void endVisit(IfStatement ifStatement, BlockScope scope);
+
void endVisit(ImportReference importRef, CompilationUnitScope scope);
+
void endVisit(Initializer initializer, MethodScope scope);
+
void endVisit(InstanceOfExpression instanceOfExpression, BlockScope scope);
+
void endVisit(IntLiteral intLiteral, BlockScope scope);
+
void endVisit(LabeledStatement labeledStatement, BlockScope scope);
+
void endVisit(LocalDeclaration localDeclaration, BlockScope scope);
+
void endVisit(LocalTypeDeclaration localTypeDeclaration, BlockScope scope);
+
void endVisit(LongLiteral longLiteral, BlockScope scope);
+
void endVisit(MemberTypeDeclaration memberTypeDeclaration, ClassScope scope);
+
void endVisit(MessageSend messageSend, BlockScope scope);
+
void endVisit(MethodDeclaration methodDeclaration, ClassScope scope);
+
void endVisit(NullLiteral nullLiteral, BlockScope scope);
+
void endVisit(OR_OR_Expression or_or_Expression, BlockScope scope);
+
void endVisit(PostfixExpression postfixExpression, BlockScope scope);
+
void endVisit(PrefixExpression prefixExpression, BlockScope scope);
- void endVisit(QualifiedAllocationExpression qualifiedAllocationExpression, BlockScope scope);
- void endVisit(QualifiedNameReference qualifiedNameReference, BlockScope scope);
- void endVisit(QualifiedSuperReference qualifiedSuperReference, BlockScope scope);
- void endVisit(QualifiedThisReference qualifiedThisReference, BlockScope scope);
- void endVisit(QualifiedTypeReference qualifiedTypeReference, BlockScope scope);
- void endVisit(QualifiedTypeReference qualifiedTypeReference, ClassScope scope);
+
+ void endVisit(QualifiedAllocationExpression qualifiedAllocationExpression,
+ BlockScope scope);
+
+ void endVisit(QualifiedNameReference qualifiedNameReference,
+ BlockScope scope);
+
+ void endVisit(QualifiedSuperReference qualifiedSuperReference,
+ BlockScope scope);
+
+ void endVisit(QualifiedThisReference qualifiedThisReference,
+ BlockScope scope);
+
+ void endVisit(QualifiedTypeReference qualifiedTypeReference,
+ BlockScope scope);
+
+ void endVisit(QualifiedTypeReference qualifiedTypeReference,
+ ClassScope scope);
+
void endVisit(ReturnStatement returnStatement, BlockScope scope);
+
void endVisit(SingleNameReference singleNameReference, BlockScope scope);
+
void endVisit(SingleTypeReference singleTypeReference, BlockScope scope);
+
void endVisit(SingleTypeReference singleTypeReference, ClassScope scope);
+
void endVisit(StringLiteral stringLiteral, BlockScope scope);
+
void endVisit(SuperReference superReference, BlockScope scope);
+
void endVisit(SwitchStatement switchStatement, BlockScope scope);
-// void endVisit(SynchronizedStatement synchronizedStatement, BlockScope scope);
+
+ // void endVisit(SynchronizedStatement synchronizedStatement, BlockScope
+ // scope);
void endVisit(ThisReference thisReference, BlockScope scope);
+
void endVisit(ThrowStatement throwStatement, BlockScope scope);
+
void endVisit(TrueLiteral trueLiteral, BlockScope scope);
+
void endVisit(TryStatement tryStatement, BlockScope scope);
+
void endVisit(TypeDeclaration typeDeclaration, CompilationUnitScope scope);
+
void endVisit(UnaryExpression unaryExpression, BlockScope scope);
+
void endVisit(WhileStatement whileStatement, BlockScope scope);
+
boolean visit(AllocationExpression allocationExpression, BlockScope scope);
+
boolean visit(AND_AND_Expression and_and_Expression, BlockScope scope);
- boolean visit(AnonymousLocalTypeDeclaration anonymousTypeDeclaration, BlockScope scope);
+
+ boolean visit(AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
+ BlockScope scope);
+
boolean visit(Argument argument, BlockScope scope);
- boolean visit(ArrayAllocationExpression arrayAllocationExpression, BlockScope scope);
+
+ boolean visit(ArrayAllocationExpression arrayAllocationExpression,
+ BlockScope scope);
+
boolean visit(ArrayInitializer arrayInitializer, BlockScope scope);
- boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, BlockScope scope);
- boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference, ClassScope scope);
+
+ boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ BlockScope scope);
+
+ boolean visit(ArrayQualifiedTypeReference arrayQualifiedTypeReference,
+ ClassScope scope);
+
boolean visit(ArrayReference arrayReference, BlockScope scope);
+
boolean visit(ArrayTypeReference arrayTypeReference, BlockScope scope);
+
boolean visit(ArrayTypeReference arrayTypeReference, ClassScope scope);
+
boolean visit(AssertStatement assertStatement, BlockScope scope);
+
boolean visit(Assignment assignment, BlockScope scope);
+
boolean visit(BinaryExpression binaryExpression, BlockScope scope);
+
boolean visit(Block block, BlockScope scope);
+
boolean visit(BreakStatement breakStatement, BlockScope scope);
+
boolean visit(CaseStatement caseStatement, BlockScope scope);
+
boolean visit(CastExpression castExpression, BlockScope scope);
-// boolean visit(CharLiteral charLiteral, BlockScope scope);
-// boolean visit(ClassLiteralAccess classLiteral, BlockScope scope);
+
+ // boolean visit(CharLiteral charLiteral, BlockScope scope);
+ // boolean visit(ClassLiteralAccess classLiteral, BlockScope scope);
boolean visit(Clinit clinit, ClassScope scope);
- boolean visit(CompilationUnitDeclaration compilationUnitDeclaration, CompilationUnitScope scope);
+
+ boolean visit(CompilationUnitDeclaration compilationUnitDeclaration,
+ CompilationUnitScope scope);
+
boolean visit(CompoundAssignment compoundAssignment, BlockScope scope);
+
boolean visit(ConditionalExpression conditionalExpression, BlockScope scope);
- boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope);
+
+ boolean visit(ConstructorDeclaration constructorDeclaration,
+ ClassScope scope);
+
boolean visit(ContinueStatement continueStatement, BlockScope scope);
+
boolean visit(DefaultCase defaultCaseStatement, BlockScope scope);
+
boolean visit(DoStatement doStatement, BlockScope scope);
+
boolean visit(DoubleLiteral doubleLiteral, BlockScope scope);
+
boolean visit(EqualExpression equalExpression, BlockScope scope);
+
boolean visit(EmptyStatement statement, BlockScope scope);
+
boolean visit(ExplicitConstructorCall explicitConstructor, BlockScope scope);
+
boolean visit(ExtendedStringLiteral extendedStringLiteral, BlockScope scope);
+
boolean visit(FalseLiteral falseLiteral, BlockScope scope);
+
boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope);
+
boolean visit(FieldReference fieldReference, BlockScope scope);
+
boolean visit(FloatLiteral floatLiteral, BlockScope scope);
+
boolean visit(ForStatement forStatement, BlockScope scope);
+
boolean visit(IfStatement ifStatement, BlockScope scope);
+
boolean visit(ImportReference importRef, CompilationUnitScope scope);
+
boolean visit(Initializer initializer, MethodScope scope);
+
boolean visit(InstanceOfExpression instanceOfExpression, BlockScope scope);
+
boolean visit(IntLiteral intLiteral, BlockScope scope);
+
boolean visit(LabeledStatement labeledStatement, BlockScope scope);
+
boolean visit(LocalDeclaration localDeclaration, BlockScope scope);
+
boolean visit(LocalTypeDeclaration localTypeDeclaration, BlockScope scope);
+
boolean visit(LongLiteral longLiteral, BlockScope scope);
+
boolean visit(MemberTypeDeclaration memberTypeDeclaration, ClassScope scope);
+
boolean visit(MessageSend messageSend, BlockScope scope);
+
boolean visit(MethodDeclaration methodDeclaration, ClassScope scope);
+
boolean visit(NullLiteral nullLiteral, BlockScope scope);
+
boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope);
+
boolean visit(PostfixExpression postfixExpression, BlockScope scope);
+
boolean visit(PrefixExpression prefixExpression, BlockScope scope);
- boolean visit(QualifiedAllocationExpression qualifiedAllocationExpression, BlockScope scope);
- boolean visit(QualifiedNameReference qualifiedNameReference, BlockScope scope);
- boolean visit(QualifiedSuperReference qualifiedSuperReference, BlockScope scope);
- boolean visit(QualifiedThisReference qualifiedThisReference, BlockScope scope);
- boolean visit(QualifiedTypeReference qualifiedTypeReference, BlockScope scope);
- boolean visit(QualifiedTypeReference qualifiedTypeReference, ClassScope scope);
+
+ boolean visit(QualifiedAllocationExpression qualifiedAllocationExpression,
+ BlockScope scope);
+
+ boolean visit(QualifiedNameReference qualifiedNameReference,
+ BlockScope scope);
+
+ boolean visit(QualifiedSuperReference qualifiedSuperReference,
+ BlockScope scope);
+
+ boolean visit(QualifiedThisReference qualifiedThisReference,
+ BlockScope scope);
+
+ boolean visit(QualifiedTypeReference qualifiedTypeReference,
+ BlockScope scope);
+
+ boolean visit(QualifiedTypeReference qualifiedTypeReference,
+ ClassScope scope);
+
boolean visit(ReturnStatement returnStatement, BlockScope scope);
+
boolean visit(SingleNameReference singleNameReference, BlockScope scope);
+
boolean visit(SingleTypeReference singleTypeReference, BlockScope scope);
+
boolean visit(SingleTypeReference singleTypeReference, ClassScope scope);
+
boolean visit(StringLiteral stringLiteral, BlockScope scope);
+
boolean visit(SuperReference superReference, BlockScope scope);
+
boolean visit(SwitchStatement switchStatement, BlockScope scope);
-// boolean visit(SynchronizedStatement synchronizedStatement, BlockScope scope);
+
+ // boolean visit(SynchronizedStatement synchronizedStatement, BlockScope
+ // scope);
boolean visit(ThisReference thisReference, BlockScope scope);
+
boolean visit(ThrowStatement throwStatement, BlockScope scope);
+
boolean visit(TrueLiteral trueLiteral, BlockScope scope);
+
boolean visit(TryStatement tryStatement, BlockScope scope);
+
boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope);
+
boolean visit(UnaryExpression unaryExpression, BlockScope scope);
+
boolean visit(WhileStatement whileStatement, BlockScope scope);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ICompilerRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ICompilerRequestor.java
index b41a9b1..9450525 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ICompilerRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ICompilerRequestor.java
@@ -14,7 +14,7 @@ package net.sourceforge.phpdt.internal.compiler;
* A callback interface for receiving compilation results.
*/
public interface ICompilerRequestor {
-
+
/**
* Accept a compilation result.
*/
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IDocumentElementRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IDocumentElementRequestor.java
index 3308ae1..3c6e134 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IDocumentElementRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IDocumentElementRequestor.java
@@ -13,399 +13,462 @@ package net.sourceforge.phpdt.internal.compiler;
import net.sourceforge.phpdt.core.compiler.IProblem;
/**
- * Part of the source element parser responsible for building the output.
- * It gets notified of structural information as they are detected, relying
- * on the requestor to assemble them together, based on the notifications it got.
- *
- * The structural investigation includes:
- * - package statement
- * - import statements
- * - top-level types: package member, member types (member types of member types...)
- * - fields
- * - methods
- *
+ * Part of the source element parser responsible for building the output. It
+ * gets notified of structural information as they are detected, relying on the
+ * requestor to assemble them together, based on the notifications it got.
+ *
+ * The structural investigation includes: - package statement - import
+ * statements - top-level types: package member, member types (member types of
+ * member types...) - fields - methods
+ *
* If reference information is requested, then all source constructs are
* investigated and type, field & method references are provided as well.
- *
+ *
* Any (parsing) problem encountered is also provided.
- *
+ *
* All positions are relative to the exact source fed to the parser.
- *
- * Elements which are complex are notified in two steps:
- * - enter : once the element header has been identified
- * - exit : once the element has been fully consumed
- *
- * other simpler elements (package, import) are read all at once:
- * - accept
- */
-
-public interface IDocumentElementRequestor {
-/**
- * @param declarationStart - a source position corresponding to the start of the package
- * declaration
- * @param declarationEnd - a source position corresponding to the end of the package
- * declaration
- * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
- * positions of the available JavaDoc comments. The array is a flattened
- * structure: 2*n entries with consecutives start and end positions.
- * If no JavaDoc is available, then null is answered instead of an empty array.
- * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
- * The array is equals to null if there are no javadoc comments
- * @param name - the name of the package
- * @param nameStartPosition - a source position corresponding to the first character of the
- * name
- * @param onDemand - a boolean equals to true if the import is an import on demand
- */
-void acceptImport(
- int declarationStart,
- int declarationEnd,
- int[] javaDocPositions,
- char[] name,
- int nameStartPosition,
- boolean onDemand);
-/**
- * @param declarationStart - a source position corresponding to the start of the package
- * declaration
- * @param declarationEnd - a source position corresponding to the end of the package
- * declaration
- * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
- * positions of the available JavaDoc comments. The array is a flattened
- * structure: 2*n entries with consecutives start and end positions.
- * If no JavaDoc is available, then null is answered instead of an empty array.
- * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
- * The array is equals to null if there are no javadoc comments
- * @param modifiers - the modifiers for this initializer
- * @param modifiersStart - a source position corresponding to the start
- * of the textual modifiers, is < 0 if there are no textual modifiers
- * @param bodyStart - the position of the '{'
- * @param bodyEnd - the position of the '}'
- */
-void acceptInitializer(
- int declarationStart,
- int declarationEnd,
- int[] javaDocPositions,
- int modifiers,
- int modifiersStart,
- int bodyStart,
- int bodyEnd);
-/*
- * Table of line separator position. This table is passed once at the end
- * of the parse action, so as to allow computation of normalized ranges.
- *
- * A line separator might corresponds to several characters in the source,
*
+ * Elements which are complex are notified in two steps: - enter :
+ * once the element header has been identified - exit : once the
+ * element has been fully consumed
+ *
+ * other simpler elements (package, import) are read all at once: - accept
*/
-void acceptLineSeparatorPositions(int[] positions);
-/**
- * @param declarationStart - a source position corresponding to the start of the package
- * declaration
- * @param declarationEnd - a source position corresponding to the end of the package
- * declaration
- * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
- * positions of the available JavaDoc comments. The array is a flattened
- * structure: 2*n entries with consecutives start and end positions.
- * If no JavaDoc is available, then null is answered instead of an empty array.
- * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
- * The array is equals to null if there are no javadoc comments
- * @param name - the name of the package
- * @param nameStartPosition - a source position corresponding to the first character of the
- * name
- */
-void acceptPackage(
- int declarationStart,
- int declarationEnd,
- int[] javaDocPositions,
- char[] name,
- int nameStartPosition);
-/**
- * @param problem - Used to report a problem while running the JDOM
- */
-void acceptProblem(IProblem problem);
-/**
- * @param declarationStart - a source position corresponding to the start
- * of this class.
- * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
- * positions of the available JavaDoc comments. The array is a flattened
- * structure: 2*n entries with consecutives start and end positions.
- * If no JavaDoc is available, then null is answered instead of an empty array.
- * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
- * The array is equals to null if there are no javadoc comments
- * @param modifiers - the modifiers for this class
- * @param modifiersStart - a source position corresponding to the start
- * of the textual modifiers, is < 0 if there are no textual modifiers
- * @param classStart - a source position corresponding to the start
- * of the keyword 'class'
- * @param name - the name of the class
- * @param nameStart - a source position corresponding to the start of the name
- * @param nameEnd - a source position corresponding to the end of the name
- * @param superclass - the name of the superclass
- * @param superclassStart - a source position corresponding to the start
- * of the superclass name
- * @param superclassEnd - a source position corresponding to the end of the
- * superclass name
- * @param superinterfaces - the name of the superinterfaces
- * @param superinterfaceStarts - an array of source positions corresponding
- * to the start of their respective superinterface names
- * @param superinterfaceEnds - an array of source positions corresponding
- * to the end of their respective superinterface names
- * @param bodyStart - a source position corresponding to the open bracket
- * of the class body
- */
-void enterClass(
- int declarationStart,
- int[] javaDocPositions,
- int modifiers,
- int modifiersStart,
- int classStart,
- char[] name,
- int nameStart,
- int nameEnd,
- char[] superclass,
- int superclassStart,
- int superclassEnd,
- char[][] superinterfaces,
- int[] superinterfaceStarts,
- int[] superinterfaceEnds,
- int bodyStart);
-void enterCompilationUnit();
-/**
- * @param declarationStart - a source position corresponding to the first character
- * of this constructor declaration
- * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
- * positions of the available JavaDoc comments. The array is a flattened
- * structure: 2*n entries with consecutives start and end positions.
- * If no JavaDoc is available, then null is answered instead of an empty array.
- * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
- * The array is equals to null if there are no javadoc comments
- * @param modifiers - the modifiers for this constructor converted to a flag
- * @param modifiersStart - a source position corresponding to the first character of the
- * textual modifiers
- * @param name - the name of this constructor
- * @param nameStart - a source position corresponding to the first character of the name
- * @param nameEnd - a source position corresponding to the last character of the name
- * @param parameterTypes - a list of parameter type names
- * @param parameterTypeStarts - a list of source positions corresponding to the
- * first character of each parameter type name
- * @param parameterTypeEnds - a list of source positions corresponding to the
- * last character of each parameter type name
- * @param parameterNames - a list of the names of the parameters
- * @param parametersEnd - a source position corresponding to the last character of the
- * parameter list
- * @param exceptionTypes - a list of the exception types
- * @param exceptionTypeStarts - a list of source positions corresponding to the first
- * character of the respective exception types
- * @param exceptionTypeEnds - a list of source positions corresponding to the last
- * character of the respective exception types
- * @param bodyStart - a source position corresponding to the start of this
- * constructor's body
- */
-void enterConstructor(
- int declarationStart,
- int[] javaDocPositions,
- int modifiers,
- int modifiersStart,
- char[] name,
- int nameStart,
- int nameEnd,
- char[][] parameterTypes,
- int [] parameterTypeStarts,
- int [] parameterTypeEnds,
- char[][] parameterNames,
- int [] parameterNameStarts,
- int [] parameterNameEnds,
- int parametersEnd,
- char[][] exceptionTypes,
- int [] exceptionTypeStarts,
- int [] exceptionTypeEnds,
- int bodyStart);
-/**
- * @param declarationStart - a source position corresponding to the first character
- * of this field
- * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
- * positions of the available JavaDoc comments. The array is a flattened
- * structure: 2*n entries with consecutives start and end positions.
- * If no JavaDoc is available, then null is answered instead of an empty array.
- * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
- * The array is equals to null if there are no javadoc comments
- * @param modifiers - the modifiers for this field converted to a flag
- * @param modifiersStart - a source position corresponding to the first character of the
- * textual modifiers
- * @param type - the name of the field type
- * @param typeStart - a source position corresponding to the start of the fields type
- * @param typeEnd - a source position corresponding to the end of the fields type
- * @param typeDimensionCount - the array dimension indicated on the type (for example, 'int[] v')
- * @param name - the name of this constructor
- * @param nameStart - a source position corresponding to the first character of the name
- * @param nameEnd - a source position corresponding to the last character of the name
- * @param extendedTypeDimensionCount - the array dimension indicated on the variable,
- * (for example, 'int v[]')
- * @param extendedTypeDimnesionEnd - a source position corresponding to the end of
- * the extened type dimension. This position should be -1 in case there is no extended
- * dimension for the type.
- */
-void enterField(
- int declarationStart,
- int[] javaDocPositions,
- int modifiers,
- int modifiersStart,
- char[] type,
- int typeStart,
- int typeEnd,
- int typeDimensionCount,
- char[] name,
- int nameStart,
- int nameEnd,
- int extendedTypeDimensionCount,
- int extendedTypeDimensionEnd);
-/**
- * @param declarationStart - a source position corresponding to the start
- * of this class.
- * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
- * positions of the available JavaDoc comments. The array is a flattened
- * structure: 2*n entries with consecutives start and end positions.
- * If no JavaDoc is available, then null is answered instead of an empty array.
- * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
- * The array is equals to null if there are no javadoc comments
- * @param modifiers - the modifiers for this class
- * @param modifiersStart - a source position corresponding to the start
- * of the textual modifiers, is < 0 if there are no textual modifiers
- * @param interfaceStart - a source position corresponding to the start
- * of the keyword 'interface'
- * @param name - the name of the class
- * @param nameStart - a source position corresponding to the start of the name
- * @param nameEnd - a source position corresponding to the end of the name
- * @param superinterfaces - the name of the superinterfaces
- * @param superinterfaceStarts - an array of source positions corresponding
- * to the start of their respective superinterface names
- * @param superinterfaceEnds - an array of source positions corresponding
- * to the end of their respective superinterface names
- * @param bodyStart - a source position corresponding to the open bracket
- * of the class body
- */
-void enterInterface(
- int declarationStart,
- int[] javaDocPositions,
- int modifiers,
- int modifiersStart,
- int interfaceStart,
- char[] name,
- int nameStart,
- int nameEnd,
- char[][] superinterfaces,
- int[] superinterfaceStarts,
- int[] superinterfaceEnds,
- int bodyStart);
-/**
- * @param declarationStart - a source position corresponding to the first character
- * of this constructor declaration
- * @param javaDocPositions - answer back an array of sourceStart/sourceEnd
- * positions of the available JavaDoc comments. The array is a flattened
- * structure: 2*n entries with consecutives start and end positions.
- * If no JavaDoc is available, then null is answered instead of an empty array.
- * e.g. { 10, 20, 25, 45 } --> javadoc1 from 10 to 20, javadoc2 from 25 to 45
- * The array is equals to null if there are no javadoc comments
- * @param modifiers - the modifiers for this constructor converted to a flag
- * @param modifiersStart - a source position corresponding to the first character of the
- * textual modifiers
- * @param returnType - the name of the return type
- * @param returnTypeStart - a source position corresponding to the first character
- * of the return type
- * @param returnTypeEnd - a source position corresponding to the last character
- * of the return type
- * @param returnTypeDimensionCount - the array dimension count as supplied on the
- * return type (for example, 'public int[] foo() {}')
- * @param name - the name of this constructor
- * @param nameStart - a source position corresponding to the first character of the name
- * @param nameEnd - a source position corresponding to the last character of the name
- * @param parameterTypes - a list of parameter type names
- * @param parameterTypeStarts - a list of source positions corresponding to the
- * first character of each parameter type name
- * @param parameterTypeEnds - a list of source positions corresponding to the
- * last character of each parameter type name
- * @param parameterNames - a list of the names of the parameters
- * @param parametersEnd - a source position corresponding to the last character of the
- * parameter list
- * @param extendedReturnTypeDimensionCount - the array dimension count as supplied on the
- * end of the parameter list (for example, 'public int foo()[] {}')
- * @param extendedReturnTypeDimensionEnd - a source position corresponding to the last character
- * of the extended return type dimension. This position should be -1 in case there is no extended
- * dimension for the type.
- * @param exceptionTypes - a list of the exception types
- * @param exceptionTypeStarts - a list of source positions corresponding to the first
- * character of the respective exception types
- * @param exceptionTypeEnds - a list of source positions corresponding to the last
- * character of the respective exception types
- * @param bodyStart - a source position corresponding to the start of this
- * method's body
- */
-void enterMethod(
- int declarationStart,
- int[] javaDocPositions,
- int modifiers,
- int modifiersStart,
- char[] returnType,
- int returnTypeStart,
- int returnTypeEnd,
- int returnTypeDimensionCount,
- char[] name,
- int nameStart,
- int nameEnd,
- char[][] parameterTypes,
- int [] parameterTypeStarts,
- int [] parameterTypeEnds,
- char[][] parameterNames,
- int [] parameterNameStarts,
- int [] parameterNameEnds,
- int parametersEnd,
- int extendedReturnTypeDimensionCount,
- int extendedReturnTypeDimensionEnd,
- char[][] exceptionTypes,
- int [] exceptionTypeStarts,
- int [] exceptionTypeEnds,
- int bodyStart);
-/**
- * @param bodyEnd - a source position corresponding to the closing bracket of the class
- * @param declarationEnd - a source position corresponding to the end of the class
- * declaration. This can include whitespace and comments following the closing bracket.
- */
-void exitClass(
- int bodyEnd,
- int declarationEnd);
-/**
- * @param declarationEnd - a source position corresponding to the end of the compilation unit
- */
-void exitCompilationUnit(
- int declarationEnd);
-/**
- * @param bodyEnd - a source position corresponding to the closing bracket of the method
- * @param declarationEnd - a source position corresponding to the end of the method
- * declaration. This can include whitespace and comments following the closing bracket.
- */
-void exitConstructor(
- int bodyEnd,
- int declarationEnd);
-/**
- * @param bodyEnd - a source position corresponding to the end of the field.
- * @param declarationEnd - a source position corresponding to the end of the field.
- * This can include whitespace and comments following the semi-colon.
- */
-void exitField(
- int bodyEnd,
- int declarationEnd);
-/**
- * @param bodyEnd - a source position corresponding to the closing bracket of the interface
- * @param declarationEnd - a source position corresponding to the end of the interface
- * declaration. This can include whitespace and comments following the closing bracket.
- */
-void exitInterface(
- int bodyEnd,
- int declarationEnd);
-/**
- * @param bodyEnd - a source position corresponding to the closing bracket of the method
- * @param declarationEnd - a source position corresponding to the end of the method
- * declaration. This can include whitespace and comments following the closing bracket.
- */
-void exitMethod(
- int bodyEnd,
- int declarationEnd);
+
+public interface IDocumentElementRequestor {
+ /**
+ * @param declarationStart -
+ * a source position corresponding to the start of the package
+ * declaration
+ * @param declarationEnd -
+ * a source position corresponding to the end of the package
+ * declaration
+ * @param javaDocPositions -
+ * answer back an array of sourceStart/sourceEnd positions of the
+ * available JavaDoc comments. The array is a flattened
+ * structure: 2*n entries with consecutives start and end
+ * positions. If no JavaDoc is available, then null is answered
+ * instead of an empty array. e.g. { 10, 20, 25, 45 } -->
+ * javadoc1 from 10 to 20, javadoc2 from 25 to 45 The array is
+ * equals to null if there are no javadoc comments
+ * @param name -
+ * the name of the package
+ * @param nameStartPosition -
+ * a source position corresponding to the first character of the
+ * name
+ * @param onDemand -
+ * a boolean equals to true if the import is an import on demand
+ */
+ void acceptImport(int declarationStart, int declarationEnd,
+ int[] javaDocPositions, char[] name, int nameStartPosition,
+ boolean onDemand);
+
+ /**
+ * @param declarationStart -
+ * a source position corresponding to the start of the package
+ * declaration
+ * @param declarationEnd -
+ * a source position corresponding to the end of the package
+ * declaration
+ * @param javaDocPositions -
+ * answer back an array of sourceStart/sourceEnd positions of the
+ * available JavaDoc comments. The array is a flattened
+ * structure: 2*n entries with consecutives start and end
+ * positions. If no JavaDoc is available, then null is answered
+ * instead of an empty array. e.g. { 10, 20, 25, 45 } -->
+ * javadoc1 from 10 to 20, javadoc2 from 25 to 45 The array is
+ * equals to null if there are no javadoc comments
+ * @param modifiers -
+ * the modifiers for this initializer
+ * @param modifiersStart -
+ * a source position corresponding to the start of the textual
+ * modifiers, is < 0 if there are no textual modifiers
+ * @param bodyStart -
+ * the position of the '{'
+ * @param bodyEnd -
+ * the position of the '}'
+ */
+ void acceptInitializer(int declarationStart, int declarationEnd,
+ int[] javaDocPositions, int modifiers, int modifiersStart,
+ int bodyStart, int bodyEnd);
+
+ /*
+ * Table of line separator position. This table is passed once at the end of
+ * the parse action, so as to allow computation of normalized ranges.
+ *
+ * A line separator might corresponds to several characters in the source,
+ *
+ */
+ void acceptLineSeparatorPositions(int[] positions);
+
+ /**
+ * @param declarationStart -
+ * a source position corresponding to the start of the package
+ * declaration
+ * @param declarationEnd -
+ * a source position corresponding to the end of the package
+ * declaration
+ * @param javaDocPositions -
+ * answer back an array of sourceStart/sourceEnd positions of the
+ * available JavaDoc comments. The array is a flattened
+ * structure: 2*n entries with consecutives start and end
+ * positions. If no JavaDoc is available, then null is answered
+ * instead of an empty array. e.g. { 10, 20, 25, 45 } -->
+ * javadoc1 from 10 to 20, javadoc2 from 25 to 45 The array is
+ * equals to null if there are no javadoc comments
+ * @param name -
+ * the name of the package
+ * @param nameStartPosition -
+ * a source position corresponding to the first character of the
+ * name
+ */
+ void acceptPackage(int declarationStart, int declarationEnd,
+ int[] javaDocPositions, char[] name, int nameStartPosition);
+
+ /**
+ * @param problem -
+ * Used to report a problem while running the JDOM
+ */
+ void acceptProblem(IProblem problem);
+
+ /**
+ * @param declarationStart -
+ * a source position corresponding to the start of this class.
+ * @param javaDocPositions -
+ * answer back an array of sourceStart/sourceEnd positions of the
+ * available JavaDoc comments. The array is a flattened
+ * structure: 2*n entries with consecutives start and end
+ * positions. If no JavaDoc is available, then null is answered
+ * instead of an empty array. e.g. { 10, 20, 25, 45 } -->
+ * javadoc1 from 10 to 20, javadoc2 from 25 to 45 The array is
+ * equals to null if there are no javadoc comments
+ * @param modifiers -
+ * the modifiers for this class
+ * @param modifiersStart -
+ * a source position corresponding to the start of the textual
+ * modifiers, is < 0 if there are no textual modifiers
+ * @param classStart -
+ * a source position corresponding to the start of the keyword
+ * 'class'
+ * @param name -
+ * the name of the class
+ * @param nameStart -
+ * a source position corresponding to the start of the name
+ * @param nameEnd -
+ * a source position corresponding to the end of the name
+ * @param superclass -
+ * the name of the superclass
+ * @param superclassStart -
+ * a source position corresponding to the start of the superclass
+ * name
+ * @param superclassEnd -
+ * a source position corresponding to the end of the superclass
+ * name
+ * @param superinterfaces -
+ * the name of the superinterfaces
+ * @param superinterfaceStarts -
+ * an array of source positions corresponding to the start of
+ * their respective superinterface names
+ * @param superinterfaceEnds -
+ * an array of source positions corresponding to the end of their
+ * respective superinterface names
+ * @param bodyStart -
+ * a source position corresponding to the open bracket of the
+ * class body
+ */
+ void enterClass(int declarationStart, int[] javaDocPositions,
+ int modifiers, int modifiersStart, int classStart, char[] name,
+ int nameStart, int nameEnd, char[] superclass, int superclassStart,
+ int superclassEnd, char[][] superinterfaces,
+ int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart);
+
+ void enterCompilationUnit();
+
+ /**
+ * @param declarationStart -
+ * a source position corresponding to the first character of this
+ * constructor declaration
+ * @param javaDocPositions -
+ * answer back an array of sourceStart/sourceEnd positions of the
+ * available JavaDoc comments. The array is a flattened
+ * structure: 2*n entries with consecutives start and end
+ * positions. If no JavaDoc is available, then null is answered
+ * instead of an empty array. e.g. { 10, 20, 25, 45 } -->
+ * javadoc1 from 10 to 20, javadoc2 from 25 to 45 The array is
+ * equals to null if there are no javadoc comments
+ * @param modifiers -
+ * the modifiers for this constructor converted to a flag
+ * @param modifiersStart -
+ * a source position corresponding to the first character of the
+ * textual modifiers
+ * @param name -
+ * the name of this constructor
+ * @param nameStart -
+ * a source position corresponding to the first character of the
+ * name
+ * @param nameEnd -
+ * a source position corresponding to the last character of the
+ * name
+ * @param parameterTypes -
+ * a list of parameter type names
+ * @param parameterTypeStarts -
+ * a list of source positions corresponding to the first
+ * character of each parameter type name
+ * @param parameterTypeEnds -
+ * a list of source positions corresponding to the last character
+ * of each parameter type name
+ * @param parameterNames -
+ * a list of the names of the parameters
+ * @param parametersEnd -
+ * a source position corresponding to the last character of the
+ * parameter list
+ * @param exceptionTypes -
+ * a list of the exception types
+ * @param exceptionTypeStarts -
+ * a list of source positions corresponding to the first
+ * character of the respective exception types
+ * @param exceptionTypeEnds -
+ * a list of source positions corresponding to the last character
+ * of the respective exception types
+ * @param bodyStart -
+ * a source position corresponding to the start of this
+ * constructor's body
+ */
+ void enterConstructor(int declarationStart, int[] javaDocPositions,
+ int modifiers, int modifiersStart, char[] name, int nameStart,
+ int nameEnd, char[][] parameterTypes, int[] parameterTypeStarts,
+ int[] parameterTypeEnds, char[][] parameterNames,
+ int[] parameterNameStarts, int[] parameterNameEnds,
+ int parametersEnd, char[][] exceptionTypes,
+ int[] exceptionTypeStarts, int[] exceptionTypeEnds, int bodyStart);
+
+ /**
+ * @param declarationStart -
+ * a source position corresponding to the first character of this
+ * field
+ * @param javaDocPositions -
+ * answer back an array of sourceStart/sourceEnd positions of the
+ * available JavaDoc comments. The array is a flattened
+ * structure: 2*n entries with consecutives start and end
+ * positions. If no JavaDoc is available, then null is answered
+ * instead of an empty array. e.g. { 10, 20, 25, 45 } -->
+ * javadoc1 from 10 to 20, javadoc2 from 25 to 45 The array is
+ * equals to null if there are no javadoc comments
+ * @param modifiers -
+ * the modifiers for this field converted to a flag
+ * @param modifiersStart -
+ * a source position corresponding to the first character of the
+ * textual modifiers
+ * @param type -
+ * the name of the field type
+ * @param typeStart -
+ * a source position corresponding to the start of the fields
+ * type
+ * @param typeEnd -
+ * a source position corresponding to the end of the fields type
+ * @param typeDimensionCount -
+ * the array dimension indicated on the type (for example, 'int[]
+ * v')
+ * @param name -
+ * the name of this constructor
+ * @param nameStart -
+ * a source position corresponding to the first character of the
+ * name
+ * @param nameEnd -
+ * a source position corresponding to the last character of the
+ * name
+ * @param extendedTypeDimensionCount -
+ * the array dimension indicated on the variable, (for example,
+ * 'int v[]')
+ * @param extendedTypeDimnesionEnd -
+ * a source position corresponding to the end of the extened type
+ * dimension. This position should be -1 in case there is no
+ * extended dimension for the type.
+ */
+ void enterField(int declarationStart, int[] javaDocPositions,
+ int modifiers, int modifiersStart, char[] type, int typeStart,
+ int typeEnd, int typeDimensionCount, char[] name, int nameStart,
+ int nameEnd, int extendedTypeDimensionCount,
+ int extendedTypeDimensionEnd);
+
+ /**
+ * @param declarationStart -
+ * a source position corresponding to the start of this class.
+ * @param javaDocPositions -
+ * answer back an array of sourceStart/sourceEnd positions of the
+ * available JavaDoc comments. The array is a flattened
+ * structure: 2*n entries with consecutives start and end
+ * positions. If no JavaDoc is available, then null is answered
+ * instead of an empty array. e.g. { 10, 20, 25, 45 } -->
+ * javadoc1 from 10 to 20, javadoc2 from 25 to 45 The array is
+ * equals to null if there are no javadoc comments
+ * @param modifiers -
+ * the modifiers for this class
+ * @param modifiersStart -
+ * a source position corresponding to the start of the textual
+ * modifiers, is < 0 if there are no textual modifiers
+ * @param interfaceStart -
+ * a source position corresponding to the start of the keyword
+ * 'interface'
+ * @param name -
+ * the name of the class
+ * @param nameStart -
+ * a source position corresponding to the start of the name
+ * @param nameEnd -
+ * a source position corresponding to the end of the name
+ * @param superinterfaces -
+ * the name of the superinterfaces
+ * @param superinterfaceStarts -
+ * an array of source positions corresponding to the start of
+ * their respective superinterface names
+ * @param superinterfaceEnds -
+ * an array of source positions corresponding to the end of their
+ * respective superinterface names
+ * @param bodyStart -
+ * a source position corresponding to the open bracket of the
+ * class body
+ */
+ void enterInterface(int declarationStart, int[] javaDocPositions,
+ int modifiers, int modifiersStart, int interfaceStart, char[] name,
+ int nameStart, int nameEnd, char[][] superinterfaces,
+ int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart);
+
+ /**
+ * @param declarationStart -
+ * a source position corresponding to the first character of this
+ * constructor declaration
+ * @param javaDocPositions -
+ * answer back an array of sourceStart/sourceEnd positions of the
+ * available JavaDoc comments. The array is a flattened
+ * structure: 2*n entries with consecutives start and end
+ * positions. If no JavaDoc is available, then null is answered
+ * instead of an empty array. e.g. { 10, 20, 25, 45 } -->
+ * javadoc1 from 10 to 20, javadoc2 from 25 to 45 The array is
+ * equals to null if there are no javadoc comments
+ * @param modifiers -
+ * the modifiers for this constructor converted to a flag
+ * @param modifiersStart -
+ * a source position corresponding to the first character of the
+ * textual modifiers
+ * @param returnType -
+ * the name of the return type
+ * @param returnTypeStart -
+ * a source position corresponding to the first character of the
+ * return type
+ * @param returnTypeEnd -
+ * a source position corresponding to the last character of the
+ * return type
+ * @param returnTypeDimensionCount -
+ * the array dimension count as supplied on the return type (for
+ * example, 'public int[] foo() {}')
+ * @param name -
+ * the name of this constructor
+ * @param nameStart -
+ * a source position corresponding to the first character of the
+ * name
+ * @param nameEnd -
+ * a source position corresponding to the last character of the
+ * name
+ * @param parameterTypes -
+ * a list of parameter type names
+ * @param parameterTypeStarts -
+ * a list of source positions corresponding to the first
+ * character of each parameter type name
+ * @param parameterTypeEnds -
+ * a list of source positions corresponding to the last character
+ * of each parameter type name
+ * @param parameterNames -
+ * a list of the names of the parameters
+ * @param parametersEnd -
+ * a source position corresponding to the last character of the
+ * parameter list
+ * @param extendedReturnTypeDimensionCount -
+ * the array dimension count as supplied on the end of the
+ * parameter list (for example, 'public int foo()[] {}')
+ * @param extendedReturnTypeDimensionEnd -
+ * a source position corresponding to the last character of the
+ * extended return type dimension. This position should be -1 in
+ * case there is no extended dimension for the type.
+ * @param exceptionTypes -
+ * a list of the exception types
+ * @param exceptionTypeStarts -
+ * a list of source positions corresponding to the first
+ * character of the respective exception types
+ * @param exceptionTypeEnds -
+ * a list of source positions corresponding to the last character
+ * of the respective exception types
+ * @param bodyStart -
+ * a source position corresponding to the start of this method's
+ * body
+ */
+ void enterMethod(int declarationStart, int[] javaDocPositions,
+ int modifiers, int modifiersStart, char[] returnType,
+ int returnTypeStart, int returnTypeEnd,
+ int returnTypeDimensionCount, char[] name, int nameStart,
+ int nameEnd, char[][] parameterTypes, int[] parameterTypeStarts,
+ int[] parameterTypeEnds, char[][] parameterNames,
+ int[] parameterNameStarts, int[] parameterNameEnds,
+ int parametersEnd, int extendedReturnTypeDimensionCount,
+ int extendedReturnTypeDimensionEnd, char[][] exceptionTypes,
+ int[] exceptionTypeStarts, int[] exceptionTypeEnds, int bodyStart);
+
+ /**
+ * @param bodyEnd -
+ * a source position corresponding to the closing bracket of the
+ * class
+ * @param declarationEnd -
+ * a source position corresponding to the end of the class
+ * declaration. This can include whitespace and comments
+ * following the closing bracket.
+ */
+ void exitClass(int bodyEnd, int declarationEnd);
+
+ /**
+ * @param declarationEnd -
+ * a source position corresponding to the end of the compilation
+ * unit
+ */
+ void exitCompilationUnit(int declarationEnd);
+
+ /**
+ * @param bodyEnd -
+ * a source position corresponding to the closing bracket of the
+ * method
+ * @param declarationEnd -
+ * a source position corresponding to the end of the method
+ * declaration. This can include whitespace and comments
+ * following the closing bracket.
+ */
+ void exitConstructor(int bodyEnd, int declarationEnd);
+
+ /**
+ * @param bodyEnd -
+ * a source position corresponding to the end of the field.
+ * @param declarationEnd -
+ * a source position corresponding to the end of the field. This
+ * can include whitespace and comments following the semi-colon.
+ */
+ void exitField(int bodyEnd, int declarationEnd);
+
+ /**
+ * @param bodyEnd -
+ * a source position corresponding to the closing bracket of the
+ * interface
+ * @param declarationEnd -
+ * a source position corresponding to the end of the interface
+ * declaration. This can include whitespace and comments
+ * following the closing bracket.
+ */
+ void exitInterface(int bodyEnd, int declarationEnd);
+
+ /**
+ * @param bodyEnd -
+ * a source position corresponding to the closing bracket of the
+ * method
+ * @param declarationEnd -
+ * a source position corresponding to the end of the method
+ * declaration. This can include whitespace and comments
+ * following the closing bracket.
+ */
+ void exitMethod(int bodyEnd, int declarationEnd);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IErrorHandlingPolicy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IErrorHandlingPolicy.java
index 48d74b8..6e39789 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IErrorHandlingPolicy.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IErrorHandlingPolicy.java
@@ -11,18 +11,17 @@
package net.sourceforge.phpdt.internal.compiler;
/*
- * Handler policy is responsible to answer the 2 following
- * questions:
- * 1. should the handler stop on first problem which appears
- * to be a real error (that is, not a warning),
- * 2. should it proceed once it has gathered all problems
- *
- * The intent is that one can supply its own policy to implement
- * some interactive error handling strategy where some UI would
- * display problems and ask user if he wants to proceed or not.
+ * Handler policy is responsible to answer the 2 following questions: 1. should
+ * the handler stop on first problem which appears to be a real error (that is,
+ * not a warning), 2. should it proceed once it has gathered all problems
+ *
+ * The intent is that one can supply its own policy to implement some
+ * interactive error handling strategy where some UI would display problems and
+ * ask user if he wants to proceed or not.
*/
public interface IErrorHandlingPolicy {
boolean proceedOnErrors();
+
boolean stopOnFirstError();
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IProblemFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IProblemFactory.java
index bc424f7..e6d3a69 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IProblemFactory.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/IProblemFactory.java
@@ -14,30 +14,26 @@ import java.util.Locale;
import net.sourceforge.phpdt.core.compiler.IProblem;
-
-
/*
- * Factory used from inside the compiler to build the actual problems
- * which are handed back in the compilation result.
- *
+ * Factory used from inside the compiler to build the actual problems which are
+ * handed back in the compilation result.
+ *
* This allows sharing the internal problem representation with the environment.
- *
- * Note: The factory is responsible for computing and storing a localized error message.
+ *
+ * Note: The factory is responsible for computing and storing a localized error
+ * message.
*/
public interface IProblemFactory {
- IProblem createProblem(
- char[] originatingFileName,
- int problemId,
- String[] problemArguments,
- String[] messageArguments, // shorter versions of the problemArguments
- int severity,
- int startPosition,
- int endPosition,
- int lineNumber);
-
+ IProblem createProblem(char[] originatingFileName, int problemId,
+ String[] problemArguments, String[] messageArguments, // shorter
+ // versions
+ // of the
+ // problemArguments
+ int severity, int startPosition, int endPosition, int lineNumber);
+
Locale getLocale();
-
+
String getLocalizedMessage(int problemId, String[] messageArguments);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ISourceElementRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ISourceElementRequestor.java
index 58c2541..2d1e256 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ISourceElementRequestor.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ISourceElementRequestor.java
@@ -13,115 +13,116 @@ package net.sourceforge.phpdt.internal.compiler;
import net.sourceforge.phpdt.core.compiler.IProblem;
/*
- * Part of the source element parser responsible for building the output.
- * It gets notified of structural information as they are detected, relying
- * on the requestor to assemble them together, based on the notifications it got.
- *
- * The structural investigation includes:
- * - package statement
- * - import statements
- * - top-level types: package member, member types (member types of member types...)
- * - fields
- * - methods
- *
+ * Part of the source element parser responsible for building the output. It
+ * gets notified of structural information as they are detected, relying on the
+ * requestor to assemble them together, based on the notifications it got.
+ *
+ * The structural investigation includes: - package statement - import
+ * statements - top-level types: package member, member types (member types of
+ * member types...) - fields - methods
+ *
* If reference information is requested, then all source constructs are
* investigated and type, field & method references are provided as well.
- *
+ *
* Any (parsing) problem encountered is also provided.
- *
+ *
* All positions are relative to the exact source fed to the parser.
- *
- * Elements which are complex are notified in two steps:
- * - enter : once the element header has been identified
- * - exit : once the element has been fully consumed
- *
- * other simpler elements (package, import) are read all at once:
- * - accept
+ *
+ * Elements which are complex are notified in two steps: - enter :
+ * once the element header has been identified - exit : once the
+ * element has been fully consumed
+ *
+ * other simpler elements (package, import) are read all at once: - accept
*/
public interface ISourceElementRequestor {
- void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition);
- //void acceptFieldReference(char[] fieldName, int sourcePosition);
- /**
- * @param declarationStart This is the position of the first character of the
- * import keyword.
- * @param declarationEnd This is the position of the ';' ending the import statement
- * or the end of the comment following the import.
- * @param name This is the name of the import like specified in the source including the dots. The '.*'
- * is never included in the name.
- * @param onDemand set to true if the import is an import on demand (e.g. import java.io.*). False otherwise.
- */
- void acceptImport(
- int declarationStart,
- int declarationEnd,
- char[] name,
- boolean onDemand);
- /*
- * Table of line separator position. This table is passed once at the end
- * of the parse action, so as to allow computation of normalized ranges.
- *
- * A line separator might corresponds to several characters in the source,
- *
- */
- void acceptLineSeparatorPositions(int[] positions);
- void acceptMethodReference(char[] methodName, int argCount, int sourcePosition);
- //void acceptPackage(
- // int declarationStart,
- // int declarationEnd,
- // char[] name);
- void acceptProblem(IProblem problem);
- void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd);
- void acceptTypeReference(char[] typeName, int sourcePosition);
- void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd);
- void acceptUnknownReference(char[] name, int sourcePosition);
- void enterClass(
- int declarationStart,
- int modifiers,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[] superclass,
- char[][] superinterfaces);
- void enterCompilationUnit();
- void enterConstructor(
- int declarationStart,
- int modifiers,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[][] parameterTypes,
- char[][] parameterNames,
- char[][] exceptionTypes);
- void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameSourceStart, int nameSourceEnd);
- //void enterInitializer(
- // int declarationStart,
- // int modifiers);
- void enterInterface(
- int declarationStart,
- int modifiers,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[][] superinterfaces);
- void enterMethod(
- int declarationStart,
- int modifiers,
- char[] returnType,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[][] parameterTypes,
- char[][] parameterNames,
- char[][] exceptionTypes);
- void exitClass(int declarationEnd);
- void exitCompilationUnit(int declarationEnd);
- void exitConstructor(int declarationEnd);
- /*
- * initializationStart denotes the source start of the expression used for initializing
- * the field if any (-1 if no initialization).
- */
- void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd);
- void exitInitializer(int declarationEnd);
- void exitInterface(int declarationEnd);
- void exitMethod(int declarationEnd);
+ void acceptConstructorReference(char[] typeName, int argCount,
+ int sourcePosition);
+
+ // void acceptFieldReference(char[] fieldName, int sourcePosition);
+ /**
+ * @param declarationStart
+ * This is the position of the first character of the import
+ * keyword.
+ * @param declarationEnd
+ * This is the position of the ';' ending the import statement or
+ * the end of the comment following the import.
+ * @param name
+ * This is the name of the import like specified in the source
+ * including the dots. The '.*' is never included in the name.
+ * @param onDemand
+ * set to true if the import is an import on demand (e.g. import
+ * java.io.*). False otherwise.
+ */
+ void acceptImport(int declarationStart, int declarationEnd, char[] name,
+ boolean onDemand);
+
+ /*
+ * Table of line separator position. This table is passed once at the end of
+ * the parse action, so as to allow computation of normalized ranges.
+ *
+ * A line separator might corresponds to several characters in the source,
+ *
+ */
+ void acceptLineSeparatorPositions(int[] positions);
+
+ void acceptMethodReference(char[] methodName, int argCount,
+ int sourcePosition);
+
+ // void acceptPackage(
+ // int declarationStart,
+ // int declarationEnd,
+ // char[] name);
+ void acceptProblem(IProblem problem);
+
+ void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd);
+
+ void acceptTypeReference(char[] typeName, int sourcePosition);
+
+ void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd);
+
+ void acceptUnknownReference(char[] name, int sourcePosition);
+
+ void enterClass(int declarationStart, int modifiers, char[] name,
+ int nameSourceStart, int nameSourceEnd, char[] superclass,
+ char[][] superinterfaces);
+
+ void enterCompilationUnit();
+
+ void enterConstructor(int declarationStart, int modifiers, char[] name,
+ int nameSourceStart, int nameSourceEnd, char[][] parameterTypes,
+ char[][] parameterNames, char[][] exceptionTypes);
+
+ void enterField(int declarationStart, int modifiers, char[] type,
+ char[] name, int nameSourceStart, int nameSourceEnd);
+
+ // void enterInitializer(
+ // int declarationStart,
+ // int modifiers);
+ void enterInterface(int declarationStart, int modifiers, char[] name,
+ int nameSourceStart, int nameSourceEnd, char[][] superinterfaces);
+
+ void enterMethod(int declarationStart, int modifiers, char[] returnType,
+ char[] name, int nameSourceStart, int nameSourceEnd,
+ char[][] parameterTypes, char[][] parameterNames,
+ char[][] exceptionTypes);
+
+ void exitClass(int declarationEnd);
+
+ void exitCompilationUnit(int declarationEnd);
+
+ void exitConstructor(int declarationEnd);
+
+ /*
+ * initializationStart denotes the source start of the expression used for
+ * initializing the field if any (-1 if no initialization).
+ */
+ void exitField(int initializationStart, int declarationEnd,
+ int declarationSourceEnd);
+
+ void exitInitializer(int declarationEnd);
+
+ void exitInterface(int declarationEnd);
+
+ void exitMethod(int declarationEnd);
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java
index b7dda3f..c120843 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/SourceElementParser.java
@@ -39,1297 +39,1404 @@ import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.core.util.CommentRecorderParser;
/**
- * A source element parser extracts structural and reference information
- * from a piece of source.
- *
- * also see @ISourceElementRequestor
- *
- * The structural investigation includes:
- * - the package statement
- * - import statements
- * - top-level types: package member, member types (member types of member types...)
- * - fields
- * - methods
- *
+ * A source element parser extracts structural and reference information from a
+ * piece of source.
+ *
+ * also see
+ *
+ * @ISourceElementRequestor
+ *
+ * The structural investigation includes: - the package statement - import
+ * statements - top-level types: package member, member types (member types of
+ * member types...) - fields - methods
+ *
* If reference information is requested, then all source constructs are
* investigated and type, field & method references are provided as well.
- *
+ *
* Any (parsing) problem encountered is also provided.
*/
-public class SourceElementParser extends CommentRecorderParser {//extends
- // UnitParser {
+public class SourceElementParser extends CommentRecorderParser {// extends
+ // UnitParser {
+
+ ISourceElementRequestor requestor;
+
+ int fieldCount;
+
+ int localIntPtr;
+
+ int lastFieldEndPosition;
+
+ ISourceType sourceType;
+
+ boolean reportReferenceInfo;
+
+ char[][] typeNames;
+
+ char[][] superTypeNames;
+
+ int nestedTypeIndex;
+
+ static final char[] JAVA_LANG_OBJECT = "java.lang.Object".toCharArray(); //$NON-NLS-1$
+
+ NameReference[] unknownRefs;
+
+ int unknownRefsCounter;
+
+ LocalDeclarationVisitor localDeclarationVisitor = null;
+
+ // CompilerOptions options;
+
+ /**
+ * An ast visitor that visits local type declarations.
+ */
+ public class LocalDeclarationVisitor extends ASTVisitor {
+ public boolean visit(TypeDeclaration typeDeclaration, BlockScope scope) {
+ notifySourceElementRequestor(typeDeclaration, sourceType == null);
+ return false; // don't visit members as this was done during
+ // notifySourceElementRequestor(...)
+ }
+
+ public boolean visit(TypeDeclaration typeDeclaration, ClassScope scope) {
+ notifySourceElementRequestor(typeDeclaration, sourceType == null);
+ return false; // don't visit members as this was done during
+ // notifySourceElementRequestor(...)
+ }
+
+ }
+
+ public SourceElementParser(final ISourceElementRequestor requestor,
+ IProblemFactory problemFactory, CompilerOptions options) {
+ // we want to notify all syntax error with the acceptProblem API
+ // To do so, we define the record method of the ProblemReporter
+ super(new ProblemReporter(DefaultErrorHandlingPolicies
+ .exitAfterAllProblems(), options, problemFactory) {
+ public void record(IProblem problem, CompilationResult unitResult,
+ ReferenceContext referenceContext) {
+ unitResult.record(problem, referenceContext);
+ if (requestor != null) {
+ requestor.acceptProblem(problem);
+ }
+ }
+ });
+ // true);
+ // options.sourceLevel >= CompilerOptions.JDK1_4);
+ this.requestor = requestor;
+ typeNames = new char[4][];
+ superTypeNames = new char[4][];
+ nestedTypeIndex = 0;
+ this.options = options;
+ }
+
+ /**
+ * @deprecated use SourceElementParser(ISourceElementRequestor,
+ * IProblemFactory, CompilerOptions)
+ */
+ public SourceElementParser(final ISourceElementRequestor requestor,
+ IProblemFactory problemFactory) {
+ this(requestor, problemFactory, new CompilerOptions());
+ }
+
+ public SourceElementParser(final ISourceElementRequestor requestor,
+ IProblemFactory problemFactory, CompilerOptions options,
+ boolean reportLocalDeclarations) {
+ this(requestor, problemFactory, options);
+ if (reportLocalDeclarations) {
+ this.localDeclarationVisitor = new LocalDeclarationVisitor();
+ }
+ }
+
+ // public void checkAnnotation() {
+ // int firstCommentIndex = scanner.commentPtr;
+ //
+ // super.checkAnnotation();
+ //
+ // // modify the modifier source start to point at the first comment
+ // if (firstCommentIndex >= 0) {
+ // modifiersSourceStart = scanner.commentStarts[0];
+ // }
+ // }
+ // protected void classInstanceCreation(boolean alwaysQualified) {
+ //
+ // boolean previousFlag = reportReferenceInfo;
+ // reportReferenceInfo = false; // not to see the type reference reported in
+ // super call to getTypeReference(...)
+ // super.classInstanceCreation(alwaysQualified);
+ // reportReferenceInfo = previousFlag;
+ // if (reportReferenceInfo){
+ // AllocationExpression alloc =
+ // (AllocationExpression)expressionStack[expressionPtr];
+ // TypeReference typeRef = alloc.type;
+ // requestor.acceptConstructorReference(
+ // typeRef instanceof SingleTypeReference
+ // ? ((SingleTypeReference) typeRef).token
+ // : CharOperation.concatWith(alloc.type.getTypeName(), '.'),
+ // alloc.arguments == null ? 0 : alloc.arguments.length,
+ // alloc.sourceStart);
+ // }
+ // }
+ // protected void consumeConstructorHeaderName() {
+ // // ConstructorHeaderName ::= Modifiersopt 'Identifier' '('
+ //
+ // /* recovering - might be an empty message send */
+ // if (currentElement != null){
+ // if (lastIgnoredToken == TokenNamenew){ // was an allocation expression
+ // lastCheckPoint = scanner.startPosition; // force to restart at this exact
+ // position
+ // restartRecovery = true;
+ // return;
+ // }
+ // }
+ // SourceConstructorDeclaration cd = new
+ // SourceConstructorDeclaration(this.compilationUnit.compilationResult);
+ //
+ // //name -- this is not really revelant but we do .....
+ // cd.selector = identifierStack[identifierPtr];
+ // long selectorSourcePositions = identifierPositionStack[identifierPtr--];
+ // identifierLengthPtr--;
+ //
+ // //modifiers
+ // cd.declarationSourceStart = intStack[intPtr--];
+ // cd.modifiers = intStack[intPtr--];
+ //
+ // //highlight starts at the selector starts
+ // cd.sourceStart = (int) (selectorSourcePositions >>> 32);
+ // cd.selectorSourceEnd = (int) selectorSourcePositions;
+ // pushOnAstStack(cd);
+ //
+ // cd.sourceEnd = lParenPos;
+ // cd.bodyStart = lParenPos+1;
+ // listLength = 0; // initialize listLength before reading parameters/throws
+ //
+ // // recovery
+ // if (currentElement != null){
+ // lastCheckPoint = cd.bodyStart;
+ // if ((currentElement instanceof RecoveredType && lastIgnoredToken !=
+ // TokenNameDOT)
+ // || cd.modifiers != 0){
+ // currentElement = currentElement.add(cd, 0);
+ // lastIgnoredToken = -1;
+ // }
+ // }
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeExitVariableWithInitialization() {
+ // // ExitVariableWithInitialization ::= $empty
+ // // the scanner is located after the comma or the semi-colon.
+ // // we want to include the comma or the semi-colon
+ // super.consumeExitVariableWithInitialization();
+ // if (isLocalDeclaration() || ((currentToken != TokenNameCOMMA) &&
+ // (currentToken != TokenNameSEMICOLON)))
+ // return;
+ // ((SourceFieldDeclaration) astStack[astPtr]).fieldEndPosition =
+ // scanner.currentPosition - 1;
+ // }
+ // protected void consumeExitVariableWithoutInitialization() {
+ // // ExitVariableWithoutInitialization ::= $empty
+ // // do nothing by default
+ // super.consumeExitVariableWithoutInitialization();
+ // if (isLocalDeclaration() || ((currentToken != TokenNameCOMMA) &&
+ // (currentToken != TokenNameSEMICOLON)))
+ // return;
+ // ((SourceFieldDeclaration) astStack[astPtr]).fieldEndPosition =
+ // scanner.currentPosition - 1;
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeFieldAccess(boolean isSuperAccess) {
+ // // FieldAccess ::= Primary '.' 'Identifier'
+ // // FieldAccess ::= 'super' '.' 'Identifier'
+ // super.consumeFieldAccess(isSuperAccess);
+ // FieldReference fr = (FieldReference) expressionStack[expressionPtr];
+ // if (reportReferenceInfo) {
+ // requestor.acceptFieldReference(fr.token, fr.sourceStart);
+ // }
+ // }
+ // protected void consumeMethodHeaderName() {
+ // // MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
+ // SourceMethodDeclaration md = new
+ // SourceMethodDeclaration(this.compilationUnit.compilationResult);
+ //
+ // //name
+ // md.selector = identifierStack[identifierPtr];
+ // long selectorSourcePositions = identifierPositionStack[identifierPtr--];
+ // identifierLengthPtr--;
+ // //type
+ // md.returnType = getTypeReference(intStack[intPtr--]);
+ // //modifiers
+ // md.declarationSourceStart = intStack[intPtr--];
+ // md.modifiers = intStack[intPtr--];
+ //
+ // //highlight starts at selector start
+ // md.sourceStart = (int) (selectorSourcePositions >>> 32);
+ // md.selectorSourceEnd = (int) selectorSourcePositions;
+ // pushOnAstStack(md);
+ // md.sourceEnd = lParenPos;
+ // md.bodyStart = lParenPos+1;
+ // listLength = 0; // initialize listLength before reading parameters/throws
+ //
+ // // recovery
+ // if (currentElement != null){
+ // if (currentElement instanceof RecoveredType
+ // //|| md.modifiers != 0
+ // || (scanner.getLineNumber(md.returnType.sourceStart)
+ // == scanner.getLineNumber(md.sourceStart))){
+ // lastCheckPoint = md.bodyStart;
+ // currentElement = currentElement.add(md, 0);
+ // lastIgnoredToken = -1;
+ // } else {
+ // lastCheckPoint = md.sourceStart;
+ // restartRecovery = true;
+ // }
+ // }
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeMethodInvocationName() {
+ // // MethodInvocation ::= Name '(' ArgumentListopt ')'
+ //
+ // // when the name is only an identifier...we have a message send to "this"
+ // (implicit)
+ // super.consumeMethodInvocationName();
+ // MessageSend messageSend = (MessageSend) expressionStack[expressionPtr];
+ // Expression[] args = messageSend.arguments;
+ // if (reportReferenceInfo) {
+ // requestor.acceptMethodReference(
+ // messageSend.selector,
+ // args == null ? 0 : args.length,
+ // (int)(messageSend.nameSourcePosition >>> 32));
+ // }
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeMethodInvocationPrimary() {
+ // super.consumeMethodInvocationPrimary();
+ // MessageSend messageSend = (MessageSend) expressionStack[expressionPtr];
+ // Expression[] args = messageSend.arguments;
+ // if (reportReferenceInfo) {
+ // requestor.acceptMethodReference(
+ // messageSend.selector,
+ // args == null ? 0 : args.length,
+ // (int)(messageSend.nameSourcePosition >>> 32));
+ // }
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // protected void consumeMethodInvocationSuper() {
+ // // MethodInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')'
+ // super.consumeMethodInvocationSuper();
+ // MessageSend messageSend = (MessageSend) expressionStack[expressionPtr];
+ // Expression[] args = messageSend.arguments;
+ // if (reportReferenceInfo) {
+ // requestor.acceptMethodReference(
+ // messageSend.selector,
+ // args == null ? 0 : args.length,
+ // (int)(messageSend.nameSourcePosition >>> 32));
+ // }
+ // }
+ // protected void consumeSingleTypeImportDeclarationName() {
+ // // SingleTypeImportDeclarationName ::= 'import' Name
+ // /* push an ImportRef build from the last name
+ // stored in the identifier stack. */
+ //
+ // super.consumeSingleTypeImportDeclarationName();
+ // ImportReference impt = (ImportReference)astStack[astPtr];
+ // if (reportReferenceInfo) {
+ // requestor.acceptTypeReference(impt.tokens, impt.sourceStart,
+ // impt.sourceEnd);
+ // }
+ // }
+ // protected void consumeTypeImportOnDemandDeclarationName() {
+ // // TypeImportOnDemandDeclarationName ::= 'import' Name '.' '*'
+ // /* push an ImportRef build from the last name
+ // stored in the identifier stack. */
+ //
+ // super.consumeTypeImportOnDemandDeclarationName();
+ // ImportReference impt = (ImportReference)astStack[astPtr];
+ // if (reportReferenceInfo) {
+ // requestor.acceptUnknownReference(impt.tokens, impt.sourceStart,
+ // impt.sourceEnd);
+ // }
+ // }
+ // protected FieldDeclaration createFieldDeclaration(Expression
+ // initialization, char[] name, int sourceStart, int sourceEnd) {
+ // return new SourceFieldDeclaration(null, name, sourceStart, sourceEnd);
+ // }
+ // protected CompilationUnitDeclaration endParse(int act) {
+ // if (sourceType != null) {
+ // if (sourceType.isInterface()) {
+ // consumeInterfaceDeclaration();
+ // } else {
+ // consumeClassDeclaration();
+ // }
+ // }
+ // if (compilationUnit != null) {
+ // CompilationUnitDeclaration result = super.endParse(act);
+ // return result;
+ // } else {
+ // return null;
+ // }
+ // }
+ /*
+ * Flush annotations defined prior to a given positions.
+ *
+ * Note: annotations are stacked in syntactical order
+ *
+ * Either answer given , or the end position of a comment line
+ * immediately following the (same line)
+ *
+ * e.g. void foo(){ } // end of method foo
+ */
+ //
+ // public int flushAnnotationsDefinedPriorTo(int position) {
+ //
+ // return lastFieldEndPosition =
+ // super.flushAnnotationsDefinedPriorTo(position);
+ // }
+ // public TypeReference getTypeReference(int dim) {
+ // /* build a Reference on a variable that may be qualified or not
+ // * This variable is a type reference and dim will be its dimensions
+ // */
+ // int length;
+ // if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
+ // // single variable reference
+ // if (dim == 0) {
+ // SingleTypeReference ref =
+ // new SingleTypeReference(
+ // identifierStack[identifierPtr],
+ // identifierPositionStack[identifierPtr--]);
+ // if (reportReferenceInfo) {
+ // requestor.acceptTypeReference(ref.token, ref.sourceStart);
+ // }
+ // return ref;
+ // } else {
+ // ArrayTypeReference ref =
+ // new ArrayTypeReference(
+ // identifierStack[identifierPtr],
+ // dim,
+ // identifierPositionStack[identifierPtr--]);
+ // ref.sourceEnd = endPosition;
+ // if (reportReferenceInfo) {
+ // requestor.acceptTypeReference(ref.token, ref.sourceStart);
+ // }
+ // return ref;
+ // }
+ // } else {
+ // if (length < 0) { //flag for precompiled type reference on base types
+ // TypeReference ref = TypeReference.baseTypeReference(-length, dim);
+ // ref.sourceStart = intStack[intPtr--];
+ // if (dim == 0) {
+ // ref.sourceEnd = intStack[intPtr--];
+ // } else {
+ // intPtr--; // no need to use this position as it is an array
+ // ref.sourceEnd = endPosition;
+ // }
+ // if (reportReferenceInfo){
+ // requestor.acceptTypeReference(ref.getTypeName(), ref.sourceStart,
+ // ref.sourceEnd);
+ // }
+ // return ref;
+ // } else { //Qualified variable reference
+ // char[][] tokens = new char[length][];
+ // identifierPtr -= length;
+ // long[] positions = new long[length];
+ // System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
+ // System.arraycopy(
+ // identifierPositionStack,
+ // identifierPtr + 1,
+ // positions,
+ // 0,
+ // length);
+ // if (dim == 0) {
+ // QualifiedTypeReference ref = new QualifiedTypeReference(tokens,
+ // positions);
+ // if (reportReferenceInfo) {
+ // requestor.acceptTypeReference(ref.tokens, ref.sourceStart,
+ // ref.sourceEnd);
+ // }
+ // return ref;
+ // } else {
+ // ArrayQualifiedTypeReference ref =
+ // new ArrayQualifiedTypeReference(tokens, dim, positions);
+ // ref.sourceEnd = endPosition;
+ // if (reportReferenceInfo) {
+ // requestor.acceptTypeReference(ref.tokens, ref.sourceStart,
+ // ref.sourceEnd);
+ // }
+ // return ref;
+ // }
+ // }
+ // }
+ // }
+ // public NameReference getUnspecifiedReference() {
+ // /* build a (unspecified) NameReference which may be qualified*/
+ //
+ // int length;
+ // if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
+ // // single variable reference
+ // SingleNameReference ref =
+ // new SingleNameReference(
+ // identifierStack[identifierPtr],
+ // identifierPositionStack[identifierPtr--]);
+ // if (reportReferenceInfo) {
+ // this.addUnknownRef(ref);
+ // }
+ // return ref;
+ // } else {
+ // //Qualified variable reference
+ // char[][] tokens = new char[length][];
+ // identifierPtr -= length;
+ // System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
+ // QualifiedNameReference ref =
+ // new QualifiedNameReference(
+ // tokens,
+ // (int) (identifierPositionStack[identifierPtr + 1] >> 32), // sourceStart
+ // (int) identifierPositionStack[identifierPtr + length]); // sourceEnd
+ // if (reportReferenceInfo) {
+ // this.addUnknownRef(ref);
+ // }
+ // return ref;
+ // }
+ // }
+ // public NameReference getUnspecifiedReferenceOptimized() {
+ // /* build a (unspecified) NameReference which may be qualified
+ // The optimization occurs for qualified reference while we are
+ // certain in this case the last item of the qualified name is
+ // a field access. This optimization is IMPORTANT while it results
+ // that when a NameReference is build, the type checker should always
+ // look for that it is not a type reference */
+ //
+ // int length;
+ // if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
+ // // single variable reference
+ // SingleNameReference ref =
+ // new SingleNameReference(
+ // identifierStack[identifierPtr],
+ // identifierPositionStack[identifierPtr--]);
+ // ref.bits &= ~ASTNode.RestrictiveFlagMASK;
+ // ref.bits |= LOCAL | FIELD;
+ // if (reportReferenceInfo) {
+ // this.addUnknownRef(ref);
+ // }
+ // return ref;
+ // }
+ //
+ // //Qualified-variable-reference
+ // //In fact it is variable-reference DOT field-ref , but it would result in
+ // a
+ // type
+ // //conflict tha can be only reduce by making a superclass (or inetrface )
+ // between
+ // //nameReference and FiledReference or putting FieldReference under
+ // NameReference
+ // //or else..........This optimisation is not really relevant so just leave
+ // as it is
+ //
+ // char[][] tokens = new char[length][];
+ // identifierPtr -= length;
+ // System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
+ // QualifiedNameReference ref =
+ // new QualifiedNameReference(
+ // tokens,
+ // (int) (identifierPositionStack[identifierPtr + 1] >> 32),
+ // // sourceStart
+ // (int) identifierPositionStack[identifierPtr + length]); // sourceEnd
+ // ref.bits &= ~ASTNode.RestrictiveFlagMASK;
+ // ref.bits |= LOCAL | FIELD;
+ // if (reportReferenceInfo) {
+ // this.addUnknownRef(ref);
+ // }
+ // return ref;
+ // }
+ // /**
+ // *
+ // * INTERNAL USE-ONLY
+ // */
+ // private boolean isLocalDeclaration() {
+ // int nestedDepth = nestedType;
+ // while (nestedDepth >= 0) {
+ // if (nestedMethod[nestedDepth] != 0) {
+ // return true;
+ // }
+ // nestedDepth--;
+ // }
+ // return false;
+ // }
+ /*
+ * Update the bodyStart of the corresponding parse node
+ */
+ public void notifySourceElementRequestor(
+ CompilationUnitDeclaration parsedUnit) {
+ if (parsedUnit == null) {
+ // when we parse a single type member declaration the compilation
+ // unit is
+ // null, but we still
+ // want to be able to notify the requestor on the created ast node
+ if (astStack[0] instanceof AbstractMethodDeclaration) {
+ notifySourceElementRequestor((AbstractMethodDeclaration) astStack[0]);
+ return;
+ }
+ return;
+ }
+ // range check
+ boolean isInRange = scanner.initialPosition <= parsedUnit.sourceStart
+ && scanner.eofPosition >= parsedUnit.sourceEnd;
+
+ // if (reportReferenceInfo) {
+ // notifyAllUnknownReferences();
+ // }
+ // collect the top level ast nodes
+ int length = 0;
+ ASTNode[] nodes = null;
+ if (sourceType == null) {
+ if (isInRange) {
+ requestor.enterCompilationUnit();
+ }
+ // ImportReference currentPackage = parsedUnit.currentPackage;
+ ImportReference[] imports = parsedUnit.imports;
+ // TypeDeclaration[] types = parsedUnit.types;
+ ArrayList types = parsedUnit.types;
+ if (types != null) {
+ // length =
+ // (currentPackage == null ? 0 : 1)
+ // + (imports == null ? 0 : imports.length)
+ // + (types == null ? 0 : types.length);
+ // nodes = new ASTNode[length];
+ length = (imports == null ? 0 : imports.length) + types.size();
+ nodes = new ASTNode[length];
+ int index = 0;
+ // if (currentPackage != null) {
+ // nodes[index++] = currentPackage;
+ // }
+ if (imports != null) {
+ for (int i = 0, max = imports.length; i < max; i++) {
+ nodes[index++] = imports[i];
+ }
+ }
+
+ for (int i = 0, max = types.size(); i < max; i++) {
+ nodes[index++] = (ASTNode) types.get(i);
+ }
+ }
+ } else {
+ // TypeDeclaration[] types = parsedUnit.types;
+ ArrayList types = parsedUnit.types;
+ if (types != null) {
+ length = types.size();
+ nodes = new ASTNode[length];
+ for (int i = 0, max = types.size(); i < max; i++) {
+ nodes[i] = (ASTNode) types.get(i);
+ }
+ }
+ }
+
+ // notify the nodes in the syntactical order
+ if (nodes != null && length > 0) {
+ quickSort(nodes, 0, length - 1);
+ for (int i = 0; i < length; i++) {
+ ASTNode node = nodes[i];
+ if (node instanceof ImportReference) {
+ ImportReference importRef = (ImportReference) node;
+ // if (node == parsedUnit.currentPackage) {
+ // notifySourceElementRequestor(importRef, true);
+ // } else {
+ notifySourceElementRequestor(importRef, false);
+ // }
+ } // else { instanceof TypeDeclaration
+ if (node instanceof TypeDeclaration) {
+ notifySourceElementRequestor((TypeDeclaration) node,
+ sourceType == null);
+ // notifySourceElementRequestor((CompilationUnitDeclaration)node,
+ // sourceType == null);
+ }
+ // jsurfer - INSERT start
+ if (node instanceof AbstractMethodDeclaration) {
+ notifySourceElementRequestor((AbstractMethodDeclaration) node);
+ }
+ // jsurfer - INSERT end
+ }
+ }
- ISourceElementRequestor requestor;
- int fieldCount;
- int localIntPtr;
- int lastFieldEndPosition;
- ISourceType sourceType;
- boolean reportReferenceInfo;
- char[][] typeNames;
- char[][] superTypeNames;
- int nestedTypeIndex;
- static final char[] JAVA_LANG_OBJECT = "java.lang.Object".toCharArray(); //$NON-NLS-1$
- NameReference[] unknownRefs;
- int unknownRefsCounter;
- LocalDeclarationVisitor localDeclarationVisitor = null;
- // CompilerOptions options;
+ if (sourceType == null) {
+ if (isInRange) {
+ requestor.exitCompilationUnit(parsedUnit.sourceEnd);
+ }
+ }
+ }
- /**
- * An ast visitor that visits local type declarations.
- */
- public class LocalDeclarationVisitor extends ASTVisitor {
- public boolean visit(TypeDeclaration typeDeclaration, BlockScope scope) {
- notifySourceElementRequestor(typeDeclaration, sourceType == null);
- return false; // don't visit members as this was done during notifySourceElementRequestor(...)
- }
- public boolean visit(TypeDeclaration typeDeclaration, ClassScope scope) {
- notifySourceElementRequestor(typeDeclaration, sourceType == null);
- return false; // don't visit members as this was done during notifySourceElementRequestor(...)
- }
-
- }
+ // private void notifyAllUnknownReferences() {
+ // for (int i = 0, max = this.unknownRefsCounter; i < max; i++) {
+ // NameReference nameRef = this.unknownRefs[i];
+ // if ((nameRef.bits & BindingIds.VARIABLE) != 0) {
+ // if ((nameRef.bits & BindingIds.TYPE) == 0) {
+ // // variable but not type
+ // if (nameRef instanceof SingleNameReference) {
+ // // local var or field
+ // requestor.acceptUnknownReference(((SingleNameReference) nameRef).token,
+ // nameRef.sourceStart);
+ // } else {
+ // // QualifiedNameReference
+ // // The last token is a field reference and the previous tokens are a
+ // type/variable references
+ // char[][] tokens = ((QualifiedNameReference) nameRef).tokens;
+ // int tokensLength = tokens.length;
+ // requestor.acceptFieldReference(tokens[tokensLength - 1],
+ // nameRef.sourceEnd
+ // - tokens[tokensLength - 1].length + 1);
+ // char[][] typeRef = new char[tokensLength - 1][];
+ // System.arraycopy(tokens, 0, typeRef, 0, tokensLength - 1);
+ // requestor.acceptUnknownReference(typeRef, nameRef.sourceStart,
+ // nameRef.sourceEnd - tokens[tokensLength - 1].length);
+ // }
+ // } else {
+ // // variable or type
+ // if (nameRef instanceof SingleNameReference) {
+ // requestor.acceptUnknownReference(((SingleNameReference) nameRef).token,
+ // nameRef.sourceStart);
+ // } else {
+ // //QualifiedNameReference
+ // requestor.acceptUnknownReference(((QualifiedNameReference)
+ // nameRef).tokens,
+ // nameRef.sourceStart, nameRef.sourceEnd);
+ // }
+ // }
+ // } else if ((nameRef.bits & BindingIds.TYPE) != 0) {
+ // if (nameRef instanceof SingleNameReference) {
+ // requestor.acceptTypeReference(((SingleNameReference) nameRef).token,
+ // nameRef.sourceStart);
+ // } else {
+ // // it is a QualifiedNameReference
+ // requestor.acceptTypeReference(((QualifiedNameReference) nameRef).tokens,
+ // nameRef.sourceStart, nameRef.sourceEnd);
+ // }
+ // }
+ // }
+ // }
+ /*
+ * Update the bodyStart of the corresponding parse node
+ */
+ public void notifySourceElementRequestor(
+ AbstractMethodDeclaration methodDeclaration) {
- public SourceElementParser(final ISourceElementRequestor requestor, IProblemFactory problemFactory, CompilerOptions options) {
- // we want to notify all syntax error with the acceptProblem API
- // To do so, we define the record method of the ProblemReporter
- super( new ProblemReporter(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) {
- public void record(IProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) {
- unitResult.record(problem, referenceContext);
- if (requestor!=null) {
- requestor.acceptProblem(problem);
- }
- }
- });
- // true);
- // options.sourceLevel >= CompilerOptions.JDK1_4);
- this.requestor = requestor;
- typeNames = new char[4][];
- superTypeNames = new char[4][];
- nestedTypeIndex = 0;
- this.options = options;
- }
+ // range check
+ boolean isInRange = scanner.initialPosition <= methodDeclaration.declarationSourceStart
+ && scanner.eofPosition >= methodDeclaration.declarationSourceEnd;
- /**
- * @deprecated use SourceElementParser(ISourceElementRequestor,
- * IProblemFactory, CompilerOptions)
- */
- public SourceElementParser(
- final ISourceElementRequestor requestor,
- IProblemFactory problemFactory) {
- this(requestor, problemFactory, new CompilerOptions());
- }
- public SourceElementParser(
- final ISourceElementRequestor requestor,
- IProblemFactory problemFactory,
- CompilerOptions options,
- boolean reportLocalDeclarations) {
- this(requestor, problemFactory, options);
- if (reportLocalDeclarations) {
- this.localDeclarationVisitor = new LocalDeclarationVisitor();
- }
- }
- //public void checkAnnotation() {
- // int firstCommentIndex = scanner.commentPtr;
- //
- // super.checkAnnotation();
- //
- // // modify the modifier source start to point at the first comment
- // if (firstCommentIndex >= 0) {
- // modifiersSourceStart = scanner.commentStarts[0];
- // }
- //}
- //protected void classInstanceCreation(boolean alwaysQualified) {
- //
- // boolean previousFlag = reportReferenceInfo;
- // reportReferenceInfo = false; // not to see the type reference reported in
- // super call to getTypeReference(...)
- // super.classInstanceCreation(alwaysQualified);
- // reportReferenceInfo = previousFlag;
- // if (reportReferenceInfo){
- // AllocationExpression alloc =
- // (AllocationExpression)expressionStack[expressionPtr];
- // TypeReference typeRef = alloc.type;
- // requestor.acceptConstructorReference(
- // typeRef instanceof SingleTypeReference
- // ? ((SingleTypeReference) typeRef).token
- // : CharOperation.concatWith(alloc.type.getTypeName(), '.'),
- // alloc.arguments == null ? 0 : alloc.arguments.length,
- // alloc.sourceStart);
- // }
- //}
- //protected void consumeConstructorHeaderName() {
- // // ConstructorHeaderName ::= Modifiersopt 'Identifier' '('
- //
- // /* recovering - might be an empty message send */
- // if (currentElement != null){
- // if (lastIgnoredToken == TokenNamenew){ // was an allocation expression
- // lastCheckPoint = scanner.startPosition; // force to restart at this exact
- // position
- // restartRecovery = true;
- // return;
- // }
- // }
- // SourceConstructorDeclaration cd = new
- // SourceConstructorDeclaration(this.compilationUnit.compilationResult);
- //
- // //name -- this is not really revelant but we do .....
- // cd.selector = identifierStack[identifierPtr];
- // long selectorSourcePositions = identifierPositionStack[identifierPtr--];
- // identifierLengthPtr--;
- //
- // //modifiers
- // cd.declarationSourceStart = intStack[intPtr--];
- // cd.modifiers = intStack[intPtr--];
- //
- // //highlight starts at the selector starts
- // cd.sourceStart = (int) (selectorSourcePositions >>> 32);
- // cd.selectorSourceEnd = (int) selectorSourcePositions;
- // pushOnAstStack(cd);
- //
- // cd.sourceEnd = lParenPos;
- // cd.bodyStart = lParenPos+1;
- // listLength = 0; // initialize listLength before reading parameters/throws
- //
- // // recovery
- // if (currentElement != null){
- // lastCheckPoint = cd.bodyStart;
- // if ((currentElement instanceof RecoveredType && lastIgnoredToken !=
- // TokenNameDOT)
- // || cd.modifiers != 0){
- // currentElement = currentElement.add(cd, 0);
- // lastIgnoredToken = -1;
- // }
- // }
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeExitVariableWithInitialization() {
- // // ExitVariableWithInitialization ::= $empty
- // // the scanner is located after the comma or the semi-colon.
- // // we want to include the comma or the semi-colon
- // super.consumeExitVariableWithInitialization();
- // if (isLocalDeclaration() || ((currentToken != TokenNameCOMMA) &&
- // (currentToken != TokenNameSEMICOLON)))
- // return;
- // ((SourceFieldDeclaration) astStack[astPtr]).fieldEndPosition =
- // scanner.currentPosition - 1;
- //}
- //protected void consumeExitVariableWithoutInitialization() {
- // // ExitVariableWithoutInitialization ::= $empty
- // // do nothing by default
- // super.consumeExitVariableWithoutInitialization();
- // if (isLocalDeclaration() || ((currentToken != TokenNameCOMMA) &&
- // (currentToken != TokenNameSEMICOLON)))
- // return;
- // ((SourceFieldDeclaration) astStack[astPtr]).fieldEndPosition =
- // scanner.currentPosition - 1;
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeFieldAccess(boolean isSuperAccess) {
- // // FieldAccess ::= Primary '.' 'Identifier'
- // // FieldAccess ::= 'super' '.' 'Identifier'
- // super.consumeFieldAccess(isSuperAccess);
- // FieldReference fr = (FieldReference) expressionStack[expressionPtr];
- // if (reportReferenceInfo) {
- // requestor.acceptFieldReference(fr.token, fr.sourceStart);
- // }
- //}
- //protected void consumeMethodHeaderName() {
- // // MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
- // SourceMethodDeclaration md = new
- // SourceMethodDeclaration(this.compilationUnit.compilationResult);
- //
- // //name
- // md.selector = identifierStack[identifierPtr];
- // long selectorSourcePositions = identifierPositionStack[identifierPtr--];
- // identifierLengthPtr--;
- // //type
- // md.returnType = getTypeReference(intStack[intPtr--]);
- // //modifiers
- // md.declarationSourceStart = intStack[intPtr--];
- // md.modifiers = intStack[intPtr--];
- //
- // //highlight starts at selector start
- // md.sourceStart = (int) (selectorSourcePositions >>> 32);
- // md.selectorSourceEnd = (int) selectorSourcePositions;
- // pushOnAstStack(md);
- // md.sourceEnd = lParenPos;
- // md.bodyStart = lParenPos+1;
- // listLength = 0; // initialize listLength before reading parameters/throws
- //
- // // recovery
- // if (currentElement != null){
- // if (currentElement instanceof RecoveredType
- // //|| md.modifiers != 0
- // || (scanner.getLineNumber(md.returnType.sourceStart)
- // == scanner.getLineNumber(md.sourceStart))){
- // lastCheckPoint = md.bodyStart;
- // currentElement = currentElement.add(md, 0);
- // lastIgnoredToken = -1;
- // } else {
- // lastCheckPoint = md.sourceStart;
- // restartRecovery = true;
- // }
- // }
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeMethodInvocationName() {
- // // MethodInvocation ::= Name '(' ArgumentListopt ')'
- //
- // // when the name is only an identifier...we have a message send to "this"
- // (implicit)
- // super.consumeMethodInvocationName();
- // MessageSend messageSend = (MessageSend) expressionStack[expressionPtr];
- // Expression[] args = messageSend.arguments;
- // if (reportReferenceInfo) {
- // requestor.acceptMethodReference(
- // messageSend.selector,
- // args == null ? 0 : args.length,
- // (int)(messageSend.nameSourcePosition >>> 32));
- // }
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeMethodInvocationPrimary() {
- // super.consumeMethodInvocationPrimary();
- // MessageSend messageSend = (MessageSend) expressionStack[expressionPtr];
- // Expression[] args = messageSend.arguments;
- // if (reportReferenceInfo) {
- // requestor.acceptMethodReference(
- // messageSend.selector,
- // args == null ? 0 : args.length,
- // (int)(messageSend.nameSourcePosition >>> 32));
- // }
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //protected void consumeMethodInvocationSuper() {
- // // MethodInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')'
- // super.consumeMethodInvocationSuper();
- // MessageSend messageSend = (MessageSend) expressionStack[expressionPtr];
- // Expression[] args = messageSend.arguments;
- // if (reportReferenceInfo) {
- // requestor.acceptMethodReference(
- // messageSend.selector,
- // args == null ? 0 : args.length,
- // (int)(messageSend.nameSourcePosition >>> 32));
- // }
- //}
- //protected void consumeSingleTypeImportDeclarationName() {
- // // SingleTypeImportDeclarationName ::= 'import' Name
- // /* push an ImportRef build from the last name
- // stored in the identifier stack. */
- //
- // super.consumeSingleTypeImportDeclarationName();
- // ImportReference impt = (ImportReference)astStack[astPtr];
- // if (reportReferenceInfo) {
- // requestor.acceptTypeReference(impt.tokens, impt.sourceStart,
- // impt.sourceEnd);
- // }
- //}
- //protected void consumeTypeImportOnDemandDeclarationName() {
- // // TypeImportOnDemandDeclarationName ::= 'import' Name '.' '*'
- // /* push an ImportRef build from the last name
- // stored in the identifier stack. */
- //
- // super.consumeTypeImportOnDemandDeclarationName();
- // ImportReference impt = (ImportReference)astStack[astPtr];
- // if (reportReferenceInfo) {
- // requestor.acceptUnknownReference(impt.tokens, impt.sourceStart,
- // impt.sourceEnd);
- // }
- //}
- //protected FieldDeclaration createFieldDeclaration(Expression
- // initialization, char[] name, int sourceStart, int sourceEnd) {
- // return new SourceFieldDeclaration(null, name, sourceStart, sourceEnd);
- //}
- //protected CompilationUnitDeclaration endParse(int act) {
- // if (sourceType != null) {
- // if (sourceType.isInterface()) {
- // consumeInterfaceDeclaration();
- // } else {
- // consumeClassDeclaration();
- // }
- // }
- // if (compilationUnit != null) {
- // CompilationUnitDeclaration result = super.endParse(act);
- // return result;
- // } else {
- // return null;
- // }
- //}
- /*
- * Flush annotations defined prior to a given positions.
- *
- * Note: annotations are stacked in syntactical order
- *
- * Either answer given , or the end position of a comment line
- * immediately following the (same line)
- *
- * e.g. void foo(){ } // end of method foo
- */
- //
- //public int flushAnnotationsDefinedPriorTo(int position) {
- //
- // return lastFieldEndPosition =
- // super.flushAnnotationsDefinedPriorTo(position);
- //}
- //public TypeReference getTypeReference(int dim) {
- // /* build a Reference on a variable that may be qualified or not
- // * This variable is a type reference and dim will be its dimensions
- // */
- // int length;
- // if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
- // // single variable reference
- // if (dim == 0) {
- // SingleTypeReference ref =
- // new SingleTypeReference(
- // identifierStack[identifierPtr],
- // identifierPositionStack[identifierPtr--]);
- // if (reportReferenceInfo) {
- // requestor.acceptTypeReference(ref.token, ref.sourceStart);
- // }
- // return ref;
- // } else {
- // ArrayTypeReference ref =
- // new ArrayTypeReference(
- // identifierStack[identifierPtr],
- // dim,
- // identifierPositionStack[identifierPtr--]);
- // ref.sourceEnd = endPosition;
- // if (reportReferenceInfo) {
- // requestor.acceptTypeReference(ref.token, ref.sourceStart);
- // }
- // return ref;
- // }
- // } else {
- // if (length < 0) { //flag for precompiled type reference on base types
- // TypeReference ref = TypeReference.baseTypeReference(-length, dim);
- // ref.sourceStart = intStack[intPtr--];
- // if (dim == 0) {
- // ref.sourceEnd = intStack[intPtr--];
- // } else {
- // intPtr--; // no need to use this position as it is an array
- // ref.sourceEnd = endPosition;
- // }
- // if (reportReferenceInfo){
- // requestor.acceptTypeReference(ref.getTypeName(), ref.sourceStart,
- // ref.sourceEnd);
- // }
- // return ref;
- // } else { //Qualified variable reference
- // char[][] tokens = new char[length][];
- // identifierPtr -= length;
- // long[] positions = new long[length];
- // System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
- // System.arraycopy(
- // identifierPositionStack,
- // identifierPtr + 1,
- // positions,
- // 0,
- // length);
- // if (dim == 0) {
- // QualifiedTypeReference ref = new QualifiedTypeReference(tokens, positions);
- // if (reportReferenceInfo) {
- // requestor.acceptTypeReference(ref.tokens, ref.sourceStart, ref.sourceEnd);
- // }
- // return ref;
- // } else {
- // ArrayQualifiedTypeReference ref =
- // new ArrayQualifiedTypeReference(tokens, dim, positions);
- // ref.sourceEnd = endPosition;
- // if (reportReferenceInfo) {
- // requestor.acceptTypeReference(ref.tokens, ref.sourceStart, ref.sourceEnd);
- // }
- // return ref;
- // }
- // }
- // }
- //}
- //public NameReference getUnspecifiedReference() {
- // /* build a (unspecified) NameReference which may be qualified*/
- //
- // int length;
- // if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
- // // single variable reference
- // SingleNameReference ref =
- // new SingleNameReference(
- // identifierStack[identifierPtr],
- // identifierPositionStack[identifierPtr--]);
- // if (reportReferenceInfo) {
- // this.addUnknownRef(ref);
- // }
- // return ref;
- // } else {
- // //Qualified variable reference
- // char[][] tokens = new char[length][];
- // identifierPtr -= length;
- // System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
- // QualifiedNameReference ref =
- // new QualifiedNameReference(
- // tokens,
- // (int) (identifierPositionStack[identifierPtr + 1] >> 32), // sourceStart
- // (int) identifierPositionStack[identifierPtr + length]); // sourceEnd
- // if (reportReferenceInfo) {
- // this.addUnknownRef(ref);
- // }
- // return ref;
- // }
- //}
- //public NameReference getUnspecifiedReferenceOptimized() {
- // /* build a (unspecified) NameReference which may be qualified
- // The optimization occurs for qualified reference while we are
- // certain in this case the last item of the qualified name is
- // a field access. This optimization is IMPORTANT while it results
- // that when a NameReference is build, the type checker should always
- // look for that it is not a type reference */
- //
- // int length;
- // if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
- // // single variable reference
- // SingleNameReference ref =
- // new SingleNameReference(
- // identifierStack[identifierPtr],
- // identifierPositionStack[identifierPtr--]);
- // ref.bits &= ~ASTNode.RestrictiveFlagMASK;
- // ref.bits |= LOCAL | FIELD;
- // if (reportReferenceInfo) {
- // this.addUnknownRef(ref);
- // }
- // return ref;
- // }
- //
- // //Qualified-variable-reference
- // //In fact it is variable-reference DOT field-ref , but it would result in a
- // type
- // //conflict tha can be only reduce by making a superclass (or inetrface )
- // between
- // //nameReference and FiledReference or putting FieldReference under
- // NameReference
- // //or else..........This optimisation is not really relevant so just leave
- // as it is
- //
- // char[][] tokens = new char[length][];
- // identifierPtr -= length;
- // System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
- // QualifiedNameReference ref =
- // new QualifiedNameReference(
- // tokens,
- // (int) (identifierPositionStack[identifierPtr + 1] >> 32),
- // // sourceStart
- // (int) identifierPositionStack[identifierPtr + length]); // sourceEnd
- // ref.bits &= ~ASTNode.RestrictiveFlagMASK;
- // ref.bits |= LOCAL | FIELD;
- // if (reportReferenceInfo) {
- // this.addUnknownRef(ref);
- // }
- // return ref;
- //}
- ///**
- // *
- // * INTERNAL USE-ONLY
- // */
- //private boolean isLocalDeclaration() {
- // int nestedDepth = nestedType;
- // while (nestedDepth >= 0) {
- // if (nestedMethod[nestedDepth] != 0) {
- // return true;
- // }
- // nestedDepth--;
- // }
- // return false;
- //}
- /*
- * Update the bodyStart of the corresponding parse node
- */
- public void notifySourceElementRequestor(CompilationUnitDeclaration parsedUnit) {
- if (parsedUnit == null) {
- // when we parse a single type member declaration the compilation unit is
- // null, but we still
- // want to be able to notify the requestor on the created ast node
- if (astStack[0] instanceof AbstractMethodDeclaration) {
- notifySourceElementRequestor((AbstractMethodDeclaration) astStack[0]);
- return;
- }
- return;
- }
- // range check
- boolean isInRange = scanner.initialPosition <= parsedUnit.sourceStart && scanner.eofPosition >= parsedUnit.sourceEnd;
+ if (methodDeclaration.isClinit()) {
+ this.visitIfNeeded(methodDeclaration);
+ return;
+ }
- // if (reportReferenceInfo) {
- // notifyAllUnknownReferences();
- // }
- // collect the top level ast nodes
- int length = 0;
- ASTNode[] nodes = null;
- if (sourceType == null) {
- if (isInRange) {
- requestor.enterCompilationUnit();
- }
- // ImportReference currentPackage = parsedUnit.currentPackage;
- ImportReference[] imports = parsedUnit.imports;
- // TypeDeclaration[] types = parsedUnit.types;
- ArrayList types = parsedUnit.types;
- if (types != null) {
- // length =
- // (currentPackage == null ? 0 : 1)
- // + (imports == null ? 0 : imports.length)
- // + (types == null ? 0 : types.length);
- // nodes = new ASTNode[length];
- length = (imports == null ? 0 : imports.length) + types.size();
- nodes = new ASTNode[length];
- int index = 0;
- // if (currentPackage != null) {
- // nodes[index++] = currentPackage;
- // }
- if (imports != null) {
- for (int i = 0, max = imports.length; i < max; i++) {
- nodes[index++] = imports[i];
- }
- }
+ if (methodDeclaration.isDefaultConstructor()) {
+ if (reportReferenceInfo) {
+ ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) methodDeclaration;
+ ExplicitConstructorCall constructorCall = constructorDeclaration.constructorCall;
+ if (constructorCall != null) {
+ switch (constructorCall.accessMode) {
+ case ExplicitConstructorCall.This:
+ requestor.acceptConstructorReference(
+ typeNames[nestedTypeIndex - 1],
+ constructorCall.arguments == null ? 0
+ : constructorCall.arguments.length,
+ constructorCall.sourceStart);
+ break;
+ case ExplicitConstructorCall.Super:
+ case ExplicitConstructorCall.ImplicitSuper:
+ requestor.acceptConstructorReference(
+ superTypeNames[nestedTypeIndex - 1],
+ constructorCall.arguments == null ? 0
+ : constructorCall.arguments.length,
+ constructorCall.sourceStart);
+ break;
+ }
+ }
+ }
+ return;
+ }
+ char[][] argumentTypes = null;
+ char[][] argumentNames = null;
+ Argument[] arguments = methodDeclaration.arguments;
+ if (arguments != null) {
+ int argumentLength = arguments.length;
+ argumentTypes = new char[argumentLength][];
+ argumentNames = new char[argumentLength][];
+ for (int i = 0; i < argumentLength; i++) {
+ argumentTypes[i] = returnTypeName(arguments[i].type);
+ argumentNames[i] = arguments[i].name;
+ }
+ }
+ char[][] thrownExceptionTypes = null;
+ TypeReference[] thrownExceptions = methodDeclaration.thrownExceptions;
+ if (thrownExceptions != null) {
+ int thrownExceptionLength = thrownExceptions.length;
+ thrownExceptionTypes = new char[thrownExceptionLength][];
+ for (int i = 0; i < thrownExceptionLength; i++) {
+ thrownExceptionTypes[i] = CharOperation.concatWith(
+ thrownExceptions[i].getTypeName(), '.');
+ }
+ }
+ // by default no selector end position
+ int selectorSourceEnd = -1;
+ if (methodDeclaration.isConstructor()) {
+ // if (methodDeclaration instanceof SourceConstructorDeclaration) {
+ // selectorSourceEnd =
+ // ((SourceConstructorDeclaration)
+ // methodDeclaration).selectorSourceEnd;
+ // }
+ if (isInRange) {
+ requestor.enterConstructor(
+ methodDeclaration.declarationSourceStart,
+ methodDeclaration.modifiers,
+ methodDeclaration.selector,
+ methodDeclaration.sourceStart, selectorSourceEnd,
+ argumentTypes, argumentNames, thrownExceptionTypes);
+ }
+ if (reportReferenceInfo) {
+ ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) methodDeclaration;
+ ExplicitConstructorCall constructorCall = constructorDeclaration.constructorCall;
+ if (constructorCall != null) {
+ switch (constructorCall.accessMode) {
+ case ExplicitConstructorCall.This:
+ requestor.acceptConstructorReference(
+ typeNames[nestedTypeIndex - 1],
+ constructorCall.arguments == null ? 0
+ : constructorCall.arguments.length,
+ constructorCall.sourceStart);
+ break;
+ case ExplicitConstructorCall.Super:
+ case ExplicitConstructorCall.ImplicitSuper:
+ requestor.acceptConstructorReference(
+ superTypeNames[nestedTypeIndex - 1],
+ constructorCall.arguments == null ? 0
+ : constructorCall.arguments.length,
+ constructorCall.sourceStart);
+ break;
+ }
+ }
+ }
+ this.visitIfNeeded(methodDeclaration);
+ if (isInRange) {
+ requestor
+ .exitConstructor(methodDeclaration.declarationSourceEnd);
+ }
+ return;
+ }
+ // if (methodDeclaration instanceof SourceMethodDeclaration) {
+ // selectorSourceEnd =
+ // ((SourceMethodDeclaration) methodDeclaration).selectorSourceEnd;
+ // }
+ if (isInRange) {
+ int modifiers = methodDeclaration.modifiers;
+ // boolean deprecated = (modifiers & AccDeprecated) != 0; //
+ // remember
+ // deprecation so as to not lose it below
+ requestor
+ .enterMethod(
+ methodDeclaration.declarationSourceStart,
+ modifiers, // deprecated
+ // ?
+ // (modifiers
+ // &
+ // AccJustFlag)
+ // |
+ // AccDeprecated
+ // :
+ // modifiers
+ // &
+ // AccJustFlag,
+ returnTypeName(((MethodDeclaration) methodDeclaration).returnType),
+ methodDeclaration.selector,
+ methodDeclaration.sourceStart, selectorSourceEnd,
+ argumentTypes, argumentNames, thrownExceptionTypes);
+ }
+ this.visitIfNeeded(methodDeclaration);
- for (int i = 0, max = types.size(); i < max; i++) {
- nodes[index++] = (ASTNode) types.get(i);
- }
- }
- } else {
- // TypeDeclaration[] types = parsedUnit.types;
- ArrayList types = parsedUnit.types;
- if (types != null) {
- length = types.size();
- nodes = new ASTNode[length];
- for (int i = 0, max = types.size(); i < max; i++) {
- nodes[i] = (ASTNode) types.get(i);
- }
- }
- }
+ if (isInRange) {
+ requestor.exitMethod(methodDeclaration.declarationSourceEnd);
+ }
+ }
- // notify the nodes in the syntactical order
- if (nodes != null && length > 0) {
- quickSort(nodes, 0, length - 1);
- for (int i = 0; i < length; i++) {
- ASTNode node = nodes[i];
- if (node instanceof ImportReference) {
- ImportReference importRef = (ImportReference)node;
-// if (node == parsedUnit.currentPackage) {
-// notifySourceElementRequestor(importRef, true);
-// } else {
- notifySourceElementRequestor(importRef, false);
-// }
- } //else { instanceof TypeDeclaration
- if (node instanceof TypeDeclaration) {
- notifySourceElementRequestor((TypeDeclaration) node, sourceType == null);
- // notifySourceElementRequestor((CompilationUnitDeclaration)node,
- // sourceType == null);
- }
- // jsurfer - INSERT start
- if (node instanceof AbstractMethodDeclaration) {
- notifySourceElementRequestor((AbstractMethodDeclaration) node);
- }
- // jsurfer - INSERT end
- }
- }
+ /*
+ * Update the bodyStart of the corresponding parse node
+ */
+ public void notifySourceElementRequestor(FieldDeclaration fieldDeclaration) {
- if (sourceType == null) {
- if (isInRange) {
- requestor.exitCompilationUnit(parsedUnit.sourceEnd);
- }
- }
- }
+ // range check
+ boolean isInRange = scanner.initialPosition <= fieldDeclaration.declarationSourceStart
+ && scanner.eofPosition >= fieldDeclaration.declarationSourceEnd;
- //private void notifyAllUnknownReferences() {
- // for (int i = 0, max = this.unknownRefsCounter; i < max; i++) {
- // NameReference nameRef = this.unknownRefs[i];
- // if ((nameRef.bits & BindingIds.VARIABLE) != 0) {
- // if ((nameRef.bits & BindingIds.TYPE) == 0) {
- // // variable but not type
- // if (nameRef instanceof SingleNameReference) {
- // // local var or field
- // requestor.acceptUnknownReference(((SingleNameReference) nameRef).token,
- // nameRef.sourceStart);
- // } else {
- // // QualifiedNameReference
- // // The last token is a field reference and the previous tokens are a
- // type/variable references
- // char[][] tokens = ((QualifiedNameReference) nameRef).tokens;
- // int tokensLength = tokens.length;
- // requestor.acceptFieldReference(tokens[tokensLength - 1], nameRef.sourceEnd
- // - tokens[tokensLength - 1].length + 1);
- // char[][] typeRef = new char[tokensLength - 1][];
- // System.arraycopy(tokens, 0, typeRef, 0, tokensLength - 1);
- // requestor.acceptUnknownReference(typeRef, nameRef.sourceStart,
- // nameRef.sourceEnd - tokens[tokensLength - 1].length);
- // }
- // } else {
- // // variable or type
- // if (nameRef instanceof SingleNameReference) {
- // requestor.acceptUnknownReference(((SingleNameReference) nameRef).token,
- // nameRef.sourceStart);
- // } else {
- // //QualifiedNameReference
- // requestor.acceptUnknownReference(((QualifiedNameReference) nameRef).tokens,
- // nameRef.sourceStart, nameRef.sourceEnd);
- // }
- // }
- // } else if ((nameRef.bits & BindingIds.TYPE) != 0) {
- // if (nameRef instanceof SingleNameReference) {
- // requestor.acceptTypeReference(((SingleNameReference) nameRef).token,
- // nameRef.sourceStart);
- // } else {
- // // it is a QualifiedNameReference
- // requestor.acceptTypeReference(((QualifiedNameReference) nameRef).tokens,
- // nameRef.sourceStart, nameRef.sourceEnd);
- // }
- // }
- // }
- //}
- /*
- * Update the bodyStart of the corresponding parse node
- */
- public void notifySourceElementRequestor(AbstractMethodDeclaration methodDeclaration) {
+ if (fieldDeclaration.isField()) {
+ int fieldEndPosition = fieldDeclaration.declarationSourceEnd;
+ // if (fieldDeclaration instanceof SourceFieldDeclaration) {
+ // fieldEndPosition = ((SourceFieldDeclaration)
+ // fieldDeclaration).fieldEndPosition;
+ // if (fieldEndPosition == 0) {
+ // // use the declaration source end by default
+ // fieldEndPosition = fieldDeclaration.declarationSourceEnd;
+ // }
+ // }
+ if (isInRange) {
+ int modifiers = fieldDeclaration.modifiers;
+ boolean deprecated = (modifiers & AccDeprecated) != 0; // remember
+ // deprecation so
+ // as to not lose
+ // it below
+ requestor.enterField(fieldDeclaration.declarationSourceStart,
+ deprecated ? (modifiers & AccJustFlag) | AccDeprecated
+ : modifiers & AccJustFlag,
+ returnTypeName(fieldDeclaration.type),
+ fieldDeclaration.name, fieldDeclaration.sourceStart,
+ fieldDeclaration.sourceEnd);
+ }
+ // this.visitIfNeeded(fieldDeclaration);
+ if (isInRange) {
+ // requestor.exitField(
+ // // filter out initializations that are not a constant (simple
+ // check)
+ // (fieldDeclaration.initialization == null
+ // || fieldDeclaration.initialization instanceof
+ // ArrayInitializer
+ // || fieldDeclaration.initialization instanceof
+ // AllocationExpression
+ // || fieldDeclaration.initialization instanceof
+ // ArrayAllocationExpression
+ // || fieldDeclaration.initialization instanceof Assignment
+ // || fieldDeclaration.initialization instanceof
+ // ClassLiteralAccess
+ // || fieldDeclaration.initialization instanceof MessageSend
+ // || fieldDeclaration.initialization instanceof ArrayReference
+ // || fieldDeclaration.initialization instanceof ThisReference)
+ // ?
+ // -1 :
+ // fieldDeclaration.initialization.sourceStart,
+ // fieldEndPosition,
+ // fieldDeclaration.declarationSourceEnd);
+ requestor.exitField(
+ // filter out initializations that are not a constant
+ // (simple check)
+ -1, fieldEndPosition,
+ fieldDeclaration.declarationSourceEnd);
+ }
- // range check
- boolean isInRange = scanner.initialPosition <= methodDeclaration.declarationSourceStart
- && scanner.eofPosition >= methodDeclaration.declarationSourceEnd;
+ } else {
+ // if (isInRange){
+ // requestor.enterInitializer(
+ // fieldDeclaration.declarationSourceStart,
+ // fieldDeclaration.modifiers);
+ // }
+ // this.visitIfNeeded((Initializer)fieldDeclaration);
+ // if (isInRange){
+ // requestor.exitInitializer(fieldDeclaration.declarationSourceEnd);
+ // }
+ }
+ }
- if (methodDeclaration.isClinit()) {
- this.visitIfNeeded(methodDeclaration);
- return;
- }
+ public void notifySourceElementRequestor(ImportReference importReference,
+ boolean isPackage) {
+ // if (isPackage) {
+ // requestor.acceptPackage(
+ // importReference.declarationSourceStart,
+ // importReference.declarationSourceEnd,
+ // CharOperation.concatWith(importReference.getImportName(), '.'));
+ // } else {
+ requestor.acceptImport(importReference.declarationSourceStart,
+ importReference.declarationSourceEnd, importReference
+ .getIncludeName(), // CharOperation.concatWith(importReference.getImportName(),
+ // '.'),
+ importReference.onDemand);
+ // }
+ }
- if (methodDeclaration.isDefaultConstructor()) {
- if (reportReferenceInfo) {
- ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) methodDeclaration;
- ExplicitConstructorCall constructorCall = constructorDeclaration.constructorCall;
- if (constructorCall != null) {
- switch (constructorCall.accessMode) {
- case ExplicitConstructorCall.This :
- requestor.acceptConstructorReference(typeNames[nestedTypeIndex - 1], constructorCall.arguments == null
- ? 0
- : constructorCall.arguments.length, constructorCall.sourceStart);
- break;
- case ExplicitConstructorCall.Super :
- case ExplicitConstructorCall.ImplicitSuper :
- requestor.acceptConstructorReference(superTypeNames[nestedTypeIndex - 1], constructorCall.arguments == null
- ? 0
- : constructorCall.arguments.length, constructorCall.sourceStart);
- break;
- }
- }
- }
- return;
- }
- char[][] argumentTypes = null;
- char[][] argumentNames = null;
- Argument[] arguments = methodDeclaration.arguments;
- if (arguments != null) {
- int argumentLength = arguments.length;
- argumentTypes = new char[argumentLength][];
- argumentNames = new char[argumentLength][];
- for (int i = 0; i < argumentLength; i++) {
- argumentTypes[i] = returnTypeName(arguments[i].type);
- argumentNames[i] = arguments[i].name;
- }
- }
- char[][] thrownExceptionTypes = null;
- TypeReference[] thrownExceptions = methodDeclaration.thrownExceptions;
- if (thrownExceptions != null) {
- int thrownExceptionLength = thrownExceptions.length;
- thrownExceptionTypes = new char[thrownExceptionLength][];
- for (int i = 0; i < thrownExceptionLength; i++) {
- thrownExceptionTypes[i] = CharOperation.concatWith(thrownExceptions[i].getTypeName(), '.');
- }
- }
- // by default no selector end position
- int selectorSourceEnd = -1;
- if (methodDeclaration.isConstructor()) {
- // if (methodDeclaration instanceof SourceConstructorDeclaration) {
- // selectorSourceEnd =
- // ((SourceConstructorDeclaration) methodDeclaration).selectorSourceEnd;
- // }
- if (isInRange) {
- requestor.enterConstructor(methodDeclaration.declarationSourceStart, methodDeclaration.modifiers,
- methodDeclaration.selector, methodDeclaration.sourceStart, selectorSourceEnd, argumentTypes, argumentNames,
- thrownExceptionTypes);
- }
- if (reportReferenceInfo) {
- ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) methodDeclaration;
- ExplicitConstructorCall constructorCall = constructorDeclaration.constructorCall;
- if (constructorCall != null) {
- switch (constructorCall.accessMode) {
- case ExplicitConstructorCall.This :
- requestor.acceptConstructorReference(typeNames[nestedTypeIndex - 1], constructorCall.arguments == null
- ? 0
- : constructorCall.arguments.length, constructorCall.sourceStart);
- break;
- case ExplicitConstructorCall.Super :
- case ExplicitConstructorCall.ImplicitSuper :
- requestor.acceptConstructorReference(superTypeNames[nestedTypeIndex - 1], constructorCall.arguments == null
- ? 0
- : constructorCall.arguments.length, constructorCall.sourceStart);
- break;
- }
- }
- }
- this.visitIfNeeded(methodDeclaration);
- if (isInRange) {
- requestor.exitConstructor(methodDeclaration.declarationSourceEnd);
- }
- return;
- }
- // if (methodDeclaration instanceof SourceMethodDeclaration) {
- // selectorSourceEnd =
- // ((SourceMethodDeclaration) methodDeclaration).selectorSourceEnd;
- // }
- if (isInRange) {
- int modifiers = methodDeclaration.modifiers;
- // boolean deprecated = (modifiers & AccDeprecated) != 0; // remember
- // deprecation so as to not lose it below
- requestor.enterMethod(methodDeclaration.declarationSourceStart, modifiers, // deprecated
- // ?
- // (modifiers
- // &
- // AccJustFlag)
- // |
- // AccDeprecated
- // :
- // modifiers
- // &
- // AccJustFlag,
- returnTypeName(((MethodDeclaration) methodDeclaration).returnType), methodDeclaration.selector,
- methodDeclaration.sourceStart, selectorSourceEnd, argumentTypes, argumentNames, thrownExceptionTypes);
- }
- this.visitIfNeeded(methodDeclaration);
+ public void notifySourceElementRequestor(TypeDeclaration typeDeclaration,
+ boolean notifyTypePresence) {
+ // // public void notifySourceElementRequestor(ASTNode typeDeclaration,
+ // boolean notifyTypePresence) {
- if (isInRange) {
- requestor.exitMethod(methodDeclaration.declarationSourceEnd);
- }
- }
- /*
- * Update the bodyStart of the corresponding parse node
- */
- public void notifySourceElementRequestor(FieldDeclaration fieldDeclaration) {
+ // range check
+ boolean isInRange = scanner.initialPosition <= typeDeclaration.declarationSourceStart
+ && scanner.eofPosition >= typeDeclaration.declarationSourceEnd;
- // range check
- boolean isInRange = scanner.initialPosition <= fieldDeclaration.declarationSourceStart
- && scanner.eofPosition >= fieldDeclaration.declarationSourceEnd;
+ FieldDeclaration[] fields = typeDeclaration.fields;
+ AbstractMethodDeclaration[] methods = typeDeclaration.methods;
+ TypeDeclaration[] memberTypes = typeDeclaration.memberTypes;
+ int fieldCount = fields == null ? 0 : fields.length;
+ int methodCount = methods == null ? 0 : methods.length;
+ int memberTypeCount = memberTypes == null ? 0 : memberTypes.length;
+ int fieldIndex = 0;
+ int methodIndex = 0;
+ int memberTypeIndex = 0;
+ boolean isInterface = typeDeclaration.isInterface();
- if (fieldDeclaration.isField()) {
- int fieldEndPosition = fieldDeclaration.declarationSourceEnd;
- // if (fieldDeclaration instanceof SourceFieldDeclaration) {
- // fieldEndPosition = ((SourceFieldDeclaration)
- // fieldDeclaration).fieldEndPosition;
- // if (fieldEndPosition == 0) {
- // // use the declaration source end by default
- // fieldEndPosition = fieldDeclaration.declarationSourceEnd;
- // }
- // }
- if (isInRange) {
- int modifiers = fieldDeclaration.modifiers;
- boolean deprecated = (modifiers & AccDeprecated) != 0; // remember
- // deprecation so
- // as to not lose
- // it below
- requestor.enterField(fieldDeclaration.declarationSourceStart, deprecated
- ? (modifiers & AccJustFlag) | AccDeprecated
- : modifiers & AccJustFlag, returnTypeName(fieldDeclaration.type), fieldDeclaration.name, fieldDeclaration.sourceStart,
- fieldDeclaration.sourceEnd);
- }
- // this.visitIfNeeded(fieldDeclaration);
- if (isInRange) {
- // requestor.exitField(
- // // filter out initializations that are not a constant (simple check)
- // (fieldDeclaration.initialization == null
- // || fieldDeclaration.initialization instanceof ArrayInitializer
- // || fieldDeclaration.initialization instanceof AllocationExpression
- // || fieldDeclaration.initialization instanceof
- // ArrayAllocationExpression
- // || fieldDeclaration.initialization instanceof Assignment
- // || fieldDeclaration.initialization instanceof ClassLiteralAccess
- // || fieldDeclaration.initialization instanceof MessageSend
- // || fieldDeclaration.initialization instanceof ArrayReference
- // || fieldDeclaration.initialization instanceof ThisReference) ?
- // -1 :
- // fieldDeclaration.initialization.sourceStart,
- // fieldEndPosition,
- // fieldDeclaration.declarationSourceEnd);
- requestor.exitField(
- // filter out initializations that are not a constant (simple check)
- -1, fieldEndPosition, fieldDeclaration.declarationSourceEnd);
- }
+ if (notifyTypePresence) {
+ char[][] interfaceNames = null;
+ int superInterfacesLength = 0;
+ TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
+ if (superInterfaces != null) {
+ superInterfacesLength = superInterfaces.length;
+ interfaceNames = new char[superInterfacesLength][];
+ } else {
+ if (typeDeclaration instanceof AnonymousLocalTypeDeclaration) {
+ // see PR 3442
+ QualifiedAllocationExpression alloc = ((AnonymousLocalTypeDeclaration) typeDeclaration).allocation;
+ if (alloc != null && alloc.type != null) {
+ superInterfaces = new TypeReference[] { ((AnonymousLocalTypeDeclaration) typeDeclaration).allocation.type };
+ superInterfacesLength = 1;
+ interfaceNames = new char[1][];
+ }
+ }
+ }
+ if (superInterfaces != null) {
+ for (int i = 0; i < superInterfacesLength; i++) {
+ interfaceNames[i] = CharOperation.concatWith(
+ superInterfaces[i].getTypeName(), '.');
+ }
+ }
+ if (isInterface) {
+ if (isInRange) {
+ int modifiers = typeDeclaration.modifiers;
+ boolean deprecated = false; // (modifiers & AccDeprecated)
+ // != 0; //
+ // remember deprecation so as to not lose
+ // it below
+ requestor.enterInterface(
+ typeDeclaration.declarationSourceStart,
+ modifiers, // deprecated
+ // ?
+ // (modifiers
+ // &
+ // AccJustFlag)
+ // |
+ // AccDeprecated
+ // :
+ // modifiers
+ // &
+ // AccJustFlag,
+ typeDeclaration.name, typeDeclaration.sourceStart,
+ typeDeclaration.sourceEnd, interfaceNames);
+ }
+ if (nestedTypeIndex == typeNames.length) {
+ // need a resize
+ System.arraycopy(typeNames, 0,
+ (typeNames = new char[nestedTypeIndex * 2][]), 0,
+ nestedTypeIndex);
+ System.arraycopy(superTypeNames, 0,
+ (superTypeNames = new char[nestedTypeIndex * 2][]),
+ 0, nestedTypeIndex);
+ }
+ typeNames[nestedTypeIndex] = typeDeclaration.name;
+ superTypeNames[nestedTypeIndex++] = JAVA_LANG_OBJECT;
+ } else {
+ TypeReference superclass = typeDeclaration.superclass;
+ if (superclass == null) {
+ if (isInRange) {
+ requestor
+ .enterClass(
+ typeDeclaration.declarationSourceStart,
+ typeDeclaration.modifiers,
+ typeDeclaration.name,
+ typeDeclaration.sourceStart,
+ typeDeclaration.sourceEnd, null,
+ interfaceNames);
+ }
+ } else {
+ if (isInRange) {
+ requestor.enterClass(
+ typeDeclaration.declarationSourceStart,
+ typeDeclaration.modifiers,
+ typeDeclaration.name,
+ typeDeclaration.sourceStart,
+ typeDeclaration.sourceEnd, CharOperation
+ .concatWith(superclass.getTypeName(),
+ '.'), interfaceNames);
+ }
+ }
+ if (nestedTypeIndex == typeNames.length) {
+ // need a resize
+ System.arraycopy(typeNames, 0,
+ (typeNames = new char[nestedTypeIndex * 2][]), 0,
+ nestedTypeIndex);
+ System.arraycopy(superTypeNames, 0,
+ (superTypeNames = new char[nestedTypeIndex * 2][]),
+ 0, nestedTypeIndex);
+ }
+ typeNames[nestedTypeIndex] = typeDeclaration.name;
+ superTypeNames[nestedTypeIndex++] = superclass == null ? JAVA_LANG_OBJECT
+ : CharOperation.concatWith(superclass.getTypeName(),
+ '.');
+ }
+ }
+ while ((fieldIndex < fieldCount) || (memberTypeIndex < memberTypeCount)
+ || (methodIndex < methodCount)) {
+ FieldDeclaration nextFieldDeclaration = null;
+ AbstractMethodDeclaration nextMethodDeclaration = null;
+ TypeDeclaration nextMemberDeclaration = null;
- } else {
- // if (isInRange){
- // requestor.enterInitializer(
- // fieldDeclaration.declarationSourceStart,
- // fieldDeclaration.modifiers);
- // }
- // this.visitIfNeeded((Initializer)fieldDeclaration);
- // if (isInRange){
- // requestor.exitInitializer(fieldDeclaration.declarationSourceEnd);
- // }
- }
- }
- public void notifySourceElementRequestor(
- ImportReference importReference,
- boolean isPackage) {
-// if (isPackage) {
-// requestor.acceptPackage(
-// importReference.declarationSourceStart,
-// importReference.declarationSourceEnd,
-// CharOperation.concatWith(importReference.getImportName(), '.'));
-// } else {
- requestor.acceptImport(
- importReference.declarationSourceStart,
- importReference.declarationSourceEnd,
- importReference.getIncludeName(), //CharOperation.concatWith(importReference.getImportName(), '.'),
- importReference.onDemand);
-// }
- }
- public void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boolean notifyTypePresence) {
- //// public void notifySourceElementRequestor(ASTNode typeDeclaration,
- // boolean notifyTypePresence) {
+ int position = Integer.MAX_VALUE;
+ int nextDeclarationType = -1;
+ if (fieldIndex < fieldCount) {
+ nextFieldDeclaration = fields[fieldIndex];
+ if (nextFieldDeclaration.declarationSourceStart < position) {
+ position = nextFieldDeclaration.declarationSourceStart;
+ nextDeclarationType = 0; // FIELD
+ }
+ }
+ if (methodIndex < methodCount) {
+ nextMethodDeclaration = methods[methodIndex];
+ if (nextMethodDeclaration.declarationSourceStart < position) {
+ position = nextMethodDeclaration.declarationSourceStart;
+ nextDeclarationType = 1; // METHOD
+ }
+ }
+ if (memberTypeIndex < memberTypeCount) {
+ nextMemberDeclaration = memberTypes[memberTypeIndex];
+ if (nextMemberDeclaration.declarationSourceStart < position) {
+ position = nextMemberDeclaration.declarationSourceStart;
+ nextDeclarationType = 2; // MEMBER
+ }
+ }
+ switch (nextDeclarationType) {
+ case 0:
+ fieldIndex++;
+ notifySourceElementRequestor(nextFieldDeclaration);
+ break;
+ case 1:
+ methodIndex++;
+ notifySourceElementRequestor(nextMethodDeclaration);
+ break;
+ case 2:
+ memberTypeIndex++;
+ notifySourceElementRequestor(nextMemberDeclaration, true);
+ }
+ }
+ if (notifyTypePresence) {
+ if (isInRange) {
+ if (isInterface) {
+ requestor
+ .exitInterface(typeDeclaration.declarationSourceEnd);
+ } else {
+ requestor.exitClass(typeDeclaration.declarationSourceEnd);
+ }
+ }
+ nestedTypeIndex--;
+ }
+ }
- // range check
- boolean isInRange = scanner.initialPosition <= typeDeclaration.declarationSourceStart
- && scanner.eofPosition >= typeDeclaration.declarationSourceEnd;
+ public void parseCompilationUnit(ICompilationUnit unit, int start, int end) {
+ // boolean needReferenceInfo) {
- FieldDeclaration[] fields = typeDeclaration.fields;
- AbstractMethodDeclaration[] methods = typeDeclaration.methods;
- TypeDeclaration[] memberTypes = typeDeclaration.memberTypes;
- int fieldCount = fields == null ? 0 : fields.length;
- int methodCount = methods == null ? 0 : methods.length;
- int memberTypeCount = memberTypes == null ? 0 : memberTypes.length;
- int fieldIndex = 0;
- int methodIndex = 0;
- int memberTypeIndex = 0;
- boolean isInterface = typeDeclaration.isInterface();
+ // reportReferenceInfo = needReferenceInfo;
+ // boolean old = diet;
+ // if (needReferenceInfo) {
+ // unknownRefs = new NameReference[10];
+ // unknownRefsCounter = 0;
+ // }
- if (notifyTypePresence) {
- char[][] interfaceNames = null;
- int superInterfacesLength = 0;
- TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
- if (superInterfaces != null) {
- superInterfacesLength = superInterfaces.length;
- interfaceNames = new char[superInterfacesLength][];
- } else {
- if (typeDeclaration instanceof AnonymousLocalTypeDeclaration) {
- // see PR 3442
- QualifiedAllocationExpression alloc = ((AnonymousLocalTypeDeclaration) typeDeclaration).allocation;
- if (alloc != null && alloc.type != null) {
- superInterfaces = new TypeReference[]{((AnonymousLocalTypeDeclaration) typeDeclaration).allocation.type};
- superInterfacesLength = 1;
- interfaceNames = new char[1][];
- }
- }
- }
- if (superInterfaces != null) {
- for (int i = 0; i < superInterfacesLength; i++) {
- interfaceNames[i] = CharOperation.concatWith(superInterfaces[i].getTypeName(), '.');
- }
- }
- if (isInterface) {
- if (isInRange) {
- int modifiers = typeDeclaration.modifiers;
- boolean deprecated = false; //(modifiers & AccDeprecated) != 0; //
- // remember deprecation so as to not lose
- // it below
- requestor.enterInterface(typeDeclaration.declarationSourceStart, modifiers, //deprecated
- // ?
- // (modifiers
- // &
- // AccJustFlag)
- // |
- // AccDeprecated
- // :
- // modifiers
- // &
- // AccJustFlag,
- typeDeclaration.name, typeDeclaration.sourceStart, typeDeclaration.sourceEnd, interfaceNames);
- }
- if (nestedTypeIndex == typeNames.length) {
- // need a resize
- System.arraycopy(typeNames, 0, (typeNames = new char[nestedTypeIndex * 2][]), 0, nestedTypeIndex);
- System.arraycopy(superTypeNames, 0, (superTypeNames = new char[nestedTypeIndex * 2][]), 0, nestedTypeIndex);
- }
- typeNames[nestedTypeIndex] = typeDeclaration.name;
- superTypeNames[nestedTypeIndex++] = JAVA_LANG_OBJECT;
- } else {
- TypeReference superclass = typeDeclaration.superclass;
- if (superclass == null) {
- if (isInRange) {
- requestor.enterClass(typeDeclaration.declarationSourceStart, typeDeclaration.modifiers, typeDeclaration.name,
- typeDeclaration.sourceStart, typeDeclaration.sourceEnd, null, interfaceNames);
- }
- } else {
- if (isInRange) {
- requestor.enterClass(typeDeclaration.declarationSourceStart, typeDeclaration.modifiers, typeDeclaration.name,
- typeDeclaration.sourceStart, typeDeclaration.sourceEnd, CharOperation.concatWith(superclass.getTypeName(), '.'),
- interfaceNames);
- }
- }
- if (nestedTypeIndex == typeNames.length) {
- // need a resize
- System.arraycopy(typeNames, 0, (typeNames = new char[nestedTypeIndex * 2][]), 0, nestedTypeIndex);
- System.arraycopy(superTypeNames, 0, (superTypeNames = new char[nestedTypeIndex * 2][]), 0, nestedTypeIndex);
- }
- typeNames[nestedTypeIndex] = typeDeclaration.name;
- superTypeNames[nestedTypeIndex++] = superclass == null ? JAVA_LANG_OBJECT : CharOperation.concatWith(superclass
- .getTypeName(), '.');
- }
- }
- while ((fieldIndex < fieldCount) || (memberTypeIndex < memberTypeCount) || (methodIndex < methodCount)) {
- FieldDeclaration nextFieldDeclaration = null;
- AbstractMethodDeclaration nextMethodDeclaration = null;
- TypeDeclaration nextMemberDeclaration = null;
+ try {
+ // diet = true;
+ CompilationResult compilationUnitResult = new CompilationResult(
+ unit, 0, 0, 10); // this.options.maxProblemsPerUnit);
+ CompilationUnitDeclaration parsedUnit = parse(unit,
+ compilationUnitResult, start, end);
+ // if (scanner.recordLineSeparator) {
+ // requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+ // }
+ // if (this.localDeclarationVisitor != null || needReferenceInfo){
+ // diet = false;
+ // this.getMethodBodies(parsedUnit);
+ // }
+ // this.scanner.resetTo(start, end);
+ // notifySourceElementRequestor(parsedUnit);
+ } catch (AbortCompilation e) {
+ } finally {
+ // diet = old;
+ }
+ }
- int position = Integer.MAX_VALUE;
- int nextDeclarationType = -1;
- if (fieldIndex < fieldCount) {
- nextFieldDeclaration = fields[fieldIndex];
- if (nextFieldDeclaration.declarationSourceStart < position) {
- position = nextFieldDeclaration.declarationSourceStart;
- nextDeclarationType = 0; // FIELD
- }
- }
- if (methodIndex < methodCount) {
- nextMethodDeclaration = methods[methodIndex];
- if (nextMethodDeclaration.declarationSourceStart < position) {
- position = nextMethodDeclaration.declarationSourceStart;
- nextDeclarationType = 1; // METHOD
- }
- }
- if (memberTypeIndex < memberTypeCount) {
- nextMemberDeclaration = memberTypes[memberTypeIndex];
- if (nextMemberDeclaration.declarationSourceStart < position) {
- position = nextMemberDeclaration.declarationSourceStart;
- nextDeclarationType = 2; // MEMBER
- }
- }
- switch (nextDeclarationType) {
- case 0 :
- fieldIndex++;
- notifySourceElementRequestor(nextFieldDeclaration);
- break;
- case 1 :
- methodIndex++;
- notifySourceElementRequestor(nextMethodDeclaration);
- break;
- case 2 :
- memberTypeIndex++;
- notifySourceElementRequestor(nextMemberDeclaration, true);
- }
- }
- if (notifyTypePresence) {
- if (isInRange) {
- if (isInterface) {
- requestor.exitInterface(typeDeclaration.declarationSourceEnd);
- } else {
- requestor.exitClass(typeDeclaration.declarationSourceEnd);
- }
- }
- nestedTypeIndex--;
- }
- }
- public void parseCompilationUnit(ICompilationUnit unit, int start, int end) {
- // boolean needReferenceInfo) {
+ public CompilationUnitDeclaration parseCompilationUnit(
+ ICompilationUnit unit, boolean fullParse) {
- // reportReferenceInfo = needReferenceInfo;
- // boolean old = diet;
- // if (needReferenceInfo) {
- // unknownRefs = new NameReference[10];
- // unknownRefsCounter = 0;
- // }
+ // boolean old = diet;
+ // if (fullParse) {
+ // unknownRefs = new NameReference[10];
+ // unknownRefsCounter = 0;
+ // }
- try {
- // diet = true;
- CompilationResult compilationUnitResult = new CompilationResult(unit, 0, 0, 10); //this.options.maxProblemsPerUnit);
- CompilationUnitDeclaration parsedUnit = parse(unit, compilationUnitResult, start, end);
- // if (scanner.recordLineSeparator) {
- // requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
- // }
- // if (this.localDeclarationVisitor != null || needReferenceInfo){
- // diet = false;
- // this.getMethodBodies(parsedUnit);
- // }
- // this.scanner.resetTo(start, end);
- // notifySourceElementRequestor(parsedUnit);
- } catch (AbortCompilation e) {
- } finally {
- // diet = old;
- }
- }
- public CompilationUnitDeclaration parseCompilationUnit(ICompilationUnit unit, boolean fullParse) {
+ try {
+ // diet = true;
+ this.reportReferenceInfo = fullParse;
+ CompilationResult compilationUnitResult = new CompilationResult(
+ unit, 0, 0, this.options.maxProblemsPerUnit);
+ CompilationUnitDeclaration parsedUnit = parse(unit,
+ compilationUnitResult, false);
+ if (scanner.recordLineSeparator) {
+ requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+ }
+ int initialStart = this.scanner.initialPosition;
+ int initialEnd = this.scanner.eofPosition;
+ // if (this.localDeclarationVisitor != null || fullParse){
+ // diet = false;
+ // this.getMethodBodies(parsedUnit);
+ // }
+ this.scanner.resetTo(initialStart, initialEnd);
+ notifySourceElementRequestor(parsedUnit);
+ return parsedUnit;
+ } catch (AbortCompilation e) {
+ // ignore this exception
+ } finally {
+ // diet = old;
+ }
+ return null;
+ }
- // boolean old = diet;
- // if (fullParse) {
- // unknownRefs = new NameReference[10];
- // unknownRefsCounter = 0;
- // }
+ public CompilationUnitDeclaration parseCompletionUnit(
+ ICompilationUnit unit, boolean fullParse) {
- try {
- // diet = true;
- this.reportReferenceInfo = fullParse;
- CompilationResult compilationUnitResult = new CompilationResult(unit, 0, 0, this.options.maxProblemsPerUnit);
- CompilationUnitDeclaration parsedUnit = parse(unit, compilationUnitResult, false);
- if (scanner.recordLineSeparator) {
- requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
- }
- int initialStart = this.scanner.initialPosition;
- int initialEnd = this.scanner.eofPosition;
- // if (this.localDeclarationVisitor != null || fullParse){
- // diet = false;
- // this.getMethodBodies(parsedUnit);
- // }
- this.scanner.resetTo(initialStart, initialEnd);
- notifySourceElementRequestor(parsedUnit);
- return parsedUnit;
- } catch (AbortCompilation e) {
- // ignore this exception
- } finally {
- // diet = old;
- }
- return null;
- }
+ // boolean old = diet;
+ // if (fullParse) {
+ // unknownRefs = new NameReference[10];
+ // unknownRefsCounter = 0;
+ // }
- public CompilationUnitDeclaration parseCompletionUnit(ICompilationUnit unit, boolean fullParse) {
+ try {
+ // diet = true;
+ this.reportReferenceInfo = fullParse;
+ CompilationResult compilationUnitResult = new CompilationResult(
+ unit, 0, 0, this.options.maxProblemsPerUnit);
+ CompilationUnitDeclaration parsedUnit = parse(unit,
+ compilationUnitResult, false);
+ // if (scanner.recordLineSeparator) {
+ // requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+ // }
+ // int initialStart = this.scanner.initialPosition;
+ // int initialEnd = this.scanner.eofPosition;
+ // // if (this.localDeclarationVisitor != null || fullParse){
+ // // diet = false;
+ // // this.getMethodBodies(parsedUnit);
+ // // }
+ // this.scanner.resetTo(initialStart, initialEnd);
+ // notifySourceElementRequestor(parsedUnit);
+ return parsedUnit;
+ } catch (AbortCompilation e) {
+ // ignore this exception
+ } finally {
+ // diet = old;
+ }
+ return null;
+ }
- // boolean old = diet;
- // if (fullParse) {
- // unknownRefs = new NameReference[10];
- // unknownRefsCounter = 0;
- // }
+ // public void parseTypeMemberDeclarations(
+ // ISourceType sourceType,
+ // ICompilationUnit sourceUnit,
+ // int start,
+ // int end,
+ // boolean needReferenceInfo) {
+ // boolean old = diet;
+ // if (needReferenceInfo) {
+ // unknownRefs = new NameReference[10];
+ // unknownRefsCounter = 0;
+ // }
+ //
+ // try {
+ // diet = !needReferenceInfo;
+ // reportReferenceInfo = needReferenceInfo;
+ // CompilationResult compilationUnitResult =
+ // new CompilationResult(sourceUnit, 0, 0, this.options.maxProblemsPerUnit);
+ // CompilationUnitDeclaration unit =
+ // SourceTypeConverter.buildCompilationUnit(
+ // new ISourceType[]{sourceType},
+ // false, // no need for field and methods
+ // false, // no need for member types
+ // false, // no need for field initialization
+ // problemReporter(),
+ // compilationUnitResult);
+ // if ((unit == null) || (unit.types == null) || (unit.types.length != 1))
+ // return;
+ // this.sourceType = sourceType;
+ // try {
+ // /* automaton initialization */
+ // initialize();
+ // goForClassBodyDeclarations();
+ // /* scanner initialization */
+ // scanner.setSource(sourceUnit.getContents());
+ // scanner.resetTo(start, end);
+ // /* unit creation */
+ // referenceContext = compilationUnit = unit;
+ // /* initialize the astStacl */
+ // // the compilationUnitDeclaration should contain exactly one type
+ // pushOnAstStack(unit.types[0]);
+ // /* run automaton */
+ // parse();
+ // notifySourceElementRequestor(unit);
+ // } finally {
+ // unit = compilationUnit;
+ // compilationUnit = null; // reset parser
+ // }
+ // } catch (AbortCompilation e) {
+ // } finally {
+ // if (scanner.recordLineSeparator) {
+ // requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+ // }
+ // diet = old;
+ // }
+ // }
+ //
+ // public void parseTypeMemberDeclarations(
+ // char[] contents,
+ // int start,
+ // int end) {
+ //
+ // boolean old = diet;
+ //
+ // try {
+ // diet = true;
+ //
+ // /* automaton initialization */
+ // initialize();
+ // goForClassBodyDeclarations();
+ // /* scanner initialization */
+ // scanner.setSource(contents);
+ // scanner.recordLineSeparator = false;
+ // scanner.taskTags = null;
+ // scanner.taskPriorities = null;
+ // scanner.resetTo(start, end);
+ //
+ // /* unit creation */
+ // referenceContext = null;
+ //
+ // /* initialize the astStacl */
+ // // the compilationUnitDeclaration should contain exactly one type
+ // /* run automaton */
+ // parse();
+ // notifySourceElementRequestor((CompilationUnitDeclaration)null);
+ // } catch (AbortCompilation e) {
+ // } finally {
+ // diet = old;
+ // }
+ // }
+ /**
+ * Sort the given ast nodes by their positions.
+ */
+ private static void quickSort(ASTNode[] sortedCollection, int left,
+ int right) {
+ int original_left = left;
+ int original_right = right;
+ ASTNode mid = sortedCollection[(left + right) / 2];
+ do {
+ while (sortedCollection[left].sourceStart < mid.sourceStart) {
+ left++;
+ }
+ while (mid.sourceStart < sortedCollection[right].sourceStart) {
+ right--;
+ }
+ if (left <= right) {
+ ASTNode tmp = sortedCollection[left];
+ sortedCollection[left] = sortedCollection[right];
+ sortedCollection[right] = tmp;
+ left++;
+ right--;
+ }
+ } while (left <= right);
+ if (original_left < right) {
+ quickSort(sortedCollection, original_left, right);
+ }
+ if (left < original_right) {
+ quickSort(sortedCollection, left, original_right);
+ }
+ }
- try {
- // diet = true;
- this.reportReferenceInfo = fullParse;
- CompilationResult compilationUnitResult = new CompilationResult(unit, 0, 0, this.options.maxProblemsPerUnit);
- CompilationUnitDeclaration parsedUnit = parse(unit, compilationUnitResult, false);
-// if (scanner.recordLineSeparator) {
-// requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
-// }
-// int initialStart = this.scanner.initialPosition;
-// int initialEnd = this.scanner.eofPosition;
-// // if (this.localDeclarationVisitor != null || fullParse){
-// // diet = false;
-// // this.getMethodBodies(parsedUnit);
-// // }
-// this.scanner.resetTo(initialStart, initialEnd);
-// notifySourceElementRequestor(parsedUnit);
- return parsedUnit;
- } catch (AbortCompilation e) {
- // ignore this exception
- } finally {
- // diet = old;
- }
- return null;
- }
- //public void parseTypeMemberDeclarations(
- // ISourceType sourceType,
- // ICompilationUnit sourceUnit,
- // int start,
- // int end,
- // boolean needReferenceInfo) {
- // boolean old = diet;
- // if (needReferenceInfo) {
- // unknownRefs = new NameReference[10];
- // unknownRefsCounter = 0;
- // }
- //
- // try {
- // diet = !needReferenceInfo;
- // reportReferenceInfo = needReferenceInfo;
- // CompilationResult compilationUnitResult =
- // new CompilationResult(sourceUnit, 0, 0, this.options.maxProblemsPerUnit);
- // CompilationUnitDeclaration unit =
- // SourceTypeConverter.buildCompilationUnit(
- // new ISourceType[]{sourceType},
- // false, // no need for field and methods
- // false, // no need for member types
- // false, // no need for field initialization
- // problemReporter(),
- // compilationUnitResult);
- // if ((unit == null) || (unit.types == null) || (unit.types.length != 1))
- // return;
- // this.sourceType = sourceType;
- // try {
- // /* automaton initialization */
- // initialize();
- // goForClassBodyDeclarations();
- // /* scanner initialization */
- // scanner.setSource(sourceUnit.getContents());
- // scanner.resetTo(start, end);
- // /* unit creation */
- // referenceContext = compilationUnit = unit;
- // /* initialize the astStacl */
- // // the compilationUnitDeclaration should contain exactly one type
- // pushOnAstStack(unit.types[0]);
- // /* run automaton */
- // parse();
- // notifySourceElementRequestor(unit);
- // } finally {
- // unit = compilationUnit;
- // compilationUnit = null; // reset parser
- // }
- // } catch (AbortCompilation e) {
- // } finally {
- // if (scanner.recordLineSeparator) {
- // requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
- // }
- // diet = old;
- // }
- //}
- //
- //public void parseTypeMemberDeclarations(
- // char[] contents,
- // int start,
- // int end) {
- //
- // boolean old = diet;
- //
- // try {
- // diet = true;
- //
- // /* automaton initialization */
- // initialize();
- // goForClassBodyDeclarations();
- // /* scanner initialization */
- // scanner.setSource(contents);
- // scanner.recordLineSeparator = false;
- // scanner.taskTags = null;
- // scanner.taskPriorities = null;
- // scanner.resetTo(start, end);
- //
- // /* unit creation */
- // referenceContext = null;
- //
- // /* initialize the astStacl */
- // // the compilationUnitDeclaration should contain exactly one type
- // /* run automaton */
- // parse();
- // notifySourceElementRequestor((CompilationUnitDeclaration)null);
- // } catch (AbortCompilation e) {
- // } finally {
- // diet = old;
- // }
- //}
- /**
- * Sort the given ast nodes by their positions.
- */
- private static void quickSort(ASTNode[] sortedCollection, int left, int right) {
- int original_left = left;
- int original_right = right;
- ASTNode mid = sortedCollection[(left + right) / 2];
- do {
- while (sortedCollection[left].sourceStart < mid.sourceStart) {
- left++;
- }
- while (mid.sourceStart < sortedCollection[right].sourceStart) {
- right--;
- }
- if (left <= right) {
- ASTNode tmp = sortedCollection[left];
- sortedCollection[left] = sortedCollection[right];
- sortedCollection[right] = tmp;
- left++;
- right--;
- }
- } while (left <= right);
- if (original_left < right) {
- quickSort(sortedCollection, original_left, right);
- }
- if (left < original_right) {
- quickSort(sortedCollection, left, original_right);
- }
- }
- /*
- * Answer a char array representation of the type name formatted like: - type
- * name + dimensions Example: "A[][]".toCharArray()
- * "java.lang.String".toCharArray()
- */
- private char[] returnTypeName(TypeReference type) {
- if (type == null)
- return null;
- int dimension = type.dimensions();
- if (dimension != 0) {
- char[] dimensionsArray = new char[dimension * 2];
- for (int i = 0; i < dimension; i++) {
- dimensionsArray[i * 2] = '[';
- dimensionsArray[(i * 2) + 1] = ']';
- }
- return CharOperation.concat(CharOperation.concatWith(type.getTypeName(), '.'), dimensionsArray);
- }
- return CharOperation.concatWith(type.getTypeName(), '.');
- }
+ /*
+ * Answer a char array representation of the type name formatted like: -
+ * type name + dimensions Example: "A[][]".toCharArray()
+ * "java.lang.String".toCharArray()
+ */
+ private char[] returnTypeName(TypeReference type) {
+ if (type == null)
+ return null;
+ int dimension = type.dimensions();
+ if (dimension != 0) {
+ char[] dimensionsArray = new char[dimension * 2];
+ for (int i = 0; i < dimension; i++) {
+ dimensionsArray[i * 2] = '[';
+ dimensionsArray[(i * 2) + 1] = ']';
+ }
+ return CharOperation.concat(CharOperation.concatWith(type
+ .getTypeName(), '.'), dimensionsArray);
+ }
+ return CharOperation.concatWith(type.getTypeName(), '.');
+ }
- public void addUnknownRef(NameReference nameRef) {
- if (this.unknownRefs.length == this.unknownRefsCounter) {
- // resize
- System.arraycopy(this.unknownRefs, 0, (this.unknownRefs = new NameReference[this.unknownRefsCounter * 2]), 0,
- this.unknownRefsCounter);
- }
- this.unknownRefs[this.unknownRefsCounter++] = nameRef;
- }
+ public void addUnknownRef(NameReference nameRef) {
+ if (this.unknownRefs.length == this.unknownRefsCounter) {
+ // resize
+ System
+ .arraycopy(
+ this.unknownRefs,
+ 0,
+ (this.unknownRefs = new NameReference[this.unknownRefsCounter * 2]),
+ 0, this.unknownRefsCounter);
+ }
+ this.unknownRefs[this.unknownRefsCounter++] = nameRef;
+ }
- private void visitIfNeeded(AbstractMethodDeclaration method) {
- if (this.localDeclarationVisitor != null && (method.bits & ASTNode.HasLocalTypeMASK) != 0) {
- if (method.statements != null) {
- int statementsLength = method.statements.length;
- for (int i = 0; i < statementsLength; i++)
- method.statements[i].traverse(this.localDeclarationVisitor, method.scope);
- }
- }
- }
+ private void visitIfNeeded(AbstractMethodDeclaration method) {
+ if (this.localDeclarationVisitor != null
+ && (method.bits & ASTNode.HasLocalTypeMASK) != 0) {
+ if (method.statements != null) {
+ int statementsLength = method.statements.length;
+ for (int i = 0; i < statementsLength; i++)
+ method.statements[i].traverse(this.localDeclarationVisitor,
+ method.scope);
+ }
+ }
+ }
- //private void visitIfNeeded(FieldDeclaration field) {
- // if (this.localDeclarationVisitor != null
- // && (field.bits & ASTNode.HasLocalTypeMASK) != 0) {
- // if (field.initialization != null) {
- // field.initialization.traverse(this.localDeclarationVisitor, null);
- // }
- // }
- //}
- //
- //private void visitIfNeeded(Initializer initializer) {
- // if (this.localDeclarationVisitor != null
- // && (initializer.bits & ASTNode.HasLocalTypeMASK) != 0) {
- // if (initializer.block != null) {
- // initializer.block.traverse(this.localDeclarationVisitor, null);
- // }
- // }
- //}
- //
- //protected void reportSyntaxError(int act, int currentKind, int
- // stateStackTop) {
- // if (compilationUnit == null) return;
- // super.reportSyntaxError(act, currentKind,stateStackTop);
- //}
- protected CompilationUnitDeclaration endParse(int act) {
- // if (sourceType != null) {
- // if (sourceType.isInterface()) {
- // consumeInterfaceDeclaration();
- // } else {
- // consumeClassDeclaration();
- // }
- // }
- if (compilationUnit != null) {
- CompilationUnitDeclaration result = super.endParse(act);
- return result;
- } else {
- return null;
- }
- }
+ // private void visitIfNeeded(FieldDeclaration field) {
+ // if (this.localDeclarationVisitor != null
+ // && (field.bits & ASTNode.HasLocalTypeMASK) != 0) {
+ // if (field.initialization != null) {
+ // field.initialization.traverse(this.localDeclarationVisitor, null);
+ // }
+ // }
+ // }
+ //
+ // private void visitIfNeeded(Initializer initializer) {
+ // if (this.localDeclarationVisitor != null
+ // && (initializer.bits & ASTNode.HasLocalTypeMASK) != 0) {
+ // if (initializer.block != null) {
+ // initializer.block.traverse(this.localDeclarationVisitor, null);
+ // }
+ // }
+ // }
+ //
+ // protected void reportSyntaxError(int act, int currentKind, int
+ // stateStackTop) {
+ // if (compilationUnit == null) return;
+ // super.reportSyntaxError(act, currentKind,stateStackTop);
+ // }
+ protected CompilationUnitDeclaration endParse(int act) {
+ // if (sourceType != null) {
+ // if (sourceType.isInterface()) {
+ // consumeInterfaceDeclaration();
+ // } else {
+ // consumeClassDeclaration();
+ // }
+ // }
+ if (compilationUnit != null) {
+ CompilationUnitDeclaration result = super.endParse(act);
+ return result;
+ } else {
+ return null;
+ }
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AND_AND_Expression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AND_AND_Expression.java
index ea4128a..4efd729 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AND_AND_Expression.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AND_AND_Expression.java
@@ -16,285 +16,298 @@ import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
import net.sourceforge.phpdt.internal.compiler.impl.Constant;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-//dedicated treatment for the &&
+// dedicated treatment for the &&
public class AND_AND_Expression extends BinaryExpression {
int rightInitStateIndex = -1;
+
int mergedInitStateIndex = -1;
public AND_AND_Expression(Expression left, Expression right, int operator) {
super(left, right, operator);
}
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
Constant cst = this.left.optimizedBooleanConstant();
- boolean isLeftOptimizedTrue = cst != NotAConstant && cst.booleanValue() == true;
- boolean isLeftOptimizedFalse = cst != NotAConstant && cst.booleanValue() == false;
+ boolean isLeftOptimizedTrue = cst != NotAConstant
+ && cst.booleanValue() == true;
+ boolean isLeftOptimizedFalse = cst != NotAConstant
+ && cst.booleanValue() == false;
if (isLeftOptimizedTrue) {
// TRUE && anything
- // need to be careful of scenario:
- // (x && y) && !z, if passing the left info to the right, it would be swapped by the !
- FlowInfo mergedInfo = left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- mergedInfo = right.analyseCode(currentScope, flowContext, mergedInfo);
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
+ // need to be careful of scenario:
+ // (x && y) && !z, if passing the left info to the right, it would
+ // be swapped by the !
+ FlowInfo mergedInfo = left.analyseCode(currentScope, flowContext,
+ flowInfo).unconditionalInits();
+ mergedInfo = right.analyseCode(currentScope, flowContext,
+ mergedInfo);
+ mergedInitStateIndex = currentScope.methodScope()
+ .recordInitializationStates(mergedInfo);
return mergedInfo;
}
-
- FlowInfo leftInfo = left.analyseCode(currentScope, flowContext, flowInfo);
- // need to be careful of scenario:
- // (x && y) && !z, if passing the left info to the right, it would be swapped by the !
- FlowInfo rightInfo = leftInfo.initsWhenTrue().unconditionalInits().copy();
- rightInitStateIndex =
- currentScope.methodScope().recordInitializationStates(rightInfo);
+
+ FlowInfo leftInfo = left.analyseCode(currentScope, flowContext,
+ flowInfo);
+ // need to be careful of scenario:
+ // (x && y) && !z, if passing the left info to the right, it would be
+ // swapped by the !
+ FlowInfo rightInfo = leftInfo.initsWhenTrue().unconditionalInits()
+ .copy();
+ rightInitStateIndex = currentScope.methodScope()
+ .recordInitializationStates(rightInfo);
int previousMode = rightInfo.reachMode();
- if (isLeftOptimizedFalse){
- rightInfo.setReachMode(FlowInfo.UNREACHABLE);
+ if (isLeftOptimizedFalse) {
+ rightInfo.setReachMode(FlowInfo.UNREACHABLE);
}
rightInfo = right.analyseCode(currentScope, flowContext, rightInfo);
FlowInfo trueMergedInfo = rightInfo.initsWhenTrue().copy();
- rightInfo.setReachMode(previousMode); // reset after trueMergedInfo got extracted
-
- FlowInfo mergedInfo =
- FlowInfo.conditional(
- trueMergedInfo,
- leftInfo.initsWhenFalse().copy().unconditionalInits().mergedWith(
- rightInfo.initsWhenFalse().copy().unconditionalInits()));
- mergedInitStateIndex =
- currentScope.methodScope().recordInitializationStates(mergedInfo);
+ rightInfo.setReachMode(previousMode); // reset after trueMergedInfo
+ // got extracted
+
+ FlowInfo mergedInfo = FlowInfo
+ .conditional(trueMergedInfo, leftInfo.initsWhenFalse().copy()
+ .unconditionalInits().mergedWith(
+ rightInfo.initsWhenFalse().copy()
+ .unconditionalInits()));
+ mergedInitStateIndex = currentScope.methodScope()
+ .recordInitializationStates(mergedInfo);
return mergedInfo;
}
/**
* Code generation for a binary operation
*/
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// Label falseLabel, endLabel;
-// if (constant != Constant.NotAConstant) {
-// // inlined value
-// if (valueRequired)
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// bits |= OnlyValueRequiredMASK;
-// generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// /* improving code gen for such a case: boolean b = i < 0 && false
-// * since the label has never been used, we have the inlined value on the stack. */
-// if (falseLabel.hasForwardReferences()) {
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// } else {
-// falseLabel.place();
-// }
-// }
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-
+ // public void generateCode(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // boolean valueRequired) {
+ //
+ // int pc = codeStream.position;
+ // Label falseLabel, endLabel;
+ // if (constant != Constant.NotAConstant) {
+ // // inlined value
+ // if (valueRequired)
+ // codeStream.generateConstant(constant, implicitConversion);
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // return;
+ // }
+ // bits |= OnlyValueRequiredMASK;
+ // generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // null,
+ // (falseLabel = new Label(codeStream)),
+ // valueRequired);
+ // /* improving code gen for such a case: boolean b = i < 0 && false
+ // * since the label has never been used, we have the inlined value on the
+ // stack. */
+ // if (falseLabel.hasForwardReferences()) {
+ // if (valueRequired) {
+ // codeStream.iconst_1();
+ // if ((bits & ValueForReturnMASK) != 0) {
+ // codeStream.ireturn();
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // } else {
+ // codeStream.goto_(endLabel = new Label(codeStream));
+ // codeStream.decrStackSize(1);
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // endLabel.place();
+ // }
+ // } else {
+ // falseLabel.place();
+ // }
+ // }
+ // if (valueRequired) {
+ // codeStream.generateImplicitConversion(implicitConversion);
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // }
/**
- * Boolean operator code generation
- * Optimized operations are: &&
+ * Boolean operator code generation Optimized operations are: &&
*/
-// public void generateOptimizedBoolean(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// if (constant != Constant.NotAConstant) {
-// super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
-// return;
-// }
-// Constant condConst;
-// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // && x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// } else {
-// // && x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_0();
-// } else {
-// if (falseLabel != null) {
-// // implicit falling through the TRUE case
-// codeStream.goto_(falseLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// return;
-// }
-// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // x &&
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// } else {
-// // x &&
-// Label internalTrueLabel = new Label(codeStream);
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// internalTrueLabel, // will be false in the end
-// null,
-// false);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// internalTrueLabel.place();
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_0();
-// } else {
-// if (falseLabel != null) {
-// // implicit falling through the TRUE case
-// codeStream.goto_(falseLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// return;
-// }
-// // default case
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// Label internalFalseLabel = new Label(codeStream);
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// internalFalseLabel,
-// true);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// null,
-// valueRequired);
-// internalFalseLabel.place();
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// left.generateOptimizedBoolean(currentScope, codeStream, null, falseLabel, true);
-// if (rightInitStateIndex != -1) {
-// codeStream.addDefinitelyAssignedVariables(currentScope, rightInitStateIndex);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// null,
-// falseLabel,
-// valueRequired);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// if (mergedInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(
-// currentScope,
-// mergedInitStateIndex);
-// }
-// }
-
+ // public void generateOptimizedBoolean(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Label trueLabel,
+ // Label falseLabel,
+ // boolean valueRequired) {
+ //
+ // if (constant != Constant.NotAConstant) {
+ // super.generateOptimizedBoolean(currentScope, codeStream, trueLabel,
+ // falseLabel, valueRequired);
+ // return;
+ // }
+ // Constant condConst;
+ // if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
+ // if (condConst.booleanValue() == true) {
+ // // && x
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // if (rightInitStateIndex != -1) {
+ // codeStream.addDefinitelyAssignedVariables(currentScope,
+ // rightInitStateIndex);
+ // }
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // }
+ // } else {
+ // // && x
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // if (valueRequired) {
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // codeStream.iconst_0();
+ // } else {
+ // if (falseLabel != null) {
+ // // implicit falling through the TRUE case
+ // codeStream.goto_(falseLabel);
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // }
+ // if (mergedInitStateIndex != -1) {
+ // codeStream.removeNotDefinitelyAssignedVariables(
+ // currentScope,
+ // mergedInitStateIndex);
+ // }
+ // return;
+ // }
+ // if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
+ // if (condConst.booleanValue() == true) {
+ // // x &&
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // }
+ // if (rightInitStateIndex != -1) {
+ // codeStream.addDefinitelyAssignedVariables(currentScope,
+ // rightInitStateIndex);
+ // }
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // } else {
+ // // x &&
+ // Label internalTrueLabel = new Label(codeStream);
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // internalTrueLabel, // will be false in the end
+ // null,
+ // false);
+ // if (rightInitStateIndex != -1) {
+ // codeStream.addDefinitelyAssignedVariables(currentScope,
+ // rightInitStateIndex);
+ // }
+ // internalTrueLabel.place();
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // if (valueRequired) {
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // codeStream.iconst_0();
+ // } else {
+ // if (falseLabel != null) {
+ // // implicit falling through the TRUE case
+ // codeStream.goto_(falseLabel);
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // }
+ // if (mergedInitStateIndex != -1) {
+ // codeStream.removeNotDefinitelyAssignedVariables(
+ // currentScope,
+ // mergedInitStateIndex);
+ // }
+ // return;
+ // }
+ // // default case
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicit falling through the FALSE case
+ // Label internalFalseLabel = new Label(codeStream);
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // null,
+ // internalFalseLabel,
+ // true);
+ // if (rightInitStateIndex != -1) {
+ // codeStream.addDefinitelyAssignedVariables(currentScope,
+ // rightInitStateIndex);
+ // }
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // null,
+ // valueRequired);
+ // internalFalseLabel.place();
+ // }
+ // } else {
+ // // implicit falling through the TRUE case
+ // if (trueLabel == null) {
+ // left.generateOptimizedBoolean(currentScope, codeStream, null, falseLabel,
+ // true);
+ // if (rightInitStateIndex != -1) {
+ // codeStream.addDefinitelyAssignedVariables(currentScope,
+ // rightInitStateIndex);
+ // }
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // null,
+ // falseLabel,
+ // valueRequired);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // if (mergedInitStateIndex != -1) {
+ // codeStream.removeNotDefinitelyAssignedVariables(
+ // currentScope,
+ // mergedInitStateIndex);
+ // }
+ // }
public boolean isCompactableOperation() {
return false;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ASTNode.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ASTNode.java
index 7c429a6..a575451 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ASTNode.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ASTNode.java
@@ -24,91 +24,171 @@ import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeConstants;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeIds;
+public abstract class ASTNode implements BaseTypes, CompilerModifiers,
+ TypeConstants, TypeIds {
-public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConstants, TypeIds {
-
public int sourceStart, sourceEnd;
- //some global provision for the hierarchy
+ // some global provision for the hierarchy
public final static Constant NotAConstant = Constant.NotAConstant;
- // storage for internal flags (32 bits) BIT USAGE
- public final static int Bit1 = 0x1; // return type (operators) | name reference kind (name ref) | add assertion (type decl)
- public final static int Bit2 = 0x2; // return type (operators) | name reference kind (name ref) | has local type (type, method, field decl)
- public final static int Bit3 = 0x4; // return type (operators) | name reference kind (name ref) | implicit this (this ref)
- public final static int Bit4 = 0x8; // return type (operators) | first assignment to local (local decl)
- public final static int Bit5 = 0x10; // value for return (binary expression) |
- public final static int Bit6 = 0x20; // depth (name ref, msg) | only value required (binary expression)
- public final static int Bit7 = 0x40; // depth (name ref, msg) | operator (operators)
- public final static int Bit8 = 0x80; // depth (name ref, msg) | operator (operators)
- public final static int Bit9 = 0x100; // depth (name ref, msg) | operator (operators)
- public final static int Bit10= 0x200; // depth (name ref, msg) | operator (operators)
- public final static int Bit11 = 0x400; // depth (name ref, msg) | operator (operators)
- public final static int Bit12 = 0x800; // depth (name ref, msg) | operator (operators)
- public final static int Bit13 = 0x1000; // depth (name ref, msg)
- public final static int Bit14 = 0x2000; // assigned (reference lhs)
- public final static int Bit15 = 0x4000;
- public final static int Bit16 = 0x8000;
- public final static int Bit17 = 0x10000;
- public final static int Bit18 = 0x20000;
- public final static int Bit19 = 0x40000;
- public final static int Bit20 = 0x80000;
- public final static int Bit21 = 0x100000;
- public final static int Bit22 = 0x200000; // parenthesis count (expression)
- public final static int Bit23 = 0x400000; // parenthesis count (expression)
- public final static int Bit24 = 0x800000; // parenthesis count (expression)
- public final static int Bit25 = 0x1000000; // parenthesis count (expression)
- public final static int Bit26 = 0x2000000; // parenthesis count (expression)
- public final static int Bit27 = 0x4000000; // parenthesis count (expression)
- public final static int Bit28 = 0x8000000; // parenthesis count (expression)
- public final static int Bit29 = 0x10000000; // parenthesis count (expression)
- public final static int Bit30 = 0x20000000; // assignment with no effect (assignment)
- public final static int Bit31 = 0x40000000; // local declaration reachable (local decl)
- public final static int Bit32 = 0x80000000; // reachable (statement)
-
- public int bits = IsReachableMASK; // reachable by default
-
- // for operators
- public static final int ReturnTypeIDMASK = Bit1|Bit2|Bit3|Bit4;
- public static final int OperatorSHIFT = 6; // Bit7 -> Bit12
- public static final int OperatorMASK = Bit7|Bit8|Bit9|Bit10|Bit11|Bit12; // 6 bits for operator ID
+ // storage for internal flags (32 bits) BIT USAGE
+ public final static int Bit1 = 0x1; // return type (operators) | name
+ // reference kind (name ref) | add
+ // assertion (type decl)
+
+ public final static int Bit2 = 0x2; // return type (operators) | name
+ // reference kind (name ref) | has local
+ // type (type, method, field decl)
+
+ public final static int Bit3 = 0x4; // return type (operators) | name
+ // reference kind (name ref) | implicit
+ // this (this ref)
+
+ public final static int Bit4 = 0x8; // return type (operators) | first
+ // assignment to local (local decl)
+
+ public final static int Bit5 = 0x10; // value for return (binary
+ // expression) |
+
+ public final static int Bit6 = 0x20; // depth (name ref, msg) | only
+ // value required (binary
+ // expression)
+
+ public final static int Bit7 = 0x40; // depth (name ref, msg) | operator
+ // (operators)
+
+ public final static int Bit8 = 0x80; // depth (name ref, msg) | operator
+ // (operators)
+
+ public final static int Bit9 = 0x100; // depth (name ref, msg) | operator
+ // (operators)
+
+ public final static int Bit10 = 0x200; // depth (name ref, msg) | operator
+ // (operators)
+
+ public final static int Bit11 = 0x400; // depth (name ref, msg) | operator
+ // (operators)
+
+ public final static int Bit12 = 0x800; // depth (name ref, msg) | operator
+ // (operators)
+
+ public final static int Bit13 = 0x1000; // depth (name ref, msg)
+
+ public final static int Bit14 = 0x2000; // assigned (reference lhs)
+
+ public final static int Bit15 = 0x4000;
+
+ public final static int Bit16 = 0x8000;
+
+ public final static int Bit17 = 0x10000;
+
+ public final static int Bit18 = 0x20000;
+
+ public final static int Bit19 = 0x40000;
+
+ public final static int Bit20 = 0x80000;
+
+ public final static int Bit21 = 0x100000;
+
+ public final static int Bit22 = 0x200000; // parenthesis count
+ // (expression)
+
+ public final static int Bit23 = 0x400000; // parenthesis count
+ // (expression)
+
+ public final static int Bit24 = 0x800000; // parenthesis count
+ // (expression)
+
+ public final static int Bit25 = 0x1000000; // parenthesis count
+ // (expression)
+
+ public final static int Bit26 = 0x2000000; // parenthesis count
+ // (expression)
+
+ public final static int Bit27 = 0x4000000; // parenthesis count
+ // (expression)
+
+ public final static int Bit28 = 0x8000000; // parenthesis count
+ // (expression)
+
+ public final static int Bit29 = 0x10000000; // parenthesis count
+ // (expression)
+
+ public final static int Bit30 = 0x20000000; // assignment with no effect
+ // (assignment)
+
+ public final static int Bit31 = 0x40000000; // local declaration reachable
+ // (local decl)
+
+ public final static int Bit32 = 0x80000000; // reachable (statement)
+
+ public int bits = IsReachableMASK; // reachable by default
+
+ // for operators
+ public static final int ReturnTypeIDMASK = Bit1 | Bit2 | Bit3 | Bit4;
+
+ public static final int OperatorSHIFT = 6; // Bit7 -> Bit12
+
+ public static final int OperatorMASK = Bit7 | Bit8 | Bit9 | Bit10 | Bit11
+ | Bit12; // 6 bits for operator ID
// for binary expressions
- public static final int ValueForReturnMASK = Bit5;
- public static final int OnlyValueRequiredMASK = Bit6;
+ public static final int ValueForReturnMASK = Bit5;
+
+ public static final int OnlyValueRequiredMASK = Bit6;
+
+ // for name references
+ public static final int RestrictiveFlagMASK = Bit1 | Bit2 | Bit3;
- // for name references
- public static final int RestrictiveFlagMASK = Bit1|Bit2|Bit3;
public static final int FirstAssignmentToLocalMASK = Bit4;
-
+
// for this reference
- public static final int IsImplicitThisMask = Bit3;
+ public static final int IsImplicitThisMask = Bit3;
// for single name references
- public static final int DepthSHIFT = 5; // Bit6 -> Bit13
- public static final int DepthMASK = Bit6|Bit7|Bit8|Bit9|Bit10|Bit11|Bit12|Bit13; // 8 bits for actual depth value (max. 255)
+ public static final int DepthSHIFT = 5; // Bit6 -> Bit13
+
+ public static final int DepthMASK = Bit6 | Bit7 | Bit8 | Bit9 | Bit10
+ | Bit11 | Bit12 | Bit13; // 8 bits for actual depth value (max.
+ // 255)
+
+ // for statements
+ public static final int IsReachableMASK = Bit32;
- // for statements
- public static final int IsReachableMASK = Bit32;
- public static final int IsLocalDeclarationReachableMASK = Bit31;
+ public static final int IsLocalDeclarationReachableMASK = Bit31;
// for type declaration
public static final int AddAssertionMASK = Bit1;
- public static final int IsMemberTypeMASK = Bit11; // local member do not know it is local at parse time (need to look at binding)
-
- // for type, method and field declarations
- public static final int HasLocalTypeMASK = Bit2; // cannot conflict with AddAssertionMASK
- // for expression
+ public static final int IsMemberTypeMASK = Bit11; // local member do not
+ // know it is local at
+ // parse time (need to
+ // look at binding)
+
+ // for type, method and field declarations
+ public static final int HasLocalTypeMASK = Bit2; // cannot conflict with
+ // AddAssertionMASK
+
+ // for expression
public static final int ParenthesizedSHIFT = 21; // Bit22 -> Bit29
- public static final int ParenthesizedMASK = Bit22|Bit23|Bit24|Bit25|Bit26|Bit27|Bit28|Bit29; // 8 bits for parenthesis count value (max. 255)
+
+ public static final int ParenthesizedMASK = Bit22 | Bit23 | Bit24 | Bit25
+ | Bit26 | Bit27 | Bit28 | Bit29; // 8 bits for parenthesis count
+ // value (max. 255)
// for assignment
- public static final int IsAssignmentWithNoEffectMASK = Bit30;
-
- // for references on lhs of assignment (set only for true assignments, as opposed to compound ones)
+ public static final int IsAssignmentWithNoEffectMASK = Bit30;
+
+ // for references on lhs of assignment (set only for true assignments, as
+ // opposed to compound ones)
public static final int IsStrictlyAssignedMASK = Bit14;
- public static final int IsCompoundAssignedMASK = Bit17; // set only for compound assignments, as opposed to other ones
+
+ public static final int IsCompoundAssignedMASK = Bit17; // set only for
+ // compound
+ // assignments, as
+ // opposed to other
+ // ones
// for empty statement
public static final int IsUsefulEmptyStatementMASK = Bit1;
@@ -118,13 +198,13 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
// for compilation unit
public static final int HasAllMethodBodies = Bit5;
-
+
// for references in Javadoc comments
public static final int InsideJavadoc = Bit16;
-
+
// for if statement
public static final int IsElseIfStatement = Bit30;
-
+
public ASTNode() {
super();
@@ -138,48 +218,59 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
return this;
}
- /* Answer true if the field use is considered deprecated.
- * An access in the same compilation unit is allowed.
- */
+ /*
+ * Answer true if the field use is considered deprecated. An access in the
+ * same compilation unit is allowed.
+ */
public final boolean isFieldUseDeprecated(FieldBinding field, Scope scope) {
if (field.isPrivate() && !scope.isDefinedInField(field)) {
- // ignore cases where field is used from within inside itself
+ // ignore cases where field is used from within inside itself
field.modifiers |= AccPrivateUsed;
}
- if (!field.isViewedAsDeprecated()) return false;
+ if (!field.isViewedAsDeprecated())
+ return false;
// inside same unit - no report
- if (scope.isDefinedInSameUnit(field.declaringClass)) return false;
-
+ if (scope.isDefinedInSameUnit(field.declaringClass))
+ return false;
+
// if context is deprecated, may avoid reporting
-// if (!scope.environment().options.reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false;
+ // if
+ // (!scope.environment().options.reportDeprecationInsideDeprecatedCode
+ // && scope.isInsideDeprecatedCode()) return false;
return true;
}
public boolean isImplicitThis() {
-
+
return false;
}
-
- /* Answer true if the method use is considered deprecated.
- * An access in the same compilation unit is allowed.
- */
+
+ /*
+ * Answer true if the method use is considered deprecated. An access in the
+ * same compilation unit is allowed.
+ */
public final boolean isMethodUseDeprecated(MethodBinding method, Scope scope) {
if (method.isPrivate() && !scope.isDefinedInMethod(method)) {
- // ignore cases where method is used from within inside itself (e.g. direct recursions)
+ // ignore cases where method is used from within inside itself (e.g.
+ // direct recursions)
method.modifiers |= AccPrivateUsed;
}
-
- if (!method.isViewedAsDeprecated()) return false;
+
+ if (!method.isViewedAsDeprecated())
+ return false;
// inside same unit - no report
- if (scope.isDefinedInSameUnit(method.declaringClass)) return false;
-
+ if (scope.isDefinedInSameUnit(method.declaringClass))
+ return false;
+
// if context is deprecated, may avoid reporting
-// if (!scope.environment().options.reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false;
+ // if
+ // (!scope.environment().options.reportDeprecationInsideDeprecatedCode
+ // && scope.isInsideDeprecatedCode()) return false;
return true;
}
@@ -193,9 +284,10 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
return false;
}
- /* Answer true if the type use is considered deprecated.
- * An access in the same compilation unit is allowed.
- */
+ /*
+ * Answer true if the type use is considered deprecated. An access in the
+ * same compilation unit is allowed.
+ */
public final boolean isTypeUseDeprecated(TypeBinding type, Scope scope) {
if (type.isArrayType())
@@ -206,17 +298,21 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
ReferenceBinding refType = (ReferenceBinding) type;
if (refType.isPrivate() && !scope.isDefinedInType(refType)) {
- // ignore cases where type is used from within inside itself
+ // ignore cases where type is used from within inside itself
refType.modifiers |= AccPrivateUsed;
}
- if (!refType.isViewedAsDeprecated()) return false;
-
+ if (!refType.isViewedAsDeprecated())
+ return false;
+
// inside same unit - no report
- if (scope.isDefinedInSameUnit(refType)) return false;
-
+ if (scope.isDefinedInSameUnit(refType))
+ return false;
+
// if context is deprecated, may avoid reporting
-// if (!scope.environment().options.reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false;
+ // if
+ // (!scope.environment().options.reportDeprecationInsideDeprecatedCode
+ // && scope.isInsideDeprecatedCode()) return false;
return true;
}
@@ -233,14 +329,14 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
s = s + "static "; //$NON-NLS-1$
if ((modifiers & AccFinal) != 0)
s = s + "final "; //$NON-NLS-1$
-// if ((modifiers & AccSynchronized) != 0)
-// s = s + "synchronized "; //$NON-NLS-1$
-// if ((modifiers & AccVolatile) != 0)
-// s = s + "volatile "; //$NON-NLS-1$
-// if ((modifiers & AccTransient) != 0)
-// s = s + "transient "; //$NON-NLS-1$
-// if ((modifiers & AccNative) != 0)
-// s = s + "native "; //$NON-NLS-1$
+ // if ((modifiers & AccSynchronized) != 0)
+ // s = s + "synchronized "; //$NON-NLS-1$
+ // if ((modifiers & AccVolatile) != 0)
+ // s = s + "volatile "; //$NON-NLS-1$
+ // if ((modifiers & AccTransient) != 0)
+ // s = s + "transient "; //$NON-NLS-1$
+ // if ((modifiers & AccNative) != 0)
+ // s = s + "native "; //$NON-NLS-1$
if ((modifiers & AccAbstract) != 0)
s = s + "abstract "; //$NON-NLS-1$
return s;
@@ -250,7 +346,8 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
public static StringBuffer printIndent(int indent, StringBuffer output) {
- for (int i = indent; i > 0; i--) output.append(" "); //$NON-NLS-1$
+ for (int i = indent; i > 0; i--)
+ output.append(" "); //$NON-NLS-1$
return output;
}
@@ -266,28 +363,29 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
output.append("static "); //$NON-NLS-1$
if ((modifiers & AccFinal) != 0)
output.append("final "); //$NON-NLS-1$
-// if ((modifiers & AccSynchronized) != 0)
-// output.append("synchronized "); //$NON-NLS-1$
-// if ((modifiers & AccVolatile) != 0)
-// output.append("volatile "); //$NON-NLS-1$
-// if ((modifiers & AccTransient) != 0)
-// output.append("transient "); //$NON-NLS-1$
-// if ((modifiers & AccNative) != 0)
-// output.append("native "); //$NON-NLS-1$
+ // if ((modifiers & AccSynchronized) != 0)
+ // output.append("synchronized "); //$NON-NLS-1$
+ // if ((modifiers & AccVolatile) != 0)
+ // output.append("volatile "); //$NON-NLS-1$
+ // if ((modifiers & AccTransient) != 0)
+ // output.append("transient "); //$NON-NLS-1$
+ // if ((modifiers & AccNative) != 0)
+ // output.append("native "); //$NON-NLS-1$
if ((modifiers & AccAbstract) != 0)
output.append("abstract "); //$NON-NLS-1$
return output;
}
- /**
+
+ /**
* @deprecated - use field instead
- */
+ */
public int sourceEnd() {
return sourceEnd;
}
-
- /**
+
+ /**
* @deprecated - use field instead
- */
+ */
public int sourceStart() {
return sourceStart;
}
@@ -307,9 +405,9 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
public String toString(int tab) {
- return "****" + super.toString() + "****"; //$NON-NLS-2$ //$NON-NLS-1$
+ return "****" + super.toString() + "****"; //$NON-NLS-2$ //$NON-NLS-1$
}
-
+
public void traverse(ASTVisitor visitor, BlockScope scope) {
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractMethodDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractMethodDeclaration.java
index 9c001cc..004039f 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractMethodDeclaration.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractMethodDeclaration.java
@@ -28,37 +28,51 @@ import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
+public abstract class AbstractMethodDeclaration extends ASTNode implements
+ ProblemSeverities, ReferenceContext {
-public abstract class AbstractMethodDeclaration
- extends ASTNode
- implements ProblemSeverities, ReferenceContext {
-
public MethodScope scope;
- //it is not relevent for constructor but it helps to have the name of the constructor here
- //which is always the name of the class.....parsing do extra work to fill it up while it do not have to....
+
+ // it is not relevent for constructor but it helps to have the name of the
+ // constructor here
+ // which is always the name of the class.....parsing do extra work to fill
+ // it up while it do not have to....
public char[] selector;
+
public int declarationSourceStart;
+
public int declarationSourceEnd;
+
public int modifiers;
+
public int modifiersSourceStart;
+
public Argument[] arguments;
+
public TypeReference[] thrownExceptions;
+
public Statement[] statements;
+
public int explicitDeclarations;
+
public MethodBinding binding;
+
public boolean ignoreFurtherInvestigation = false;
+
public boolean needFreeReturn = false;
-
+
public int bodyStart;
+
public int bodyEnd = -1;
+
public CompilationResult compilationResult;
-
- AbstractMethodDeclaration(CompilationResult compilationResult){
+
+ AbstractMethodDeclaration(CompilationResult compilationResult) {
this.compilationResult = compilationResult;
}
-
+
/*
- * We cause the compilation task to abort to a given extent.
+ * We cause the compilation task to abort to a given extent.
*/
public void abort(int abortLevel) {
@@ -66,48 +80,51 @@ public abstract class AbstractMethodDeclaration
throw new AbortCompilation(); // cannot do better
}
- CompilationResult compilationResult =
- scope.referenceCompilationUnit().compilationResult;
+ CompilationResult compilationResult = scope.referenceCompilationUnit().compilationResult;
switch (abortLevel) {
- case AbortCompilation :
- throw new AbortCompilation(compilationResult);
- case AbortCompilationUnit :
- throw new AbortCompilationUnit(compilationResult);
- case AbortType :
- throw new AbortType(compilationResult);
- default :
- throw new AbortMethod(compilationResult);
+ case AbortCompilation:
+ throw new AbortCompilation(compilationResult);
+ case AbortCompilationUnit:
+ throw new AbortCompilationUnit(compilationResult);
+ case AbortType:
+ throw new AbortType(compilationResult);
+ default:
+ throw new AbortMethod(compilationResult);
}
}
- public abstract void analyseCode(ClassScope scope, InitializationFlowContext initializationContext, FlowInfo info);
+ public abstract void analyseCode(ClassScope scope,
+ InitializationFlowContext initializationContext, FlowInfo info);
- /**
+ /**
* Bind and add argument's binding into the scope of the method
*/
public void bindArguments() {
if (arguments != null) {
- // by default arguments in abstract/native methods are considered to be used (no complaint is expected)
- boolean used = binding == null || binding.isAbstract();// || binding.isNative();
+ // by default arguments in abstract/native methods are considered to
+ // be used (no complaint is expected)
+ boolean used = binding == null || binding.isAbstract();// ||
+ // binding.isNative();
int length = arguments.length;
for (int i = 0; i < length; i++) {
- TypeBinding argType = binding == null ? null : binding.parameters[i];
+ TypeBinding argType = binding == null ? null
+ : binding.parameters[i];
arguments[i].bind(scope, argType, used);
}
}
}
/**
- * Record the thrown exception type bindings in the corresponding type references.
+ * Record the thrown exception type bindings in the corresponding type
+ * references.
*/
public void bindThrownExceptions() {
- if (this.thrownExceptions != null
- && this.binding != null
- && this.binding.thrownExceptions != null) {
+ if (this.thrownExceptions != null && this.binding != null
+ && this.binding.thrownExceptions != null) {
int thrownExceptionLength = this.thrownExceptions.length;
int length = this.binding.thrownExceptions.length;
if (length == thrownExceptionLength) {
@@ -116,24 +133,28 @@ public abstract class AbstractMethodDeclaration
}
} else {
int bindingIndex = 0;
- for (int i = 0; i < thrownExceptionLength && bindingIndex < length; i++) {
+ for (int i = 0; i < thrownExceptionLength
+ && bindingIndex < length; i++) {
TypeReference thrownException = this.thrownExceptions[i];
ReferenceBinding thrownExceptionBinding = this.binding.thrownExceptions[bindingIndex];
char[][] bindingCompoundName = thrownExceptionBinding.compoundName;
if (thrownException instanceof SingleTypeReference) {
// single type reference
int lengthName = bindingCompoundName.length;
- char[] thrownExceptionTypeName = thrownException.getTypeName()[0];
- if (CharOperation.equals(thrownExceptionTypeName, bindingCompoundName[lengthName - 1])) {
+ char[] thrownExceptionTypeName = thrownException
+ .getTypeName()[0];
+ if (CharOperation.equals(thrownExceptionTypeName,
+ bindingCompoundName[lengthName - 1])) {
thrownException.resolvedType = thrownExceptionBinding;
bindingIndex++;
}
} else {
// qualified type reference
- if (CharOperation.equals(thrownException.getTypeName(), bindingCompoundName)) {
+ if (CharOperation.equals(thrownException.getTypeName(),
+ bindingCompoundName)) {
thrownException.resolvedType = thrownExceptionBinding;
bindingIndex++;
- }
+ }
}
}
}
@@ -141,123 +162,126 @@ public abstract class AbstractMethodDeclaration
}
public CompilationResult compilationResult() {
-
+
return this.compilationResult;
}
-
+
/**
* Bytecode generation for a method
*/
-// public void generateCode(ClassScope classScope, ClassFile classFile) {
-//
-// int problemResetPC = 0;
-// classFile.codeStream.wideMode = false; // reset wideMode to false
-// if (ignoreFurtherInvestigation) {
-// // method is known to have errors, dump a problem method
-// if (this.binding == null)
-// return; // handle methods with invalid signature or duplicates
-// int problemsLength;
-// IProblem[] problems =
-// scope.referenceCompilationUnit().compilationResult.getProblems();
-// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
-// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
-// classFile.addProblemMethod(this, binding, problemsCopy);
-// return;
-// }
-// // regular code generation
-// try {
-// problemResetPC = classFile.contentsOffset;
-// this.generateCode(classFile);
-// } catch (AbortMethod e) {
-// // a fatal error was detected during code generation, need to restart code gen if possible
-// if (e.compilationResult == CodeStream.RESTART_IN_WIDE_MODE) {
-// // a branch target required a goto_w, restart code gen in wide mode.
-// try {
-// this.traverse(new ResetStateForCodeGenerationVisitor(), classScope);
-// classFile.contentsOffset = problemResetPC;
-// classFile.methodCount--;
-// classFile.codeStream.wideMode = true; // request wide mode
-// this.generateCode(classFile); // restart method generation
-// } catch (AbortMethod e2) {
-// int problemsLength;
-// IProblem[] problems =
-// scope.referenceCompilationUnit().compilationResult.getAllProblems();
-// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
-// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
-// classFile.addProblemMethod(this, binding, problemsCopy, problemResetPC);
-// }
-// } else {
-// // produce a problem method accounting for this fatal error
-// int problemsLength;
-// IProblem[] problems =
-// scope.referenceCompilationUnit().compilationResult.getAllProblems();
-// IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
-// System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
-// classFile.addProblemMethod(this, binding, problemsCopy, problemResetPC);
-// }
-// }
-// }
-//
-// private void generateCode(ClassFile classFile) {
-//
-// classFile.generateMethodInfoHeader(binding);
-// int methodAttributeOffset = classFile.contentsOffset;
-// int attributeNumber = classFile.generateMethodInfoAttribute(binding);
-// if ((!binding.isNative()) && (!binding.isAbstract())) {
-// int codeAttributeOffset = classFile.contentsOffset;
-// classFile.generateCodeAttributeHeader();
-// CodeStream codeStream = classFile.codeStream;
-// codeStream.reset(this, classFile);
-// // initialize local positions
-// this.scope.computeLocalVariablePositions(binding.isStatic() ? 0 : 1, codeStream);
-//
-// // arguments initialization for local variable debug attributes
-// if (arguments != null) {
-// for (int i = 0, max = arguments.length; i < max; i++) {
-// LocalVariableBinding argBinding;
-// codeStream.addVisibleLocalVariable(argBinding = arguments[i].binding);
-// argBinding.recordInitializationStartPC(0);
-// }
-// }
-// if (statements != null) {
-// for (int i = 0, max = statements.length; i < max; i++)
-// statements[i].generateCode(scope, codeStream);
-// }
-// if (this.needFreeReturn) {
-// codeStream.return_();
-// }
-// // local variable attributes
-// codeStream.exitUserScope(scope);
-// codeStream.recordPositionsFrom(0, this.declarationSourceEnd);
-// classFile.completeCodeAttribute(codeAttributeOffset);
-// attributeNumber++;
-// } else {
-// checkArgumentsSize();
-// }
-// classFile.completeMethodInfo(methodAttributeOffset, attributeNumber);
-//
-// // if a problem got reported during code gen, then trigger problem method creation
-// if (ignoreFurtherInvestigation) {
-// throw new AbortMethod(scope.referenceCompilationUnit().compilationResult);
-// }
-// }
-
-// private void checkArgumentsSize() {
-// TypeBinding[] parameters = binding.parameters;
-// int size = 1; // an abstact method or a native method cannot be static
-// for (int i = 0, max = parameters.length; i < max; i++) {
-// TypeBinding parameter = parameters[i];
-// if (parameter == LongBinding || parameter == DoubleBinding) {
-// size += 2;
-// } else {
-// size++;
-// }
-// if (size > 0xFF) {
-// scope.problemReporter().noMoreAvailableSpaceForArgument(scope.locals[i], scope.locals[i].declaration);
-// }
-// }
-// }
-
+ // public void generateCode(ClassScope classScope, ClassFile classFile) {
+ //
+ // int problemResetPC = 0;
+ // classFile.codeStream.wideMode = false; // reset wideMode to false
+ // if (ignoreFurtherInvestigation) {
+ // // method is known to have errors, dump a problem method
+ // if (this.binding == null)
+ // return; // handle methods with invalid signature or duplicates
+ // int problemsLength;
+ // IProblem[] problems =
+ // scope.referenceCompilationUnit().compilationResult.getProblems();
+ // IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+ // System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+ // classFile.addProblemMethod(this, binding, problemsCopy);
+ // return;
+ // }
+ // // regular code generation
+ // try {
+ // problemResetPC = classFile.contentsOffset;
+ // this.generateCode(classFile);
+ // } catch (AbortMethod e) {
+ // // a fatal error was detected during code generation, need to restart
+ // code gen if possible
+ // if (e.compilationResult == CodeStream.RESTART_IN_WIDE_MODE) {
+ // // a branch target required a goto_w, restart code gen in wide mode.
+ // try {
+ // this.traverse(new ResetStateForCodeGenerationVisitor(), classScope);
+ // classFile.contentsOffset = problemResetPC;
+ // classFile.methodCount--;
+ // classFile.codeStream.wideMode = true; // request wide mode
+ // this.generateCode(classFile); // restart method generation
+ // } catch (AbortMethod e2) {
+ // int problemsLength;
+ // IProblem[] problems =
+ // scope.referenceCompilationUnit().compilationResult.getAllProblems();
+ // IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+ // System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+ // classFile.addProblemMethod(this, binding, problemsCopy, problemResetPC);
+ // }
+ // } else {
+ // // produce a problem method accounting for this fatal error
+ // int problemsLength;
+ // IProblem[] problems =
+ // scope.referenceCompilationUnit().compilationResult.getAllProblems();
+ // IProblem[] problemsCopy = new IProblem[problemsLength = problems.length];
+ // System.arraycopy(problems, 0, problemsCopy, 0, problemsLength);
+ // classFile.addProblemMethod(this, binding, problemsCopy, problemResetPC);
+ // }
+ // }
+ // }
+ //
+ // private void generateCode(ClassFile classFile) {
+ //
+ // classFile.generateMethodInfoHeader(binding);
+ // int methodAttributeOffset = classFile.contentsOffset;
+ // int attributeNumber = classFile.generateMethodInfoAttribute(binding);
+ // if ((!binding.isNative()) && (!binding.isAbstract())) {
+ // int codeAttributeOffset = classFile.contentsOffset;
+ // classFile.generateCodeAttributeHeader();
+ // CodeStream codeStream = classFile.codeStream;
+ // codeStream.reset(this, classFile);
+ // // initialize local positions
+ // this.scope.computeLocalVariablePositions(binding.isStatic() ? 0 : 1,
+ // codeStream);
+ //
+ // // arguments initialization for local variable debug attributes
+ // if (arguments != null) {
+ // for (int i = 0, max = arguments.length; i < max; i++) {
+ // LocalVariableBinding argBinding;
+ // codeStream.addVisibleLocalVariable(argBinding = arguments[i].binding);
+ // argBinding.recordInitializationStartPC(0);
+ // }
+ // }
+ // if (statements != null) {
+ // for (int i = 0, max = statements.length; i < max; i++)
+ // statements[i].generateCode(scope, codeStream);
+ // }
+ // if (this.needFreeReturn) {
+ // codeStream.return_();
+ // }
+ // // local variable attributes
+ // codeStream.exitUserScope(scope);
+ // codeStream.recordPositionsFrom(0, this.declarationSourceEnd);
+ // classFile.completeCodeAttribute(codeAttributeOffset);
+ // attributeNumber++;
+ // } else {
+ // checkArgumentsSize();
+ // }
+ // classFile.completeMethodInfo(methodAttributeOffset, attributeNumber);
+ //
+ // // if a problem got reported during code gen, then trigger problem method
+ // creation
+ // if (ignoreFurtherInvestigation) {
+ // throw new
+ // AbortMethod(scope.referenceCompilationUnit().compilationResult);
+ // }
+ // }
+ // private void checkArgumentsSize() {
+ // TypeBinding[] parameters = binding.parameters;
+ // int size = 1; // an abstact method or a native method cannot be static
+ // for (int i = 0, max = parameters.length; i < max; i++) {
+ // TypeBinding parameter = parameters[i];
+ // if (parameter == LongBinding || parameter == DoubleBinding) {
+ // size += 2;
+ // } else {
+ // size++;
+ // }
+ // if (size > 0xFF) {
+ // scope.problemReporter().noMoreAvailableSpaceForArgument(scope.locals[i],
+ // scope.locals[i].declaration);
+ // }
+ // }
+ // }
public boolean hasErrors() {
return this.ignoreFurtherInvestigation;
}
@@ -289,12 +313,12 @@ public abstract class AbstractMethodDeclaration
return false;
}
-// public boolean isNative() {
-//
-// if (binding != null)
-// return binding.isNative();
-// return (modifiers & AccNative) != 0;
-// }
+ // public boolean isNative() {
+ //
+ // if (binding != null)
+ // return binding.isNative();
+ // return (modifiers & AccNative) != 0;
+ // }
public boolean isStatic() {
@@ -306,9 +330,9 @@ public abstract class AbstractMethodDeclaration
/**
* Fill up the method body with statement
*/
- public abstract void parseStatements(
- UnitParser parser,
- CompilationUnitDeclaration unit);
+ public abstract void parseStatements(UnitParser parser,
+ CompilationUnitDeclaration unit);
+
public StringBuffer print(int tab, StringBuffer output) {
printIndent(tab, output);
@@ -316,7 +340,8 @@ public abstract class AbstractMethodDeclaration
printReturnType(0, output).append(this.selector).append('(');
if (this.arguments != null) {
for (int i = 0; i < this.arguments.length; i++) {
- if (i > 0) output.append(", "); //$NON-NLS-1$
+ if (i > 0)
+ output.append(", "); //$NON-NLS-1$
this.arguments[i].print(0, output);
}
}
@@ -324,7 +349,8 @@ public abstract class AbstractMethodDeclaration
if (this.thrownExceptions != null) {
output.append(" throws "); //$NON-NLS-1$
for (int i = 0; i < this.thrownExceptions.length; i++) {
- if (i > 0) output.append(", "); //$NON-NLS-1$
+ if (i > 0)
+ output.append(", "); //$NON-NLS-1$
this.thrownExceptions[i].print(0, output);
}
}
@@ -334,14 +360,14 @@ public abstract class AbstractMethodDeclaration
public StringBuffer printBody(int indent, StringBuffer output) {
- if (isAbstract() || (this.modifiers & AccSemicolonBody) != 0)
+ if (isAbstract() || (this.modifiers & AccSemicolonBody) != 0)
return output.append(';');
output.append(" {"); //$NON-NLS-1$
if (this.statements != null) {
for (int i = 0; i < this.statements.length; i++) {
output.append('\n');
- this.statements[i].printStatement(indent, output);
+ this.statements[i].printStatement(indent, output);
}
}
output.append('\n'); //$NON-NLS-1$
@@ -350,9 +376,10 @@ public abstract class AbstractMethodDeclaration
}
public StringBuffer printReturnType(int indent, StringBuffer output) {
-
+
return output;
}
+
public void resolve(ClassScope upperScope) {
if (binding == null) {
@@ -360,12 +387,13 @@ public abstract class AbstractMethodDeclaration
}
try {
- bindArguments();
+ bindArguments();
bindThrownExceptions();
resolveStatements();
- } catch (AbortMethod e) { // ========= abort on fatal error =============
+ } catch (AbortMethod e) { // ========= abort on fatal error
+ // =============
this.ignoreFurtherInvestigation = true;
- }
+ }
}
public void resolveStatements() {
@@ -401,8 +429,10 @@ public abstract class AbstractMethodDeclaration
s += arguments[i].toString(0);
if (i != (arguments.length - 1))
s = s + ", "; //$NON-NLS-1$
- };
- };
+ }
+ ;
+ }
+ ;
s += ")"; //$NON-NLS-1$
if (thrownExceptions != null) {
s += " throws "; //$NON-NLS-1$
@@ -410,8 +440,10 @@ public abstract class AbstractMethodDeclaration
s += thrownExceptions[i].toString(0);
if (i != (thrownExceptions.length - 1))
s = s + ", "; //$NON-NLS-1$
- };
- };
+ }
+ ;
+ }
+ ;
s += toStringStatements(tab + 1);
return s;
@@ -435,8 +467,6 @@ public abstract class AbstractMethodDeclaration
return s;
}
- public void traverse(
- ASTVisitor visitor,
- ClassScope classScope) {
+ public void traverse(ASTVisitor visitor, ClassScope classScope) {
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractVariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractVariableDeclaration.java
index 84319d5..5ca4e4d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractVariableDeclaration.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AbstractVariableDeclaration.java
@@ -18,26 +18,34 @@ public abstract class AbstractVariableDeclaration extends Statement {
public int modifiers;
public TypeReference type;
+
public Expression initialization;
public char[] name;
+
public int declarationEnd;
+
public int declarationSourceStart;
+
public int declarationSourceEnd;
+
public int modifiersSourceStart;
-
- public AbstractVariableDeclaration() {}
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ public AbstractVariableDeclaration() {
+ }
+
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
return flowInfo;
}
public abstract String name();
+
public StringBuffer printStatement(int indent, StringBuffer output) {
printIndent(indent, output);
printModifiers(this.modifiers, output);
- type.print(0, output).append(' ').append(this.name);
+ type.print(0, output).append(' ').append(this.name);
if (initialization != null) {
output.append(" = "); //$NON-NLS-1$
initialization.printExpression(indent, output);
@@ -45,8 +53,9 @@ public abstract class AbstractVariableDeclaration extends Statement {
return output.append(';');
}
- public void resolve(BlockScope scope) {}
-
+ public void resolve(BlockScope scope) {
+ }
+
public String toString(int tab) {
String s = tabString(tab);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AllocationExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AllocationExpression.java
index 7eb480b..c164bcb 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AllocationExpression.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AllocationExpression.java
@@ -24,12 +24,12 @@ import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.SyntheticArgumentBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-public class AllocationExpression
- extends Expression
- implements InvocationSite {
-
+public class AllocationExpression extends Expression implements InvocationSite {
+
public TypeReference type;
+
public Expression[] arguments;
+
public MethodBinding binding;
MethodBinding syntheticAccessor;
@@ -37,114 +37,117 @@ public class AllocationExpression
public AllocationExpression() {
}
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
// check captured variables are initialized in current context (26134)
- checkCapturedLocalInitializationIfNecessary(this.binding.declaringClass, currentScope, flowInfo);
+ checkCapturedLocalInitializationIfNecessary(
+ this.binding.declaringClass, currentScope, flowInfo);
// process arguments
if (arguments != null) {
for (int i = 0, count = arguments.length; i < count; i++) {
- flowInfo =
- arguments[i]
- .analyseCode(currentScope, flowContext, flowInfo)
- .unconditionalInits();
+ flowInfo = arguments[i].analyseCode(currentScope, flowContext,
+ flowInfo).unconditionalInits();
}
}
// record some dependency information for exception types
ReferenceBinding[] thrownExceptions;
if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) {
// check exception handling
- flowContext.checkExceptionHandlers(
- thrownExceptions,
- this,
- flowInfo,
- currentScope);
+ flowContext.checkExceptionHandlers(thrownExceptions, this,
+ flowInfo, currentScope);
}
manageEnclosingInstanceAccessIfNecessary(currentScope);
manageSyntheticAccessIfNecessary(currentScope);
-
+
return flowInfo;
}
- public void checkCapturedLocalInitializationIfNecessary(ReferenceBinding checkedType, BlockScope currentScope, FlowInfo flowInfo) {
+ public void checkCapturedLocalInitializationIfNecessary(
+ ReferenceBinding checkedType, BlockScope currentScope,
+ FlowInfo flowInfo) {
- if (checkedType.isLocalType()
- && !checkedType.isAnonymousType()
- && !currentScope.isDefinedInType(checkedType)) { // only check external allocations
+ if (checkedType.isLocalType() && !checkedType.isAnonymousType()
+ && !currentScope.isDefinedInType(checkedType)) { // only
+ // check
+ // external
+ // allocations
NestedTypeBinding nestedType = (NestedTypeBinding) checkedType;
- SyntheticArgumentBinding[] syntheticArguments = nestedType.syntheticOuterLocalVariables();
- if (syntheticArguments != null)
- for (int i = 0, count = syntheticArguments.length; i < count; i++){
+ SyntheticArgumentBinding[] syntheticArguments = nestedType
+ .syntheticOuterLocalVariables();
+ if (syntheticArguments != null)
+ for (int i = 0, count = syntheticArguments.length; i < count; i++) {
SyntheticArgumentBinding syntheticArgument = syntheticArguments[i];
LocalVariableBinding targetLocal;
- if ((targetLocal = syntheticArgument.actualOuterLocalVariable) == null) continue;
-// if (targetLocal.declaration != null && !flowInfo.isDefinitelyAssigned(targetLocal)){
-// currentScope.problemReporter().uninitializedLocalVariable(targetLocal, this);
-// }
+ if ((targetLocal = syntheticArgument.actualOuterLocalVariable) == null)
+ continue;
+ // if (targetLocal.declaration != null &&
+ // !flowInfo.isDefinitelyAssigned(targetLocal)){
+ // currentScope.problemReporter().uninitializedLocalVariable(targetLocal,
+ // this);
+ // }
}
-
+
}
}
-
+
public Expression enclosingInstance() {
return null;
}
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// ReferenceBinding allocatedType = binding.declaringClass;
-//
-// codeStream.new_(allocatedType);
-// if (valueRequired) {
-// codeStream.dup();
-// }
-// // better highlight for allocation: display the type individually
-// codeStream.recordPositionsFrom(pc, type.sourceStart);
-//
-// // handling innerclass instance allocation - enclosing instance arguments
-// if (allocatedType.isNestedType()) {
-// codeStream.generateSyntheticEnclosingInstanceValues(
-// currentScope,
-// allocatedType,
-// enclosingInstance(),
-// this);
-// }
-// // generate the arguments for constructor
-// if (arguments != null) {
-// for (int i = 0, count = arguments.length; i < count; i++) {
-// arguments[i].generateCode(currentScope, codeStream, true);
-// }
-// }
-// // handling innerclass instance allocation - outer local arguments
-// if (allocatedType.isNestedType()) {
-// codeStream.generateSyntheticOuterArgumentValues(
-// currentScope,
-// allocatedType,
-// this);
-// }
-// // invoke constructor
-// if (syntheticAccessor == null) {
-// codeStream.invokespecial(binding);
-// } else {
-// // synthetic accessor got some extra arguments appended to its signature, which need values
-// for (int i = 0,
-// max = syntheticAccessor.parameters.length - binding.parameters.length;
-// i < max;
-// i++) {
-// codeStream.aconst_null();
-// }
-// codeStream.invokespecial(syntheticAccessor);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
+ // public void generateCode(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // boolean valueRequired) {
+ //
+ // int pc = codeStream.position;
+ // ReferenceBinding allocatedType = binding.declaringClass;
+ //
+ // codeStream.new_(allocatedType);
+ // if (valueRequired) {
+ // codeStream.dup();
+ // }
+ // // better highlight for allocation: display the type individually
+ // codeStream.recordPositionsFrom(pc, type.sourceStart);
+ //
+ // // handling innerclass instance allocation - enclosing instance arguments
+ // if (allocatedType.isNestedType()) {
+ // codeStream.generateSyntheticEnclosingInstanceValues(
+ // currentScope,
+ // allocatedType,
+ // enclosingInstance(),
+ // this);
+ // }
+ // // generate the arguments for constructor
+ // if (arguments != null) {
+ // for (int i = 0, count = arguments.length; i < count; i++) {
+ // arguments[i].generateCode(currentScope, codeStream, true);
+ // }
+ // }
+ // // handling innerclass instance allocation - outer local arguments
+ // if (allocatedType.isNestedType()) {
+ // codeStream.generateSyntheticOuterArgumentValues(
+ // currentScope,
+ // allocatedType,
+ // this);
+ // }
+ // // invoke constructor
+ // if (syntheticAccessor == null) {
+ // codeStream.invokespecial(binding);
+ // } else {
+ // // synthetic accessor got some extra arguments appended to its signature,
+ // which need values
+ // for (int i = 0,
+ // max = syntheticAccessor.parameters.length - binding.parameters.length;
+ // i < max;
+ // i++) {
+ // codeStream.aconst_null();
+ // }
+ // codeStream.invokespecial(syntheticAccessor);
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
public boolean isSuperAccess() {
@@ -156,26 +159,29 @@ public class AllocationExpression
return true;
}
- /* Inner emulation consists in either recording a dependency
- * link only, or performing one level of propagation.
- *
- * Dependency mechanism is used whenever dealing with source target
- * types, since by the time we reach them, we might not yet know their
- * exact need.
+ /*
+ * Inner emulation consists in either recording a dependency link only, or
+ * performing one level of propagation.
+ *
+ * Dependency mechanism is used whenever dealing with source target types,
+ * since by the time we reach them, we might not yet know their exact need.
*/
public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope) {
ReferenceBinding allocatedType;
- // perform some emulation work in case there is some and we are inside a local type only
+ // perform some emulation work in case there is some and we are inside a
+ // local type only
if ((allocatedType = binding.declaringClass).isNestedType()
- && currentScope.enclosingSourceType().isLocalType()) {
+ && currentScope.enclosingSourceType().isLocalType()) {
if (allocatedType.isLocalType()) {
- ((LocalTypeBinding) allocatedType).addInnerEmulationDependent(currentScope, false);
+ ((LocalTypeBinding) allocatedType).addInnerEmulationDependent(
+ currentScope, false);
// request cascade of accesses
} else {
- // locally propagate, since we already now the desired shape for sure
+ // locally propagate, since we already now the desired shape for
+ // sure
currentScope.propagateInnerEmulation(allocatedType, false);
// request cascade of accesses
}
@@ -185,37 +191,43 @@ public class AllocationExpression
public void manageSyntheticAccessIfNecessary(BlockScope currentScope) {
if (binding.isPrivate()
- && (currentScope.enclosingSourceType() != binding.declaringClass)) {
-
-// if (currentScope
-// .environment()
-// .options
-// .isPrivateConstructorAccessChangingVisibility) {
-// binding.tagForClearingPrivateModifier();
-// // constructor will not be dumped as private, no emulation required thus
-// } else {
- syntheticAccessor =
- ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
-// }
+ && (currentScope.enclosingSourceType() != binding.declaringClass)) {
+
+ // if (currentScope
+ // .environment()
+ // .options
+ // .isPrivateConstructorAccessChangingVisibility) {
+ // binding.tagForClearingPrivateModifier();
+ // // constructor will not be dumped as private, no emulation
+ // required thus
+ // } else {
+ syntheticAccessor = ((SourceTypeBinding) binding.declaringClass)
+ .addSyntheticMethod(binding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(binding,
+ this);
+ // }
}
}
+
public StringBuffer printExpression(int indent, StringBuffer output) {
output.append("new "); //$NON-NLS-1$
- type.printExpression(0, output);
+ type.printExpression(0, output);
output.append('(');
if (arguments != null) {
for (int i = 0; i < arguments.length; i++) {
- if (i > 0) output.append(", "); //$NON-NLS-1$
+ if (i > 0)
+ output.append(", "); //$NON-NLS-1$
arguments[i].printExpression(0, output);
}
}
return output.append(')');
}
+
public TypeBinding resolveType(BlockScope scope) {
- // Propagate the type checking to the arguments, and check if the constructor is defined.
+ // Propagate the type checking to the arguments, and check if the
+ // constructor is defined.
constant = NotAConstant;
this.resolvedType = type.resolveType(scope);
// will check for null after args are resolved
@@ -240,8 +252,9 @@ public class AllocationExpression
return this.resolvedType;
}
ReferenceBinding allocatedType = (ReferenceBinding) this.resolvedType;
- if (!(binding = scope.getConstructor(allocatedType, argumentTypes, this))
- .isValidBinding()) {
+ if (!(binding = scope
+ .getConstructor(allocatedType, argumentTypes, this))
+ .isValidBinding()) {
if (binding.declaringClass == null)
binding.declaringClass = allocatedType;
scope.problemReporter().invalidConstructor(this, binding);
@@ -252,7 +265,8 @@ public class AllocationExpression
if (arguments != null)
for (int i = 0; i < arguments.length; i++)
- arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
+ arguments[i].implicitWidening(binding.parameters[i],
+ argumentTypes[i]);
return allocatedType;
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java
index 73b3689..841196d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AnonymousLocalTypeDeclaration.java
@@ -22,27 +22,30 @@ import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
public static final char[] ANONYMOUS_EMPTY_NAME = new char[] {};
+
public QualifiedAllocationExpression allocation;
public AnonymousLocalTypeDeclaration(CompilationResult compilationResult) {
super(compilationResult);
modifiers = AccDefault;
name = ANONYMOUS_EMPTY_NAME;
- }
-
- // use a default name in order to th name lookup
+ }
+
+ // use a default name in order to th name lookup
// to operate just like a regular type (which has a name)
- //without checking systematically if the naem is null ....
- public MethodBinding createsInternalConstructorWithBinding(MethodBinding inheritedConstructorBinding) {
+ // without checking systematically if the naem is null ....
+ public MethodBinding createsInternalConstructorWithBinding(
+ MethodBinding inheritedConstructorBinding) {
- //Add to method'set, the default constuctor that just recall the
- //super constructor with the same arguments
+ // Add to method'set, the default constuctor that just recall the
+ // super constructor with the same arguments
String baseName = "$anonymous"; //$NON-NLS-1$
TypeBinding[] argumentTypes = inheritedConstructorBinding.parameters;
int argumentsLength = argumentTypes.length;
- //the constructor
- ConstructorDeclaration cd = new ConstructorDeclaration(this.compilationResult);
- cd.selector = new char[] { 'x' }; //no maining
+ // the constructor
+ ConstructorDeclaration cd = new ConstructorDeclaration(
+ this.compilationResult);
+ cd.selector = new char[] { 'x' }; // no maining
cd.sourceStart = sourceStart;
cd.sourceEnd = sourceEnd;
cd.modifiers = modifiers & AccVisibilityMASK;
@@ -51,11 +54,12 @@ public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
if (argumentsLength > 0) {
Argument[] arguments = (cd.arguments = new Argument[argumentsLength]);
for (int i = argumentsLength; --i >= 0;) {
- arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, AccDefault);
+ arguments[i] = new Argument((baseName + i).toCharArray(), 0L,
+ null /* type ref */, AccDefault);
}
}
- //the super call inside the constructor
+ // the super call inside the constructor
cd.constructorCall = SuperReference.implicitSuperConstructorCall();
cd.constructorCall.sourceStart = sourceStart;
cd.constructorCall.sourceEnd = sourceEnd;
@@ -64,32 +68,33 @@ public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
Expression[] args;
args = cd.constructorCall.arguments = new Expression[argumentsLength];
for (int i = argumentsLength; --i >= 0;) {
- args[i] = new SingleNameReference((baseName + i).toCharArray(), 0L);
+ args[i] = new SingleNameReference((baseName + i).toCharArray(),
+ 0L);
}
}
- //adding the constructor in the methods list
+ // adding the constructor in the methods list
if (methods == null) {
methods = new AbstractMethodDeclaration[] { cd };
} else {
AbstractMethodDeclaration[] newMethods;
- System.arraycopy(
- methods,
- 0,
- newMethods = new AbstractMethodDeclaration[methods.length + 1],
- 1,
- methods.length);
+ System
+ .arraycopy(
+ methods,
+ 0,
+ newMethods = new AbstractMethodDeclaration[methods.length + 1],
+ 1, methods.length);
newMethods[0] = cd;
methods = newMethods;
}
- //============BINDING UPDATE==========================
- cd.binding = new MethodBinding(
- cd.modifiers, //methodDeclaration
- argumentsLength == 0 ? NoParameters : argumentTypes, //arguments bindings
- inheritedConstructorBinding.thrownExceptions, //exceptions
- binding); //declaringClass
-
+ // ============BINDING UPDATE==========================
+ cd.binding = new MethodBinding(cd.modifiers, // methodDeclaration
+ argumentsLength == 0 ? NoParameters : argumentTypes, // arguments
+ // bindings
+ inheritedConstructorBinding.thrownExceptions, // exceptions
+ binding); // declaringClass
+
cd.scope = new MethodScope(scope, cd, true);
cd.bindArguments();
cd.constructorCall.resolve(cd.scope);
@@ -98,27 +103,25 @@ public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
binding.methods = new MethodBinding[] { cd.binding };
} else {
MethodBinding[] newMethods;
- System.arraycopy(
- binding.methods,
- 0,
- newMethods = new MethodBinding[binding.methods.length + 1],
- 1,
- binding.methods.length);
+ System.arraycopy(binding.methods, 0,
+ newMethods = new MethodBinding[binding.methods.length + 1],
+ 1, binding.methods.length);
newMethods[0] = cd.binding;
binding.methods = newMethods;
}
- //===================================================
+ // ===================================================
return cd.binding;
}
+
public void resolve(BlockScope scope) {
if (binding != null) {
// remember local types binding for innerclass emulation propagation
- scope.referenceCompilationUnit().record((LocalTypeBinding)binding);
+ scope.referenceCompilationUnit().record((LocalTypeBinding) binding);
}
- // scope and binding are provided in updateBindingSuperclass
+ // scope and binding are provided in updateBindingSuperclass
resolve();
updateMaxFieldCount();
}
@@ -129,12 +132,10 @@ public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
}
/**
- * Iteration for a local anonymous innertype
- *
+ * Iteration for a local anonymous innertype
+ *
*/
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
+ public void traverse(ASTVisitor visitor, BlockScope blockScope) {
if (ignoreFurtherInvestigation)
return;
@@ -145,7 +146,8 @@ public class AnonymousLocalTypeDeclaration extends LocalTypeDeclaration {
int methodsLength;
int memberTypesLength;
- // is bound to the actual type from the allocation expression
+ // is bound to the actual type from the allocation
+ // expression
// therefore it has already been iterated at this point.
if (memberTypes != null) {
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Argument.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Argument.java
index 27da26c..aa0bd08 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Argument.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Argument.java
@@ -17,7 +17,7 @@ import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
public class Argument extends LocalDeclaration {
-
+
public Argument(char[] name, long posNom, TypeReference tr, int modifiers) {
super(null, name, (int) (posNom >>> 32), (int) posNom);
@@ -34,17 +34,18 @@ public class Argument extends LocalDeclaration {
// record the resolved type into the type reference
int modifierFlag = this.modifiers;
if ((this.binding = scope.duplicateName(this.name)) != null) {
- //the name already exist....may carry on with the first binding ....
+ // the name already exist....may carry on with the first binding
+ // ....
scope.problemReporter().redefineArgument(this);
} else {
- scope.addLocalVariable(
- this.binding =
- new LocalVariableBinding(this, typeBinding, modifierFlag, true));
- //true stand for argument instead of just local
+ scope.addLocalVariable(this.binding = new LocalVariableBinding(
+ this, typeBinding, modifierFlag, true));
+ // true stand for argument instead of just local
if (typeBinding != null && isTypeUseDeprecated(typeBinding, scope))
scope.problemReporter().deprecatedType(typeBinding, this.type);
this.binding.declaration = this;
- this.binding.useFlag = used ? LocalVariableBinding.USED : LocalVariableBinding.UNUSED;
+ this.binding.useFlag = used ? LocalVariableBinding.USED
+ : LocalVariableBinding.UNUSED;
}
}
@@ -54,15 +55,25 @@ public class Argument extends LocalDeclaration {
// provide the scope with a side effect : insertion of a LOCAL
// that represents the argument. The type must be from JavaThrowable
- TypeBinding tb = type.resolveTypeExpecting(scope, scope.getJavaLangThrowable());
+ TypeBinding tb = type.resolveTypeExpecting(scope, scope
+ .getJavaLangThrowable());
if (tb == null)
return null;
if ((binding = scope.duplicateName(name)) != null) {
- // the name already exists....may carry on with the first binding ....
+ // the name already exists....may carry on with the first binding
+ // ....
scope.problemReporter().redefineArgument(this);
return null;
}
- binding = new LocalVariableBinding(this, tb, modifiers, false); // argument decl, but local var (where isArgument = false)
+ binding = new LocalVariableBinding(this, tb, modifiers, false); // argument
+ // decl,
+ // but
+ // local
+ // var
+ // (where
+ // isArgument
+ // =
+ // false)
scope.addLocalVariable(binding);
binding.constant = NotAConstant;
return tb;
@@ -84,7 +95,7 @@ public class Argument extends LocalDeclaration {
}
public void traverse(ASTVisitor visitor, BlockScope scope) {
-
+
if (visitor.visit(this, scope)) {
if (type != null)
type.traverse(visitor, scope);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayAllocationExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayAllocationExpression.java
index 9adf04f..3d8c880 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayAllocationExpression.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayAllocationExpression.java
@@ -18,14 +18,14 @@ import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
public class ArrayAllocationExpression extends Expression {
public TypeReference type;
- //dimensions.length gives the number of dimensions, but the
+ // dimensions.length gives the number of dimensions, but the
// last ones may be nulled as in new int[4][5][][]
public Expression[] dimensions;
+
public ArrayInitializer initializer;
/**
@@ -35,10 +35,8 @@ public class ArrayAllocationExpression extends Expression {
super();
}
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
for (int i = 0, max = dimensions.length; i < max; i++) {
Expression dim;
if ((dim = dimensions[i]) != null) {
@@ -55,46 +53,46 @@ public class ArrayAllocationExpression extends Expression {
/**
* Code generation for a array allocation expression
*/
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-//
-// if (initializer != null) {
-// initializer.generateCode(currentScope, codeStream, valueRequired);
-// return;
-// }
-//
-// int nonNullDimensionsLength = 0;
-// for (int i = 0, max = dimensions.length; i < max; i++)
-// if (dimensions[i] != null) {
-// dimensions[i].generateCode(currentScope, codeStream, true);
-// nonNullDimensionsLength++;
-// }
-//
-// // Generate a sequence of bytecodes corresponding to an array allocation
-// if (this.resolvedType.dimensions() == 1) {
-// // Mono-dimensional array
-// codeStream.newArray(currentScope, (ArrayBinding)this.resolvedType);
-// } else {
-// // Multi-dimensional array
-// codeStream.multianewarray(this.resolvedType, nonNullDimensionsLength);
-// }
-//
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// } else {
-// codeStream.pop();
-// }
-//
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
+ // public void generateCode(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // boolean valueRequired) {
+ //
+ // int pc = codeStream.position;
+ //
+ // if (initializer != null) {
+ // initializer.generateCode(currentScope, codeStream, valueRequired);
+ // return;
+ // }
+ //
+ // int nonNullDimensionsLength = 0;
+ // for (int i = 0, max = dimensions.length; i < max; i++)
+ // if (dimensions[i] != null) {
+ // dimensions[i].generateCode(currentScope, codeStream, true);
+ // nonNullDimensionsLength++;
+ // }
+ //
+ // // Generate a sequence of bytecodes corresponding to an array allocation
+ // if (this.resolvedType.dimensions() == 1) {
+ // // Mono-dimensional array
+ // codeStream.newArray(currentScope, (ArrayBinding)this.resolvedType);
+ // } else {
+ // // Multi-dimensional array
+ // codeStream.multianewarray(this.resolvedType, nonNullDimensionsLength);
+ // }
+ //
+ // if (valueRequired) {
+ // codeStream.generateImplicitConversion(implicitConversion);
+ // } else {
+ // codeStream.pop();
+ // }
+ //
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
public StringBuffer printExpression(int indent, StringBuffer output) {
output.append("new "); //$NON-NLS-1$
- type.print(0, output);
+ type.print(0, output);
for (int i = 0; i < dimensions.length; i++) {
if (dimensions[i] == null)
output.append("[]"); //$NON-NLS-1$
@@ -103,19 +101,23 @@ public class ArrayAllocationExpression extends Expression {
dimensions[i].printExpression(0, output);
output.append(']');
}
- }
- if (initializer != null) initializer.printExpression(0, output);
+ }
+ if (initializer != null)
+ initializer.printExpression(0, output);
return output;
}
+
public TypeBinding resolveType(BlockScope scope) {
// Build an array type reference using the current dimensions
// The parser does not check for the fact that dimension may be null
- // only at the -end- like new int [4][][]. The parser allows new int[][4][]
- // so this must be checked here......(this comes from a reduction to LL1 grammar)
+ // only at the -end- like new int [4][][]. The parser allows new
+ // int[][4][]
+ // so this must be checked here......(this comes from a reduction to LL1
+ // grammar)
TypeBinding referenceType = type.resolveType(scope);
-
+
// will check for null after dimensions are checked
constant = Constant.NotAConstant;
if (referenceType == VoidBinding) {
@@ -123,14 +125,17 @@ public class ArrayAllocationExpression extends Expression {
referenceType = null;
}
- // check the validity of the dimension syntax (and test for all null dimensions)
+ // check the validity of the dimension syntax (and test for all null
+ // dimensions)
int explicitDimIndex = -1;
for (int i = dimensions.length; --i >= 0;) {
if (dimensions[i] != null) {
- if (explicitDimIndex < 0) explicitDimIndex = i;
- } else if (explicitDimIndex> 0) {
+ if (explicitDimIndex < 0)
+ explicitDimIndex = i;
+ } else if (explicitDimIndex > 0) {
// should not have an empty dimension before an non-empty one
- scope.problemReporter().incorrectLocationForEmptyDimension(this, i);
+ scope.problemReporter().incorrectLocationForEmptyDimension(
+ this, i);
}
}
@@ -144,10 +149,11 @@ public class ArrayAllocationExpression extends Expression {
scope.problemReporter().cannotDefineDimensionsAndInitializer(this);
}
- // dimensions resolution
+ // dimensions resolution
for (int i = 0; i <= explicitDimIndex; i++) {
if (dimensions[i] != null) {
- TypeBinding dimensionType = dimensions[i].resolveTypeExpecting(scope, IntBinding);
+ TypeBinding dimensionType = dimensions[i].resolveTypeExpecting(
+ scope, IntBinding);
if (dimensionType != null) {
dimensions[i].implicitWidening(IntBinding, dimensionType);
}
@@ -159,12 +165,13 @@ public class ArrayAllocationExpression extends Expression {
if (dimensions.length > 255) {
scope.problemReporter().tooManyDimensions(this);
}
- this.resolvedType = scope.createArray(referenceType, dimensions.length);
+ this.resolvedType = scope.createArray(referenceType,
+ dimensions.length);
// check the initializer
if (initializer != null) {
if ((initializer.resolveTypeExpecting(scope, this.resolvedType)) != null)
- initializer.binding = (ArrayBinding)this.resolvedType;
+ initializer.binding = (ArrayBinding) this.resolvedType;
}
}
return this.resolvedType;
@@ -178,7 +185,7 @@ public class ArrayAllocationExpression extends Expression {
s = s + "[]"; //$NON-NLS-1$
else
s = s + "[" + dimensions[i].toStringExpression() + "]"; //$NON-NLS-2$ //$NON-NLS-1$
- }
+ }
if (initializer != null)
s = s + initializer.toStringExpression();
return s;
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayInitializer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayInitializer.java
index 1e16c28..b184c17 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayInitializer.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayInitializer.java
@@ -16,203 +16,224 @@ import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
public class ArrayInitializer extends Expression {
- public Expression[] expressions;
+ public Expression[] expressions;
- public ArrayBinding binding; //the type of the { , , , }
+ public ArrayBinding binding; // the type of the { , , , }
- /**
- * ArrayInitializer constructor comment.
- */
- public ArrayInitializer() {
- super();
- }
+ /**
+ * ArrayInitializer constructor comment.
+ */
+ public ArrayInitializer() {
+ super();
+ }
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- if (expressions != null) {
- for (int i = 0, max = expressions.length; i < max; i++) {
- flowInfo = expressions[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
- }
- }
- return flowInfo;
- }
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
+ if (expressions != null) {
+ for (int i = 0, max = expressions.length; i < max; i++) {
+ flowInfo = expressions[i].analyseCode(currentScope,
+ flowContext, flowInfo).unconditionalInits();
+ }
+ }
+ return flowInfo;
+ }
- /**
- * Code generation for a array initializer
- */
- //public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
- // // Flatten the values and compute the dimensions, by iterating in depth into nested array initializers
- //
- // int pc = codeStream.position;
- // int expressionLength = (expressions == null) ? 0: expressions.length;
- // codeStream.generateInlinedValue(expressionLength);
- // codeStream.newArray(currentScope, binding);
- // if (expressions != null) {
- // // binding is an ArrayType, so I can just deal with the dimension
- // int elementsTypeID = binding.dimensions > 1 ? -1 : binding.leafComponentType.id;
- // for (int i = 0; i < expressionLength; i++) {
- // Expression expr;
- // if ((expr = expressions[i]).constant != NotAConstant) {
- // switch (elementsTypeID) { // filter out initializations to default values
- // case T_int :
- // case T_short :
- // case T_byte :
- // case T_char :
- // case T_long :
- // if (expr.constant.longValue() != 0) {
- // codeStream.dup();
- // codeStream.generateInlinedValue(i);
- // expr.generateCode(currentScope, codeStream, true);
- // codeStream.arrayAtPut(elementsTypeID, false);
- // }
- // break;
- // case T_float :
- // case T_double :
- // double constantValue = expr.constant.doubleValue();
- // if (constantValue == -0.0 || constantValue != 0) {
- // codeStream.dup();
- // codeStream.generateInlinedValue(i);
- // expr.generateCode(currentScope, codeStream, true);
- // codeStream.arrayAtPut(elementsTypeID, false);
- // }
- // break;
- // case T_boolean :
- // if (expr.constant.booleanValue() != false) {
- // codeStream.dup();
- // codeStream.generateInlinedValue(i);
- // expr.generateCode(currentScope, codeStream, true);
- // codeStream.arrayAtPut(elementsTypeID, false);
- // }
- // break;
- // default :
- // if (!(expr instanceof NullLiteral)) {
- // codeStream.dup();
- // codeStream.generateInlinedValue(i);
- // expr.generateCode(currentScope, codeStream, true);
- // codeStream.arrayAtPut(elementsTypeID, false);
- // }
- // }
- // } else if (!(expr instanceof NullLiteral)) {
- // codeStream.dup();
- // codeStream.generateInlinedValue(i);
- // expr.generateCode(currentScope, codeStream, true);
- // codeStream.arrayAtPut(elementsTypeID, false);
- // }
- // }
- // }
- // if (!valueRequired) {
- // codeStream.pop();
- // }
- // codeStream.recordPositionsFrom(pc, this.sourceStart);
- //}
- public StringBuffer printExpression(int indent, StringBuffer output) {
+ /**
+ * Code generation for a array initializer
+ */
+ // public void generateCode(BlockScope currentScope, CodeStream codeStream,
+ // boolean valueRequired) {
+ // // Flatten the values and compute the dimensions, by iterating in depth
+ // into nested array initializers
+ //
+ // int pc = codeStream.position;
+ // int expressionLength = (expressions == null) ? 0: expressions.length;
+ // codeStream.generateInlinedValue(expressionLength);
+ // codeStream.newArray(currentScope, binding);
+ // if (expressions != null) {
+ // // binding is an ArrayType, so I can just deal with the dimension
+ // int elementsTypeID = binding.dimensions > 1 ? -1 :
+ // binding.leafComponentType.id;
+ // for (int i = 0; i < expressionLength; i++) {
+ // Expression expr;
+ // if ((expr = expressions[i]).constant != NotAConstant) {
+ // switch (elementsTypeID) { // filter out initializations to default values
+ // case T_int :
+ // case T_short :
+ // case T_byte :
+ // case T_char :
+ // case T_long :
+ // if (expr.constant.longValue() != 0) {
+ // codeStream.dup();
+ // codeStream.generateInlinedValue(i);
+ // expr.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(elementsTypeID, false);
+ // }
+ // break;
+ // case T_float :
+ // case T_double :
+ // double constantValue = expr.constant.doubleValue();
+ // if (constantValue == -0.0 || constantValue != 0) {
+ // codeStream.dup();
+ // codeStream.generateInlinedValue(i);
+ // expr.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(elementsTypeID, false);
+ // }
+ // break;
+ // case T_boolean :
+ // if (expr.constant.booleanValue() != false) {
+ // codeStream.dup();
+ // codeStream.generateInlinedValue(i);
+ // expr.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(elementsTypeID, false);
+ // }
+ // break;
+ // default :
+ // if (!(expr instanceof NullLiteral)) {
+ // codeStream.dup();
+ // codeStream.generateInlinedValue(i);
+ // expr.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(elementsTypeID, false);
+ // }
+ // }
+ // } else if (!(expr instanceof NullLiteral)) {
+ // codeStream.dup();
+ // codeStream.generateInlinedValue(i);
+ // expr.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(elementsTypeID, false);
+ // }
+ // }
+ // }
+ // if (!valueRequired) {
+ // codeStream.pop();
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
+ public StringBuffer printExpression(int indent, StringBuffer output) {
- output.append('{');
- if (expressions != null) {
- int j = 20;
- for (int i = 0; i < expressions.length; i++) {
- if (i > 0)
- output.append(", "); //$NON-NLS-1$
- expressions[i].printExpression(0, output);
- j--;
- if (j == 0) {
- output.append('\n');
- printIndent(indent + 1, output);
- j = 20;
- }
- }
- }
- return output.append('}');
- }
+ output.append('{');
+ if (expressions != null) {
+ int j = 20;
+ for (int i = 0; i < expressions.length; i++) {
+ if (i > 0)
+ output.append(", "); //$NON-NLS-1$
+ expressions[i].printExpression(0, output);
+ j--;
+ if (j == 0) {
+ output.append('\n');
+ printIndent(indent + 1, output);
+ j = 20;
+ }
+ }
+ }
+ return output.append('}');
+ }
- public TypeBinding resolveTypeExpecting(BlockScope scope, TypeBinding expectedTb) {
- // Array initializers can only occur on the right hand side of an assignment
- // expression, therefore the expected type contains the valid information
- // concerning the type that must be enforced by the elements of the array initializer.
+ public TypeBinding resolveTypeExpecting(BlockScope scope,
+ TypeBinding expectedTb) {
+ // Array initializers can only occur on the right hand side of an
+ // assignment
+ // expression, therefore the expected type contains the valid
+ // information
+ // concerning the type that must be enforced by the elements of the
+ // array initializer.
- // this method is recursive... (the test on isArrayType is the stop case)
+ // this method is recursive... (the test on isArrayType is the stop
+ // case)
- constant = NotAConstant;
- if (expectedTb.isArrayType()) {
- binding = (ArrayBinding) expectedTb;
- if (expressions == null)
- return binding;
- TypeBinding expectedElementsTb = binding.elementsType(scope);
- if (expectedElementsTb.isBaseType()) {
- for (int i = 0, length = expressions.length; i < length; i++) {
- Expression expression = expressions[i];
- TypeBinding expressionTb = (expression instanceof ArrayInitializer) ? expression.resolveTypeExpecting(scope,
- expectedElementsTb) : expression.resolveType(scope);
- if (expressionTb == null)
- return null;
+ constant = NotAConstant;
+ if (expectedTb.isArrayType()) {
+ binding = (ArrayBinding) expectedTb;
+ if (expressions == null)
+ return binding;
+ TypeBinding expectedElementsTb = binding.elementsType(scope);
+ if (expectedElementsTb.isBaseType()) {
+ for (int i = 0, length = expressions.length; i < length; i++) {
+ Expression expression = expressions[i];
+ TypeBinding expressionTb = (expression instanceof ArrayInitializer) ? expression
+ .resolveTypeExpecting(scope, expectedElementsTb)
+ : expression.resolveType(scope);
+ if (expressionTb == null)
+ return null;
- // Compile-time conversion required?
- if (expression.isConstantValueOfTypeAssignableToType(expressionTb, expectedElementsTb)) {
- expression.implicitWidening(expectedElementsTb, expressionTb);
- } else if (BaseTypeBinding.isWidening(expectedElementsTb.id, expressionTb.id)) {
- expression.implicitWidening(expectedElementsTb, expressionTb);
- } else {
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(expression, expressionTb, expectedElementsTb);
- return null;
- }
- }
- } else {
- for (int i = 0, length = expressions.length; i < length; i++)
- if (expressions[i].resolveTypeExpecting(scope, expectedElementsTb) == null)
- return null;
- }
- return binding;
- }
+ // Compile-time conversion required?
+ if (expression.isConstantValueOfTypeAssignableToType(
+ expressionTb, expectedElementsTb)) {
+ expression.implicitWidening(expectedElementsTb,
+ expressionTb);
+ } else if (BaseTypeBinding.isWidening(
+ expectedElementsTb.id, expressionTb.id)) {
+ expression.implicitWidening(expectedElementsTb,
+ expressionTb);
+ } else {
+ scope.problemReporter()
+ .typeMismatchErrorActualTypeExpectedType(
+ expression, expressionTb,
+ expectedElementsTb);
+ return null;
+ }
+ }
+ } else {
+ for (int i = 0, length = expressions.length; i < length; i++)
+ if (expressions[i].resolveTypeExpecting(scope,
+ expectedElementsTb) == null)
+ return null;
+ }
+ return binding;
+ }
- // infer initializer type for error reporting based on first element
- TypeBinding leafElementType = null;
- int dim = 1;
- if (expressions == null) {
- leafElementType = scope.getJavaLangObject();
- } else {
- Expression currentExpression = expressions[0];
- while (currentExpression != null && currentExpression instanceof ArrayInitializer) {
- dim++;
- Expression[] subExprs = ((ArrayInitializer) currentExpression).expressions;
- if (subExprs == null) {
- leafElementType = scope.getJavaLangObject();
- currentExpression = null;
- break;
- }
- currentExpression = ((ArrayInitializer) currentExpression).expressions[0];
- }
- if (currentExpression != null) {
- leafElementType = currentExpression.resolveType(scope);
- }
- }
- if (leafElementType != null) {
- TypeBinding probableTb = scope.createArray(leafElementType, dim);
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(this, probableTb, expectedTb);
- }
- return null;
- }
+ // infer initializer type for error reporting based on first element
+ TypeBinding leafElementType = null;
+ int dim = 1;
+ if (expressions == null) {
+ leafElementType = scope.getJavaLangObject();
+ } else {
+ Expression currentExpression = expressions[0];
+ while (currentExpression != null
+ && currentExpression instanceof ArrayInitializer) {
+ dim++;
+ Expression[] subExprs = ((ArrayInitializer) currentExpression).expressions;
+ if (subExprs == null) {
+ leafElementType = scope.getJavaLangObject();
+ currentExpression = null;
+ break;
+ }
+ currentExpression = ((ArrayInitializer) currentExpression).expressions[0];
+ }
+ if (currentExpression != null) {
+ leafElementType = currentExpression.resolveType(scope);
+ }
+ }
+ if (leafElementType != null) {
+ TypeBinding probableTb = scope.createArray(leafElementType, dim);
+ scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
+ this, probableTb, expectedTb);
+ }
+ return null;
+ }
- public String toStringExpression() {
+ public String toStringExpression() {
- String s = "{"; //$NON-NLS-1$
- if (expressions != null) {
- int j = 20;
- for (int i = 0; i < expressions.length; i++) {
- s = s + expressions[i].toStringExpression() + ","; //$NON-NLS-1$
- j--;
- if (j == 0) {
- s = s + "\n ";j = 20;}}}; //$NON-NLS-1$
- s = s + "}"; //$NON-NLS-1$
- return s;
- }
+ String s = "{"; //$NON-NLS-1$
+ if (expressions != null) {
+ int j = 20;
+ for (int i = 0; i < expressions.length; i++) {
+ s = s + expressions[i].toStringExpression() + ","; //$NON-NLS-1$
+ j--;
+ if (j == 0) {
+ s = s + "\n ";j = 20;}}}; //$NON-NLS-1$
+ s = s + "}"; //$NON-NLS-1$
+ return s;
+ }
- public void traverse(ASTVisitor visitor, BlockScope scope) {
- if (visitor.visit(this, scope)) {
- if (expressions != null) {
- int expressionsLength = expressions.length;
- for (int i = 0; i < expressionsLength; i++)
- expressions[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, scope);
- }
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (expressions != null) {
+ int expressionsLength = expressions.length;
+ for (int i = 0; i < expressionsLength; i++)
+ expressions[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayQualifiedTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayQualifiedTypeReference.java
index 26e133c..b8f27aa 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayQualifiedTypeReference.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayQualifiedTypeReference.java
@@ -18,40 +18,49 @@ import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
public class ArrayQualifiedTypeReference extends QualifiedTypeReference {
int dimensions;
-public ArrayQualifiedTypeReference(char[][] sources , int dim, long[] poss) {
- super( sources , poss);
- dimensions = dim ;
-}
-public ArrayQualifiedTypeReference(char[][] sources , TypeBinding tb, int dim, long[] poss) {
- super( sources , tb, poss);
- dimensions = dim ;
-}
-public int dimensions() {
- return dimensions;
-}
-public TypeBinding getTypeBinding(Scope scope) {
- if (this.resolvedType != null)
- return this.resolvedType;
- if (dimensions > 255) {
- scope.problemReporter().tooManyDimensions(this);
+
+ public ArrayQualifiedTypeReference(char[][] sources, int dim, long[] poss) {
+ super(sources, poss);
+ dimensions = dim;
+ }
+
+ public ArrayQualifiedTypeReference(char[][] sources, TypeBinding tb,
+ int dim, long[] poss) {
+ super(sources, tb, poss);
+ dimensions = dim;
+ }
+
+ public int dimensions() {
+ return dimensions;
+ }
+
+ public TypeBinding getTypeBinding(Scope scope) {
+ if (this.resolvedType != null)
+ return this.resolvedType;
+ if (dimensions > 255) {
+ scope.problemReporter().tooManyDimensions(this);
+ }
+ return scope.createArray(scope.getType(tokens), dimensions);
+ }
+
+ public String toStringExpression(int tab) {
+ /* slow speed */
+
+ String s = super.toStringExpression(tab);
+ if (dimensions == 1)
+ return s + "[]"; //$NON-NLS-1$
+ for (int i = 1; i <= dimensions; i++)
+ s = s + "[]"; //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+
+ public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
}
- return scope.createArray(scope.getType(tokens), dimensions);
-}
-public String toStringExpression(int tab){
- /* slow speed */
-
- String s = super.toStringExpression(tab) ;
- if (dimensions == 1 ) return s + "[]" ; //$NON-NLS-1$
- for (int i=1 ; i <= dimensions ; i++)
- s = s + "[]" ; //$NON-NLS-1$
- return s ;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayReference.java
index 5d49323..1f1a810 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayReference.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayReference.java
@@ -19,8 +19,9 @@ import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
public class ArrayReference extends Reference {
-
+
public Expression receiver;
+
public Expression position;
public ArrayReference(Expression rec, Expression pos) {
@@ -29,154 +30,150 @@ public class ArrayReference extends Reference {
sourceStart = rec.sourceStart;
}
- public FlowInfo analyseAssignment(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo,
- Assignment assignment,
- boolean compoundAssignment) {
+ public FlowInfo analyseAssignment(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo, Assignment assignment,
+ boolean compoundAssignment) {
if (assignment.expression == null) {
- return analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
+ return analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits();
} else {
- return assignment
- .expression
- .analyseCode(
+ return assignment.expression.analyseCode(
currentScope,
flowContext,
- analyseCode(currentScope, flowContext, flowInfo).unconditionalInits())
- .unconditionalInits();
+ analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits()).unconditionalInits();
}
}
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
- return position.analyseCode(
- currentScope,
- flowContext,
- receiver.analyseCode(currentScope, flowContext, flowInfo));
+ return position.analyseCode(currentScope, flowContext, receiver
+ .analyseCode(currentScope, flowContext, flowInfo));
}
-// public void generateAssignment(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Assignment assignment,
-// boolean valueRequired) {
-//
-// receiver.generateCode(currentScope, codeStream, true);
-// position.generateCode(currentScope, codeStream, true);
-// assignment.expression.generateCode(currentScope, codeStream, true);
-// codeStream.arrayAtPut(this.resolvedType.id, valueRequired);
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(assignment.implicitConversion);
-// }
-// }
+ // public void generateAssignment(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Assignment assignment,
+ // boolean valueRequired) {
+ //
+ // receiver.generateCode(currentScope, codeStream, true);
+ // position.generateCode(currentScope, codeStream, true);
+ // assignment.expression.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAtPut(this.resolvedType.id, valueRequired);
+ // if (valueRequired) {
+ // codeStream.generateImplicitConversion(assignment.implicitConversion);
+ // }
+ // }
/**
* Code generation for a array reference
*/
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// receiver.generateCode(currentScope, codeStream, true);
-// position.generateCode(currentScope, codeStream, true);
-// codeStream.arrayAt(this.resolvedType.id);
-// // Generating code for the potential runtime type checking
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// } else {
-// if (this.resolvedType == LongBinding
-// || this.resolvedType == DoubleBinding) {
-// codeStream.pop2();
-// } else {
-// codeStream.pop();
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-//
-// public void generateCompoundAssignment(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Expression expression,
-// int operator,
-// int assignmentImplicitConversion,
-// boolean valueRequired) {
-//
-// receiver.generateCode(currentScope, codeStream, true);
-// position.generateCode(currentScope, codeStream, true);
-// codeStream.dup2();
-// codeStream.arrayAt(this.resolvedType.id);
-// int operationTypeID;
-// if ((operationTypeID = implicitConversion >> 4) == T_String) {
-// codeStream.generateStringAppend(currentScope, null, expression);
-// } else {
-// // promote the array reference to the suitable operation type
-// codeStream.generateImplicitConversion(implicitConversion);
-// // generate the increment value (will by itself be promoted to the operation value)
-// if (expression == IntLiteral.One) { // prefix operation
-// codeStream.generateConstant(expression.constant, implicitConversion);
-// } else {
-// expression.generateCode(currentScope, codeStream, true);
-// }
-// // perform the operation
-// codeStream.sendOperator(operator, operationTypeID);
-// // cast the value back to the array reference type
-// codeStream.generateImplicitConversion(assignmentImplicitConversion);
-// }
-// codeStream.arrayAtPut(this.resolvedType.id, valueRequired);
-// }
-//
-// public void generatePostIncrement(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// CompoundAssignment postIncrement,
-// boolean valueRequired) {
-//
-// receiver.generateCode(currentScope, codeStream, true);
-// position.generateCode(currentScope, codeStream, true);
-// codeStream.dup2();
-// codeStream.arrayAt(this.resolvedType.id);
-// if (valueRequired) {
-// if ((this.resolvedType == LongBinding)
-// || (this.resolvedType == DoubleBinding)) {
-// codeStream.dup2_x2();
-// } else {
-// codeStream.dup_x2();
-// }
-// }
-// codeStream.generateConstant(
-// postIncrement.expression.constant,
-// implicitConversion);
-// codeStream.sendOperator(postIncrement.operator, this.resolvedType.id);
-// codeStream.generateImplicitConversion(
-// postIncrement.assignmentImplicitConversion);
-// codeStream.arrayAtPut(this.resolvedType.id, false);
-// }
+ // public void generateCode(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // boolean valueRequired) {
+ //
+ // int pc = codeStream.position;
+ // receiver.generateCode(currentScope, codeStream, true);
+ // position.generateCode(currentScope, codeStream, true);
+ // codeStream.arrayAt(this.resolvedType.id);
+ // // Generating code for the potential runtime type checking
+ // if (valueRequired) {
+ // codeStream.generateImplicitConversion(implicitConversion);
+ // } else {
+ // if (this.resolvedType == LongBinding
+ // || this.resolvedType == DoubleBinding) {
+ // codeStream.pop2();
+ // } else {
+ // codeStream.pop();
+ // }
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
+ //
+ // public void generateCompoundAssignment(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Expression expression,
+ // int operator,
+ // int assignmentImplicitConversion,
+ // boolean valueRequired) {
+ //
+ // receiver.generateCode(currentScope, codeStream, true);
+ // position.generateCode(currentScope, codeStream, true);
+ // codeStream.dup2();
+ // codeStream.arrayAt(this.resolvedType.id);
+ // int operationTypeID;
+ // if ((operationTypeID = implicitConversion >> 4) == T_String) {
+ // codeStream.generateStringAppend(currentScope, null, expression);
+ // } else {
+ // // promote the array reference to the suitable operation type
+ // codeStream.generateImplicitConversion(implicitConversion);
+ // // generate the increment value (will by itself be promoted to the
+ // operation value)
+ // if (expression == IntLiteral.One) { // prefix operation
+ // codeStream.generateConstant(expression.constant, implicitConversion);
+ // } else {
+ // expression.generateCode(currentScope, codeStream, true);
+ // }
+ // // perform the operation
+ // codeStream.sendOperator(operator, operationTypeID);
+ // // cast the value back to the array reference type
+ // codeStream.generateImplicitConversion(assignmentImplicitConversion);
+ // }
+ // codeStream.arrayAtPut(this.resolvedType.id, valueRequired);
+ // }
+ //
+ // public void generatePostIncrement(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // CompoundAssignment postIncrement,
+ // boolean valueRequired) {
+ //
+ // receiver.generateCode(currentScope, codeStream, true);
+ // position.generateCode(currentScope, codeStream, true);
+ // codeStream.dup2();
+ // codeStream.arrayAt(this.resolvedType.id);
+ // if (valueRequired) {
+ // if ((this.resolvedType == LongBinding)
+ // || (this.resolvedType == DoubleBinding)) {
+ // codeStream.dup2_x2();
+ // } else {
+ // codeStream.dup_x2();
+ // }
+ // }
+ // codeStream.generateConstant(
+ // postIncrement.expression.constant,
+ // implicitConversion);
+ // codeStream.sendOperator(postIncrement.operator, this.resolvedType.id);
+ // codeStream.generateImplicitConversion(
+ // postIncrement.assignmentImplicitConversion);
+ // codeStream.arrayAtPut(this.resolvedType.id, false);
+ // }
public StringBuffer printExpression(int indent, StringBuffer output) {
receiver.printExpression(0, output).append('[');
return position.printExpression(0, output).append(']');
}
-
+
public TypeBinding resolveType(BlockScope scope) {
constant = Constant.NotAConstant;
TypeBinding arrayType = receiver.resolveType(scope);
if (arrayType != null) {
if (arrayType.isArrayType()) {
- this.resolvedType = ((ArrayBinding) arrayType).elementsType(scope);
+ this.resolvedType = ((ArrayBinding) arrayType)
+ .elementsType(scope);
} else {
- scope.problemReporter().referenceMustBeArrayTypeAt(arrayType, this);
+ scope.problemReporter().referenceMustBeArrayTypeAt(arrayType,
+ this);
}
}
- TypeBinding positionType = position.resolveTypeExpecting(scope, IntBinding);
+ TypeBinding positionType = position.resolveTypeExpecting(scope,
+ IntBinding);
if (positionType != null) {
position.implicitWidening(IntBinding, positionType);
}
@@ -186,11 +183,11 @@ public class ArrayReference extends Reference {
public String toStringExpression() {
return receiver.toStringExpression() + "[" //$NON-NLS-1$
- +position.toStringExpression() + "]"; //$NON-NLS-1$
- }
+ + position.toStringExpression() + "]"; //$NON-NLS-1$
+ }
public void traverse(ASTVisitor visitor, BlockScope scope) {
-
+
if (visitor.visit(this, scope)) {
receiver.traverse(visitor, scope);
position.traverse(visitor, scope);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayTypeReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayTypeReference.java
index fb4d932..f7edabc 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayTypeReference.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayTypeReference.java
@@ -17,41 +17,53 @@ import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
public class ArrayTypeReference extends SingleTypeReference {
public int dimensions;
-/**
- * ArrayTypeReference constructor comment.
- * @param source char[]
- * @param dim int
- * @param pos int
- */
-public ArrayTypeReference(char[] source, int dim, long pos) {
- super(source, pos);
- dimensions = dim ;
-}
-public ArrayTypeReference(char[] source, TypeBinding tb, int dim, long pos) {
- super(source, tb, pos);
- dimensions = dim ;}
-public int dimensions() {
- return dimensions;
-}
-public TypeBinding getTypeBinding(Scope scope) {
- if (this.resolvedType != null)
- return this.resolvedType;
- if (dimensions > 255) {
- scope.problemReporter().tooManyDimensions(this);
+
+ /**
+ * ArrayTypeReference constructor comment.
+ *
+ * @param source
+ * char[]
+ * @param dim
+ * int
+ * @param pos
+ * int
+ */
+ public ArrayTypeReference(char[] source, int dim, long pos) {
+ super(source, pos);
+ dimensions = dim;
}
- return scope.createArray(scope.getType(token), dimensions);
-}
-public String toStringExpression(int tab){
+ public ArrayTypeReference(char[] source, TypeBinding tb, int dim, long pos) {
+ super(source, tb, pos);
+ dimensions = dim;
+ }
- String s = super.toStringExpression(tab) ;
- if (dimensions == 1 ) return s + "[]" ; //$NON-NLS-1$
- for (int i=1 ; i <= dimensions ; i++)
- s = s + "[]" ; //$NON-NLS-1$
- return s ;
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
- visitor.visit(this, scope);
- visitor.endVisit(this, scope);
-}
+ public int dimensions() {
+ return dimensions;
+ }
+
+ public TypeBinding getTypeBinding(Scope scope) {
+ if (this.resolvedType != null)
+ return this.resolvedType;
+ if (dimensions > 255) {
+ scope.problemReporter().tooManyDimensions(this);
+ }
+ return scope.createArray(scope.getType(token), dimensions);
+
+ }
+
+ public String toStringExpression(int tab) {
+
+ String s = super.toStringExpression(tab);
+ if (dimensions == 1)
+ return s + "[]"; //$NON-NLS-1$
+ for (int i = 1; i <= dimensions; i++)
+ s = s + "[]"; //$NON-NLS-1$
+ return s;
+ }
+
+ public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AssertStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AssertStatement.java
index 87f61e8..64705dc 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AssertStatement.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AssertStatement.java
@@ -21,18 +21,17 @@ import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
public class AssertStatement extends Statement {
-
+
public Expression assertExpression, exceptionArgument;
// for local variable attribute
int preAssertInitStateIndex = -1;
+
private FieldBinding assertionSyntheticFieldBinding;
-
- public AssertStatement(
- Expression exceptionArgument,
- Expression assertExpression,
- int startPosition) {
-
+
+ public AssertStatement(Expression exceptionArgument,
+ Expression assertExpression, int startPosition) {
+
this.assertExpression = assertExpression;
this.exceptionArgument = exceptionArgument;
sourceStart = startPosition;
@@ -46,77 +45,85 @@ public class AssertStatement extends Statement {
sourceEnd = assertExpression.sourceEnd;
}
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
-
- preAssertInitStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo);
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
- Constant cst = this.assertExpression.optimizedBooleanConstant();
- boolean isOptimizedTrueAssertion = cst != NotAConstant && cst.booleanValue() == true;
- boolean isOptimizedFalseAssertion = cst != NotAConstant && cst.booleanValue() == false;
+ preAssertInitStateIndex = currentScope.methodScope()
+ .recordInitializationStates(flowInfo);
+
+ Constant cst = this.assertExpression.optimizedBooleanConstant();
+ boolean isOptimizedTrueAssertion = cst != NotAConstant
+ && cst.booleanValue() == true;
+ boolean isOptimizedFalseAssertion = cst != NotAConstant
+ && cst.booleanValue() == false;
FlowInfo assertInfo = flowInfo.copy();
if (isOptimizedTrueAssertion) {
assertInfo.setReachMode(FlowInfo.UNREACHABLE);
}
- assertInfo = assertExpression.analyseCode(currentScope, flowContext, assertInfo).unconditionalInits();
-
+ assertInfo = assertExpression.analyseCode(currentScope, flowContext,
+ assertInfo).unconditionalInits();
+
if (exceptionArgument != null) {
- // only gets evaluated when escaping - results are not taken into account
- FlowInfo exceptionInfo = exceptionArgument.analyseCode(currentScope, flowContext, assertInfo.copy());
-
- if (!isOptimizedTrueAssertion){
- flowContext.checkExceptionHandlers(
- currentScope.getJavaLangAssertionError(),
- this,
- exceptionInfo,
- currentScope);
+ // only gets evaluated when escaping - results are not taken into
+ // account
+ FlowInfo exceptionInfo = exceptionArgument.analyseCode(
+ currentScope, flowContext, assertInfo.copy());
+
+ if (!isOptimizedTrueAssertion) {
+ flowContext.checkExceptionHandlers(currentScope
+ .getJavaLangAssertionError(), this, exceptionInfo,
+ currentScope);
}
}
-
+
// add the assert support in the clinit
manageSyntheticAccessIfNecessary(currentScope);
if (isOptimizedFalseAssertion) {
- return flowInfo; // if assertions are enabled, the following code will be unreachable
+ return flowInfo; // if assertions are enabled, the following code
+ // will be unreachable
} else {
- return flowInfo.mergedWith(assertInfo.unconditionalInits());
+ return flowInfo.mergedWith(assertInfo.unconditionalInits());
}
}
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-//
-// if (this.assertionSyntheticFieldBinding != null) {
-// Label assertionActivationLabel = new Label(codeStream);
-// codeStream.getstatic(this.assertionSyntheticFieldBinding);
-// codeStream.ifne(assertionActivationLabel);
-// Label falseLabel = new Label(codeStream);
-// assertExpression.generateOptimizedBoolean(currentScope, codeStream, (falseLabel = new Label(codeStream)), null , true);
-// codeStream.newJavaLangAssertionError();
-// codeStream.dup();
-// if (exceptionArgument != null) {
-// exceptionArgument.generateCode(currentScope, codeStream, true);
-// codeStream.invokeJavaLangAssertionErrorConstructor(exceptionArgument.implicitConversion & 0xF);
-// } else {
-// codeStream.invokeJavaLangAssertionErrorDefaultConstructor();
-// }
-// codeStream.athrow();
-// falseLabel.place();
-// assertionActivationLabel.place();
-// }
-//
-// // May loose some local variable initializations : affecting the local variable attributes
-// if (preAssertInitStateIndex != -1) {
-// codeStream.removeNotDefinitelyAssignedVariables(currentScope, preAssertInitStateIndex);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
+ // public void generateCode(BlockScope currentScope, CodeStream codeStream)
+ // {
+ //
+ // if ((bits & IsReachableMASK) == 0) {
+ // return;
+ // }
+ // int pc = codeStream.position;
+ //
+ // if (this.assertionSyntheticFieldBinding != null) {
+ // Label assertionActivationLabel = new Label(codeStream);
+ // codeStream.getstatic(this.assertionSyntheticFieldBinding);
+ // codeStream.ifne(assertionActivationLabel);
+ // Label falseLabel = new Label(codeStream);
+ // assertExpression.generateOptimizedBoolean(currentScope, codeStream,
+ // (falseLabel = new Label(codeStream)), null , true);
+ // codeStream.newJavaLangAssertionError();
+ // codeStream.dup();
+ // if (exceptionArgument != null) {
+ // exceptionArgument.generateCode(currentScope, codeStream, true);
+ // codeStream.invokeJavaLangAssertionErrorConstructor(exceptionArgument.implicitConversion
+ // & 0xF);
+ // } else {
+ // codeStream.invokeJavaLangAssertionErrorDefaultConstructor();
+ // }
+ // codeStream.athrow();
+ // falseLabel.place();
+ // assertionActivationLabel.place();
+ // }
+ //
+ // // May loose some local variable initializations : affecting the local
+ // variable attributes
+ // if (preAssertInitStateIndex != -1) {
+ // codeStream.removeNotDefinitelyAssignedVariables(currentScope,
+ // preAssertInitStateIndex);
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
public StringBuffer printStatement(int tab, StringBuffer output) {
printIndent(tab, output);
@@ -128,20 +135,24 @@ public class AssertStatement extends Statement {
}
return output.append(';');
}
+
public void resolve(BlockScope scope) {
assertExpression.resolveTypeExpecting(scope, BooleanBinding);
if (exceptionArgument != null) {
- TypeBinding exceptionArgumentType = exceptionArgument.resolveType(scope);
- if (exceptionArgumentType != null){
- if (exceptionArgumentType.id == T_void){
- scope.problemReporter().illegalVoidExpression(exceptionArgument);
+ TypeBinding exceptionArgumentType = exceptionArgument
+ .resolveType(scope);
+ if (exceptionArgumentType != null) {
+ if (exceptionArgumentType.id == T_void) {
+ scope.problemReporter().illegalVoidExpression(
+ exceptionArgument);
}
- exceptionArgument.implicitConversion = (exceptionArgumentType.id << 4) + exceptionArgumentType.id;
+ exceptionArgument.implicitConversion = (exceptionArgumentType.id << 4)
+ + exceptionArgumentType.id;
}
}
}
-
+
public void traverse(ASTVisitor visitor, BlockScope scope) {
if (visitor.visit(this, scope)) {
@@ -151,20 +162,23 @@ public class AssertStatement extends Statement {
}
}
visitor.endVisit(this, scope);
- }
-
+ }
+
public void manageSyntheticAccessIfNecessary(BlockScope currentScope) {
// need assertion flag: $assertionsDisabled on outer most source clas
- // (in case of static member of interface, will use the outermost static member - bug 22334)
+ // (in case of static member of interface, will use the outermost static
+ // member - bug 22334)
SourceTypeBinding outerMostClass = currentScope.enclosingSourceType();
- while (outerMostClass.isLocalType()){
+ while (outerMostClass.isLocalType()) {
ReferenceBinding enclosing = outerMostClass.enclosingType();
- if (enclosing == null || enclosing.isInterface()) break;
+ if (enclosing == null || enclosing.isInterface())
+ break;
outerMostClass = (SourceTypeBinding) enclosing;
}
- this.assertionSyntheticFieldBinding = outerMostClass.addSyntheticField(this, currentScope);
+ this.assertionSyntheticFieldBinding = outerMostClass.addSyntheticField(
+ this, currentScope);
// find and enable assertion support
TypeDeclaration typeDeclaration = outerMostClass.scope.referenceType();
@@ -172,7 +186,8 @@ public class AssertStatement extends Statement {
for (int i = 0, max = methods.length; i < max; i++) {
AbstractMethodDeclaration method = methods[i];
if (method.isClinit()) {
- ((Clinit) method).addSupportForAssertion(assertionSyntheticFieldBinding);
+ ((Clinit) method)
+ .addSupportForAssertion(assertionSyntheticFieldBinding);
break;
}
}
@@ -190,5 +205,5 @@ public class AssertStatement extends Statement {
}
return buffer.toString();
}
-
+
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Assignment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Assignment.java
index 90a58c8..297f4a0 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Assignment.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Assignment.java
@@ -22,152 +22,167 @@ import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
public class Assignment extends Expression {
public Expression lhs;
+
public Expression expression;
-
+
public Assignment(Expression lhs, Expression expression, int sourceEnd) {
- //lhs is always a reference by construction ,
- //but is build as an expression ==> the checkcast cannot fail
+ // lhs is always a reference by construction ,
+ // but is build as an expression ==> the checkcast cannot fail
this.lhs = lhs;
lhs.bits |= IsStrictlyAssignedMASK; // tag lhs as assigned
-
+
this.expression = expression;
this.sourceStart = lhs.sourceStart;
this.sourceEnd = sourceEnd;
}
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
- // record setting a variable: various scenarii are possible, setting an array reference,
- // a field reference, a blank final field reference, a field of an enclosing instance or
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
+ // record setting a variable: various scenarii are possible, setting an
+ // array reference,
+ // a field reference, a blank final field reference, a field of an
+ // enclosing instance or
// just a local variable.
- return ((Reference) lhs)
- .analyseAssignment(currentScope, flowContext, flowInfo, this, false)
- .unconditionalInits();
+ return ((Reference) lhs).analyseAssignment(currentScope, flowContext,
+ flowInfo, this, false).unconditionalInits();
}
void checkAssignmentEffect(BlockScope scope) {
-
+
Binding left = getDirectBinding(this.lhs);
if (left != null && left == getDirectBinding(this.expression)) {
- scope.problemReporter().assignmentHasNoEffect(this, left.shortReadableName());
- this.bits |= IsAssignmentWithNoEffectMASK; // record assignment has no effect
+ scope.problemReporter().assignmentHasNoEffect(this,
+ left.shortReadableName());
+ this.bits |= IsAssignmentWithNoEffectMASK; // record assignment has
+ // no effect
}
}
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// // various scenarii are possible, setting an array reference,
-// // a field reference, a blank final field reference, a field of an enclosing instance or
-// // just a local variable.
-//
-// int pc = codeStream.position;
-// if ((this.bits & IsAssignmentWithNoEffectMASK) != 0) {
-// if (valueRequired) {
-// this.expression.generateCode(currentScope, codeStream, true);
-// }
-// } else {
-// ((Reference) lhs).generateAssignment(currentScope, codeStream, this, valueRequired);
-// // variable may have been optimized out
-// // the lhs is responsible to perform the implicitConversion generation for the assignment since optimized for unused local assignment.
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
+ // public void generateCode(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // boolean valueRequired) {
+ //
+ // // various scenarii are possible, setting an array reference,
+ // // a field reference, a blank final field reference, a field of an
+ // enclosing instance or
+ // // just a local variable.
+ //
+ // int pc = codeStream.position;
+ // if ((this.bits & IsAssignmentWithNoEffectMASK) != 0) {
+ // if (valueRequired) {
+ // this.expression.generateCode(currentScope, codeStream, true);
+ // }
+ // } else {
+ // ((Reference) lhs).generateAssignment(currentScope, codeStream, this,
+ // valueRequired);
+ // // variable may have been optimized out
+ // // the lhs is responsible to perform the implicitConversion generation
+ // for the assignment since optimized for unused local assignment.
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
Binding getDirectBinding(Expression someExpression) {
if (someExpression instanceof SingleNameReference) {
- return ((SingleNameReference)someExpression).binding;
+ return ((SingleNameReference) someExpression).binding;
} else if (someExpression instanceof FieldReference) {
- FieldReference fieldRef = (FieldReference)someExpression;
- if (fieldRef.receiver.isThis() && !(fieldRef.receiver instanceof QualifiedThisReference)) {
+ FieldReference fieldRef = (FieldReference) someExpression;
+ if (fieldRef.receiver.isThis()
+ && !(fieldRef.receiver instanceof QualifiedThisReference)) {
return fieldRef.binding;
- }
+ }
}
return null;
}
+
public StringBuffer print(int indent, StringBuffer output) {
- //no () when used as a statement
+ // no () when used as a statement
printIndent(indent, output);
return printExpressionNoParenthesis(indent, output);
}
+
public StringBuffer printExpression(int indent, StringBuffer output) {
- //subclass redefine printExpressionNoParenthesis()
+ // subclass redefine printExpressionNoParenthesis()
output.append('(');
return printExpressionNoParenthesis(0, output).append(')');
- }
+ }
- public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
+ public StringBuffer printExpressionNoParenthesis(int indent,
+ StringBuffer output) {
lhs.printExpression(indent, output).append(" = "); //$NON-NLS-1$
return expression.printExpression(0, output);
}
-
+
public StringBuffer printStatement(int indent, StringBuffer output) {
- //no () when used as a statement
+ // no () when used as a statement
return print(indent, output).append(';');
}
+
public TypeBinding resolveType(BlockScope scope) {
- // due to syntax lhs may be only a NameReference, a FieldReference or an ArrayReference
+ // due to syntax lhs may be only a NameReference, a FieldReference or an
+ // ArrayReference
constant = NotAConstant;
if (!(this.lhs instanceof Reference)) {
scope.problemReporter().expressionShouldBeAVariable(this.lhs);
}
- this.resolvedType = lhs.resolveType(scope); // expressionType contains the assignment type (lhs Type)
+ this.resolvedType = lhs.resolveType(scope); // expressionType contains
+ // the assignment type (lhs
+ // Type)
TypeBinding rhsType = expression.resolveType(scope);
if (this.resolvedType == null || rhsType == null) {
return null;
}
checkAssignmentEffect(scope);
-
- // Compile-time conversion of base-types : implicit narrowing integer into byte/short/character
+
+ // Compile-time conversion of base-types : implicit narrowing integer
+ // into byte/short/character
// may require to widen the rhs expression at runtime
- if ((expression.isConstantValueOfTypeAssignableToType(rhsType, this.resolvedType)
- || (this.resolvedType.isBaseType() && BaseTypeBinding.isWidening(this.resolvedType.id, rhsType.id)))
+ if ((expression.isConstantValueOfTypeAssignableToType(rhsType,
+ this.resolvedType) || (this.resolvedType.isBaseType() && BaseTypeBinding
+ .isWidening(this.resolvedType.id, rhsType.id)))
|| rhsType.isCompatibleWith(this.resolvedType)) {
expression.implicitWidening(this.resolvedType, rhsType);
return this.resolvedType;
}
scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
- expression,
- rhsType,
- this.resolvedType);
+ expression, rhsType, this.resolvedType);
return this.resolvedType;
}
public String toString(int tab) {
- //no () when used as a statement
+ // no () when used as a statement
return tabString(tab) + toStringExpressionNoParenthesis();
}
public String toStringExpression() {
- //subclass redefine toStringExpressionNoParenthesis()
+ // subclass redefine toStringExpressionNoParenthesis()
return "(" + toStringExpressionNoParenthesis() + ")"; //$NON-NLS-2$ //$NON-NLS-1$
- }
-
+ }
+
public String toStringExpressionNoParenthesis() {
- return lhs.toStringExpression() + " " //$NON-NLS-1$
- + "=" //$NON-NLS-1$
- + ((expression.constant != null) && (expression.constant != NotAConstant)
- ? " /*cst:" + expression.constant.toString() + "*/ " //$NON-NLS-1$ //$NON-NLS-2$
- : " ") //$NON-NLS-1$
- + expression.toStringExpression();
+ return lhs.toStringExpression()
+ + " " //$NON-NLS-1$
+ + "=" //$NON-NLS-1$
+ + ((expression.constant != null)
+ && (expression.constant != NotAConstant) ? " /*cst:" + expression.constant.toString() + "*/ " //$NON-NLS-1$ //$NON-NLS-2$
+ : " ") //$NON-NLS-1$
+ + expression.toStringExpression();
}
+
public void traverse(ASTVisitor visitor, BlockScope scope) {
-
+
if (visitor.visit(this, scope)) {
lhs.traverse(visitor, scope);
expression.traverse(visitor, scope);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java
index ce506cb..8a264bc 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java
@@ -21,6 +21,7 @@ import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
public class BinaryExpression extends OperatorExpression {
public Expression left, right;
+
public Constant optimizedBooleanConstant;
public BinaryExpression(Expression left, Expression right, int operator) {
@@ -32,1622 +33,1631 @@ public class BinaryExpression extends OperatorExpression {
this.sourceEnd = right.sourceEnd;
}
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
- return right
- .analyseCode(
+ return right.analyseCode(
currentScope,
flowContext,
- left.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits())
- .unconditionalInits();
+ left.analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits()).unconditionalInits();
}
public void computeConstant(BlockScope scope, int leftId, int rightId) {
- //compute the constant when valid
+ // compute the constant when valid
if ((this.left.constant != Constant.NotAConstant)
- && (this.right.constant != Constant.NotAConstant)) {
+ && (this.right.constant != Constant.NotAConstant)) {
try {
- this.constant =
- Constant.computeConstantOperation(
- this.left.constant,
- leftId,
+ this.constant = Constant.computeConstantOperation(
+ this.left.constant, leftId,
(this.bits & OperatorMASK) >> OperatorSHIFT,
- this.right.constant,
- rightId);
+ this.right.constant, rightId);
} catch (ArithmeticException e) {
this.constant = Constant.NotAConstant;
// 1.2 no longer throws an exception at compile-time
- //scope.problemReporter().compileTimeConstantThrowsArithmeticException(this);
+ // scope.problemReporter().compileTimeConstantThrowsArithmeticException(this);
}
} else {
this.constant = Constant.NotAConstant;
- //add some work for the boolean operators & |
-// this.optimizedBooleanConstant(
-// leftId,
-// (this.bits & OperatorMASK) >> OperatorSHIFT,
-// rightId);
+ // add some work for the boolean operators & |
+ // this.optimizedBooleanConstant(
+ // leftId,
+ // (this.bits & OperatorMASK) >> OperatorSHIFT,
+ // rightId);
}
}
public Constant optimizedBooleanConstant() {
- return this.optimizedBooleanConstant == null ? this.constant : this.optimizedBooleanConstant;
+ return this.optimizedBooleanConstant == null ? this.constant
+ : this.optimizedBooleanConstant;
}
/**
* Code generation for a binary operation
*/
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// Label falseLabel, endLabel;
-// if (constant != Constant.NotAConstant) {
-// if (valueRequired)
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// bits |= OnlyValueRequiredMASK;
-// switch ((bits & OperatorMASK) >> OperatorSHIFT) {
-// case PLUS :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_String :
-// codeStream.generateStringAppend(currentScope, left, right);
-// if (!valueRequired)
-// codeStream.pop();
-// break;
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.iadd();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ladd();
-// break;
-// case T_double :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.dadd();
-// break;
-// case T_float :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.fadd();
-// break;
-// }
-// break;
-// case MINUS :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.isub();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lsub();
-// break;
-// case T_double :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.dsub();
-// break;
-// case T_float :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.fsub();
-// break;
-// }
-// break;
-// case MULTIPLY :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.imul();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lmul();
-// break;
-// case T_double :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.dmul();
-// break;
-// case T_float :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.fmul();
-// break;
-// }
-// break;
-// case DIVIDE :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, true);
-// right.generateCode(currentScope, codeStream, true);
-// codeStream.idiv();
-// if (!valueRequired)
-// codeStream.pop();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, true);
-// right.generateCode(currentScope, codeStream, true);
-// codeStream.ldiv();
-// if (!valueRequired)
-// codeStream.pop2();
-// break;
-// case T_double :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ddiv();
-// break;
-// case T_float :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.fdiv();
-// break;
-// }
-// break;
-// case REMAINDER :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, true);
-// right.generateCode(currentScope, codeStream, true);
-// codeStream.irem();
-// if (!valueRequired)
-// codeStream.pop();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, true);
-// right.generateCode(currentScope, codeStream, true);
-// codeStream.lrem();
-// if (!valueRequired)
-// codeStream.pop2();
-// break;
-// case T_double :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.drem();
-// break;
-// case T_float :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.frem();
-// break;
-// }
-// break;
-// case AND :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// // 0 & x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_int)
-// && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, false);
-// if (valueRequired)
-// codeStream.iconst_0();
-// } else {
-// // x & 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_int)
-// && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, false);
-// if (valueRequired)
-// codeStream.iconst_0();
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.iand();
-// }
-// }
-// break;
-// case T_long :
-// // 0 & x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_long)
-// && (left.constant.longValue() == 0L)) {
-// right.generateCode(currentScope, codeStream, false);
-// if (valueRequired)
-// codeStream.lconst_0();
-// } else {
-// // x & 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_long)
-// && (right.constant.longValue() == 0L)) {
-// left.generateCode(currentScope, codeStream, false);
-// if (valueRequired)
-// codeStream.lconst_0();
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.land();
-// }
-// }
-// break;
-// case T_boolean : // logical and
-// generateOptimizedLogicalAnd(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// /* improving code gen for such a case: boolean b = i < 0 && false;
-// * since the label has never been used, we have the inlined value on the stack. */
-// if (falseLabel.hasForwardReferences()) {
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// } else {
-// falseLabel.place();
-// }
-// }
-// }
-// break;
-// case OR :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// // 0 | x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_int)
-// && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// // x | 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_int)
-// && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ior();
-// }
-// }
-// break;
-// case T_long :
-// // 0 | x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_long)
-// && (left.constant.longValue() == 0L)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// // x | 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_long)
-// && (right.constant.longValue() == 0L)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lor();
-// }
-// }
-// break;
-// case T_boolean : // logical or
-// generateOptimizedLogicalOr(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// /* improving code gen for such a case: boolean b = i < 0 || true;
-// * since the label has never been used, we have the inlined value on the stack. */
-// if (falseLabel.hasForwardReferences()) {
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// } else {
-// falseLabel.place();
-// }
-// }
-// }
-// break;
-// case XOR :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// // 0 ^ x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_int)
-// && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// // x ^ 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_int)
-// && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ixor();
-// }
-// }
-// break;
-// case T_long :
-// // 0 ^ x
-// if ((left.constant != Constant.NotAConstant)
-// && (left.constant.typeID() == T_long)
-// && (left.constant.longValue() == 0L)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// // x ^ 0
-// if ((right.constant != Constant.NotAConstant)
-// && (right.constant.typeID() == T_long)
-// && (right.constant.longValue() == 0L)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lxor();
-// }
-// }
-// break;
-// case T_boolean :
-// generateOptimizedLogicalXor(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// /* improving code gen for such a case: boolean b = i < 0 ^ bool;
-// * since the label has never been used, we have the inlined value on the stack. */
-// if (falseLabel.hasForwardReferences()) {
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// } else {
-// falseLabel.place();
-// }
-// }
-// }
-// break;
-// case LEFT_SHIFT :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ishl();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lshl();
-// }
-// break;
-// case RIGHT_SHIFT :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.ishr();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lshr();
-// }
-// break;
-// case UNSIGNED_RIGHT_SHIFT :
-// switch (bits & ReturnTypeIDMASK) {
-// case T_int :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.iushr();
-// break;
-// case T_long :
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired)
-// codeStream.lushr();
-// }
-// break;
-// case GREATER :
-// generateOptimizedGreaterThan(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// }
-// break;
-// case GREATER_EQUAL :
-// generateOptimizedGreaterThanOrEqual(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// }
-// break;
-// case LESS :
-// generateOptimizedLessThan(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// }
-// break;
-// case LESS_EQUAL :
-// generateOptimizedLessThanOrEqual(
-// currentScope,
-// codeStream,
-// null,
-// (falseLabel = new Label(codeStream)),
-// valueRequired);
-// if (valueRequired) {
-// codeStream.iconst_1();
-// if ((bits & ValueForReturnMASK) != 0) {
-// codeStream.ireturn();
-// falseLabel.place();
-// codeStream.iconst_0();
-// } else {
-// codeStream.goto_(endLabel = new Label(codeStream));
-// codeStream.decrStackSize(1);
-// falseLabel.place();
-// codeStream.iconst_0();
-// endLabel.place();
-// }
-// }
-// }
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
+ // public void generateCode(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // boolean valueRequired) {
+ //
+ // int pc = codeStream.position;
+ // Label falseLabel, endLabel;
+ // if (constant != Constant.NotAConstant) {
+ // if (valueRequired)
+ // codeStream.generateConstant(constant, implicitConversion);
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // return;
+ // }
+ // bits |= OnlyValueRequiredMASK;
+ // switch ((bits & OperatorMASK) >> OperatorSHIFT) {
+ // case PLUS :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_String :
+ // codeStream.generateStringAppend(currentScope, left, right);
+ // if (!valueRequired)
+ // codeStream.pop();
+ // break;
+ // case T_int :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.iadd();
+ // break;
+ // case T_long :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.ladd();
+ // break;
+ // case T_double :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.dadd();
+ // break;
+ // case T_float :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.fadd();
+ // break;
+ // }
+ // break;
+ // case MINUS :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_int :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.isub();
+ // break;
+ // case T_long :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.lsub();
+ // break;
+ // case T_double :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.dsub();
+ // break;
+ // case T_float :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.fsub();
+ // break;
+ // }
+ // break;
+ // case MULTIPLY :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_int :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.imul();
+ // break;
+ // case T_long :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.lmul();
+ // break;
+ // case T_double :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.dmul();
+ // break;
+ // case T_float :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.fmul();
+ // break;
+ // }
+ // break;
+ // case DIVIDE :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_int :
+ // left.generateCode(currentScope, codeStream, true);
+ // right.generateCode(currentScope, codeStream, true);
+ // codeStream.idiv();
+ // if (!valueRequired)
+ // codeStream.pop();
+ // break;
+ // case T_long :
+ // left.generateCode(currentScope, codeStream, true);
+ // right.generateCode(currentScope, codeStream, true);
+ // codeStream.ldiv();
+ // if (!valueRequired)
+ // codeStream.pop2();
+ // break;
+ // case T_double :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.ddiv();
+ // break;
+ // case T_float :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.fdiv();
+ // break;
+ // }
+ // break;
+ // case REMAINDER :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_int :
+ // left.generateCode(currentScope, codeStream, true);
+ // right.generateCode(currentScope, codeStream, true);
+ // codeStream.irem();
+ // if (!valueRequired)
+ // codeStream.pop();
+ // break;
+ // case T_long :
+ // left.generateCode(currentScope, codeStream, true);
+ // right.generateCode(currentScope, codeStream, true);
+ // codeStream.lrem();
+ // if (!valueRequired)
+ // codeStream.pop2();
+ // break;
+ // case T_double :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.drem();
+ // break;
+ // case T_float :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.frem();
+ // break;
+ // }
+ // break;
+ // case AND :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_int :
+ // // 0 & x
+ // if ((left.constant != Constant.NotAConstant)
+ // && (left.constant.typeID() == T_int)
+ // && (left.constant.intValue() == 0)) {
+ // right.generateCode(currentScope, codeStream, false);
+ // if (valueRequired)
+ // codeStream.iconst_0();
+ // } else {
+ // // x & 0
+ // if ((right.constant != Constant.NotAConstant)
+ // && (right.constant.typeID() == T_int)
+ // && (right.constant.intValue() == 0)) {
+ // left.generateCode(currentScope, codeStream, false);
+ // if (valueRequired)
+ // codeStream.iconst_0();
+ // } else {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.iand();
+ // }
+ // }
+ // break;
+ // case T_long :
+ // // 0 & x
+ // if ((left.constant != Constant.NotAConstant)
+ // && (left.constant.typeID() == T_long)
+ // && (left.constant.longValue() == 0L)) {
+ // right.generateCode(currentScope, codeStream, false);
+ // if (valueRequired)
+ // codeStream.lconst_0();
+ // } else {
+ // // x & 0
+ // if ((right.constant != Constant.NotAConstant)
+ // && (right.constant.typeID() == T_long)
+ // && (right.constant.longValue() == 0L)) {
+ // left.generateCode(currentScope, codeStream, false);
+ // if (valueRequired)
+ // codeStream.lconst_0();
+ // } else {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.land();
+ // }
+ // }
+ // break;
+ // case T_boolean : // logical and
+ // generateOptimizedLogicalAnd(
+ // currentScope,
+ // codeStream,
+ // null,
+ // (falseLabel = new Label(codeStream)),
+ // valueRequired);
+ // /* improving code gen for such a case: boolean b = i < 0 && false;
+ // * since the label has never been used, we have the inlined value on the
+ // stack. */
+ // if (falseLabel.hasForwardReferences()) {
+ // if (valueRequired) {
+ // codeStream.iconst_1();
+ // if ((bits & ValueForReturnMASK) != 0) {
+ // codeStream.ireturn();
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // } else {
+ // codeStream.goto_(endLabel = new Label(codeStream));
+ // codeStream.decrStackSize(1);
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // endLabel.place();
+ // }
+ // } else {
+ // falseLabel.place();
+ // }
+ // }
+ // }
+ // break;
+ // case OR :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_int :
+ // // 0 | x
+ // if ((left.constant != Constant.NotAConstant)
+ // && (left.constant.typeID() == T_int)
+ // && (left.constant.intValue() == 0)) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // // x | 0
+ // if ((right.constant != Constant.NotAConstant)
+ // && (right.constant.typeID() == T_int)
+ // && (right.constant.intValue() == 0)) {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.ior();
+ // }
+ // }
+ // break;
+ // case T_long :
+ // // 0 | x
+ // if ((left.constant != Constant.NotAConstant)
+ // && (left.constant.typeID() == T_long)
+ // && (left.constant.longValue() == 0L)) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // // x | 0
+ // if ((right.constant != Constant.NotAConstant)
+ // && (right.constant.typeID() == T_long)
+ // && (right.constant.longValue() == 0L)) {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.lor();
+ // }
+ // }
+ // break;
+ // case T_boolean : // logical or
+ // generateOptimizedLogicalOr(
+ // currentScope,
+ // codeStream,
+ // null,
+ // (falseLabel = new Label(codeStream)),
+ // valueRequired);
+ // /* improving code gen for such a case: boolean b = i < 0 || true;
+ // * since the label has never been used, we have the inlined value on the
+ // stack. */
+ // if (falseLabel.hasForwardReferences()) {
+ // if (valueRequired) {
+ // codeStream.iconst_1();
+ // if ((bits & ValueForReturnMASK) != 0) {
+ // codeStream.ireturn();
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // } else {
+ // codeStream.goto_(endLabel = new Label(codeStream));
+ // codeStream.decrStackSize(1);
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // endLabel.place();
+ // }
+ // } else {
+ // falseLabel.place();
+ // }
+ // }
+ // }
+ // break;
+ // case XOR :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_int :
+ // // 0 ^ x
+ // if ((left.constant != Constant.NotAConstant)
+ // && (left.constant.typeID() == T_int)
+ // && (left.constant.intValue() == 0)) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // // x ^ 0
+ // if ((right.constant != Constant.NotAConstant)
+ // && (right.constant.typeID() == T_int)
+ // && (right.constant.intValue() == 0)) {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.ixor();
+ // }
+ // }
+ // break;
+ // case T_long :
+ // // 0 ^ x
+ // if ((left.constant != Constant.NotAConstant)
+ // && (left.constant.typeID() == T_long)
+ // && (left.constant.longValue() == 0L)) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // // x ^ 0
+ // if ((right.constant != Constant.NotAConstant)
+ // && (right.constant.typeID() == T_long)
+ // && (right.constant.longValue() == 0L)) {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.lxor();
+ // }
+ // }
+ // break;
+ // case T_boolean :
+ // generateOptimizedLogicalXor(
+ // currentScope,
+ // codeStream,
+ // null,
+ // (falseLabel = new Label(codeStream)),
+ // valueRequired);
+ // /* improving code gen for such a case: boolean b = i < 0 ^ bool;
+ // * since the label has never been used, we have the inlined value on the
+ // stack. */
+ // if (falseLabel.hasForwardReferences()) {
+ // if (valueRequired) {
+ // codeStream.iconst_1();
+ // if ((bits & ValueForReturnMASK) != 0) {
+ // codeStream.ireturn();
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // } else {
+ // codeStream.goto_(endLabel = new Label(codeStream));
+ // codeStream.decrStackSize(1);
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // endLabel.place();
+ // }
+ // } else {
+ // falseLabel.place();
+ // }
+ // }
+ // }
+ // break;
+ // case LEFT_SHIFT :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_int :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.ishl();
+ // break;
+ // case T_long :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.lshl();
+ // }
+ // break;
+ // case RIGHT_SHIFT :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_int :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.ishr();
+ // break;
+ // case T_long :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.lshr();
+ // }
+ // break;
+ // case UNSIGNED_RIGHT_SHIFT :
+ // switch (bits & ReturnTypeIDMASK) {
+ // case T_int :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.iushr();
+ // break;
+ // case T_long :
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired)
+ // codeStream.lushr();
+ // }
+ // break;
+ // case GREATER :
+ // generateOptimizedGreaterThan(
+ // currentScope,
+ // codeStream,
+ // null,
+ // (falseLabel = new Label(codeStream)),
+ // valueRequired);
+ // if (valueRequired) {
+ // codeStream.iconst_1();
+ // if ((bits & ValueForReturnMASK) != 0) {
+ // codeStream.ireturn();
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // } else {
+ // codeStream.goto_(endLabel = new Label(codeStream));
+ // codeStream.decrStackSize(1);
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // endLabel.place();
+ // }
+ // }
+ // break;
+ // case GREATER_EQUAL :
+ // generateOptimizedGreaterThanOrEqual(
+ // currentScope,
+ // codeStream,
+ // null,
+ // (falseLabel = new Label(codeStream)),
+ // valueRequired);
+ // if (valueRequired) {
+ // codeStream.iconst_1();
+ // if ((bits & ValueForReturnMASK) != 0) {
+ // codeStream.ireturn();
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // } else {
+ // codeStream.goto_(endLabel = new Label(codeStream));
+ // codeStream.decrStackSize(1);
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // endLabel.place();
+ // }
+ // }
+ // break;
+ // case LESS :
+ // generateOptimizedLessThan(
+ // currentScope,
+ // codeStream,
+ // null,
+ // (falseLabel = new Label(codeStream)),
+ // valueRequired);
+ // if (valueRequired) {
+ // codeStream.iconst_1();
+ // if ((bits & ValueForReturnMASK) != 0) {
+ // codeStream.ireturn();
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // } else {
+ // codeStream.goto_(endLabel = new Label(codeStream));
+ // codeStream.decrStackSize(1);
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // endLabel.place();
+ // }
+ // }
+ // break;
+ // case LESS_EQUAL :
+ // generateOptimizedLessThanOrEqual(
+ // currentScope,
+ // codeStream,
+ // null,
+ // (falseLabel = new Label(codeStream)),
+ // valueRequired);
+ // if (valueRequired) {
+ // codeStream.iconst_1();
+ // if ((bits & ValueForReturnMASK) != 0) {
+ // codeStream.ireturn();
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // } else {
+ // codeStream.goto_(endLabel = new Label(codeStream));
+ // codeStream.decrStackSize(1);
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // endLabel.place();
+ // }
+ // }
+ // }
+ // if (valueRequired) {
+ // codeStream.generateImplicitConversion(implicitConversion);
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
/**
- * Boolean operator code generation
- * Optimized operations are: <, <=, >, >=, &, |, ^
+ * Boolean operator code generation Optimized operations are: <, <=, >, >=, &, |, ^
*/
-// public void generateOptimizedBoolean(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean)) {
-// super.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// }
-// switch ((bits & OperatorMASK) >> OperatorSHIFT) {
-// case LESS :
-// generateOptimizedLessThan(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case LESS_EQUAL :
-// generateOptimizedLessThanOrEqual(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case GREATER :
-// generateOptimizedGreaterThan(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case GREATER_EQUAL :
-// generateOptimizedGreaterThanOrEqual(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case AND :
-// generateOptimizedLogicalAnd(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case OR :
-// generateOptimizedLogicalOr(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// case XOR :
-// generateOptimizedLogicalXor(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// return;
-// }
-// super.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-//
-// /**
-// * Boolean generation for >
-// */
-// public void generateOptimizedGreaterThan(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// int promotedTypeID = left.implicitConversion >> 4;
-// // both sides got promoted in the same way
-// if (promotedTypeID == T_int) {
-// // 0 > x
-// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.iflt(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifge(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// // x > 0
-// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifgt(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifle(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// }
-// // default comparison
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmpgt(trueLabel);
-// break;
-// case T_float :
-// codeStream.fcmpl();
-// codeStream.ifgt(trueLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifgt(trueLabel);
-// break;
-// case T_double :
-// codeStream.dcmpl();
-// codeStream.ifgt(trueLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicit falling through the TRUE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmple(falseLabel);
-// break;
-// case T_float :
-// codeStream.fcmpl();
-// codeStream.ifle(falseLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifle(falseLabel);
-// break;
-// case T_double :
-// codeStream.dcmpl();
-// codeStream.ifle(falseLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-
+ // public void generateOptimizedBoolean(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Label trueLabel,
+ // Label falseLabel,
+ // boolean valueRequired) {
+ //
+ // if ((constant != Constant.NotAConstant) && (constant.typeID() ==
+ // T_boolean)) {
+ // super.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // return;
+ // }
+ // switch ((bits & OperatorMASK) >> OperatorSHIFT) {
+ // case LESS :
+ // generateOptimizedLessThan(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // return;
+ // case LESS_EQUAL :
+ // generateOptimizedLessThanOrEqual(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // return;
+ // case GREATER :
+ // generateOptimizedGreaterThan(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // return;
+ // case GREATER_EQUAL :
+ // generateOptimizedGreaterThanOrEqual(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // return;
+ // case AND :
+ // generateOptimizedLogicalAnd(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // return;
+ // case OR :
+ // generateOptimizedLogicalOr(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // return;
+ // case XOR :
+ // generateOptimizedLogicalXor(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // return;
+ // }
+ // super.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // }
+ //
+ // /**
+ // * Boolean generation for >
+ // */
+ // public void generateOptimizedGreaterThan(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Label trueLabel,
+ // Label falseLabel,
+ // boolean valueRequired) {
+ //
+ // int promotedTypeID = left.implicitConversion >> 4;
+ // // both sides got promoted in the same way
+ // if (promotedTypeID == T_int) {
+ // // 0 > x
+ // if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicitly falling through the FALSE case
+ // codeStream.iflt(trueLabel);
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicitly falling through the TRUE case
+ // codeStream.ifge(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // // x > 0
+ // if ((right.constant != NotAConstant) && (right.constant.intValue() == 0))
+ // {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicitly falling through the FALSE case
+ // codeStream.ifgt(trueLabel);
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicitly falling through the TRUE case
+ // codeStream.ifle(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // }
+ // // default comparison
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicit falling through the FALSE case
+ // switch (promotedTypeID) {
+ // case T_int :
+ // codeStream.if_icmpgt(trueLabel);
+ // break;
+ // case T_float :
+ // codeStream.fcmpl();
+ // codeStream.ifgt(trueLabel);
+ // break;
+ // case T_long :
+ // codeStream.lcmp();
+ // codeStream.ifgt(trueLabel);
+ // break;
+ // case T_double :
+ // codeStream.dcmpl();
+ // codeStream.ifgt(trueLabel);
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicit falling through the TRUE case
+ // switch (promotedTypeID) {
+ // case T_int :
+ // codeStream.if_icmple(falseLabel);
+ // break;
+ // case T_float :
+ // codeStream.fcmpl();
+ // codeStream.ifle(falseLabel);
+ // break;
+ // case T_long :
+ // codeStream.lcmp();
+ // codeStream.ifle(falseLabel);
+ // break;
+ // case T_double :
+ // codeStream.dcmpl();
+ // codeStream.ifle(falseLabel);
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // }
/**
* Boolean generation for >=
*/
-// public void generateOptimizedGreaterThanOrEqual(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// int promotedTypeID = left.implicitConversion >> 4;
-// // both sides got promoted in the same way
-// if (promotedTypeID == T_int) {
-// // 0 >= x
-// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifle(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifgt(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// // x >= 0
-// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifge(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.iflt(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// }
-// // default comparison
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmpge(trueLabel);
-// break;
-// case T_float :
-// codeStream.fcmpl();
-// codeStream.ifge(trueLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifge(trueLabel);
-// break;
-// case T_double :
-// codeStream.dcmpl();
-// codeStream.ifge(trueLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicit falling through the TRUE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmplt(falseLabel);
-// break;
-// case T_float :
-// codeStream.fcmpl();
-// codeStream.iflt(falseLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.iflt(falseLabel);
-// break;
-// case T_double :
-// codeStream.dcmpl();
-// codeStream.iflt(falseLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-//
-// /**
-// * Boolean generation for <
-// */
-// public void generateOptimizedLessThan(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// int promotedTypeID = left.implicitConversion >> 4;
-// // both sides got promoted in the same way
-// if (promotedTypeID == T_int) {
-// // 0 < x
-// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifgt(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifle(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// // x < 0
-// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.iflt(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifge(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// }
-// // default comparison
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmplt(trueLabel);
-// break;
-// case T_float :
-// codeStream.fcmpg();
-// codeStream.iflt(trueLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.iflt(trueLabel);
-// break;
-// case T_double :
-// codeStream.dcmpg();
-// codeStream.iflt(trueLabel);
-// }
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicit falling through the TRUE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmpge(falseLabel);
-// break;
-// case T_float :
-// codeStream.fcmpg();
-// codeStream.ifge(falseLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifge(falseLabel);
-// break;
-// case T_double :
-// codeStream.dcmpg();
-// codeStream.ifge(falseLabel);
-// }
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-//
-// /**
-// * Boolean generation for <=
-// */
-// public void generateOptimizedLessThanOrEqual(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// int promotedTypeID = left.implicitConversion >> 4;
-// // both sides got promoted in the same way
-// if (promotedTypeID == T_int) {
-// // 0 <= x
-// if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifge(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.iflt(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// // x <= 0
-// if ((right.constant != NotAConstant) && (right.constant.intValue() == 0)) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicitly falling through the FALSE case
-// codeStream.ifle(trueLabel);
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicitly falling through the TRUE case
-// codeStream.ifgt(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// }
-// // default comparison
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmple(trueLabel);
-// break;
-// case T_float :
-// codeStream.fcmpg();
-// codeStream.ifle(trueLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifle(trueLabel);
-// break;
-// case T_double :
-// codeStream.dcmpg();
-// codeStream.ifle(trueLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// }
-// } else {
-// if (trueLabel == null) {
-// // implicit falling through the TRUE case
-// switch (promotedTypeID) {
-// case T_int :
-// codeStream.if_icmpgt(falseLabel);
-// break;
-// case T_float :
-// codeStream.fcmpg();
-// codeStream.ifgt(falseLabel);
-// break;
-// case T_long :
-// codeStream.lcmp();
-// codeStream.ifgt(falseLabel);
-// break;
-// case T_double :
-// codeStream.dcmpg();
-// codeStream.ifgt(falseLabel);
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// return;
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-//
-// /**
-// * Boolean generation for &
-// */
-// public void generateOptimizedLogicalAnd(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// Constant condConst;
-// if ((left.implicitConversion & 0xF) == T_boolean) {
-// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // & x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// } else {
-// // & x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_0();
-// } else {
-// if (falseLabel != null) {
-// // implicit falling through the TRUE case
-// codeStream.goto_(falseLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-// return;
-// }
-// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // x &
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// } else {
-// // x &
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_0();
-// } else {
-// if (falseLabel != null) {
-// // implicit falling through the TRUE case
-// codeStream.goto_(falseLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-// return;
-// }
-// }
-// // default case
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// codeStream.iand();
-// if ((bits & OnlyValueRequiredMASK) == 0) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.ifne(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.ifeq(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-//
-// /**
-// * Boolean generation for |
-// */
-// public void generateOptimizedLogicalOr(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// Constant condConst;
-// if ((left.implicitConversion & 0xF) == T_boolean) {
-// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // | x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_1();
-// } else {
-// if (trueLabel != null) {
-// codeStream.goto_(trueLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// } else {
-// // | x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// }
-// return;
-// }
-// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // x |
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if (valueRequired) {
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// codeStream.iconst_1();
-// } else {
-// if (trueLabel != null) {
-// codeStream.goto_(trueLabel);
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// } else {
-// // x |
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// }
-// return;
-// }
-// }
-// // default case
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// codeStream.ior();
-// if ((bits & OnlyValueRequiredMASK) == 0) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.ifne(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.ifeq(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-//
-// /**
-// * Boolean generation for ^
-// */
-// public void generateOptimizedLogicalXor(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// Label trueLabel,
-// Label falseLabel,
-// boolean valueRequired) {
-//
-// Constant condConst;
-// if ((left.implicitConversion & 0xF) == T_boolean) {
-// if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // ^ x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// falseLabel,
-// trueLabel,
-// valueRequired);
-// } else {
-// // ^ x
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// right.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// }
-// return;
-// }
-// if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (condConst.booleanValue() == true) {
-// // x ^
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// falseLabel,
-// trueLabel,
-// valueRequired);
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// } else {
-// // x ^
-// if ((bits & OnlyValueRequiredMASK) != 0) {
-// left.generateCode(currentScope, codeStream, valueRequired);
-// } else {
-// left.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// valueRequired);
-// }
-// right.generateOptimizedBoolean(
-// currentScope,
-// codeStream,
-// trueLabel,
-// falseLabel,
-// false);
-// }
-// return;
-// }
-// }
-// // default case
-// left.generateCode(currentScope, codeStream, valueRequired);
-// right.generateCode(currentScope, codeStream, valueRequired);
-// if (valueRequired) {
-// codeStream.ixor();
-// if ((bits & OnlyValueRequiredMASK) == 0) {
-// if (falseLabel == null) {
-// if (trueLabel != null) {
-// // implicit falling through the FALSE case
-// codeStream.ifne(trueLabel);
-// }
-// } else {
-// // implicit falling through the TRUE case
-// if (trueLabel == null) {
-// codeStream.ifeq(falseLabel);
-// } else {
-// // no implicit fall through TRUE/FALSE --> should never occur
-// }
-// }
-// }
-// }
-// // reposition the endPC
-// codeStream.updateLastRecordedEndPC(codeStream.position);
-// }
-//
-// public void generateOptimizedStringBuffer(
-// BlockScope blockScope,
-// CodeStream codeStream,
-// int typeID) {
-//
-// /* In the case trying to make a string concatenation, there is no need to create a new
-// * string buffer, thus use a lower-level API for code generation involving only the
-// * appending of arguments to the existing StringBuffer
-// */
-//
-// if ((((bits & OperatorMASK) >> OperatorSHIFT) == PLUS)
-// && ((bits & ReturnTypeIDMASK) == T_String)) {
-// if (constant != NotAConstant) {
-// codeStream.generateConstant(constant, implicitConversion);
-// codeStream.invokeStringBufferAppendForType(implicitConversion & 0xF);
-// } else {
-// int pc = codeStream.position;
-// left.generateOptimizedStringBuffer(
-// blockScope,
-// codeStream,
-// left.implicitConversion & 0xF);
-// codeStream.recordPositionsFrom(pc, left.sourceStart);
-// pc = codeStream.position;
-// right.generateOptimizedStringBuffer(
-// blockScope,
-// codeStream,
-// right.implicitConversion & 0xF);
-// codeStream.recordPositionsFrom(pc, right.sourceStart);
-// }
-// } else {
-// super.generateOptimizedStringBuffer(blockScope, codeStream, typeID);
-// }
-// }
-//
-// public void generateOptimizedStringBufferCreation(
-// BlockScope blockScope,
-// CodeStream codeStream,
-// int typeID) {
-//
-// /* In the case trying to make a string concatenation, there is no need to create a new
-// * string buffer, thus use a lower-level API for code generation involving only the
-// * appending of arguments to the existing StringBuffer
-// */
-//
-// if ((((bits & OperatorMASK) >> OperatorSHIFT) == PLUS)
-// && ((bits & ReturnTypeIDMASK) == T_String)) {
-// if (constant != NotAConstant) {
-// codeStream.newStringBuffer(); // new: java.lang.StringBuffer
-// codeStream.dup();
-// codeStream.ldc(constant.stringValue());
-// codeStream.invokeStringBufferStringConstructor();
-// // invokespecial: java.lang.StringBuffer.(Ljava.lang.String;)V
-// } else {
-// int pc = codeStream.position;
-// left.generateOptimizedStringBufferCreation(
-// blockScope,
-// codeStream,
-// left.implicitConversion & 0xF);
-// codeStream.recordPositionsFrom(pc, left.sourceStart);
-// pc = codeStream.position;
-// right.generateOptimizedStringBuffer(
-// blockScope,
-// codeStream,
-// right.implicitConversion & 0xF);
-// codeStream.recordPositionsFrom(pc, right.sourceStart);
-// }
-// } else {
-// super.generateOptimizedStringBufferCreation(blockScope, codeStream, typeID);
-// }
-// }
-//
-// public boolean isCompactableOperation() {
-//
-// return true;
-// }
-//
-// public void optimizedBooleanConstant(int leftId, int operator, int rightId) {
-//
-// switch (operator) {
-// case AND :
-// if ((leftId != T_boolean) || (rightId != T_boolean))
-// return;
-// case AND_AND :
-// Constant cst;
-// if ((cst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (cst.booleanValue() == false) { // left is equivalent to false
-// optimizedBooleanConstant = cst; // constant(false)
-// return;
-// } else { //left is equivalent to true
-// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
-// optimizedBooleanConstant = cst;
-// // the conditional result is equivalent to the right conditional value
-// }
-// return;
-// }
-// }
-// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (cst.booleanValue() == false) { // right is equivalent to false
-// optimizedBooleanConstant = cst; // constant(false)
-// }
-// }
-// return;
-// case OR :
-// if ((leftId != T_boolean) || (rightId != T_boolean))
-// return;
-// case OR_OR :
-// if ((cst = left.optimizedBooleanConstant()) != NotAConstant) {
-// if (cst.booleanValue() == true) { // left is equivalent to true
-// optimizedBooleanConstant = cst; // constant(true)
-// return;
-// } else { //left is equivalent to false
-// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
-// optimizedBooleanConstant = cst;
-// }
-// return;
-// }
-// }
-// if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
-// if (cst.booleanValue() == true) { // right is equivalent to true
-// optimizedBooleanConstant = cst; // constant(true)
-// }
-// }
-// }
-// }
- public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
+ // public void generateOptimizedGreaterThanOrEqual(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Label trueLabel,
+ // Label falseLabel,
+ // boolean valueRequired) {
+ //
+ // int promotedTypeID = left.implicitConversion >> 4;
+ // // both sides got promoted in the same way
+ // if (promotedTypeID == T_int) {
+ // // 0 >= x
+ // if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicitly falling through the FALSE case
+ // codeStream.ifle(trueLabel);
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicitly falling through the TRUE case
+ // codeStream.ifgt(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // // x >= 0
+ // if ((right.constant != NotAConstant) && (right.constant.intValue() == 0))
+ // {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicitly falling through the FALSE case
+ // codeStream.ifge(trueLabel);
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicitly falling through the TRUE case
+ // codeStream.iflt(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // }
+ // // default comparison
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicit falling through the FALSE case
+ // switch (promotedTypeID) {
+ // case T_int :
+ // codeStream.if_icmpge(trueLabel);
+ // break;
+ // case T_float :
+ // codeStream.fcmpl();
+ // codeStream.ifge(trueLabel);
+ // break;
+ // case T_long :
+ // codeStream.lcmp();
+ // codeStream.ifge(trueLabel);
+ // break;
+ // case T_double :
+ // codeStream.dcmpl();
+ // codeStream.ifge(trueLabel);
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicit falling through the TRUE case
+ // switch (promotedTypeID) {
+ // case T_int :
+ // codeStream.if_icmplt(falseLabel);
+ // break;
+ // case T_float :
+ // codeStream.fcmpl();
+ // codeStream.iflt(falseLabel);
+ // break;
+ // case T_long :
+ // codeStream.lcmp();
+ // codeStream.iflt(falseLabel);
+ // break;
+ // case T_double :
+ // codeStream.dcmpl();
+ // codeStream.iflt(falseLabel);
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // }
+ //
+ // /**
+ // * Boolean generation for <
+ // */
+ // public void generateOptimizedLessThan(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Label trueLabel,
+ // Label falseLabel,
+ // boolean valueRequired) {
+ //
+ // int promotedTypeID = left.implicitConversion >> 4;
+ // // both sides got promoted in the same way
+ // if (promotedTypeID == T_int) {
+ // // 0 < x
+ // if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicitly falling through the FALSE case
+ // codeStream.ifgt(trueLabel);
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicitly falling through the TRUE case
+ // codeStream.ifle(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // // x < 0
+ // if ((right.constant != NotAConstant) && (right.constant.intValue() == 0))
+ // {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicitly falling through the FALSE case
+ // codeStream.iflt(trueLabel);
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicitly falling through the TRUE case
+ // codeStream.ifge(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // }
+ // // default comparison
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicit falling through the FALSE case
+ // switch (promotedTypeID) {
+ // case T_int :
+ // codeStream.if_icmplt(trueLabel);
+ // break;
+ // case T_float :
+ // codeStream.fcmpg();
+ // codeStream.iflt(trueLabel);
+ // break;
+ // case T_long :
+ // codeStream.lcmp();
+ // codeStream.iflt(trueLabel);
+ // break;
+ // case T_double :
+ // codeStream.dcmpg();
+ // codeStream.iflt(trueLabel);
+ // }
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicit falling through the TRUE case
+ // switch (promotedTypeID) {
+ // case T_int :
+ // codeStream.if_icmpge(falseLabel);
+ // break;
+ // case T_float :
+ // codeStream.fcmpg();
+ // codeStream.ifge(falseLabel);
+ // break;
+ // case T_long :
+ // codeStream.lcmp();
+ // codeStream.ifge(falseLabel);
+ // break;
+ // case T_double :
+ // codeStream.dcmpg();
+ // codeStream.ifge(falseLabel);
+ // }
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // }
+ //
+ // /**
+ // * Boolean generation for <=
+ // */
+ // public void generateOptimizedLessThanOrEqual(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Label trueLabel,
+ // Label falseLabel,
+ // boolean valueRequired) {
+ //
+ // int promotedTypeID = left.implicitConversion >> 4;
+ // // both sides got promoted in the same way
+ // if (promotedTypeID == T_int) {
+ // // 0 <= x
+ // if ((left.constant != NotAConstant) && (left.constant.intValue() == 0)) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicitly falling through the FALSE case
+ // codeStream.ifge(trueLabel);
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicitly falling through the TRUE case
+ // codeStream.iflt(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // // x <= 0
+ // if ((right.constant != NotAConstant) && (right.constant.intValue() == 0))
+ // {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicitly falling through the FALSE case
+ // codeStream.ifle(trueLabel);
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicitly falling through the TRUE case
+ // codeStream.ifgt(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // }
+ // // default comparison
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicit falling through the FALSE case
+ // switch (promotedTypeID) {
+ // case T_int :
+ // codeStream.if_icmple(trueLabel);
+ // break;
+ // case T_float :
+ // codeStream.fcmpg();
+ // codeStream.ifle(trueLabel);
+ // break;
+ // case T_long :
+ // codeStream.lcmp();
+ // codeStream.ifle(trueLabel);
+ // break;
+ // case T_double :
+ // codeStream.dcmpg();
+ // codeStream.ifle(trueLabel);
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // }
+ // } else {
+ // if (trueLabel == null) {
+ // // implicit falling through the TRUE case
+ // switch (promotedTypeID) {
+ // case T_int :
+ // codeStream.if_icmpgt(falseLabel);
+ // break;
+ // case T_float :
+ // codeStream.fcmpg();
+ // codeStream.ifgt(falseLabel);
+ // break;
+ // case T_long :
+ // codeStream.lcmp();
+ // codeStream.ifgt(falseLabel);
+ // break;
+ // case T_double :
+ // codeStream.dcmpg();
+ // codeStream.ifgt(falseLabel);
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // return;
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // }
+ //
+ // /**
+ // * Boolean generation for &
+ // */
+ // public void generateOptimizedLogicalAnd(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Label trueLabel,
+ // Label falseLabel,
+ // boolean valueRequired) {
+ //
+ // Constant condConst;
+ // if ((left.implicitConversion & 0xF) == T_boolean) {
+ // if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
+ // if (condConst.booleanValue() == true) {
+ // // & x
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // }
+ // } else {
+ // // & x
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // if (valueRequired) {
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // codeStream.iconst_0();
+ // } else {
+ // if (falseLabel != null) {
+ // // implicit falling through the TRUE case
+ // codeStream.goto_(falseLabel);
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // }
+ // return;
+ // }
+ // if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
+ // if (condConst.booleanValue() == true) {
+ // // x &
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // }
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // } else {
+ // // x &
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // if (valueRequired) {
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // codeStream.iconst_0();
+ // } else {
+ // if (falseLabel != null) {
+ // // implicit falling through the TRUE case
+ // codeStream.goto_(falseLabel);
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // }
+ // return;
+ // }
+ // }
+ // // default case
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // codeStream.iand();
+ // if ((bits & OnlyValueRequiredMASK) == 0) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicit falling through the FALSE case
+ // codeStream.ifne(trueLabel);
+ // }
+ // } else {
+ // // implicit falling through the TRUE case
+ // if (trueLabel == null) {
+ // codeStream.ifeq(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // }
+ //
+ // /**
+ // * Boolean generation for |
+ // */
+ // public void generateOptimizedLogicalOr(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Label trueLabel,
+ // Label falseLabel,
+ // boolean valueRequired) {
+ //
+ // Constant condConst;
+ // if ((left.implicitConversion & 0xF) == T_boolean) {
+ // if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
+ // if (condConst.booleanValue() == true) {
+ // // | x
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // if (valueRequired) {
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // codeStream.iconst_1();
+ // } else {
+ // if (trueLabel != null) {
+ // codeStream.goto_(trueLabel);
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // } else {
+ // // | x
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // }
+ // }
+ // return;
+ // }
+ // if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
+ // if (condConst.booleanValue() == true) {
+ // // x |
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // if (valueRequired) {
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // codeStream.iconst_1();
+ // } else {
+ // if (trueLabel != null) {
+ // codeStream.goto_(trueLabel);
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // } else {
+ // // x |
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // }
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // }
+ // return;
+ // }
+ // }
+ // // default case
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // codeStream.ior();
+ // if ((bits & OnlyValueRequiredMASK) == 0) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicit falling through the FALSE case
+ // codeStream.ifne(trueLabel);
+ // }
+ // } else {
+ // // implicit falling through the TRUE case
+ // if (trueLabel == null) {
+ // codeStream.ifeq(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // }
+ //
+ // /**
+ // * Boolean generation for ^
+ // */
+ // public void generateOptimizedLogicalXor(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // Label trueLabel,
+ // Label falseLabel,
+ // boolean valueRequired) {
+ //
+ // Constant condConst;
+ // if ((left.implicitConversion & 0xF) == T_boolean) {
+ // if ((condConst = left.optimizedBooleanConstant()) != NotAConstant) {
+ // if (condConst.booleanValue() == true) {
+ // // ^ x
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // falseLabel,
+ // trueLabel,
+ // valueRequired);
+ // } else {
+ // // ^ x
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // }
+ // }
+ // return;
+ // }
+ // if ((condConst = right.optimizedBooleanConstant()) != NotAConstant) {
+ // if (condConst.booleanValue() == true) {
+ // // x ^
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // falseLabel,
+ // trueLabel,
+ // valueRequired);
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // } else {
+ // // x ^
+ // if ((bits & OnlyValueRequiredMASK) != 0) {
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // } else {
+ // left.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // valueRequired);
+ // }
+ // right.generateOptimizedBoolean(
+ // currentScope,
+ // codeStream,
+ // trueLabel,
+ // falseLabel,
+ // false);
+ // }
+ // return;
+ // }
+ // }
+ // // default case
+ // left.generateCode(currentScope, codeStream, valueRequired);
+ // right.generateCode(currentScope, codeStream, valueRequired);
+ // if (valueRequired) {
+ // codeStream.ixor();
+ // if ((bits & OnlyValueRequiredMASK) == 0) {
+ // if (falseLabel == null) {
+ // if (trueLabel != null) {
+ // // implicit falling through the FALSE case
+ // codeStream.ifne(trueLabel);
+ // }
+ // } else {
+ // // implicit falling through the TRUE case
+ // if (trueLabel == null) {
+ // codeStream.ifeq(falseLabel);
+ // } else {
+ // // no implicit fall through TRUE/FALSE --> should never occur
+ // }
+ // }
+ // }
+ // }
+ // // reposition the endPC
+ // codeStream.updateLastRecordedEndPC(codeStream.position);
+ // }
+ //
+ // public void generateOptimizedStringBuffer(
+ // BlockScope blockScope,
+ // CodeStream codeStream,
+ // int typeID) {
+ //
+ // /* In the case trying to make a string concatenation, there is no need to
+ // create a new
+ // * string buffer, thus use a lower-level API for code generation involving
+ // only the
+ // * appending of arguments to the existing StringBuffer
+ // */
+ //
+ // if ((((bits & OperatorMASK) >> OperatorSHIFT) == PLUS)
+ // && ((bits & ReturnTypeIDMASK) == T_String)) {
+ // if (constant != NotAConstant) {
+ // codeStream.generateConstant(constant, implicitConversion);
+ // codeStream.invokeStringBufferAppendForType(implicitConversion & 0xF);
+ // } else {
+ // int pc = codeStream.position;
+ // left.generateOptimizedStringBuffer(
+ // blockScope,
+ // codeStream,
+ // left.implicitConversion & 0xF);
+ // codeStream.recordPositionsFrom(pc, left.sourceStart);
+ // pc = codeStream.position;
+ // right.generateOptimizedStringBuffer(
+ // blockScope,
+ // codeStream,
+ // right.implicitConversion & 0xF);
+ // codeStream.recordPositionsFrom(pc, right.sourceStart);
+ // }
+ // } else {
+ // super.generateOptimizedStringBuffer(blockScope, codeStream, typeID);
+ // }
+ // }
+ //
+ // public void generateOptimizedStringBufferCreation(
+ // BlockScope blockScope,
+ // CodeStream codeStream,
+ // int typeID) {
+ //
+ // /* In the case trying to make a string concatenation, there is no need to
+ // create a new
+ // * string buffer, thus use a lower-level API for code generation involving
+ // only the
+ // * appending of arguments to the existing StringBuffer
+ // */
+ //
+ // if ((((bits & OperatorMASK) >> OperatorSHIFT) == PLUS)
+ // && ((bits & ReturnTypeIDMASK) == T_String)) {
+ // if (constant != NotAConstant) {
+ // codeStream.newStringBuffer(); // new: java.lang.StringBuffer
+ // codeStream.dup();
+ // codeStream.ldc(constant.stringValue());
+ // codeStream.invokeStringBufferStringConstructor();
+ // // invokespecial: java.lang.StringBuffer.(Ljava.lang.String;)V
+ // } else {
+ // int pc = codeStream.position;
+ // left.generateOptimizedStringBufferCreation(
+ // blockScope,
+ // codeStream,
+ // left.implicitConversion & 0xF);
+ // codeStream.recordPositionsFrom(pc, left.sourceStart);
+ // pc = codeStream.position;
+ // right.generateOptimizedStringBuffer(
+ // blockScope,
+ // codeStream,
+ // right.implicitConversion & 0xF);
+ // codeStream.recordPositionsFrom(pc, right.sourceStart);
+ // }
+ // } else {
+ // super.generateOptimizedStringBufferCreation(blockScope, codeStream,
+ // typeID);
+ // }
+ // }
+ //
+ // public boolean isCompactableOperation() {
+ //
+ // return true;
+ // }
+ //
+ // public void optimizedBooleanConstant(int leftId, int operator, int
+ // rightId) {
+ //
+ // switch (operator) {
+ // case AND :
+ // if ((leftId != T_boolean) || (rightId != T_boolean))
+ // return;
+ // case AND_AND :
+ // Constant cst;
+ // if ((cst = left.optimizedBooleanConstant()) != NotAConstant) {
+ // if (cst.booleanValue() == false) { // left is equivalent to false
+ // optimizedBooleanConstant = cst; // constant(false)
+ // return;
+ // } else { //left is equivalent to true
+ // if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
+ // optimizedBooleanConstant = cst;
+ // // the conditional result is equivalent to the right conditional value
+ // }
+ // return;
+ // }
+ // }
+ // if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
+ // if (cst.booleanValue() == false) { // right is equivalent to false
+ // optimizedBooleanConstant = cst; // constant(false)
+ // }
+ // }
+ // return;
+ // case OR :
+ // if ((leftId != T_boolean) || (rightId != T_boolean))
+ // return;
+ // case OR_OR :
+ // if ((cst = left.optimizedBooleanConstant()) != NotAConstant) {
+ // if (cst.booleanValue() == true) { // left is equivalent to true
+ // optimizedBooleanConstant = cst; // constant(true)
+ // return;
+ // } else { //left is equivalent to false
+ // if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
+ // optimizedBooleanConstant = cst;
+ // }
+ // return;
+ // }
+ // }
+ // if ((cst = right.optimizedBooleanConstant()) != NotAConstant) {
+ // if (cst.booleanValue() == true) { // right is equivalent to true
+ // optimizedBooleanConstant = cst; // constant(true)
+ // }
+ // }
+ // }
+ // }
+ public StringBuffer printExpressionNoParenthesis(int indent,
+ StringBuffer output) {
- left.printExpression(indent, output).append(' ').append(operatorToString()).append(' ');
+ left.printExpression(indent, output).append(' ').append(
+ operatorToString()).append(' ');
return right.printExpression(0, output);
}
+
public TypeBinding resolveType(BlockScope scope) {
// use the id of the type to navigate into the table
@@ -1659,8 +1669,8 @@ public class BinaryExpression extends OperatorExpression {
}
int leftId = leftTb.id;
int rightId = rightTb.id;
- if (leftId > 15
- || rightId > 15) { // must convert String + Object || Object + String
+ if (leftId > 15 || rightId > 15) { // must convert String + Object ||
+ // Object + String
if (leftId == T_String) {
rightId = T_Object;
} else if (rightId == T_String) {
@@ -1673,78 +1683,81 @@ public class BinaryExpression extends OperatorExpression {
}
if (((bits & OperatorMASK) >> OperatorSHIFT) == PLUS) {
if (leftId == T_String
- && rightTb.isArrayType()
- && ((ArrayBinding) rightTb).elementsType(scope) == CharBinding)
- scope.problemReporter().signalNoImplicitStringConversionForCharArrayExpression(
- right);
- else if (
- rightId == T_String
+ && rightTb.isArrayType()
+ && ((ArrayBinding) rightTb).elementsType(scope) == CharBinding)
+ scope
+ .problemReporter()
+ .signalNoImplicitStringConversionForCharArrayExpression(
+ right);
+ else if (rightId == T_String
&& leftTb.isArrayType()
&& ((ArrayBinding) leftTb).elementsType(scope) == CharBinding)
- scope.problemReporter().signalNoImplicitStringConversionForCharArrayExpression(
- left);
+ scope
+ .problemReporter()
+ .signalNoImplicitStringConversionForCharArrayExpression(
+ left);
}
// the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4 <<0
+ // (cast) left Op (cast) rigth --> result
+ // 0000 0000 0000 0000 0000
+ // <<16 <<12 <<8 <<4 <<0
// Don't test for result = 0. If it is zero, some more work is done.
- // On the one hand when it is not zero (correct code) we avoid doing the test
- int result =
- ResolveTypeTables[(bits & OperatorMASK) >> OperatorSHIFT][(leftId << 4)
+ // On the one hand when it is not zero (correct code) we avoid doing the
+ // test
+ int result = ResolveTypeTables[(bits & OperatorMASK) >> OperatorSHIFT][(leftId << 4)
+ rightId];
left.implicitConversion = result >>> 12;
right.implicitConversion = (result >>> 4) & 0x000FF;
bits |= result & 0xF;
switch (result & 0xF) { // record the current ReturnTypeID
- // only switch on possible result type.....
- case T_boolean :
- this.resolvedType = BooleanBinding;
- break;
- case T_byte :
- this.resolvedType = ByteBinding;
- break;
- case T_char :
- this.resolvedType = CharBinding;
- break;
- case T_double :
- this.resolvedType = DoubleBinding;
- break;
- case T_float :
- this.resolvedType = FloatBinding;
- break;
- case T_int :
- this.resolvedType = IntBinding;
- break;
- case T_long :
- this.resolvedType = LongBinding;
- break;
- case T_String :
- this.resolvedType = scope.getJavaLangString();
- break;
- default : //error........
- constant = Constant.NotAConstant;
- scope.problemReporter().invalidOperator(this, leftTb, rightTb);
- return null;
+ // only switch on possible result type.....
+ case T_boolean:
+ this.resolvedType = BooleanBinding;
+ break;
+ case T_byte:
+ this.resolvedType = ByteBinding;
+ break;
+ case T_char:
+ this.resolvedType = CharBinding;
+ break;
+ case T_double:
+ this.resolvedType = DoubleBinding;
+ break;
+ case T_float:
+ this.resolvedType = FloatBinding;
+ break;
+ case T_int:
+ this.resolvedType = IntBinding;
+ break;
+ case T_long:
+ this.resolvedType = LongBinding;
+ break;
+ case T_String:
+ this.resolvedType = scope.getJavaLangString();
+ break;
+ default: // error........
+ constant = Constant.NotAConstant;
+ scope.problemReporter().invalidOperator(this, leftTb, rightTb);
+ return null;
}
// compute the constant when valid
computeConstant(scope, leftId, rightId);
return this.resolvedType;
}
-
+
public String toStringExpressionNoParenthesis() {
return left.toStringExpression() + " " + //$NON-NLS-1$
- operatorToString() + " " + //$NON-NLS-1$
- right.toStringExpression();
+ operatorToString() + " " + //$NON-NLS-1$
+ right.toStringExpression();
}
public void traverse(ASTVisitor visitor, BlockScope scope) {
-
+
if (visitor.visit(this, scope)) {
left.traverse(visitor, scope);
right.traverse(visitor, scope);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java
index 30a2c2b..df31b10 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java
@@ -17,28 +17,31 @@ import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
public class Block extends Statement {
-
+
public Statement[] statements;
+
public int explicitDeclarations;
+
// the number of explicit declaration , used to create scope
public BlockScope scope;
+
public static final Block None = new Block(0);
-
+
public Block(int explicitDeclarations) {
this.explicitDeclarations = explicitDeclarations;
}
-
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
+
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
// empty block
- if (statements == null) return flowInfo;
+ if (statements == null)
+ return flowInfo;
boolean didAlreadyComplain = false;
for (int i = 0, max = statements.length; i < max; i++) {
Statement stat;
- if (!flowInfo.complainIfUnreachable(stat = statements[i], scope, didAlreadyComplain)) {
+ if (!flowInfo.complainIfUnreachable(stat = statements[i], scope,
+ didAlreadyComplain)) {
flowInfo = stat.analyseCode(scope, flowContext, flowInfo);
} else {
didAlreadyComplain = true;
@@ -49,7 +52,7 @@ public class Block extends Statement {
public static final Block EmptyWith(int sourceStart, int sourceEnd) {
- //return an empty block which position is s and e
+ // return an empty block which position is s and e
Block bk = new Block(0);
bk.sourceStart = sourceStart;
bk.sourceEnd = sourceEnd;
@@ -59,33 +62,35 @@ public class Block extends Statement {
/**
* Code generation for a block
*/
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-// if (statements != null) {
-// for (int i = 0, max = statements.length; i < max; i++) {
-// statements[i].generateCode(scope, codeStream);
-// }
-// } // for local variable debug attributes
-// if (scope != currentScope) { // was really associated with its own scope
-// codeStream.exitUserScope(scope);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
+ // public void generateCode(BlockScope currentScope, CodeStream codeStream)
+ // {
+ //
+ // if ((bits & IsReachableMASK) == 0) {
+ // return;
+ // }
+ // int pc = codeStream.position;
+ // if (statements != null) {
+ // for (int i = 0, max = statements.length; i < max; i++) {
+ // statements[i].generateCode(scope, codeStream);
+ // }
+ // } // for local variable debug attributes
+ // if (scope != currentScope) { // was really associated with its own scope
+ // codeStream.exitUserScope(scope);
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
public boolean isEmptyBlock() {
return statements == null;
}
+
public StringBuffer printBody(int indent, StringBuffer output) {
- if (this.statements == null) return output;
+ if (this.statements == null)
+ return output;
for (int i = 0; i < statements.length; i++) {
statements[i].printStatement(indent + 1, output);
- output.append('\n');
+ output.append('\n');
}
return output;
}
@@ -97,13 +102,12 @@ public class Block extends Statement {
printBody(indent, output);
return printIndent(indent, output).append('}');
}
+
public void resolve(BlockScope upperScope) {
if (statements != null) {
- scope =
- explicitDeclarations == 0
- ? upperScope
- : new BlockScope(upperScope, explicitDeclarations);
+ scope = explicitDeclarations == 0 ? upperScope : new BlockScope(
+ upperScope, explicitDeclarations);
int i = 0, length = statements.length;
while (i < length)
statements[i++].resolve(scope);
@@ -149,13 +153,12 @@ public class Block extends Statement {
} else {
buffer.append(";\n"); //$NON-NLS-1$
}
- };
+ }
+ ;
return buffer.toString();
}
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
+ public void traverse(ASTVisitor visitor, BlockScope blockScope) {
if (visitor.visit(this, blockScope)) {
if (statements != null) {
@@ -166,14 +169,14 @@ public class Block extends Statement {
}
visitor.endVisit(this, blockScope);
}
-
+
/**
* Dispatch the call on its last statement.
*/
public void branchChainTo(Label label) {
- if (this.statements != null) {
- this.statements[statements.length - 1].branchChainTo(label);
- }
+ if (this.statements != null) {
+ this.statements[statements.length - 1].branchChainTo(label);
+ }
}
-
+
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BranchStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BranchStatement.java
index 245a491..4b17645 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BranchStatement.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BranchStatement.java
@@ -14,59 +14,64 @@ import net.sourceforge.phpdt.internal.compiler.codegen.Label;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
public abstract class BranchStatement extends Statement {
- public Expression expression;
+ public Expression expression;
+
public Label targetLabel;
+
public ASTNode[] subroutines;
-/**
- * BranchStatement constructor comment.
- */
-public BranchStatement(Expression expr, int s,int e) {
- expression = expr ;
- sourceStart = s;
- sourceEnd = e;
-}
-/**
- * Branch code generation
- *
- * generate the finallyInvocationSequence.
- */
-//public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-//
-// // generation of code responsible for invoking the finally
-// // blocks in sequence
-// if (subroutines != null){
-// for (int i = 0, max = subroutines.length; i < max; i++){
-// ASTNode sub;
-// if ((sub = subroutines[i]) instanceof SynchronizedStatement){
-// codeStream.load(((SynchronizedStatement)sub).synchroVariable);
-// codeStream.monitorexit();
-// } else {
-// TryStatement trySub = (TryStatement) sub;
-// if (trySub.subRoutineCannotReturn) {
-// codeStream.goto_(trySub.subRoutineStartLabel);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// } else {
-// codeStream.jsr(trySub.subRoutineStartLabel);
-// }
-// }
-// }
-// }
-// codeStream.goto_(targetLabel);
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public void resetStateForCodeGeneration() {
- if (this.targetLabel != null) {
- this.targetLabel.resetStateForCodeGeneration();
+
+ /**
+ * BranchStatement constructor comment.
+ */
+ public BranchStatement(Expression expr, int s, int e) {
+ expression = expr;
+ sourceStart = s;
+ sourceEnd = e;
}
-}
-public void resolve(BlockScope scope) {
-}
+ /**
+ * Branch code generation
+ *
+ * generate the finallyInvocationSequence.
+ */
+ // public void generateCode(BlockScope currentScope, CodeStream codeStream)
+ // {
+ //
+ // if ((bits & IsReachableMASK) == 0) {
+ // return;
+ // }
+ // int pc = codeStream.position;
+ //
+ // // generation of code responsible for invoking the finally
+ // // blocks in sequence
+ // if (subroutines != null){
+ // for (int i = 0, max = subroutines.length; i < max; i++){
+ // ASTNode sub;
+ // if ((sub = subroutines[i]) instanceof SynchronizedStatement){
+ // codeStream.load(((SynchronizedStatement)sub).synchroVariable);
+ // codeStream.monitorexit();
+ // } else {
+ // TryStatement trySub = (TryStatement) sub;
+ // if (trySub.subRoutineCannotReturn) {
+ // codeStream.goto_(trySub.subRoutineStartLabel);
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // return;
+ // } else {
+ // codeStream.jsr(trySub.subRoutineStartLabel);
+ // }
+ // }
+ // }
+ // }
+ // codeStream.goto_(targetLabel);
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
+ public void resetStateForCodeGeneration() {
+ if (this.targetLabel != null) {
+ this.targetLabel.resetStateForCodeGeneration();
+ }
+ }
+
+ public void resolve(BlockScope scope) {
+ }
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BreakStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BreakStatement.java
index a033e1e..0acbc7d 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BreakStatement.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BreakStatement.java
@@ -16,69 +16,74 @@ import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
public class BreakStatement extends BranchStatement {
-
+
public BreakStatement(Expression expr, int sourceStart, int e) {
super(expr, sourceStart, e);
}
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
- // here requires to generate a sequence of finally blocks invocations depending corresponding
- // to each of the traversed try statements, so that execution will terminate properly.
+ // here requires to generate a sequence of finally blocks invocations
+ // depending corresponding
+ // to each of the traversed try statements, so that execution will
+ // terminate properly.
// lookup the label, this should answer the returnContext
-// FlowContext targetContext = (label == null)
-// ? flowContext.getTargetContextForDefaultBreak()
-// : flowContext.getTargetContextForBreakLabel(label);
-//
-// if (targetContext == null) {
-// if (label == null) {
-// currentScope.problemReporter().invalidBreak(this);
-// } else {
-// currentScope.problemReporter().undefinedLabel(this);
-// }
-// return flowInfo; // pretend it did not break since no actual target
-// }
-//
-// targetLabel = targetContext.breakLabel();
-// FlowContext traversedContext = flowContext;
-// int subIndex = 0, maxSub = 5;
-// subroutines = new ASTNode[maxSub];
-//
-// do {
-// ASTNode sub;
-// if ((sub = traversedContext.subRoutine()) != null) {
-// if (subIndex == maxSub) {
-// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[maxSub*=2]), 0, subIndex); // grow
-// }
-// subroutines[subIndex++] = sub;
-// if (sub.cannotReturn()) {
-// break;
-// }
-// }
-// traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
-//
-// ASTNode node;
-// if ((node = traversedContext.associatedNode) instanceof TryStatement) {
-// TryStatement tryStatement = (TryStatement) node;
-// flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits
-// } else if (traversedContext == targetContext) {
-// // only record break info once accumulated through subroutines, and only against target context
-// targetContext.recordBreakFrom(flowInfo);
-// break;
-// }
-// } while ((traversedContext = traversedContext.parent) != null);
-//
-// // resize subroutines
-// if (subIndex != maxSub) {
-// System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
-// }
+ // FlowContext targetContext = (label == null)
+ // ? flowContext.getTargetContextForDefaultBreak()
+ // : flowContext.getTargetContextForBreakLabel(label);
+ //
+ // if (targetContext == null) {
+ // if (label == null) {
+ // currentScope.problemReporter().invalidBreak(this);
+ // } else {
+ // currentScope.problemReporter().undefinedLabel(this);
+ // }
+ // return flowInfo; // pretend it did not break since no actual target
+ // }
+ //
+ // targetLabel = targetContext.breakLabel();
+ // FlowContext traversedContext = flowContext;
+ // int subIndex = 0, maxSub = 5;
+ // subroutines = new ASTNode[maxSub];
+ //
+ // do {
+ // ASTNode sub;
+ // if ((sub = traversedContext.subRoutine()) != null) {
+ // if (subIndex == maxSub) {
+ // System.arraycopy(subroutines, 0, (subroutines = new
+ // ASTNode[maxSub*=2]), 0, subIndex); // grow
+ // }
+ // subroutines[subIndex++] = sub;
+ // if (sub.cannotReturn()) {
+ // break;
+ // }
+ // }
+ // traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
+ //
+ // ASTNode node;
+ // if ((node = traversedContext.associatedNode) instanceof TryStatement)
+ // {
+ // TryStatement tryStatement = (TryStatement) node;
+ // flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); //
+ // collect inits
+ // } else if (traversedContext == targetContext) {
+ // // only record break info once accumulated through subroutines, and
+ // only against target context
+ // targetContext.recordBreakFrom(flowInfo);
+ // break;
+ // }
+ // } while ((traversedContext = traversedContext.parent) != null);
+ //
+ // // resize subroutines
+ // if (subIndex != maxSub) {
+ // System.arraycopy(subroutines, 0, (subroutines = new
+ // ASTNode[subIndex]), 0, subIndex);
+ // }
return FlowInfo.DEAD_END;
}
-
+
public String toString(int tab) {
String s = tabString(tab);
@@ -87,15 +92,17 @@ public class BreakStatement extends BranchStatement {
s += expression.toString();
return s;
}
+
public StringBuffer printStatement(int tab, StringBuffer output) {
printIndent(tab, output).append("break "); //$NON-NLS-1$
- if (expression != null) output.append(expression);
+ if (expression != null)
+ output.append(expression);
return output.append(';');
}
- public void traverse(
- IAbstractSyntaxTreeVisitor visitor,
- BlockScope blockscope) {
+
+ public void traverse(IAbstractSyntaxTreeVisitor visitor,
+ BlockScope blockscope) {
visitor.visit(this, blockscope);
visitor.endVisit(this, blockscope);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CaseStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CaseStatement.java
index 976bc66..c0fef15 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CaseStatement.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CaseStatement.java
@@ -18,42 +18,44 @@ import net.sourceforge.phpdt.internal.compiler.impl.Constant;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
public class CaseStatement extends Statement {
-
+
public Expression constantExpression;
+
public CaseLabel targetLabel;
+
public CaseStatement(int sourceStart, Expression constantExpression) {
this.constantExpression = constantExpression;
this.sourceEnd = constantExpression.sourceEnd;
this.sourceStart = sourceStart;
}
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
if (constantExpression.constant == NotAConstant)
- currentScope.problemReporter().caseExpressionMustBeConstant(constantExpression);
+ currentScope.problemReporter().caseExpressionMustBeConstant(
+ constantExpression);
- this.constantExpression.analyseCode(currentScope, flowContext, flowInfo);
+ this.constantExpression
+ .analyseCode(currentScope, flowContext, flowInfo);
return flowInfo;
}
/**
* Case code generation
- *
+ *
*/
-// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
-//
-// if ((bits & IsReachableMASK) == 0) {
-// return;
-// }
-// int pc = codeStream.position;
-// targetLabel.place();
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
+ // public void generateCode(BlockScope currentScope, CodeStream codeStream)
+ // {
+ //
+ // if ((bits & IsReachableMASK) == 0) {
+ // return;
+ // }
+ // int pc = codeStream.position;
+ // targetLabel.place();
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
public StringBuffer printStatement(int tab, StringBuffer output) {
printIndent(tab, output);
@@ -65,30 +67,28 @@ public class CaseStatement extends Statement {
}
return output.append(';');
}
+
/**
* No-op : should use resolveCase(...) instead.
*/
public void resolve(BlockScope scope) {
}
- public Constant resolveCase(
- BlockScope scope,
- TypeBinding switchType,
- SwitchStatement switchStatement) {
+ public Constant resolveCase(BlockScope scope, TypeBinding switchType,
+ SwitchStatement switchStatement) {
// add into the collection of cases of the associated switch statement
switchStatement.cases[switchStatement.caseCount++] = this;
TypeBinding caseType = constantExpression.resolveType(scope);
if (caseType == null || switchType == null)
return null;
- if (constantExpression.isConstantValueOfTypeAssignableToType(caseType, switchType))
+ if (constantExpression.isConstantValueOfTypeAssignableToType(caseType,
+ switchType))
return constantExpression.constant;
if (caseType.isCompatibleWith(switchType))
return constantExpression.constant;
scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
- constantExpression,
- caseType,
- switchType);
+ constantExpression, caseType, switchType);
return null;
}
@@ -99,9 +99,7 @@ public class CaseStatement extends Statement {
return s;
}
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
+ public void traverse(ASTVisitor visitor, BlockScope blockScope) {
if (visitor.visit(this, blockScope)) {
constantExpression.traverse(visitor, blockScope);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CastExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CastExpression.java
index 950716d..ad9c88a 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CastExpression.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CastExpression.java
@@ -25,44 +25,43 @@ import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
public class CastExpression extends Expression {
public Expression expression;
+
public Expression type;
+
public boolean needRuntimeCheckcast;
- //expression.implicitConversion holds the cast for baseType casting
+ // expression.implicitConversion holds the cast for baseType casting
public CastExpression(Expression e, Expression t) {
expression = e;
type = t;
- //due to the fact an expression may start with ( and that a cast also start with (
- //the field is an expression....it can be a TypeReference OR a NameReference Or
- //an expression <--this last one is invalid.......
+ // due to the fact an expression may start with ( and that a cast also
+ // start with (
+ // the field is an expression....it can be a TypeReference OR a
+ // NameReference Or
+ // an expression <--this last one is invalid.......
// :-( .............
- //if (type instanceof TypeReference )
- // flag = IsTypeReference ;
- //else
- // if (type instanceof NameReference)
- // flag = IsNameReference ;
- // else
- // flag = IsExpression ;
+ // if (type instanceof TypeReference )
+ // flag = IsTypeReference ;
+ // else
+ // if (type instanceof NameReference)
+ // flag = IsNameReference ;
+ // else
+ // flag = IsExpression ;
}
- public FlowInfo analyseCode(
- BlockScope currentScope,
- FlowContext flowContext,
- FlowInfo flowInfo) {
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
- return expression
- .analyseCode(currentScope, flowContext, flowInfo)
- .unconditionalInits();
+ return expression.analyseCode(currentScope, flowContext, flowInfo)
+ .unconditionalInits();
}
- public final void areTypesCastCompatible(
- BlockScope scope,
- TypeBinding castType,
- TypeBinding expressionType) {
+ public final void areTypesCastCompatible(BlockScope scope,
+ TypeBinding castType, TypeBinding expressionType) {
// see specifications 5.5
// handle errors and process constant when needed
@@ -72,141 +71,174 @@ public class CastExpression extends Expression {
// we then do not report an obvious-cascade-error.
needRuntimeCheckcast = false;
- if (castType == null || expressionType == null) return;
+ if (castType == null || expressionType == null)
+ return;
// identity conversion cannot be performed upfront, due to side-effects
// like constant propagation
-
+
if (castType.isBaseType()) {
if (expressionType.isBaseType()) {
if (expressionType == castType) {
expression.implicitWidening(castType, expressionType);
- constant = expression.constant; //use the same constant
+ constant = expression.constant; // use the same constant
return;
}
if (expressionType.isCompatibleWith(castType)
- || BaseTypeBinding.isNarrowing(castType.id, expressionType.id)) {
- expression.implicitConversion = (castType.id << 4) + expressionType.id;
+ || BaseTypeBinding.isNarrowing(castType.id,
+ expressionType.id)) {
+ expression.implicitConversion = (castType.id << 4)
+ + expressionType.id;
if (expression.constant != Constant.NotAConstant)
- constant = expression.constant.castTo(expression.implicitConversion);
+ constant = expression.constant
+ .castTo(expression.implicitConversion);
return;
}
}
- scope.problemReporter().typeCastError(this, castType, expressionType);
+ scope.problemReporter().typeCastError(this, castType,
+ expressionType);
return;
}
- //-----------cast to something which is NOT a base type--------------------------
+ // -----------cast to something which is NOT a base
+ // type--------------------------
if (expressionType == NullBinding) {
- // if (castType.isArrayType()){ // 26903 - need checkcast when casting null to array type
- // needRuntimeCheckcast = true;
- // }
- return; //null is compatible with every thing
+ // if (castType.isArrayType()){ // 26903 - need checkcast when
+ // casting null to array type
+ // needRuntimeCheckcast = true;
+ // }
+ return; // null is compatible with every thing
}
if (expressionType.isBaseType()) {
- scope.problemReporter().typeCastError(this, castType, expressionType);
+ scope.problemReporter().typeCastError(this, castType,
+ expressionType);
return;
}
if (expressionType.isArrayType()) {
- if (castType == expressionType) return; // identity conversion
+ if (castType == expressionType)
+ return; // identity conversion
if (castType.isArrayType()) {
- //------- (castType.isArray) expressionType.isArray -----------
- TypeBinding exprElementType = ((ArrayBinding) expressionType).elementsType(scope);
+ // ------- (castType.isArray) expressionType.isArray -----------
+ TypeBinding exprElementType = ((ArrayBinding) expressionType)
+ .elementsType(scope);
if (exprElementType.isBaseType()) {
- // <---stop the recursion-------
+ // <---stop the recursion-------
if (((ArrayBinding) castType).elementsType(scope) == exprElementType)
needRuntimeCheckcast = true;
else
- scope.problemReporter().typeCastError(this, castType, expressionType);
+ scope.problemReporter().typeCastError(this, castType,
+ expressionType);
return;
}
// recursively on the elements...
- areTypesCastCompatible(
- scope,
- ((ArrayBinding) castType).elementsType(scope),
- exprElementType);
+ areTypesCastCompatible(scope, ((ArrayBinding) castType)
+ .elementsType(scope), exprElementType);
return;
- } else if (
- castType.isClass()) {
- //------(castType.isClass) expressionType.isArray ---------------
+ } else if (castType.isClass()) {
+ // ------(castType.isClass) expressionType.isArray
+ // ---------------
if (scope.isJavaLangObject(castType))
return;
- } else { //------- (castType.isInterface) expressionType.isArray -----------
- if (scope.isJavaLangCloneable(castType) || scope.isJavaIoSerializable(castType)) {
+ } else { // ------- (castType.isInterface) expressionType.isArray
+ // -----------
+ if (scope.isJavaLangCloneable(castType)
+ || scope.isJavaIoSerializable(castType)) {
needRuntimeCheckcast = true;
return;
}
}
- scope.problemReporter().typeCastError(this, castType, expressionType);
+ scope.problemReporter().typeCastError(this, castType,
+ expressionType);
return;
}
if (expressionType.isClass()) {
if (castType.isArrayType()) {
// ---- (castType.isArray) expressionType.isClass -------
- if (scope.isJavaLangObject(expressionType)) { // potential runtime error
+ if (scope.isJavaLangObject(expressionType)) { // potential
+ // runtime error
needRuntimeCheckcast = true;
return;
}
- } else if (castType.isClass()) { // ----- (castType.isClass) expressionType.isClass ------
- if (expressionType.isCompatibleWith(castType)){ // no runtime error
- if (castType.id == T_String) constant = expression.constant; // (String) cst is still a constant
+ } else if (castType.isClass()) { // ----- (castType.isClass)
+ // expressionType.isClass ------
+ if (expressionType.isCompatibleWith(castType)) { // no
+ // runtime
+ // error
+ if (castType.id == T_String)
+ constant = expression.constant; // (String) cst is still
+ // a constant
return;
}
if (castType.isCompatibleWith(expressionType)) {
- // potential runtime error
+ // potential runtime error
needRuntimeCheckcast = true;
return;
}
- } else { // ----- (castType.isInterface) expressionType.isClass -------
+ } else { // ----- (castType.isInterface) expressionType.isClass
+ // -------
if (((ReferenceBinding) expressionType).isFinal()) {
- // no subclass for expressionType, thus compile-time check is valid
- if (expressionType.isCompatibleWith(castType))
+ // no subclass for expressionType, thus compile-time check
+ // is valid
+ if (expressionType.isCompatibleWith(castType))
return;
- } else { // a subclass may implement the interface ==> no check at compile time
+ } else { // a subclass may implement the interface ==> no
+ // check at compile time
needRuntimeCheckcast = true;
return;
}
}
- scope.problemReporter().typeCastError(this, castType, expressionType);
+ scope.problemReporter().typeCastError(this, castType,
+ expressionType);
return;
}
- // if (expressionType.isInterface()) { cannot be anything else
+ // if (expressionType.isInterface()) { cannot be anything else
if (castType.isArrayType()) {
// ----- (castType.isArray) expressionType.isInterface ------
if (scope.isJavaLangCloneable(expressionType)
- || scope.isJavaIoSerializable(expressionType)) // potential runtime error
+ || scope.isJavaIoSerializable(expressionType)) // potential
+ // runtime
+ // error
needRuntimeCheckcast = true;
else
- scope.problemReporter().typeCastError(this, castType, expressionType);
+ scope.problemReporter().typeCastError(this, castType,
+ expressionType);
return;
- } else if (castType.isClass()) { // ----- (castType.isClass) expressionType.isInterface --------
+ } else if (castType.isClass()) { // ----- (castType.isClass)
+ // expressionType.isInterface
+ // --------
if (scope.isJavaLangObject(castType)) // no runtime error
return;
if (((ReferenceBinding) castType).isFinal()) {
// no subclass for castType, thus compile-time check is valid
if (!castType.isCompatibleWith(expressionType)) {
// potential runtime error
- scope.problemReporter().typeCastError(this, castType, expressionType);
+ scope.problemReporter().typeCastError(this, castType,
+ expressionType);
return;
}
}
- } else { // ----- (castType.isInterface) expressionType.isInterface -------
- if (castType == expressionType) return; // identity conversion
+ } else { // ----- (castType.isInterface) expressionType.isInterface
+ // -------
+ if (castType == expressionType)
+ return; // identity conversion
if (Scope.compareTypes(castType, expressionType) == NotRelated) {
- MethodBinding[] castTypeMethods = ((ReferenceBinding) castType).methods();
- MethodBinding[] expressionTypeMethods =
- ((ReferenceBinding) expressionType).methods();
+ MethodBinding[] castTypeMethods = ((ReferenceBinding) castType)
+ .methods();
+ MethodBinding[] expressionTypeMethods = ((ReferenceBinding) expressionType)
+ .methods();
int exprMethodsLength = expressionTypeMethods.length;
for (int i = 0, castMethodsLength = castTypeMethods.length; i < castMethodsLength; i++)
for (int j = 0; j < exprMethodsLength; j++) {
if ((castTypeMethods[i].returnType != expressionTypeMethods[j].returnType)
&& (castTypeMethods[i].selector == expressionTypeMethods[j].selector)
- && castTypeMethods[i].areParametersEqual(expressionTypeMethods[j])) {
- scope.problemReporter().typeCastError(this, castType, expressionType);
+ && castTypeMethods[i]
+ .areParametersEqual(expressionTypeMethods[j])) {
+ scope.problemReporter().typeCastError(this,
+ castType, expressionType);
}
}
}
@@ -217,52 +249,56 @@ public class CastExpression extends Expression {
/**
* Cast expression code generation
- *
- * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
- * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
- * @param valueRequired boolean
+ *
+ * @param currentScope
+ * net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream
+ * net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
+ * @param valueRequired
+ * boolean
*/
-// public void generateCode(
-// BlockScope currentScope,
-// CodeStream codeStream,
-// boolean valueRequired) {
-//
-// int pc = codeStream.position;
-// if (constant != NotAConstant) {
-// if (valueRequired
-// || needRuntimeCheckcast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler omits casting check
-// codeStream.generateConstant(constant, implicitConversion);
-// if (needRuntimeCheckcast) {
-// codeStream.checkcast(this.resolvedType);
-// if (!valueRequired)
-// codeStream.pop();
-// }
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// return;
-// }
-// expression.generateCode(
-// currentScope,
-// codeStream,
-// valueRequired || needRuntimeCheckcast);
-// if (needRuntimeCheckcast) {
-// codeStream.checkcast(this.resolvedType);
-// if (!valueRequired)
-// codeStream.pop();
-// } else {
-// if (valueRequired)
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-// }
-
- public Expression innermostCastedExpression(){
+ // public void generateCode(
+ // BlockScope currentScope,
+ // CodeStream codeStream,
+ // boolean valueRequired) {
+ //
+ // int pc = codeStream.position;
+ // if (constant != NotAConstant) {
+ // if (valueRequired
+ // || needRuntimeCheckcast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler
+ // omits casting check
+ // codeStream.generateConstant(constant, implicitConversion);
+ // if (needRuntimeCheckcast) {
+ // codeStream.checkcast(this.resolvedType);
+ // if (!valueRequired)
+ // codeStream.pop();
+ // }
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // return;
+ // }
+ // expression.generateCode(
+ // currentScope,
+ // codeStream,
+ // valueRequired || needRuntimeCheckcast);
+ // if (needRuntimeCheckcast) {
+ // codeStream.checkcast(this.resolvedType);
+ // if (!valueRequired)
+ // codeStream.pop();
+ // } else {
+ // if (valueRequired)
+ // codeStream.generateImplicitConversion(implicitConversion);
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
+ public Expression innermostCastedExpression() {
Expression current = this.expression;
while (current instanceof CastExpression) {
current = ((CastExpression) current).expression;
}
return current;
}
+
public StringBuffer printExpression(int indent, StringBuffer output) {
output.append('(');
@@ -273,8 +309,10 @@ public class CastExpression extends Expression {
public TypeBinding resolveType(BlockScope scope) {
// compute a new constant if the cast is effective
- // due to the fact an expression may start with ( and that a cast can also start with (
- // the field is an expression....it can be a TypeReference OR a NameReference Or
+ // due to the fact an expression may start with ( and that a cast can
+ // also start with (
+ // the field is an expression....it can be a TypeReference OR a
+ // NameReference Or
// any kind of Expression <-- this last one is invalid.......
constant = Constant.NotAConstant;
@@ -283,12 +321,14 @@ public class CastExpression extends Expression {
this.resolvedType = type.resolveType(scope);
TypeBinding castedExpressionType = expression.resolveType(scope);
if (this.resolvedType != null && castedExpressionType != null) {
- areTypesCastCompatible(scope, this.resolvedType, castedExpressionType);
+ areTypesCastCompatible(scope, this.resolvedType,
+ castedExpressionType);
}
return this.resolvedType;
} else { // expression as a cast !!!!!!!!
TypeBinding castedExpressionType = expression.resolveType(scope);
- if (castedExpressionType == null) return null;
+ if (castedExpressionType == null)
+ return null;
scope.problemReporter().invalidTypeReference(type);
return null;
}
@@ -297,12 +337,10 @@ public class CastExpression extends Expression {
public String toStringExpression() {
return "(" + type.toString(0) + ") " + //$NON-NLS-2$ //$NON-NLS-1$
- expression.toStringExpression();
+ expression.toStringExpression();
}
- public void traverse(
- ASTVisitor visitor,
- BlockScope blockScope) {
+ public void traverse(ASTVisitor visitor, BlockScope blockScope) {
if (visitor.visit(this, blockScope)) {
type.traverse(visitor, blockScope);
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Clinit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Clinit.java
index bbd37e2..d04f112 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Clinit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Clinit.java
@@ -23,10 +23,11 @@ import net.sourceforge.phpdt.internal.compiler.parser.UnitParser;
import net.sourceforge.phpdt.internal.compiler.problem.AbortMethod;
public class Clinit extends AbstractMethodDeclaration {
-
+
public final static char[] ConstantPoolName = "".toCharArray(); //$NON-NLS-1$
private FieldBinding assertionSyntheticFieldBinding = null;
+
private FieldBinding classLiteralSyntheticField = null;
public Clinit(CompilationResult compilationResult) {
@@ -35,44 +36,37 @@ public class Clinit extends AbstractMethodDeclaration {
selector = ConstantPoolName;
}
- public void analyseCode(
- ClassScope classScope,
- InitializationFlowContext staticInitializerFlowContext,
- FlowInfo flowInfo) {
+ public void analyseCode(ClassScope classScope,
+ InitializationFlowContext staticInitializerFlowContext,
+ FlowInfo flowInfo) {
if (ignoreFurtherInvestigation)
return;
try {
- ExceptionHandlingFlowContext clinitContext =
- new ExceptionHandlingFlowContext(
- staticInitializerFlowContext.parent,
- this,
- NoExceptions,
- scope,
- FlowInfo.DEAD_END);
+ ExceptionHandlingFlowContext clinitContext = new ExceptionHandlingFlowContext(
+ staticInitializerFlowContext.parent, this, NoExceptions,
+ scope, FlowInfo.DEAD_END);
// check for missing returning path
this.needFreeReturn = flowInfo.isReachable();
// check missing blank final field initializations
- flowInfo = flowInfo.mergedWith(staticInitializerFlowContext.initsOnReturn);
+ flowInfo = flowInfo
+ .mergedWith(staticInitializerFlowContext.initsOnReturn);
FieldBinding[] fields = scope.enclosingSourceType().fields();
for (int i = 0, count = fields.length; i < count; i++) {
FieldBinding field;
- if ((field = fields[i]).isStatic()
- && field.isFinal()
- && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
- scope.problemReporter().uninitializedBlankFinalField(
- field,
- scope.referenceType().declarationOf(field));
- // can complain against the field decl, since only one
+ if ((field = fields[i]).isStatic() && field.isFinal()
+ && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
+ scope.problemReporter().uninitializedBlankFinalField(field,
+ scope.referenceType().declarationOf(field));
+ // can complain against the field decl, since only one
+ //
}
}
// check static initializers thrown exceptions
- staticInitializerFlowContext.checkInitializerExceptions(
- scope,
- clinitContext,
- flowInfo);
+ staticInitializerFlowContext.checkInitializerExceptions(scope,
+ clinitContext, flowInfo);
} catch (AbortMethod e) {
this.ignoreFurtherInvestigation = true;
}
@@ -80,126 +74,133 @@ public class Clinit extends AbstractMethodDeclaration {
/**
* Bytecode generation for a method
- *
- * @param classScope net.sourceforge.phpdt.internal.compiler.lookup.ClassScope
- * @param classFile net.sourceforge.phpdt.internal.compiler.codegen.ClassFile
+ *
+ * @param classScope
+ * net.sourceforge.phpdt.internal.compiler.lookup.ClassScope
+ * @param classFile
+ * net.sourceforge.phpdt.internal.compiler.codegen.ClassFile
*/
-// public void generateCode(ClassScope classScope, ClassFile classFile) {
-//
-// int clinitOffset = 0;
-// if (ignoreFurtherInvestigation) {
-// // should never have to add any problem method
-// return;
-// }
-// try {
-// clinitOffset = classFile.contentsOffset;
-// this.generateCode(classScope, classFile, clinitOffset);
-// } catch (AbortMethod e) {
-// // should never occur
-// // the clinit referenceContext is the type declaration
-// // All clinit problems will be reported against the type: AbortType instead of AbortMethod
-// // reset the contentsOffset to the value before generating the clinit code
-// // decrement the number of method info as well.
-// // This is done in the addProblemMethod and addProblemConstructor for other
-// // cases.
-// if (e.compilationResult == CodeStream.RESTART_IN_WIDE_MODE) {
-// // a branch target required a goto_w, restart code gen in wide mode.
-// try {
-// if (statements != null) {
-// for (int i = 0, max = statements.length; i < max; i++)
-// statements[i].resetStateForCodeGeneration();
-// }
-// classFile.contentsOffset = clinitOffset;
-// classFile.methodCount--;
-// classFile.codeStream.wideMode = true; // request wide mode
-// this.generateCode(classScope, classFile, clinitOffset);
-// // restart method generation
-// } catch (AbortMethod e2) {
-// classFile.contentsOffset = clinitOffset;
-// classFile.methodCount--;
-// }
-// } else {
-// // produce a problem method accounting for this fatal error
-// classFile.contentsOffset = clinitOffset;
-// classFile.methodCount--;
-// }
-// }
-// }
-
+ // public void generateCode(ClassScope classScope, ClassFile classFile) {
+ //
+ // int clinitOffset = 0;
+ // if (ignoreFurtherInvestigation) {
+ // // should never have to add any problem method
+ // return;
+ // }
+ // try {
+ // clinitOffset = classFile.contentsOffset;
+ // this.generateCode(classScope, classFile, clinitOffset);
+ // } catch (AbortMethod e) {
+ // // should never occur
+ // // the clinit referenceContext is the type declaration
+ // // All clinit problems will be reported against the type: AbortType
+ // instead of AbortMethod
+ // // reset the contentsOffset to the value before generating the clinit
+ // code
+ // // decrement the number of method info as well.
+ // // This is done in the addProblemMethod and addProblemConstructor for
+ // other
+ // // cases.
+ // if (e.compilationResult == CodeStream.RESTART_IN_WIDE_MODE) {
+ // // a branch target required a goto_w, restart code gen in wide mode.
+ // try {
+ // if (statements != null) {
+ // for (int i = 0, max = statements.length; i < max; i++)
+ // statements[i].resetStateForCodeGeneration();
+ // }
+ // classFile.contentsOffset = clinitOffset;
+ // classFile.methodCount--;
+ // classFile.codeStream.wideMode = true; // request wide mode
+ // this.generateCode(classScope, classFile, clinitOffset);
+ // // restart method generation
+ // } catch (AbortMethod e2) {
+ // classFile.contentsOffset = clinitOffset;
+ // classFile.methodCount--;
+ // }
+ // } else {
+ // // produce a problem method accounting for this fatal error
+ // classFile.contentsOffset = clinitOffset;
+ // classFile.methodCount--;
+ // }
+ // }
+ // }
/**
* Bytecode generation for a method
- *
- * @param classScope net.sourceforge.phpdt.internal.compiler.lookup.ClassScope
- * @param classFile net.sourceforge.phpdt.internal.compiler.codegen.ClassFile
+ *
+ * @param classScope
+ * net.sourceforge.phpdt.internal.compiler.lookup.ClassScope
+ * @param classFile
+ * net.sourceforge.phpdt.internal.compiler.codegen.ClassFile
*/
-// private void generateCode(
-// ClassScope classScope,
-// ClassFile classFile,
-// int clinitOffset) {
-//
-// ConstantPool constantPool = classFile.constantPool;
-// int constantPoolOffset = constantPool.currentOffset;
-// int constantPoolIndex = constantPool.currentIndex;
-// classFile.generateMethodInfoHeaderForClinit();
-// int codeAttributeOffset = classFile.contentsOffset;
-// classFile.generateCodeAttributeHeader();
-// CodeStream codeStream = classFile.codeStream;
-// this.resolve(classScope);
-//
-// codeStream.reset(this, classFile);
-// TypeDeclaration declaringType = classScope.referenceContext;
-//
-// // initialize local positions - including initializer scope.
-// MethodScope staticInitializerScope = declaringType.staticInitializerScope;
-// staticInitializerScope.computeLocalVariablePositions(0, codeStream);
-//
-// // 1.4 feature
-// // This has to be done before any other initialization
-// if (this.assertionSyntheticFieldBinding != null) {
-// // generate code related to the activation of assertion for this class
-// codeStream.generateClassLiteralAccessForType(
-// classScope.enclosingSourceType(),
-// classLiteralSyntheticField);
-// codeStream.invokeJavaLangClassDesiredAssertionStatus();
-// Label falseLabel = new Label(codeStream);
-// codeStream.ifne(falseLabel);
-// codeStream.iconst_1();
-// Label jumpLabel = new Label(codeStream);
-// codeStream.goto_(jumpLabel);
-// falseLabel.place();
-// codeStream.iconst_0();
-// jumpLabel.place();
-// codeStream.putstatic(this.assertionSyntheticFieldBinding);
-// }
-// // generate initializers
-// if (declaringType.fields != null) {
-// for (int i = 0, max = declaringType.fields.length; i < max; i++) {
-// FieldDeclaration fieldDecl;
-// if ((fieldDecl = declaringType.fields[i]).isStatic()) {
-// fieldDecl.generateCode(staticInitializerScope, codeStream);
-// }
-// }
-// }
-// if (codeStream.position == 0) {
-// // do not need to output a Clinit if no bytecodes
-// // so we reset the offset inside the byte array contents.
-// classFile.contentsOffset = clinitOffset;
-// // like we don't addd a method we need to undo the increment on the method count
-// classFile.methodCount--;
-// // reset the constant pool to its state before the clinit
-// constantPool.resetForClinit(constantPoolIndex, constantPoolOffset);
-// } else {
-// if (this.needFreeReturn) {
-// int oldPosition = codeStream.position;
-// codeStream.return_();
-// codeStream.updateLocalVariablesAttribute(oldPosition);
-// }
-// // Record the end of the clinit: point to the declaration of the class
-// codeStream.recordPositionsFrom(0, declaringType.sourceStart);
-// classFile.completeCodeAttributeForClinit(codeAttributeOffset);
-// }
-// }
-
+ // private void generateCode(
+ // ClassScope classScope,
+ // ClassFile classFile,
+ // int clinitOffset) {
+ //
+ // ConstantPool constantPool = classFile.constantPool;
+ // int constantPoolOffset = constantPool.currentOffset;
+ // int constantPoolIndex = constantPool.currentIndex;
+ // classFile.generateMethodInfoHeaderForClinit();
+ // int codeAttributeOffset = classFile.contentsOffset;
+ // classFile.generateCodeAttributeHeader();
+ // CodeStream codeStream = classFile.codeStream;
+ // this.resolve(classScope);
+ //
+ // codeStream.reset(this, classFile);
+ // TypeDeclaration declaringType = classScope.referenceContext;
+ //
+ // // initialize local positions - including initializer scope.
+ // MethodScope staticInitializerScope =
+ // declaringType.staticInitializerScope;
+ // staticInitializerScope.computeLocalVariablePositions(0, codeStream);
+ //
+ // // 1.4 feature
+ // // This has to be done before any other initialization
+ // if (this.assertionSyntheticFieldBinding != null) {
+ // // generate code related to the activation of assertion for this class
+ // codeStream.generateClassLiteralAccessForType(
+ // classScope.enclosingSourceType(),
+ // classLiteralSyntheticField);
+ // codeStream.invokeJavaLangClassDesiredAssertionStatus();
+ // Label falseLabel = new Label(codeStream);
+ // codeStream.ifne(falseLabel);
+ // codeStream.iconst_1();
+ // Label jumpLabel = new Label(codeStream);
+ // codeStream.goto_(jumpLabel);
+ // falseLabel.place();
+ // codeStream.iconst_0();
+ // jumpLabel.place();
+ // codeStream.putstatic(this.assertionSyntheticFieldBinding);
+ // }
+ // // generate initializers
+ // if (declaringType.fields != null) {
+ // for (int i = 0, max = declaringType.fields.length; i < max; i++) {
+ // FieldDeclaration fieldDecl;
+ // if ((fieldDecl = declaringType.fields[i]).isStatic()) {
+ // fieldDecl.generateCode(staticInitializerScope, codeStream);
+ // }
+ // }
+ // }
+ // if (codeStream.position == 0) {
+ // // do not need to output a Clinit if no bytecodes
+ // // so we reset the offset inside the byte array contents.
+ // classFile.contentsOffset = clinitOffset;
+ // // like we don't addd a method we need to undo the increment on the
+ // method count
+ // classFile.methodCount--;
+ // // reset the constant pool to its state before the clinit
+ // constantPool.resetForClinit(constantPoolIndex, constantPoolOffset);
+ // } else {
+ // if (this.needFreeReturn) {
+ // int oldPosition = codeStream.position;
+ // codeStream.return_();
+ // codeStream.updateLocalVariablesAttribute(oldPosition);
+ // }
+ // // Record the end of the clinit: point to the declaration of the class
+ // codeStream.recordPositionsFrom(0, declaringType.sourceStart);
+ // classFile.completeCodeAttributeForClinit(codeAttributeOffset);
+ // }
+ // }
public boolean isClinit() {
return true;
@@ -215,15 +216,18 @@ public class Clinit extends AbstractMethodDeclaration {
return true;
}
- public void parseStatements(UnitParser parser, CompilationUnitDeclaration unit) {
- //the clinit is filled by hand ....
+ public void parseStatements(UnitParser parser,
+ CompilationUnitDeclaration unit) {
+ // the clinit is filled by hand ....
}
+
public StringBuffer print(int tab, StringBuffer output) {
printIndent(tab, output).append("()"); //$NON-NLS-1$
printBody(tab + 1, output);
return output;
}
+
public void resolve(ClassScope scope) {
this.scope = new MethodScope(scope, scope.referenceContext, true);
@@ -238,24 +242,25 @@ public class Clinit extends AbstractMethodDeclaration {
return s;
}
- public void traverse(
- IAbstractSyntaxTreeVisitor visitor,
- ClassScope classScope) {
+ public void traverse(IAbstractSyntaxTreeVisitor visitor,
+ ClassScope classScope) {
visitor.visit(this, classScope);
visitor.endVisit(this, classScope);
}
// 1.4 feature
- public void addSupportForAssertion(FieldBinding assertionSyntheticFieldBinding) {
+ public void addSupportForAssertion(
+ FieldBinding assertionSyntheticFieldBinding) {
this.assertionSyntheticFieldBinding = assertionSyntheticFieldBinding;
- // we need to add the field right now, because the field infos are generated before the methods
- SourceTypeBinding sourceType =
- this.scope.outerMostMethodScope().enclosingSourceType();
- this.classLiteralSyntheticField =
- sourceType.addSyntheticField(sourceType, scope);
+ // we need to add the field right now, because the field infos are
+ // generated before the methods
+ SourceTypeBinding sourceType = this.scope.outerMostMethodScope()
+ .enclosingSourceType();
+ this.classLiteralSyntheticField = sourceType.addSyntheticField(
+ sourceType, scope);
}
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompilationUnitDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompilationUnitDeclaration.java
index 583b11a..3ea6e05 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompilationUnitDeclaration.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompilationUnitDeclaration.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.ast;
+
import java.util.ArrayList;
import net.sourceforge.phpdt.core.compiler.CharOperation;
@@ -23,204 +24,217 @@ import net.sourceforge.phpdt.internal.compiler.problem.AbortType;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
-public class CompilationUnitDeclaration extends ASTNode implements ProblemSeverities, ReferenceContext {
-
- public ImportReference currentPackage;
- public ImportReference[] imports;
- // public TypeDeclaration[] types;
- public ArrayList types;
-
- //public char[][] name;
- public int[][] comments;
-
- public boolean ignoreFurtherInvestigation = false; // once pointless to investigate due to errors
- public boolean ignoreMethodBodies = false;
- public CompilationUnitScope scope;
- public ProblemReporter problemReporter;
- public CompilationResult compilationResult;
-
- private LocalTypeBinding[] localTypes;
- int localTypeCount = 0;
-
- public boolean isPropagatingInnerClassEmulation;
-
- public CompilationUnitDeclaration(ProblemReporter problemReporter, CompilationResult compilationResult, int sourceLength) {
-
- this.problemReporter = problemReporter;
- this.compilationResult = compilationResult;
- this.types = new ArrayList();
- //by definition of a compilation unit....
- sourceStart = 0;
- sourceEnd = sourceLength - 1;
- }
-
- /*
- * We cause the compilation task to abort to a given extent.
- */
- public void abort(int abortLevel) {
-
- switch (abortLevel) {
- case AbortType :
- throw new AbortType(compilationResult);
- case AbortMethod :
- throw new AbortMethod(compilationResult);
- default :
- throw new AbortCompilationUnit(compilationResult);
- }
- }
-
- /*
- * Dispatch code analysis AND request saturation of inner emulation
- */
- public void analyseCode() {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (types != null) {
- for (int i = 0, count = types.size(); i < count; i++) {
- if (types.get(i) instanceof TypeDeclaration)
- ((TypeDeclaration) types.get(i)).analyseCode(scope);
- }
- }
- // request inner emulation propagation
- propagateInnerEmulationForAllLocalTypes();
- } catch (AbortCompilationUnit e) {
- this.ignoreFurtherInvestigation = true;
- return;
- }
- }
-
- /*
- * When unit result is about to be accepted, removed back pointers
- * to compiler structures.
- */
- public void cleanUp() {
- if (this.types != null) {
- for (int i = 0, max = this.types.size(); i < max; i++) {
- if (this.types.get(i) instanceof TypeDeclaration) {
- cleanUp((TypeDeclaration) this.types.get(i));
- }
- }
- for (int i = 0, max = this.localTypeCount; i < max; i++) {
- // null out the type's scope backpointers
- localTypes[i].scope = null; // local members are already in the list
- }
- }
- // ClassFile[] classFiles = compilationResult.getClassFiles();
- // for (int i = 0, max = classFiles.length; i < max; i++) {
- // // clear the classFile back pointer to the bindings
- // ClassFile classFile = classFiles[i];
- // // null out the classfile backpointer to a type binding
- // classFile.referenceBinding = null;
- // classFile.codeStream = null; // codeStream holds onto ast and scopes
- // classFile.innerClassesBindings = null;
- // }
- }
- private void cleanUp(TypeDeclaration type) {
- if (type.memberTypes != null) {
- for (int i = 0, max = type.memberTypes.length; i < max; i++) {
- cleanUp(type.memberTypes[i]);
- }
- }
- if (type.binding != null) {
- // null out the type's scope backpointers
- type.binding.scope = null;
- }
- }
-
-// public void checkUnusedImports() {
-//
-// if (this.scope.imports != null) {
-// for (int i = 0, max = this.scope.imports.length; i < max; i++) {
-// ImportBinding importBinding = this.scope.imports[i];
-// ImportReference importReference = importBinding.reference;
-// if (importReference != null && !importReference.used) {
-// scope.problemReporter().unusedImport(importReference);
-// }
-// }
-// }
-// }
-
- public CompilationResult compilationResult() {
- return compilationResult;
- }
-
- /*
- * Finds the matching type amoung this compilation unit types.
- * Returns null if no type with this name is found.
- * The type name is a compound name
- * eg. if we're looking for X.A.B then a type name would be {X, A, B}
- */
- public TypeDeclaration declarationOfType(char[][] typeName) {
-
- for (int i = 0; i < this.types.size(); i++) {
- if (this.types.get(i) instanceof TypeDeclaration) {
- TypeDeclaration typeDecl = ((TypeDeclaration) this.types.get(i)).declarationOfType(typeName);
- if (typeDecl != null) {
- return typeDecl;
- }
- }
- }
- return null;
- }
-
- /**
- * Bytecode generation
- */
- // public void generateCode() {
- //
- // if (ignoreFurtherInvestigation) {
- // if (types != null) {
- // for (int i = 0, count = types.length; i < count; i++) {
- // types[i].ignoreFurtherInvestigation = true;
- // // propagate the flag to request problem type creation
- // types[i].generateCode(scope);
- // }
- // }
- // return;
- // }
- // try {
- // if (types != null) {
- // for (int i = 0, count = types.length; i < count; i++)
- // types[i].generateCode(scope);
- // }
- // } catch (AbortCompilationUnit e) {
- // }
- // }
-
- public char[] getFileName() {
-
- return compilationResult.getFileName();
- }
-
- public char[] getMainTypeName() {
-
- if (compilationResult.compilationUnit == null) {
- char[] fileName = compilationResult.getFileName();
-
- int start = CharOperation.lastIndexOf('/', fileName) + 1;
- if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName))
- start = CharOperation.lastIndexOf('\\', fileName) + 1;
-
- int end = CharOperation.lastIndexOf('.', fileName);
- if (end == -1)
- end = fileName.length;
-
- return CharOperation.subarray(fileName, start, end);
- } else {
- return compilationResult.compilationUnit.getMainTypeName();
- }
- }
-
- public boolean isEmpty() {
-
- return (currentPackage == null) && (imports == null) && (types == null);
- }
-
- public boolean hasErrors() {
- return this.ignoreFurtherInvestigation;
- }
+public class CompilationUnitDeclaration extends ASTNode implements
+ ProblemSeverities, ReferenceContext {
+
+ public ImportReference currentPackage;
+
+ public ImportReference[] imports;
+
+ // public TypeDeclaration[] types;
+ public ArrayList types;
+
+ // public char[][] name;
+ public int[][] comments;
+
+ public boolean ignoreFurtherInvestigation = false; // once pointless to
+ // investigate due to
+ // errors
+
+ public boolean ignoreMethodBodies = false;
+
+ public CompilationUnitScope scope;
+
+ public ProblemReporter problemReporter;
+
+ public CompilationResult compilationResult;
+
+ private LocalTypeBinding[] localTypes;
+
+ int localTypeCount = 0;
+
+ public boolean isPropagatingInnerClassEmulation;
+
+ public CompilationUnitDeclaration(ProblemReporter problemReporter,
+ CompilationResult compilationResult, int sourceLength) {
+
+ this.problemReporter = problemReporter;
+ this.compilationResult = compilationResult;
+ this.types = new ArrayList();
+ // by definition of a compilation unit....
+ sourceStart = 0;
+ sourceEnd = sourceLength - 1;
+ }
+
+ /*
+ * We cause the compilation task to abort to a given extent.
+ */
+ public void abort(int abortLevel) {
+
+ switch (abortLevel) {
+ case AbortType:
+ throw new AbortType(compilationResult);
+ case AbortMethod:
+ throw new AbortMethod(compilationResult);
+ default:
+ throw new AbortCompilationUnit(compilationResult);
+ }
+ }
+
+ /*
+ * Dispatch code analysis AND request saturation of inner emulation
+ */
+ public void analyseCode() {
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (types != null) {
+ for (int i = 0, count = types.size(); i < count; i++) {
+ if (types.get(i) instanceof TypeDeclaration)
+ ((TypeDeclaration) types.get(i)).analyseCode(scope);
+ }
+ }
+ // request inner emulation propagation
+ propagateInnerEmulationForAllLocalTypes();
+ } catch (AbortCompilationUnit e) {
+ this.ignoreFurtherInvestigation = true;
+ return;
+ }
+ }
+
+ /*
+ * When unit result is about to be accepted, removed back pointers to
+ * compiler structures.
+ */
+ public void cleanUp() {
+ if (this.types != null) {
+ for (int i = 0, max = this.types.size(); i < max; i++) {
+ if (this.types.get(i) instanceof TypeDeclaration) {
+ cleanUp((TypeDeclaration) this.types.get(i));
+ }
+ }
+ for (int i = 0, max = this.localTypeCount; i < max; i++) {
+ // null out the type's scope backpointers
+ localTypes[i].scope = null; // local members are already in the
+ // list
+ }
+ }
+ // ClassFile[] classFiles = compilationResult.getClassFiles();
+ // for (int i = 0, max = classFiles.length; i < max; i++) {
+ // // clear the classFile back pointer to the bindings
+ // ClassFile classFile = classFiles[i];
+ // // null out the classfile backpointer to a type binding
+ // classFile.referenceBinding = null;
+ // classFile.codeStream = null; // codeStream holds onto ast and scopes
+ // classFile.innerClassesBindings = null;
+ // }
+ }
+
+ private void cleanUp(TypeDeclaration type) {
+ if (type.memberTypes != null) {
+ for (int i = 0, max = type.memberTypes.length; i < max; i++) {
+ cleanUp(type.memberTypes[i]);
+ }
+ }
+ if (type.binding != null) {
+ // null out the type's scope backpointers
+ type.binding.scope = null;
+ }
+ }
+
+ // public void checkUnusedImports() {
+ //
+ // if (this.scope.imports != null) {
+ // for (int i = 0, max = this.scope.imports.length; i < max; i++) {
+ // ImportBinding importBinding = this.scope.imports[i];
+ // ImportReference importReference = importBinding.reference;
+ // if (importReference != null && !importReference.used) {
+ // scope.problemReporter().unusedImport(importReference);
+ // }
+ // }
+ // }
+ // }
+
+ public CompilationResult compilationResult() {
+ return compilationResult;
+ }
+
+ /*
+ * Finds the matching type amoung this compilation unit types. Returns null
+ * if no type with this name is found. The type name is a compound name eg.
+ * if we're looking for X.A.B then a type name would be {X, A, B}
+ */
+ public TypeDeclaration declarationOfType(char[][] typeName) {
+
+ for (int i = 0; i < this.types.size(); i++) {
+ if (this.types.get(i) instanceof TypeDeclaration) {
+ TypeDeclaration typeDecl = ((TypeDeclaration) this.types.get(i))
+ .declarationOfType(typeName);
+ if (typeDecl != null) {
+ return typeDecl;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Bytecode generation
+ */
+ // public void generateCode() {
+ //
+ // if (ignoreFurtherInvestigation) {
+ // if (types != null) {
+ // for (int i = 0, count = types.length; i < count; i++) {
+ // types[i].ignoreFurtherInvestigation = true;
+ // // propagate the flag to request problem type creation
+ // types[i].generateCode(scope);
+ // }
+ // }
+ // return;
+ // }
+ // try {
+ // if (types != null) {
+ // for (int i = 0, count = types.length; i < count; i++)
+ // types[i].generateCode(scope);
+ // }
+ // } catch (AbortCompilationUnit e) {
+ // }
+ // }
+ public char[] getFileName() {
+
+ return compilationResult.getFileName();
+ }
+
+ public char[] getMainTypeName() {
+
+ if (compilationResult.compilationUnit == null) {
+ char[] fileName = compilationResult.getFileName();
+
+ int start = CharOperation.lastIndexOf('/', fileName) + 1;
+ if (start == 0 || start < CharOperation.lastIndexOf('\\', fileName))
+ start = CharOperation.lastIndexOf('\\', fileName) + 1;
+
+ int end = CharOperation.lastIndexOf('.', fileName);
+ if (end == -1)
+ end = fileName.length;
+
+ return CharOperation.subarray(fileName, start, end);
+ } else {
+ return compilationResult.compilationUnit.getMainTypeName();
+ }
+ }
+
+ public boolean isEmpty() {
+
+ return (currentPackage == null) && (imports == null) && (types == null);
+ }
+
+ public boolean hasErrors() {
+ return this.ignoreFurtherInvestigation;
+ }
+
public StringBuffer print(int indent, StringBuffer output) {
if (currentPackage != null) {
@@ -235,113 +249,117 @@ public class CompilationUnitDeclaration extends ASTNode implements ProblemSeveri
if (types != null) {
for (int i = 0; i < types.size(); i++) {
- ((ASTNode)types.get(i)).print(indent, output).append("\n"); //$NON-NLS-1$
+ ((ASTNode) types.get(i)).print(indent, output).append("\n"); //$NON-NLS-1$
}
}
return output;
}
-
- /*
- * Force inner local types to update their innerclass emulation
- */
- public void propagateInnerEmulationForAllLocalTypes() {
-
- isPropagatingInnerClassEmulation = true;
- for (int i = 0, max = this.localTypeCount; i < max; i++) {
-
- LocalTypeBinding localType = localTypes[i];
- // only propagate for reachable local types
- if ((localType.scope.referenceType().bits & IsReachableMASK) != 0) {
- localType.updateInnerEmulationDependents();
- }
- }
- }
-
- /*
- * Keep track of all local types, so as to update their innerclass
- * emulation later on.
- */
- public void record(LocalTypeBinding localType) {
-
- if (this.localTypeCount == 0) {
- this.localTypes = new LocalTypeBinding[5];
- } else if (this.localTypeCount == this.localTypes.length) {
- System.arraycopy(
- this.localTypes,
- 0,
- (this.localTypes = new LocalTypeBinding[this.localTypeCount * 2]),
- 0,
- this.localTypeCount);
- }
- this.localTypes[this.localTypeCount++] = localType;
- }
-
- public void resolve() {
-
- try {
- if (types != null) {
- for (int i = 0, count = types.size(); i < count; i++) {
- if (types.get(i) instanceof TypeDeclaration) {
- ((TypeDeclaration) types.get(i)).resolve(scope);
- }
- }
- }
-// if (!this.compilationResult.hasSyntaxError())
-// checkUnusedImports();
- } catch (AbortCompilationUnit e) {
- this.ignoreFurtherInvestigation = true;
- return;
- }
- }
-
- public void tagAsHavingErrors() {
- ignoreFurtherInvestigation = true;
- }
-
- public String toString(int tab) {
-
- String s = ""; //$NON-NLS-1$
- if (currentPackage != null)
- s = tabString(tab) + "package " + currentPackage.toString(0, false) + ";\n"; //$NON-NLS-1$ //$NON-NLS-2$
-
- if (imports != null)
- for (int i = 0; i < imports.length; i++) {
- s += tabString(tab) + "include " + imports[i].toString() + ";\n"; //$NON-NLS-1$ //$NON-NLS-2$
- };
-
- if (types != null)
- for (int i = 0; i < types.size(); i++) {
- s += ((ASTNode) types.get(i)).toString(tab) + "\n"; //$NON-NLS-1$
- }
- return s;
- }
-
- public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, scope)) {
- if (currentPackage != null) {
- currentPackage.traverse(visitor, scope);
- }
- if (imports != null) {
- int importLength = imports.length;
- for (int i = 0; i < importLength; i++) {
- imports[i].traverse(visitor, scope);
- }
- }
- if (types != null) {
- int typesLength = types.size();
- for (int i = 0; i < typesLength; i++) {
- if (types.get(i) instanceof TypeDeclaration) {
- ((TypeDeclaration) types.get(i)).traverse(visitor, scope);
- }
- }
- }
- }
- visitor.endVisit(this, scope);
- } catch (AbortCompilationUnit e) {
- }
- }
+
+ /*
+ * Force inner local types to update their innerclass emulation
+ */
+ public void propagateInnerEmulationForAllLocalTypes() {
+
+ isPropagatingInnerClassEmulation = true;
+ for (int i = 0, max = this.localTypeCount; i < max; i++) {
+
+ LocalTypeBinding localType = localTypes[i];
+ // only propagate for reachable local types
+ if ((localType.scope.referenceType().bits & IsReachableMASK) != 0) {
+ localType.updateInnerEmulationDependents();
+ }
+ }
+ }
+
+ /*
+ * Keep track of all local types, so as to update their innerclass emulation
+ * later on.
+ */
+ public void record(LocalTypeBinding localType) {
+
+ if (this.localTypeCount == 0) {
+ this.localTypes = new LocalTypeBinding[5];
+ } else if (this.localTypeCount == this.localTypes.length) {
+ System
+ .arraycopy(
+ this.localTypes,
+ 0,
+ (this.localTypes = new LocalTypeBinding[this.localTypeCount * 2]),
+ 0, this.localTypeCount);
+ }
+ this.localTypes[this.localTypeCount++] = localType;
+ }
+
+ public void resolve() {
+
+ try {
+ if (types != null) {
+ for (int i = 0, count = types.size(); i < count; i++) {
+ if (types.get(i) instanceof TypeDeclaration) {
+ ((TypeDeclaration) types.get(i)).resolve(scope);
+ }
+ }
+ }
+ // if (!this.compilationResult.hasSyntaxError())
+ // checkUnusedImports();
+ } catch (AbortCompilationUnit e) {
+ this.ignoreFurtherInvestigation = true;
+ return;
+ }
+ }
+
+ public void tagAsHavingErrors() {
+ ignoreFurtherInvestigation = true;
+ }
+
+ public String toString(int tab) {
+
+ String s = ""; //$NON-NLS-1$
+ if (currentPackage != null)
+ s = tabString(tab)
+ + "package " + currentPackage.toString(0, false) + ";\n"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (imports != null)
+ for (int i = 0; i < imports.length; i++) {
+ s += tabString(tab)
+ + "include " + imports[i].toString() + ";\n"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ ;
+
+ if (types != null)
+ for (int i = 0; i < types.size(); i++) {
+ s += ((ASTNode) types.get(i)).toString(tab) + "\n"; //$NON-NLS-1$
+ }
+ return s;
+ }
+
+ public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
+
+ if (ignoreFurtherInvestigation)
+ return;
+ try {
+ if (visitor.visit(this, scope)) {
+ if (currentPackage != null) {
+ currentPackage.traverse(visitor, scope);
+ }
+ if (imports != null) {
+ int importLength = imports.length;
+ for (int i = 0; i < importLength; i++) {
+ imports[i].traverse(visitor, scope);
+ }
+ }
+ if (types != null) {
+ int typesLength = types.size();
+ for (int i = 0; i < typesLength; i++) {
+ if (types.get(i) instanceof TypeDeclaration) {
+ ((TypeDeclaration) types.get(i)).traverse(visitor,
+ scope);
+ }
+ }
+ }
+ }
+ visitor.endVisit(this, scope);
+ } catch (AbortCompilationUnit e) {
+ }
+ }
}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompoundAssignment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompoundAssignment.java
index 5912979..5f6649e 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompoundAssignment.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/CompoundAssignment.java
@@ -18,129 +18,157 @@ import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
public class CompoundAssignment extends Assignment implements OperatorIds {
public int operator;
+
public int assignmentImplicitConversion;
- // var op exp is equivalent to var = (varType) var op exp
+ // var op exp is equivalent to var = (varType) var op exp
// assignmentImplicitConversion stores the cast needed for the assignment
-public CompoundAssignment(Expression lhs, Expression expression,int operator, int sourceEnd) {
- //lhs is always a reference by construction ,
- //but is build as an expression ==> the checkcast cannot fail
+ public CompoundAssignment(Expression lhs, Expression expression,
+ int operator, int sourceEnd) {
+ // lhs is always a reference by construction ,
+ // but is build as an expression ==> the checkcast cannot fail
- super(lhs, expression, sourceEnd);
- lhs.bits &= ~IsStrictlyAssignedMASK; // tag lhs as NON assigned - it is also a read access
- this.operator = operator ;
-}
-public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- // record setting a variable: various scenarii are possible, setting an array reference,
- // a field reference, a blank final field reference, a field of an enclosing instance or
- // just a local variable.
+ super(lhs, expression, sourceEnd);
+ lhs.bits &= ~IsStrictlyAssignedMASK; // tag lhs as NON assigned - it
+ // is also a read access
+ this.operator = operator;
+ }
- return ((Reference) lhs).analyseAssignment(currentScope, flowContext, flowInfo, this, true).unconditionalInits();
-}
-//public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-//
-// // various scenarii are possible, setting an array reference,
-// // a field reference, a blank final field reference, a field of an enclosing instance or
-// // just a local variable.
-//
-// int pc = codeStream.position;
-// ((Reference) lhs).generateCompoundAssignment(currentScope, codeStream, expression, operator, assignmentImplicitConversion, valueRequired);
-// if (valueRequired) {
-// codeStream.generateImplicitConversion(implicitConversion);
-// }
-// codeStream.recordPositionsFrom(pc, this.sourceStart);
-//}
-public String operatorToString() {
- switch (operator) {
- case PLUS :
+ public FlowInfo analyseCode(BlockScope currentScope,
+ FlowContext flowContext, FlowInfo flowInfo) {
+ // record setting a variable: various scenarii are possible, setting an
+ // array reference,
+ // a field reference, a blank final field reference, a field of an
+ // enclosing instance or
+ // just a local variable.
+
+ return ((Reference) lhs).analyseAssignment(currentScope, flowContext,
+ flowInfo, this, true).unconditionalInits();
+ }
+
+ // public void generateCode(BlockScope currentScope, CodeStream codeStream,
+ // boolean valueRequired) {
+ //
+ // // various scenarii are possible, setting an array reference,
+ // // a field reference, a blank final field reference, a field of an
+ // enclosing instance or
+ // // just a local variable.
+ //
+ // int pc = codeStream.position;
+ // ((Reference) lhs).generateCompoundAssignment(currentScope, codeStream,
+ // expression, operator, assignmentImplicitConversion, valueRequired);
+ // if (valueRequired) {
+ // codeStream.generateImplicitConversion(implicitConversion);
+ // }
+ // codeStream.recordPositionsFrom(pc, this.sourceStart);
+ // }
+ public String operatorToString() {
+ switch (operator) {
+ case PLUS:
return "+="; //$NON-NLS-1$
- case MINUS :
+ case MINUS:
return "-="; //$NON-NLS-1$
- case MULTIPLY :
+ case MULTIPLY:
return "*="; //$NON-NLS-1$
- case DIVIDE :
+ case DIVIDE:
return "/="; //$NON-NLS-1$
- case AND :
+ case AND:
return "&="; //$NON-NLS-1$
- case OR :
+ case OR:
return "|="; //$NON-NLS-1$
- case XOR :
+ case XOR:
return "^="; //$NON-NLS-1$
- case REMAINDER :
+ case REMAINDER:
return "%="; //$NON-NLS-1$
- case LEFT_SHIFT :
+ case LEFT_SHIFT:
return "<<="; //$NON-NLS-1$
- case RIGHT_SHIFT :
+ case RIGHT_SHIFT:
return ">>="; //$NON-NLS-1$
- case UNSIGNED_RIGHT_SHIFT :
+ case UNSIGNED_RIGHT_SHIFT:
return ">>>="; //$NON-NLS-1$
- };
- return "unknown operator"; //$NON-NLS-1$
-}
-public TypeBinding resolveType(BlockScope scope) {
- constant = NotAConstant;
- if (!(this.lhs instanceof Reference)) {
- scope.problemReporter().expressionShouldBeAVariable(this.lhs);
- }
- TypeBinding lhsType = lhs.resolveType(scope);
- TypeBinding expressionType = expression.resolveType(scope);
- if (lhsType == null || expressionType == null)
- return null;
-
- int lhsId = lhsType.id;
- int expressionId = expressionType.id;
- if (restrainUsageToNumericTypes() && !lhsType.isNumericType()) {
- scope.problemReporter().operatorOnlyValidOnNumericType(this, lhsType, expressionType);
- return null;
- }
- if (lhsId > 15 || expressionId > 15) {
- if (lhsId != T_String) { // String += Object is valid wheraas Object -= String is not
- scope.problemReporter().invalidOperator(this, lhsType, expressionType);
- return null;
}
- expressionId = T_Object; // use the Object has tag table
+ ;
+ return "unknown operator"; //$NON-NLS-1$
}
- // the code is an int
- // (cast) left Op (cast) rigth --> result
- // 0000 0000 0000 0000 0000
- // <<16 <<12 <<8 <<4 <<0
+ public TypeBinding resolveType(BlockScope scope) {
+ constant = NotAConstant;
+ if (!(this.lhs instanceof Reference)) {
+ scope.problemReporter().expressionShouldBeAVariable(this.lhs);
+ }
+ TypeBinding lhsType = lhs.resolveType(scope);
+ TypeBinding expressionType = expression.resolveType(scope);
+ if (lhsType == null || expressionType == null)
+ return null;
- // the conversion is stored INTO the reference (info needed for the code gen)
- int result = OperatorExpression.ResolveTypeTables[operator][ (lhsId << 4) + expressionId];
- if (result == T_undefined) {
- scope.problemReporter().invalidOperator(this, lhsType, expressionType);
- return null;
- }
- if (operator == PLUS){
- if(scope.isJavaLangObject(lhsType)) {
- //