<import plugin="org.eclipse.search"/>
<import plugin="org.eclipse.update.ui"/>
<!-- <import plugin="net.sourceforge.phpeclipse.quantum.sql"/> -->
- <import plugin="com.quantum.Quantum"/>
+ <!-- <import plugin="com.quantum.Quantum"/> -->
<import plugin="net.sourceforge.phpeclipse.webbrowser"/>
+ <import plugin="net.sourceforge.phpeclipse.externaltools"/>
<import plugin="net.sourceforge.phpeclipse.core"/>
<import plugin="net.sourceforge.phpeclipse.ui"/>
<import plugin="net.sourceforge.phpeclipse.xml.core"/>
id="net.sourceforge.phpeclipse.PHPPerspective">
</perspective>
</extension>
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="net.sourceforge.phpeclipse.PHPPerspective">
- <actionSet id="net.sourceforge.phpeclipse.PHPActionSet"/>
- </perspectiveExtension>
- <perspectiveExtension
- targetID="net.sourceforge.phpeclipse.PHPPerspective">
- <actionSet id="net.sf.eclipsetidy.ActionSet"/>
- </perspectiveExtension>
- </extension>
+
<extension
point="org.eclipse.ui.newWizards">
<category
<extension
point="org.eclipse.ui.actionSets">
<actionSet
- label="PHP/Apache"
- visible="false"
- id="net.sourceforge.phpeclipse.PHPActionSet">
- <menu
- label="PHP/Apache"
- id="net.sourceforge.phpeclipse.PHPMenu">
- <separator
- name="phpeclipse">
- </separator>
- </menu>
- <action
- label="Restart Apache"
- icon="icons/obj16/apache_restart.gif"
- tooltip="Restart Apache"
- class="net.sourceforge.phpeclipse.actions.PHPRestartApacheAction"
- menubarPath="net.sourceforge.phpeclipse.PHPMenu/phpeclipse"
- toolbarPath="Normal"
- id="net.sourceforge.phpeclipse.actions.PHPRestartApacheAction">
- </action>
- <action
- label="Stop Apache"
- icon="icons/obj16/apache_stop.gif"
- tooltip="Stop Apache"
- class="net.sourceforge.phpeclipse.actions.PHPStopApacheAction"
- menubarPath="net.sourceforge.phpeclipse.PHPMenu/phpeclipse"
- toolbarPath="Normal"
- id="net.sourceforge.phpeclipse.actions.PHPStopApacheAction">
- </action>
- <action
- label="Start Apache"
- icon="icons/obj16/apache.gif"
- tooltip="Start Apache"
- class="net.sourceforge.phpeclipse.actions.PHPStartApacheAction"
- menubarPath="net.sourceforge.phpeclipse.PHPMenu/phpeclipse"
- toolbarPath="Normal"
- id="net.sourceforge.phpeclipse.actions.PHPStartApacheAction">
- </action>
- <action
- label="Start MySQL"
- icon="icons/obj16/sql.gif"
- tooltip="Start MySQL"
- class="net.sourceforge.phpeclipse.actions.PHPStartMySQLAction"
- menubarPath="net.sourceforge.phpeclipse.PHPMenu/phpeclipse"
- toolbarPath="Normal"
- id="net.sourceforge.phpeclipse.actions.PHPStartMySQLAction">
- </action>
- <action
- label="Stop XAMPP"
- icon="icons/obj16/xampp_stop.gif"
- tooltip="Stop XAMPP"
- class="net.sourceforge.phpeclipse.actions.PHPStopXAMPPAction"
- menubarPath="net.sourceforge.phpeclipse.PHPMenu/phpeclipse"
- toolbarPath="Normal"
- id="net.sourceforge.phpeclipse.actions.PHPStopXAMPPAction">
- </action>
- <action
- label="Start XAMPP"
- icon="icons/obj16/xampp_start.gif"
- tooltip="Start XAMPP"
- class="net.sourceforge.phpeclipse.actions.PHPStartXAMPPAction"
- menubarPath="net.sourceforge.phpeclipse.PHPMenu/phpeclipse"
- toolbarPath="Normal"
- id="net.sourceforge.phpeclipse.actions.PHPStartXAMPPAction">
- </action>
- </actionSet>
-
- <actionSet
label="%CodingActionSet.label"
description="%CodingActionSet.description"
visible="false"
<extension
point="org.eclipse.ui.popupMenus">
- <!-- <objectContribution
- objectClass="org.eclipse.core.resources.IProject"
- id="net.sourceforge.phpeclipse.actions.PHPDocumentorAction">
- <action
- label="Run PHPDocumentor"
- class="net.sourceforge.phpeclipse.actions.PHPDocumentorAction"
- menubarPath="additions"
- id="net.sourceforge.phpeclipse.actions.PHPDocumentorAction">
- </action>
- </objectContribution> -->
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.php"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- <action
- label="Run External PHP Parser"
- class="net.sourceforge.phpeclipse.actions.PHPExternalParserAction"
- menubarPath="additions"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.php3"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- <action
- label="Run External PHP Parser"
- class="net.sourceforge.phpeclipse.actions.PHPExternalParserAction"
- menubarPath="additions"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.php4"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- <action
- label="Run External PHP Parser"
- class="net.sourceforge.phpeclipse.actions.PHPExternalParserAction"
- menubarPath="additions"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.php5"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- <action
- label="Run External PHP Parser"
- class="net.sourceforge.phpeclipse.actions.PHPExternalParserAction"
- menubarPath="additions"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.module"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- <action
- label="Run External PHP Parser"
- class="net.sourceforge.phpeclipse.actions.PHPExternalParserAction"
- menubarPath="additions"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.inc"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- <action
- label="Run External PHP Parser"
- class="net.sourceforge.phpeclipse.actions.PHPExternalParserAction"
- menubarPath="additions"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.phtml"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- <action
- label="Run External PHP Parser"
- class="net.sourceforge.phpeclipse.actions.PHPExternalParserAction"
- menubarPath="additions"
- id="net.sourceforge.phpeclipse.actions.externalParserAction">
- </action>
- </objectContribution>
<objectContribution
objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.php"
</action>
</objectContribution>
- <viewerContribution
+ <!-- <viewerContribution
targetID="#PHPEditorContext"
id="net.sourceforge.phpeclipse.actions.popupOpenSQLTable">
<action
menubarPath="additions"
id="net.sourceforge.phpeclipse.actions.opensqltable">
</action>
- </viewerContribution>
+ </viewerContribution> -->
<viewerContribution
targetID="#PHPEditorContext"
id="net.sourceforge.phpeclipse.actions.popupHTMLWizard">
<extension
point="org.eclipse.ui.preferencePages">
- <page
+ <!-- <page
name="PHP"
category="net.sourceforge.phpeclipse.ui.preferencePage"
class="net.sourceforge.phpeclipse.PHPEclipseBasePreferencePage"
id="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage">
+ </page> -->
+ <page name="PHP"
+ category="net.sourceforge.phpeclipse.ui.preferencePage"
+ class="net.sourceforge.phpdt.internal.ui.preferences.JavaEditorPreferencePage"
+ id="net.sourceforge.phpeclipse.preferences.PHPPreferencePage">
</page>
<page
name="Code Templates"
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.CodeTemplatePreferencePage"
id="net.sourceforge.phpeclipse.preference.CodeTemplatePreferencePage">
</page>
<!-- <page
name="Members Sort Order"
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.MembersOrderPreferencePage"
id="net.sourceforge.phpeclipse.preference.MembersOrderPreferencePage">
- </page> -->
+ </page>
<page
name="PHP External Parser Command"
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpeclipse.preferences.PHPEclipseParserPreferencePage"
id="net.sourceforge.phpeclipse.preferences.PHPEclipseParserPreferencePage">
</page>
-<!-- <page
+ <page
name="Editor2"
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpeclipse.PHPSyntaxEditorPreferencePage"
id="net.sourceforge.phpeclipse.preference.PHPSyntaxEditorPreferencePage">
</page>
<page
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
name="PHP Project Defaults"
class="net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences"
id="net.sourceforge.phpeclipse.preferences.PHPMiscProjectPreferences">
</page>
<page
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
name="PHP Browser Preview"
class="net.sourceforge.phpeclipse.preferences.PHPPreviewProjectPreferences"
id="net.sourceforge.phpeclipse.preferences.PHPPreviewProjectPreferences">
</page> -->
<page
name="%compilerOptionsPrefName"
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.CompilerPreferencePage"
id="net.sourceforge.phpeclipse.preference.CompilerPreferencePage">
</page>
<page
name="%todoTaskPrefName"
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.TodoTaskPreferencePage"
id="net.sourceforge.phpeclipse.preference.TodoTaskPreferencePage">
</page>
<page
name="Formatter"
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.CodeFormatterPreferencePage"
id="net.sourceforge.phpeclipse.preference.CodeFormatterPreferencePage">
</page>
- <page name="Editor"
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
- class="net.sourceforge.phpdt.internal.ui.preferences.JavaEditorPreferencePage"
- id="net.sourceforge.phpdt.internal.ui.preferences.JavaEditorPreferencePage">
- </page>
<page name="%codeAssistPageName"
- category="net.sourceforge.phpdt.internal.ui.preferences.JavaEditorPreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.CodeAssistPreferencePage"
id="net.sourceforge.phpdt.internal.ui.preferences.CodeAssistPreferencePage">
</page>
<page
name="%templatePageName"
- category="net.sourceforge.phpdt.internal.ui.preferences.JavaEditorPreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.JavaTemplatePreferencePage"
id="net.sourceforge.phpeclipse.preference.TemplatePreferencePage">
</page>
<!-- <page
name="%templatePageName"
- category="net.sourceforge.phpdt.internal.ui.preferences.JavaEditorPreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.TemplatePreferencePage"
id="net.sourceforge.phpeclipse.preference.TemplatePreferencePage">
</page>
<page
name="Language Settings"
- category="net.sourceforge.phpeclipse.preference.PHPEclipsePreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpeclipse.PHPLanguagePreferencePage"
id="net.sourceforge.phpeclipse.preference.PHPLanguagePreferencePage">
</page> -->
<page
name="%spellingPrefName"
- category="net.sourceforge.phpdt.internal.ui.preferences.JavaEditorPreferencePage"
+ category="net.sourceforge.phpeclipse.preferences.PHPPreferencePage"
class="net.sourceforge.phpdt.internal.ui.preferences.SpellingPreferencePage"
id = "net.sourceforge.phpdt.internal.ui.preferences.SpellingPreferencePage">
</page>
expanderClass="net.sourceforge.phpdt.externaltools.variable.WorkingSetExpander">
</variable>
</extension>
+
<extension
point= "net.sourceforge.phpeclipse.foldingStructureProviders">
<provider
}
}
- // int index = includeNameString.indexOf('/');
- // if (index < 0) {
// includeNameString contains no path separator
path = project.getLocation().append(resourcePath.removeLastSegments(1));
path = path.append(includeNameString);
+++ /dev/null
-/*
- * Created on 28.06.2003
- *
- */
-package net.sourceforge.phpdt.internal.ui.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();
-
- 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();
- }
-
-}
+++ /dev/null
-package net.sourceforge.phpeclipse.actions;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.MessageFormat;
-import java.util.Hashtable;
-
-import net.sourceforge.phpdt.internal.ui.util.StringUtil;
-import net.sourceforge.phpeclipse.PHPConsole;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-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 = PHPeclipsePlugin.getDefault().getPreferenceStore();
- final String filename = fFileToParse.getLocation().toString();
-
- final String[] arguments = { filename };
- final MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.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("<br />", 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("<br>", 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 <b>");
- 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, "<b>", "");
- current = StringUtil.replaceAll(current, "</b>", "");
- 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
+++ /dev/null
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
-package net.sourceforge.phpeclipse.actions;
-
-import java.util.Iterator;
-
-import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class PHPDocumentorAction implements IObjectActionDelegate {
-
- private IWorkbenchPart workbenchPart;
- /**
- * Constructor for Action1.
- */
- public PHPDocumentorAction() {
- 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();
-
- final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- final String phpExecutable = store.getString(PHPeclipsePlugin.PHP_RUN_PREF);
-
- //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 the resource
- switch (resource.getType()) {
- case IResource.PROJECT :
- IProject project = (IProject) resource;
- String projectName = project.getLocation().toString();
- String targetDirectory = projectName + "/phpdoc";
- // example:
- // C:\>php.exe "C:\Path\To\phpdoc" -t targetdir -o HTML:default:default -d parsedir
- String argument =
- "\"C:\\php\\phpDocumentor\\phpdoc\" -t " + targetDirectory + " -o HTML:default:default -d " + projectName;
- ExternalToolsUtil.execute("phpdocumentor", phpExecutable, argument, true);
- break;
- // case IResource.FILE :
- // // single file:
- // IFile file = (IFile) resource;
- // PHPParserSuperclass.phpExternalParse(file);
- }
- }
- }
- }
-
- /**
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
-}
+++ /dev/null
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
-package net.sourceforge.phpeclipse.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-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) {
- }
-
-}
+++ /dev/null
-/***********************************************************************************************************************************
- * Copyright (c) 2000, 2002 IBM Corp. and others. All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors: www.phpeclipse.de
- **********************************************************************************************************************************/
-package net.sourceforge.phpeclipse.actions;
-
-import java.sql.SQLException;
-
-import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
-import net.sourceforge.phpeclipse.ui.WebUI;
-import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.ActionDelegate;
-
-import com.quantum.ExternalInterface;
-import com.quantum.QuantumPlugin;
-// import com.quantum.util.connection.NotConnectedException;
-
-public class PHPOpenSQLTableEditorAction extends ActionDelegate implements IEditorActionDelegate {
-
- private IWorkbenchWindow fWindow;
-
- private PHPEditor fEditor;
-
- private IProject fProject;
-
- public void dispose() {
- }
-
- public void init(IWorkbenchWindow window) {
- this.fWindow = window;
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- if (!selection.isEmpty()) {
- if (selection instanceof TextSelection) {
- action.setEnabled(true);
- } else if (fWindow.getActivePage() != null && fWindow.getActivePage().getActivePart() != null) {
- //
- }
- }
- }
-
- private IWorkbenchPage getActivePage() {
- fWindow = fEditor.getEditorSite().getWorkbenchWindow();
- IWorkbenchPage page = fWindow.getActivePage();
- return page;
- }
-
- public IContainer getWorkingLocation(IFileEditorInput editorInput) {
- if (editorInput == null || editorInput.getFile() == null) {
- return null;
- }
- return editorInput.getFile().getParent();
- }
-
- private IFile getIncludeFile(IProject project, IFileEditorInput editorInput, String relativeFilename) {
- // IContainer container = getWorkingLocation(editorInput);
- // String fullPath = project.getLocation().toString();
- Path path = new Path(relativeFilename);
- IFile file = project.getFile(path);
- return file;
- }
-
- public void run(IAction action) {
- if (fEditor == null) {
- IEditorPart targetEditor = fWindow.getActivePage().getActiveEditor();
- if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
- fEditor = (PHPEditor) targetEditor;
- }
- }
- if (fEditor != null) {
- fWindow = fEditor.getEditorSite().getWorkbenchWindow();
- IFile f = ((IFileEditorInput) fEditor.getEditorInput()).getFile();
- fProject = f.getProject();
- String bookmarkString = ProjectPrefUtil.getMiscProjectsPreferenceValue(fProject, WebUI.PHP_BOOKMARK_DEFAULT);
- if (bookmarkString != null && !bookmarkString.equals("")) {
- ITextSelection selection = (ITextSelection) fEditor.getSelectionProvider().getSelection();
- IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
- int pos = selection.getOffset();
- // System.out.println(selection.getText());
- String tableName = getSQLTableName(doc, pos);
- if (tableName != null && tableName.length() > 0)
- try {
- ExternalInterface.displayTable(bookmarkString, tableName);
-
- IViewPart viewPart = null;
- String view = "com.quantum.view.tableview.TableView";
- try {
- IWorkbenchPage page = QuantumPlugin.getDefault().getActivePage();
- viewPart = page.findView(view);
- if (viewPart == null) {
- viewPart = page.showView(view);
- }
- page.bringToTop(viewPart);
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (Exception /* NotConnectedException */ e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- //
- // IViewPart viewPart = null;
- // String view = "com.quantum.view.tableview.TableView";
- // try {
- // IWorkbenchPage page = QuantumPlugin.getDefault().getActivePage();
- // viewPart = page.findView(view);
- // if (viewPart == null) {
- // viewPart = page.showView(view);
- // }
- // page.bringToTop(viewPart);
- // getTables((TableView) viewPart, fProject, tableName);
- // } catch (PartInitException e) {
- // e.printStackTrace();
- // }
-
- }
- }
-
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
- fEditor = (PHPEditor) targetEditor;
- }
- }
-
- private String getSQLTableName(IDocument doc, int pos) {
- Point word = null;
- int start = -1;
- int end = -1;
-
- try {
-
- int position = pos;
- char character;
-
- while (position >= 0) {
- character = doc.getChar(position);
- if (Character.isWhitespace(character) || (character == '\"') || (character == '\'') || (character == '\r')
- || (character == '\n'))
- break;
- --position;
- }
-
- start = position;
-
- position = pos;
- int length = doc.getLength();
-
- while (position < length) {
- character = doc.getChar(position);
- if (Character.isWhitespace(character) || (character == '\"') || (character == '\'') || (character == '\r')
- || (character == '\n'))
- break;
- ++position;
- }
-
- start++;
- end = position;
-
- if (end > start)
- word = new Point(start, end - start);
-
- } catch (BadLocationException x) {
- }
-
- if (word != null) {
- try {
- return doc.get(word.x, word.y);
- } catch (BadLocationException e) {
- }
- }
- return "";
- }
-
- // public void getTables(TableView tableView, IProject project, String tableName) {
- // // Get The Database bookmark from the Quantum SQL plugin:
- // BookmarkCollection sqlBookMarks = BookmarkCollection.getInstance();
- // if (sqlBookMarks != null) {
- // String bookmarkString = ProjectPrefUtil.getMiscProjectsPreferenceValue(project,
- // WebUI.PHP_BOOKMARK_DEFAULT);
- // if (bookmarkString != null && !bookmarkString.equals("")) {
- // Bookmark bookmark = sqlBookMarks.find(bookmarkString);
- // ArrayList sqlList = new ArrayList();
- // if (bookmark != null && !bookmark.isConnected()) {
- // new ConnectionUtil().connect(bookmark, null);
- // }
- // if (bookmark != null && bookmark.isConnected()) {
- // try {
- // Connection connection = bookmark.getConnection();
- // DatabaseMetaData metaData = connection.getMetaData();
- // ConnectionUtil connectionUtil = new ConnectionUtil();
- // Entity entity;
- // DatabaseAdapter adapter;
- //
- // if (metaData != null) {
- // String columnName;
- // String prefixWithoutDollar = tableName;
- // if (prefixWithoutDollar.charAt(0) == '$') {
- // prefixWithoutDollar = prefixWithoutDollar.substring(1);
- // }
- // ResultSet set;
- // set = metaData.getTables(null, null, "%" + prefixWithoutDollar
- // + "%", null);
- // while (set.next()) {
- // tableName = set.getString("TABLE_NAME");
- // tableName = (tableName == null) ? "" : tableName.trim();
- // if (tableName != null && tableName.length() > 0) {
- // sqlList.add(tableName);
- // }
- // }
- // set.close();
- // EntityFactory entityFactory = EntityFactory.getInstance();
- // if (sqlList.size() == 1) {
- // adapter = bookmark.getAdapter();
- // entity = entityFactory.create(bookmark, null, (String) sqlList
- // .get(0), Entity.TABLE_TYPE, false);
- // String query = adapter.getTableQuery(entity.getQualifiedName());
- //
- // try {
- // SQLResults results = MultiSQLServer.getInstance().execute(
- // bookmark, connectionUtil.connect(bookmark, fWindow.getShell()),
- // entity, query);
- //
- // if (results != null && results.isResultSet()) {
- // SQLResultSetCollection.getInstance().addSQLResultSet(
- // (SQLResultSetResults) results);
- // }
- // } catch (SQLException e) {
- // ExceptionDisplayDialog.openError(fWindow.getShell(), null, null, e);
- // }
- // // tableView.loadTable(entityFactory.create(
- // // bookmark, null,
- // // (String) sqlList.get(0),
- // // Entity.TABLE_TYPE));
- // } else if (sqlList.size() > 1) {
- // ListSelectionDialog listSelectionDialog = new ListSelectionDialog(
- // PHPeclipsePlugin.getDefault().getWorkbench()
- // .getActiveWorkbenchWindow().getShell(), sqlList,
- // new ListContentProvider(), new LabelProvider(),
- // "Select the SQL table to open.");
- // listSelectionDialog.setTitle("Multiple tablenames found");
- // if (listSelectionDialog.open() == Window.OK) {
- // Object[] locations = listSelectionDialog.getResult();
- // if (locations != null) {
- // for (int i = 0; i < locations.length; i++) {
- // adapter = bookmark.getAdapter();
- // entity = entityFactory.create(bookmark, null,
- // (String) locations[i], Entity.TABLE_TYPE, false);
- // String query = adapter.getTableQuery(entity
- // .getQualifiedName());
- //
- // try {
- // SQLResults results = MultiSQLServer.getInstance()
- // .execute(bookmark,
- // connectionUtil.connect(bookmark, fWindow.getShell()),
- // entity, query);
- //
- // if (results != null && results.isResultSet()) {
- // SQLResultSetCollection.getInstance().addSQLResultSet(
- // (SQLResultSetResults) results);
- // }
- // } catch (SQLException e) {
- // ExceptionDisplayDialog.openError(fWindow.getShell(), null, null, e);
- // }
- //
- // // tableView
- // // .loadTable(entityFactory
- // // .create(
- // // bookmark,
- // // null,
- // // (String) locations[i],
- // // Entity.TABLE_TYPE));
- // }
- //
- // }
- // }
- // }
- // }
- // } catch (NotConnectedException e) {
- // // ignore this - not mission critical
- // } catch (SQLException e) {
- // e.printStackTrace();
- // }
- // }
- // }
- // }
- // }
-
-}
\ No newline at end of file
+++ /dev/null
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
-package net.sourceforge.phpeclipse.actions;
-
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-public class PHPRestartApacheAction extends PHPStartApacheAction {
- public void run(IAction action) {
- final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- // execute(store.getString(PHPeclipsePlugin.APACHE_RESTART_PREF), "Restart Apache: ");
- execute(
- "apache_restart",
- store.getString(PHPeclipsePlugin.APACHE_RUN_PREF),
- store.getString(PHPeclipsePlugin.APACHE_RESTART_PREF),
- store.getBoolean(PHPeclipsePlugin.APACHE_RESTART_BACKGROUND));
- }
-}
+++ /dev/null
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
-package net.sourceforge.phpeclipse.actions;
-
-import java.text.MessageFormat;
-
-import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil;
-import net.sourceforge.phpeclipse.PHPConsole;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.ui.WebUI;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate {
- protected IWorkbenchWindow activeWindow = null;
-
- public void run(IAction action) {
- final IPreferenceStore store =
- PHPeclipsePlugin.getDefault().getPreferenceStore();
- String documentRoot = store.getString(WebUI.PHP_DOCUMENTROOT_PREF);
- // replace backslash with slash in the DocumentRoot under Windows
- documentRoot = documentRoot.replace('\\', '/');
- String[] arguments = { documentRoot };
- MessageFormat form =
- new MessageFormat(store.getString(PHPeclipsePlugin.APACHE_START_PREF));
- execute(
- "apache_start",
- store.getString(PHPeclipsePlugin.APACHE_RUN_PREF),
- form.format(arguments),
- store.getBoolean(PHPeclipsePlugin.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);
-
- ExternalToolsUtil.execute(command, executable, arguments, background);
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
-
- }
-
- public void init(IWorkbenchWindow window) {
- this.activeWindow = window;
- }
-
- public void dispose() {
-
- }
-
-}
+++ /dev/null
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
-package net.sourceforge.phpeclipse.actions;
-
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-public class PHPStartMySQLAction extends PHPStartApacheAction {
- public void run(IAction action) {
- final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- // execute(store.getString(PHPeclipsePlugin.MYSQL_PREF), "Start MySQL: ");
- execute(
- "mysql_start",
- store.getString(PHPeclipsePlugin.MYSQL_RUN_PREF),
- store.getString(PHPeclipsePlugin.MYSQL_PREF),
- store.getBoolean(PHPeclipsePlugin.MYSQL_START_BACKGROUND));
- }
-}
+++ /dev/null
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
-package net.sourceforge.phpeclipse.actions;
-
-import java.io.File;
-
-import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil;
-import net.sourceforge.phpeclipse.PHPConsole;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-public class PHPStartXAMPPAction implements IWorkbenchWindowActionDelegate {
- protected IWorkbenchWindow activeWindow = null;
-
- public void run(IAction action) {
- final IPreferenceStore store =
- PHPeclipsePlugin.getDefault().getPreferenceStore();
- String executable = store.getString(PHPeclipsePlugin.XAMPP_START_PREF);
- String workingDirectory = null;
- if (executable!=null && executable.length()>0) {
- int index = executable.lastIndexOf(File.separatorChar);
- if (index>0) {
- workingDirectory = executable.substring(0, index);
- }
- }
- execute(
- "xampp_start",
- executable,
- workingDirectory,
- true);
- }
-
- /**
- * Executes an external progam and saves the LaunchConfiguration under external tools
- * @param command external tools command name
- * @param executable executable path i.e.c:\apache\apache.exe
- * @param background run this configuration in background mode
- */
- public static void execute(
- String command,
- String executable,
- String workingDirectory,
- boolean background) {
- PHPConsole console = new PHPConsole();
- String consoleMessage;
- if (background) {
- consoleMessage =
- "run in background mode-"
- + command
- + ": "
- + executable;
- } else {
- consoleMessage =
- "run in foreground mode-"
- + command
- + ": "
- + executable;
- }
- console.println(consoleMessage);
-
- ExternalToolsUtil.execute(command, executable, workingDirectory, null, background);
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
-
- }
-
- public void init(IWorkbenchWindow window) {
- this.activeWindow = window;
- }
-
- public void dispose() {
-
- }
-
-}
+++ /dev/null
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
-package net.sourceforge.phpeclipse.actions;
-
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-public class PHPStopApacheAction extends PHPStartApacheAction {
- public void run(IAction action) {
- final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- // execute(store.getString(PHPeclipsePlugin.APACHE_STOP_PREF), "Stop Apache: ");
- execute(
- "apache_stop",
- store.getString(PHPeclipsePlugin.APACHE_RUN_PREF),
- store.getString(PHPeclipsePlugin.APACHE_STOP_PREF),
- store.getBoolean(PHPeclipsePlugin.APACHE_STOP_BACKGROUND));
- }
-}
+++ /dev/null
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- www.phpeclipse.de
-**********************************************************************/
-package net.sourceforge.phpeclipse.actions;
-
-import java.io.File;
-
-import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil;
-import net.sourceforge.phpeclipse.PHPConsole;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-public class PHPStopXAMPPAction implements IWorkbenchWindowActionDelegate {
- protected IWorkbenchWindow activeWindow = null;
-
- public void run(IAction action) {
- final IPreferenceStore store =
- PHPeclipsePlugin.getDefault().getPreferenceStore();
- String executable = store.getString(PHPeclipsePlugin.XAMPP_STOP_PREF);
- String workingDirectory = null;
- if (executable!=null && executable.length()>0) {
- int index = executable.lastIndexOf(File.separatorChar);
- if (index>0) {
- workingDirectory = executable.substring(0, index);
- }
- }
- execute(
- "xampp_stop",
- executable,
- workingDirectory,
- true);
- }
-
- /**
- * Executes an external progam and saves the LaunchConfiguration under external tools
- * @param command external tools command name
- * @param executable executable path i.e.c:\apache\apache.exe
- * @param background run this configuration in background mode
- */
- public static void execute(
- String command,
- String executable,
- String workingDirectory,
- boolean background) {
- PHPConsole console = new PHPConsole();
- String consoleMessage;
- if (background) {
- consoleMessage =
- "run in background mode-"
- + command
- + ": "
- + executable;
- } else {
- consoleMessage =
- "run in foreground mode-"
- + command
- + ": "
- + executable;
- }
- console.println(consoleMessage);
-
- ExternalToolsUtil.execute(command, executable, workingDirectory, null, background);
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
-
- }
-
- public void init(IWorkbenchWindow window) {
- this.activeWindow = window;
- }
-
- public void dispose() {
-
- }
-
-}
+++ /dev/null
-package net.sourceforge.phpeclipse.phpeditor;
-
-/**********************************************************************
- 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
- **********************************************************************/
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sourceforge.phpdt.internal.compiler.util.Util;
-import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.actions.ExternalPHPParser;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-
-//import test.PHPParserManager;
-
-/**
- * ClassDeclaration that defines the action for parsing the current PHP file
- */
-public class PHPParserAction extends TextEditorAction {
-
- private static PHPParserAction instance = new PHPParserAction();
-
- protected IFile fileToParse;
-
- protected List fVariables = new ArrayList(100);
-
- /**
- * Constructs and updates the action.
- */
- private PHPParserAction() {
- super(PHPEditorMessages.getResourceBundle(), "ParserAction.", null); //$NON-NLS-1$
- update();
- }
-
- public static PHPParserAction getInstance() {
- return instance;
- }
-
- /**
- * Code called when the action is fired.
- */
- public void run() {
- boolean phpFlag = false;
-
- // try {
- fileToParse = getPHPFile();
- parseFile(fileToParse);
- }
-
- public static void parseFile(IFile fileToParse) {
- boolean phpFlag = false;
- // try {
-
- if (fileToParse == null) {
- // TODO should never happen => should throw an exception
- System.err.println("Error : no file in the editor");
-
- return;
- }
- String name = fileToParse.getName(); //.toLowerCase();
-
- if (PHPFileUtil.isPHPFileName(name)) {
- IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- ExternalPHPParser parser = new ExternalPHPParser(fileToParse);
- parser.phpExternalParse();
- }
- }
-
- /**
- * Finds the file that's currently opened in the PHP Text Editor
- */
- protected IFile getPHPFile() {
- 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;
- }
-
- protected static void parse(IFile fileToParse) {
- InputStream stream = null;
- char[] charArray;
- try {
- stream = new BufferedInputStream(fileToParse.getContents());
- charArray = Util.getInputStreamAsCharArray(stream, -1, null);
- ExternalPHPParser parser = new ExternalPHPParser(fileToParse);
- parser.phpExternalParse();
- } catch (CoreException e) {
- } catch (IOException e) {
- } finally {
- try {
- if (stream != null) {
- stream.close();
- }
- } catch (IOException e) {
- }
- }
- }
-}
\ No newline at end of file
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
-import com.quantum.ExternalInterface;
+//import com.quantum.ExternalInterface;
// import com.quantum.util.connection.NotConnectedException;
/**
builtinResults = builtinEngine.getResults();
}
}
- ICompletionProposal[] sqlResults = new ICompletionProposal[0];
- if (project != null) {
- sqlResults = getSQLProposals(viewer, project, context, prefix, sqlTable);
- }
+// ICompletionProposal[] sqlResults = new ICompletionProposal[0];
+// if (project != null) {
+// sqlResults = getSQLProposals(viewer, project, context, prefix, sqlTable);
+// }
// concatenate the result arrays
IPHPCompletionProposal[] total;
total = new IPHPCompletionProposal[localVariableResults.length + templateResults.length + identifierResults.length
- + builtinResults.length + declarationResults.length + sqlResults.length];
+ + builtinResults.length + declarationResults.length];// + sqlResults.length];
System.arraycopy(templateResults, 0, total, 0, templateResults.length);
System.arraycopy(identifierResults, 0, total, templateResults.length, identifierResults.length);
System.arraycopy(builtinResults, 0, total, templateResults.length + identifierResults.length, builtinResults.length);
System.arraycopy(declarationResults, 0, total, templateResults.length + identifierResults.length + builtinResults.length,
declarationResults.length);
- System.arraycopy(sqlResults, 0, total, templateResults.length + identifierResults.length + builtinResults.length
- + declarationResults.length, sqlResults.length);
+// System.arraycopy(sqlResults, 0, total, templateResults.length + identifierResults.length + builtinResults.length
+// + declarationResults.length, sqlResults.length);
+// System.arraycopy(localVariableResults, 0, total, templateResults.length + identifierResults.length + builtinResults.length
+// + declarationResults.length + sqlResults.length, localVariableResults.length);
System.arraycopy(localVariableResults, 0, total, templateResults.length + identifierResults.length + builtinResults.length
- + declarationResults.length + sqlResults.length, localVariableResults.length);
+ + declarationResults.length, localVariableResults.length);
results = total;
fNumberOfComputedResults = (results == null ? 0 : results.length);
/*
* @param sqlResults
* @return
*/
- private ICompletionProposal[] getSQLProposals(ITextViewer viewer, IProject project, DocumentTemplateContext context,
- String prefix, TableName sqlTable) {
- ICompletionProposal[] sqlResults = new ICompletionProposal[0];
- // Get The Database bookmark from the Quantum SQL plugin:
- // BookmarkCollection sqlBookMarks = BookmarkCollection.getInstance();
- // if (sqlBookMarks != null) {
- String bookmarkString = ProjectPrefUtil.getMiscProjectsPreferenceValue(project, IPreferenceConstants.PHP_BOOKMARK_DEFAULT);
- if (bookmarkString != null && !bookmarkString.equals("")) {
- String[] bookmarks = ExternalInterface.getBookmarkNames();
- boolean foundBookmark = false;
- for (int i = 0; i < bookmarks.length; i++) {
- if (bookmarks[i].equals(bookmarkString)) {
- foundBookmark = true;
- }
- }
- if (!foundBookmark) {
- return sqlResults;
- }
- // Bookmark bookmark = sqlBookMarks.find(bookmarkString);
- ArrayList sqlList = new ArrayList();
- if (!ExternalInterface.isBookmarkConnected(bookmarkString)) {
- ExternalInterface.connectBookmark(bookmarkString, null);
- if (!ExternalInterface.isBookmarkConnected(bookmarkString)) {
- return sqlResults;
- }
- }
- // if (ExternalInterface.isBookmarkConnected(bookmarkString)) {
- try {
- int start = context.getStart();
- int end = context.getEnd();
- String foundSQLTableName = sqlTable.getTableName();
- String tableName;
- String columnName;
- String prefixWithoutDollar = prefix;
- boolean isDollarPrefix = false;
- if (prefix.length() > 0 && prefix.charAt(0) == '$') {
- prefixWithoutDollar = prefix.substring(1);
- isDollarPrefix = true;
- }
- IRegion region = new Region(start, end - start);
- ResultSet set;
- if (!isDollarPrefix) {
- String[] tableNames = ExternalInterface.getMatchingTableNames(null, bookmarkString, prefixWithoutDollar, null, false);
- for (int i = 0; i < tableNames.length; i++) {
- sqlList.add(new SQLProposal(tableNames[i], context, region, viewer, PHPUiImages.get(PHPUiImages.IMG_TABLE)));
- }
- }
-
- String[] columnNames = ExternalInterface.getMatchingColumnNames(null, bookmarkString, prefixWithoutDollar, null, false);
- for (int i = 0; i < columnNames.length; i++) {
- sqlList.add(new SQLProposal(columnNames[i], context, region, viewer, PHPUiImages.get(PHPUiImages.IMG_TABLE)));
- }
-
- sqlResults = new IPHPCompletionProposal[sqlList.size()];
- for (int i = 0; i < sqlList.size(); i++) {
- sqlResults[i] = (SQLProposal) sqlList.get(i);
- }
- } catch (Exception /* NotConnectedException */ e) {
-
- }
- // }
- }
- // }
- return sqlResults;
- }
+// private ICompletionProposal[] getSQLProposals(ITextViewer viewer, IProject project, DocumentTemplateContext context,
+// String prefix, TableName sqlTable) {
+// ICompletionProposal[] sqlResults = new ICompletionProposal[0];
+// // Get The Database bookmark from the Quantum SQL plugin:
+// // BookmarkCollection sqlBookMarks = BookmarkCollection.getInstance();
+// // if (sqlBookMarks != null) {
+// String bookmarkString = ProjectPrefUtil.getMiscProjectsPreferenceValue(project, IPreferenceConstants.PHP_BOOKMARK_DEFAULT);
+// if (bookmarkString != null && !bookmarkString.equals("")) {
+// String[] bookmarks = ExternalInterface.getBookmarkNames();
+// boolean foundBookmark = false;
+// for (int i = 0; i < bookmarks.length; i++) {
+// if (bookmarks[i].equals(bookmarkString)) {
+// foundBookmark = true;
+// }
+// }
+// if (!foundBookmark) {
+// return sqlResults;
+// }
+// // Bookmark bookmark = sqlBookMarks.find(bookmarkString);
+// ArrayList sqlList = new ArrayList();
+// if (!ExternalInterface.isBookmarkConnected(bookmarkString)) {
+// ExternalInterface.connectBookmark(bookmarkString, null);
+// if (!ExternalInterface.isBookmarkConnected(bookmarkString)) {
+// return sqlResults;
+// }
+// }
+// // if (ExternalInterface.isBookmarkConnected(bookmarkString)) {
+// try {
+// int start = context.getStart();
+// int end = context.getEnd();
+// String foundSQLTableName = sqlTable.getTableName();
+// String tableName;
+// String columnName;
+// String prefixWithoutDollar = prefix;
+// boolean isDollarPrefix = false;
+// if (prefix.length() > 0 && prefix.charAt(0) == '$') {
+// prefixWithoutDollar = prefix.substring(1);
+// isDollarPrefix = true;
+// }
+// IRegion region = new Region(start, end - start);
+// ResultSet set;
+// if (!isDollarPrefix) {
+// String[] tableNames = ExternalInterface.getMatchingTableNames(null, bookmarkString, prefixWithoutDollar, null, false);
+// for (int i = 0; i < tableNames.length; i++) {
+// sqlList.add(new SQLProposal(tableNames[i], context, region, viewer, PHPUiImages.get(PHPUiImages.IMG_TABLE)));
+// }
+// }
+//
+// String[] columnNames = ExternalInterface.getMatchingColumnNames(null, bookmarkString, prefixWithoutDollar, null, false);
+// for (int i = 0; i < columnNames.length; i++) {
+// sqlList.add(new SQLProposal(columnNames[i], context, region, viewer, PHPUiImages.get(PHPUiImages.IMG_TABLE)));
+// }
+//
+// sqlResults = new IPHPCompletionProposal[sqlList.size()];
+// for (int i = 0; i < sqlList.size(); i++) {
+// sqlResults[i] = (SQLProposal) sqlList.get(i);
+// }
+// } catch (Exception /* NotConnectedException */ e) {
+//
+// }
+// // }
+// }
+// // }
+// return sqlResults;
+// }
private boolean looksLikeMethod(PHPCodeReader reader) throws IOException {
int curr = reader.read();
+++ /dev/null
-package net.sourceforge.phpeclipse.preferences;
-
-import net.sourceforge.phpeclipse.IPreferenceConstants;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-public class PHPEclipseParserPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
-// private SelectionListener SelectionListener;
-// private ModifyListener ModifyListener;
-// private ModifyListener TextModifyListener;
-//
-// private ArrayList CheckBoxes = new ArrayList();
-// private ArrayList ComboBoxes = new ArrayList();
-// private ArrayList TextBoxes = new ArrayList();
-// private ArrayList RadioButtons = new ArrayList();
-
-
-// RadioGroupFieldEditor chooseParser;
- StringFieldEditor externalParserSFE;
- // BooleanFieldEditor parseOnSave;
-
- public PHPEclipseParserPreferencePage() {
- super();
- setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
- setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$
- }
-
- public void init(IWorkbench workbench) {
- }
- protected void performDefaults() {
-// chooseParser.loadDefault();
- externalParserSFE.loadDefault();
-// parseOnSave.loadDefault();
- super.performDefaults();
- }
-
- public boolean performOk() {
-// chooseParser.store();
- externalParserSFE.store();
-// parseOnSave.store();
- return super.performOk();
- }
-
- protected Control createContents(Composite parent) {
- initializeDialogUnits(parent);
- final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- Composite composite = new Composite(parent, SWT.LEFT);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- composite.setLayout(new GridLayout());
-
- //Create parser settings composite
- Composite parserSettingsComposite = new Composite(composite, SWT.NONE);
- parserSettingsComposite.setLayout(new GridLayout());
- parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE);
- parserSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers"));
- parserSettingsGroup.setLayout(new GridLayout());
- parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-// chooseParser =
-// new RadioGroupFieldEditor(
-// IPreferenceConstants.PHP_PARSER_DEFAULT,
-// PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.choose"),
-// 1,
-// new String[][] {
-// { PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.internal"), IPreferenceConstants.PHP_INTERNAL_PARSER },
-// {
-// PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.external"), IPreferenceConstants.PHP_EXTERNAL_PARSER }
-// }, parserSettingsGroup);
-// chooseParser.setPreferencePage(this);
-// chooseParser.setPreferenceStore(getPreferenceStore());
-// chooseParser.load();
- //create a copmposte just for the StringEditor - makes layout simpler
- Composite externalParserCompo = new Composite(parserSettingsGroup, SWT.NONE);
- externalParserSFE =
- new StringFieldEditor(
- IPreferenceConstants.EXTERNAL_PARSER_PREF,
- PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"),
- externalParserCompo
- /*parserSettingsGroup*/
- );
- externalParserSFE.setPreferencePage(this);
- externalParserSFE.setPreferenceStore(getPreferenceStore());
- externalParserSFE.load();
-
-// parseOnSave =
-// new BooleanFieldEditor(
-// PHPeclipsePlugin.PHP_PARSE_ON_SAVE,
-// PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.pos"),
-// parserSettingsGroup);
-// parseOnSave.setPreferencePage(this);
-// parseOnSave.setPreferenceStore(getPreferenceStore());
-// parseOnSave.load();
-
- return composite;
- }
-}