+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry exported="true" kind="src" path="/net.sourceforge.phpeclipse"/>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
- <classpathentry kind="lib"
- path="C:/eclipse/plugins/org.eclipse.debug.core_2.0.0/dtcore.jar"
- rootpath="" sourcepath="C:/eclipse/plugins/org.eclipse.platform.source_2.0.0/src/org.eclipse.debug.core_2.0.0/dtcoresrc.zip"/>
- <classpathentry kind="lib" path="C:/eclipse/plugins/org.junit_3.7.0/junit.jar"/>
- <classpathentry kind="lib" path="C:/eclipse/plugins/org.apache.xerces_4.0.3/xmlParserAPIs.jar"/>
- <classpathentry kind="lib" path="C:/eclipse/plugins/org.apache.xerces_4.0.3/xercesImpl.jar"/>
- <classpathentry kind="lib" path="C:/eclipse/plugins/org.eclipse.core.boot_2.0.0/boot.jar"/>
- <classpathentry kind="lib" path="C:/eclipse/plugins/org.eclipse.core.resources_2.0.0/resources.jar"/>
- <classpathentry kind="lib" path="C:/eclipse/plugins/org.eclipse.core.runtime_2.0.0/runtime.jar"/>
- <classpathentry kind="lib"
- path="C:/eclipse/plugins/org.eclipse.ui_2.0.0/workbench.jar" sourcepath="C:/eclipse/plugins/org.eclipse.platform.source_2.0.0/src/org.eclipse.ui_2.0.0/workbenchsrc.zip"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>net.sourceforge.phpeclipse.launching</name>
- <comment></comment>
- <projects>
- <project>net.sourceforge.phpeclipse</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<form>
- <p/><p><b>Tips on working with this plug-in project</b></p><li>For the view of the new plug-in at a glance, go to the <img href="pageImage"/><a href="OverviewPage">Overview</a>.</li><li>You can test the contributions of this plug-in by launching another instance of the workbench. On the <b>Run</b> menu, click <b>Run As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.run">Run-time Workbench</a> from the available choices.</li><li>You can add more functionality to this plug-in by adding extensions using the <a href="action.newExtension">New Extension Wizard</a>.</li><li>The plug-in project contains Java code that you can debug. Place breakpoints in Java classes. On the <b>Run</b> menu, select <b>Debug As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.debug">Run-time Workbench</a> from the available choices.</li>
-</form>
+++ /dev/null
-
-Plugin.name=PHPEclipse Launching Support
-LaunchConfigurationTypePHPApplication.name=PHP Application
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="net.sourceforge.phpeclipse.launching"
- name="%Plugin.name"
- version="1.0.3"
- provider-name="eclipseproject.de"
- class="net.sourceforge.phpdt.internal.launching.PHPLaunchingPlugin">
-
- <runtime>
- <library name="phpdtlaunching.jar">
- <export name="*"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.debug.core"/>
- <import plugin="org.junit"/>
- <import plugin="org.apache.xerces"/>
- <import plugin="net.sourceforge.phpeclipse"/>
- </requires>
-
-
- <extension
- point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- name="%LaunchConfigurationTypePHPApplication.name"
- delegate="net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationDelegate"
- modes="run"
- id="net.sourceforge.phpdt.launching.LaunchConfigurationTypePHPApplication">
- <fileExtension
- default="true"
- extension="php">
- </fileExtension>
- <fileExtension
- default="true"
- extension="php3">
- </fileExtension>
- <fileExtension
- default="true"
- extension="php4">
- </fileExtension>
- </launchConfigurationType>
- </extension>
-
-</plugin>
\ No newline at end of file
+++ /dev/null
-package net.sourceforge.phpdt.internal.launching;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-
-import net.sourceforge.phpeclipse.resourcesview.PHPProject;
-import org.eclipse.core.boot.BootLoader;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IProcess;
-
-public class InterpreterRunner {
-
- public InterpreterRunner() {
- }
-
- public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) {
- String commandLine = renderCommandLine(configuration);
- File workingDirectory = configuration.getAbsoluteWorkingDirectory();
-
- Process nativePHPProcess = null;
- try {
- nativePHPProcess = configuration.getInterpreter().exec(commandLine, workingDirectory);
- } catch (IOException e) {
- throw new RuntimeException("Unable to execute interpreter: " + commandLine + workingDirectory);
- }
-
- IProcess process = DebugPlugin.getDefault().newProcess(launch, nativePHPProcess, renderLabel(configuration));
- process.setAttribute(PHPLaunchingPlugin.PLUGIN_ID + ".launcher.cmdline", commandLine);
- return process ;
- }
-
- protected String renderLabel(InterpreterRunnerConfiguration configuration) {
- StringBuffer buffer = new StringBuffer();
-
- PHPInterpreter interpreter = configuration.getInterpreter();
- buffer.append("PHP ");
- buffer.append(interpreter.getCommand());
- buffer.append(" : ");
- buffer.append(configuration.getFileName());
-
- return buffer.toString();
- }
-
- protected String renderCommandLine(InterpreterRunnerConfiguration configuration) {
- PHPInterpreter interpreter = configuration.getInterpreter();
-
- StringBuffer buffer = new StringBuffer();
- buffer.append(this.getDebugCommandLineArgument());
- // buffer.append(renderLoadPath(configuration));
- buffer.append(" " + configuration.getInterpreterArguments());
- // buffer.append(interpreter.endOfOptionsDelimeter);
- buffer.append(" " + osDependentPath(configuration.getAbsoluteFileName()));
- buffer.append(" " + configuration.getProgramArguments());
-
- return buffer.toString();
- }
-
-// protected String renderLoadPath(InterpreterRunnerConfiguration configuration) {
-// StringBuffer loadPath = new StringBuffer();
-//
-// PHPProject project = configuration.getProject();
-// addToLoadPath(loadPath, project.getProject());
-//
-// Iterator referencedProjects = project.getReferencedProjects().iterator();
-// while (referencedProjects.hasNext())
-// addToLoadPath(loadPath, (IProject) referencedProjects.next());
-//
-// return loadPath.toString();
-// }
-
-// protected void addToLoadPath(StringBuffer loadPath, IProject project) {
-//
-// loadPath.append(" -I " + osDependentPath(project.getLocation().toOSString()));
-// }
-
- protected String osDependentPath(String aPath) {
- if (BootLoader.getOS().equals(BootLoader.OS_WIN32))
- aPath = "\"" + aPath + "\"";
-
- return aPath;
- }
-
- protected String getDebugCommandLineArgument() {
- return "" ;
- }
-
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.launching;
-
-import java.io.File;
-
-import net.sourceforge.phpeclipse.resourcesview.PHPProject;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunchConfiguration;
-
-public class InterpreterRunnerConfiguration {
- protected ILaunchConfiguration configuration;
-
- public InterpreterRunnerConfiguration(ILaunchConfiguration aConfiguration) {
- configuration = aConfiguration;
- }
-
- 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) {}
-
- return fileName.replace('\\', '/');
- }
-
- public PHPProject getProject() {
- String projectName = "";
-
- try {
- projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, "");
- } catch(CoreException e) {
- PHPLaunchingPlugin.getDefault().log(e);
- }
-
- IProject project = PHPLaunchingPlugin.getWorkspace().getRoot().getProject(projectName);
-
- PHPProject phpProject = new PHPProject();
- phpProject.setProject(project);
- return phpProject;
- }
-
- public File getAbsoluteWorkingDirectory() {
- String file = null;
- try {
- 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 "";
- }
-
- public String getProgramArguments() {
- try {
- 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) {}
-
- return PHPRuntime.getDefault().getInterpreter(selectedInterpreter);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.launching;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.eclipse.core.internal.resources.OS;
-import org.eclipse.core.runtime.IPath;
-
-public class PHPInterpreter {
- //public final String endOfOptionsDelimeter = " -- ";
-
- protected IPath installLocation;
- protected String name;
-
- public PHPInterpreter(String aName, IPath validInstallLocation) {
- name = aName;
- installLocation = validInstallLocation;
- }
-
- public IPath getInstallLocation() {
- return installLocation;
- }
-
- public void setInstallLocation(IPath validInstallLocation) {
- installLocation = validInstallLocation;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String newName) {
- name = newName;
- }
-
- public String getCommand() {
- String directory = installLocation.toOSString() + File.separator;
- if (new File(directory + "php.exe").isFile())
- return directory + "php.exe";
-
- if (new File(directory, "php").isFile())
- return directory + "php";
-
- return null;
- }
-
- public Process exec(String arguments, File workingDirectory) throws IOException {
- return Runtime.getRuntime().exec(this.getCommand() + " " + arguments, null, workingDirectory);
- }
-
- public boolean equals(Object other) {
- if (other instanceof PHPInterpreter) {
- PHPInterpreter otherInterpreter = (PHPInterpreter) other;
- if (name.equals(otherInterpreter.getName()))
- return installLocation.equals(otherInterpreter.getInstallLocation());
- }
-
- return false;
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.launching;
-
-
-
-public interface PHPLaunchConfigurationAttribute {
- static final String PHP_LAUNCH_CONFIGURATION_TYPE = "net.sourceforge.phpdt.launching.LaunchConfigurationTypePHPApplication";
-
- static final String CUSTOM_LOAD_PATH = PHPLaunchingPlugin.PLUGIN_ID + ".CUSTOM_LOAD_PATH";
- static final String FILE_NAME = PHPLaunchingPlugin.PLUGIN_ID + ".FILE_NAME";
- static final String INTERPRETER_ARGUMENTS = PHPLaunchingPlugin.PLUGIN_ID + ".INTERPRETER_ARGUMENTS";
- static final String MODULE_NAME = PHPLaunchingPlugin.PLUGIN_ID + ".MODULE_NAME";
- static final String PROGRAM_ARGUMENTS = PHPLaunchingPlugin.PLUGIN_ID + ".PROGRAM_ARGUMENTS";
- static final String PROJECT_NAME = PHPLaunchingPlugin.PLUGIN_ID + ".PROJECT_NAME";
- static final String SELECTED_INTERPRETER = PHPLaunchingPlugin.PLUGIN_ID + ".SELECTED_INTERPRETER";
- static final String WORKING_DIRECTORY = PHPLaunchingPlugin.PLUGIN_ID + ".WORKING_DIRECTORY";
- static final String USE_DEFAULT_LOAD_PATH = PHPLaunchingPlugin.PLUGIN_ID + ".USE_DEFAULT_LOAD_PATH";
- static final String USE_DEFAULT_WORKING_DIRECTORY = PHPLaunchingPlugin.PLUGIN_ID + ".USE_DEFAULT_WORKING_DIRECTORY";
-}
\ No newline at end of file
+++ /dev/null
-package net.sourceforge.phpdt.internal.launching;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-
-
-public class PHPLaunchConfigurationDelegate implements ILaunchConfigurationDelegate {
- protected static final InterpreterRunner interpreterRunner = new InterpreterRunner();
-// protected static final DebuggerRunner debuggerRunner = new DebuggerRunner();
-
- public PHPLaunchConfigurationDelegate() {
- super();
- }
-
- /**
- * @see ILaunchConfigurationDelegate#launch(ILaunchConfiguration, String, ILaunch, IProgressMonitor)
- */
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
- if (PHPRuntime.getDefault().getSelectedInterpreter() == null)
- throw new CoreException(new Status(IStatus.ERROR, PHPLaunchingPlugin.PLUGIN_ID, IStatus.OK, "You must define an interpreter before running PHP.", null));
-// if (mode.equals("debug")) {
-// debuggerRunner.run(new InterpreterRunnerConfiguration(configuration), launch);
-// } else {
- interpreterRunner.run(new InterpreterRunnerConfiguration(configuration), launch);
-// }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.launching;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class PHPLaunchingMessages {
-
- private static final String BUNDLE_NAME = PHPLaunchingMessages.class.getName();
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private PHPLaunchingMessages() {}
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
+++ /dev/null
-
-#########################################
-# PHPLaunchingPlugin
-#########################################
-
-PHPLaunchingPlugin.internalErrorOccurred=Internal error occurred
\ No newline at end of file
+++ /dev/null
-package net.sourceforge.phpdt.internal.launching;
-
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-
-public class PHPLaunchingPlugin extends Plugin {
- public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.launching"; //$NON-NLS-1$
-
- protected static PHPLaunchingPlugin plugin;
-
- public PHPLaunchingPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- }
-
- public static PHPLaunchingPlugin getDefault() {
- return plugin;
- }
-
- public static IWorkspace getWorkspace() {
- return PHPeclipsePlugin.getWorkspace();
- }
-
- 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, PHPLaunchingMessages.getString("PHPLaunchingPlugin.internalErrorOccurred"), e)); //$NON-NLS-1$
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.launching;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.parsers.SAXParserFactory;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-
-public class PHPRuntime {
- protected static PHPRuntime runtime;
-
- protected List installedInterpreters;
- protected PHPInterpreter selectedInterpreter;
- protected PHPRuntime() {
- super();
- }
-
- public static PHPRuntime getDefault() {
- if (runtime == null) {
- runtime = new PHPRuntime();
- }
- return runtime;
- }
-
- public PHPInterpreter getSelectedInterpreter() {
- if (selectedInterpreter == null) {
- loadRuntimeConfiguration();
- }
- return selectedInterpreter;
- }
-
- public PHPInterpreter getInterpreter(String name) {
- Iterator interpreters = getInstalledInterpreters().iterator();
- while(interpreters.hasNext()) {
- PHPInterpreter each = (PHPInterpreter) interpreters.next();
- if (each.getName().equals(name))
- return each;
- }
-
- return getSelectedInterpreter();
- }
-
- public void setSelectedInterpreter(PHPInterpreter anInterpreter) {
- selectedInterpreter = anInterpreter;
- saveRuntimeConfiguration();
- }
-
- public void addInstalledInterpreter(PHPInterpreter anInterpreter) {
- getInstalledInterpreters().add(anInterpreter);
- if (getInstalledInterpreters().size() == 1)
- setSelectedInterpreter((PHPInterpreter) getInstalledInterpreters().get(0));
-
- saveRuntimeConfiguration();
- }
-
- public List getInstalledInterpreters() {
- if (installedInterpreters == null)
- loadRuntimeConfiguration();
- return installedInterpreters;
- }
-
- public void setInstalledInterpreters(List newInstalledInterpreters) {
- installedInterpreters = newInstalledInterpreters;
- if (installedInterpreters.size() > 0)
- setSelectedInterpreter((PHPInterpreter)installedInterpreters.get(0));
- else
- setSelectedInterpreter(null);
- }
-
- protected void saveRuntimeConfiguration() {
- writeXML(getRuntimeConfigurationWriter());
- }
-
- protected Writer getRuntimeConfigurationWriter() {
- try {
- OutputStream stream = new BufferedOutputStream(new FileOutputStream(getRuntimeConfigurationFile()));
- return new OutputStreamWriter(stream);
- } catch (FileNotFoundException e) {}
-
- return null;
- }
-
- protected void loadRuntimeConfiguration() {
- installedInterpreters = new ArrayList();
- try {
- XMLReader reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
- reader.setContentHandler(getRuntimeConfigurationContentHandler());
- reader.parse(new InputSource(getRuntimeConfigurationReader()));
- } catch(Exception e) {
- PHPLaunchingPlugin.getDefault().log(e);
- }
- }
-
- protected Reader getRuntimeConfigurationReader() {
- try {
- return new FileReader(getRuntimeConfigurationFile());
- } catch(FileNotFoundException e) {}
- return new StringReader("");
- }
-
- protected void writeXML(Writer writer) {
- try {
- writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?><runtimeconfig>");
- Iterator interpretersIterator = installedInterpreters.iterator();
- while (interpretersIterator.hasNext()) {
- writer.write("<interpreter name=\"");
-
- PHPInterpreter entry = (PHPInterpreter) interpretersIterator.next();
- writer.write(entry.getName());
- writer.write("\" path=\"");
- writer.write(entry.getInstallLocation().toString());
- writer.write("\"");
- if (entry.equals(selectedInterpreter))
- writer.write(" selected=\"true\"");
-
- writer.write("/>");
- }
- writer.write("</runtimeconfig>");
- writer.flush();
- } 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 {
- if ("interpreter".equals(qName)) {
- String interpreterName = atts.getValue("name");
- IPath installLocation = new Path(atts.getValue("path"));
- PHPInterpreter interpreter = new PHPInterpreter(interpreterName, 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 {}
- };
- }
-
- protected File getRuntimeConfigurationFile() {
- IPath stateLocation = PHPLaunchingPlugin.getDefault().getStateLocation();
- IPath fileLocation = stateLocation.append("runtimeConfiguration.xml");
- return new File(fileLocation.toOSString());
- }
-}