Parser detects wrong include files now
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / views / PHPConsole.java
index 638ca71..2e98d5d 100644 (file)
@@ -9,7 +9,7 @@ http://www.eclipse.org/legal/cpl-v10.html
 
 Contributors:
     IBM Corporation - Initial implementation
-    Klaus Hartlage - www.eclipseproject.de
+    www.phpeclipse.de
 **********************************************************************/
 
 import java.io.BufferedReader;
@@ -36,15 +36,12 @@ import org.eclipse.jface.text.TextViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StyledText;
 import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ViewPart;
 
 /**
@@ -53,15 +50,16 @@ import org.eclipse.ui.part.ViewPart;
  */
 public class PHPConsole extends ViewPart {
 
-  public static final String CONSOLE_ID = "net.sourceforge.phpeclipse.views.phpconsoleview";
+  public static final String CONSOLE_ID =
+    "net.sourceforge.phpeclipse.views.phpconsoleview";
   private int COMMAND_COMBO_SIZE = 10;
 
   private TextViewer fViewer = null;
   private Document fDocument = null;
   private StyledText fStyledText;
   // private Combo fCommandCombo;
-//  private ProcessOutputWriter consoleOut;
-//  private ProcessOutputWriter consoleErr;
+  //  private ProcessOutputWriter consoleOut;
+  //  private ProcessOutputWriter consoleErr;
 
   // private Action goAction;
 
@@ -101,20 +99,20 @@ public class PHPConsole extends ViewPart {
    * @see ViewPart#createPartControl
    */
   public void createPartControl(Composite parent) {
-//    Composite container = new Composite(parent, SWT.NULL);
-//    //   control = container;
-//    GridLayout layout = new GridLayout();
-//    layout.marginWidth = 0;
-//    layout.marginHeight = 0;
-//    layout.verticalSpacing = 0;
-//    container.setLayout(layout);
-//    Composite navContainer = new Composite(container, SWT.NONE);
-//    layout = new GridLayout();
-//    layout.numColumns = 2;
-//    layout.marginHeight = 1;
-//    navContainer.setLayout(layout);
-//    createCommandBar(navContainer);
-//    navContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+    //    Composite container = new Composite(parent, SWT.NULL);
+    //    //   control = container;
+    //    GridLayout layout = new GridLayout();
+    //    layout.marginWidth = 0;
+    //    layout.marginHeight = 0;
+    //    layout.verticalSpacing = 0;
+    //    container.setLayout(layout);
+    //    Composite navContainer = new Composite(container, SWT.NONE);
+    //    layout = new GridLayout();
+    //    layout.numColumns = 2;
+    //    layout.marginHeight = 1;
+    //    navContainer.setLayout(layout);
+    //    createCommandBar(navContainer);
+    //    navContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
 
     fViewer = new TextViewer(parent, SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
     GridData viewerData = new GridData(GridData.FILL_BOTH);
@@ -122,7 +120,8 @@ public class PHPConsole extends ViewPart {
     fViewer.setEditable(false);
 
     fStyledText = fViewer.getTextWidget();
-    fStyledText.setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
+    fStyledText.setFont(
+      JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
 
     cutAction.setText("Cut");
     copyAction.setText("Copy");
@@ -147,8 +146,8 @@ public class PHPConsole extends ViewPart {
   }
 
   private void createCommandBar(Composite parent) {
-//    Label addressLabel = new Label(parent, SWT.NONE);
-//    addressLabel.setText("Command:");
+    //    Label addressLabel = new Label(parent, SWT.NONE);
+    //    addressLabel.setText("Command:");
 
     //    fCommandCombo = new Combo(parent, SWT.DROP_DOWN | SWT.BORDER);
     //    fCommandCombo.addModifyListener(new ModifyListener() {
@@ -368,10 +367,20 @@ public class PHPConsole extends ViewPart {
   }
 
   public static PHPConsole getInstance() {
-    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+    // IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+    IWorkbenchPage page =
+      PHPeclipsePlugin
+        .getDefault()
+        .getWorkbench()
+        .getActiveWorkbenchWindow()
+        .getActivePage();
     PHPConsole console = (PHPConsole) page.findView(PHPConsole.CONSOLE_ID);
 
-    if (PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PHPeclipsePlugin.SHOW_OUTPUT_IN_CONSOLE) == true) {
+    if (PHPeclipsePlugin
+      .getDefault()
+      .getPreferenceStore()
+      .getBoolean(PHPeclipsePlugin.SHOW_OUTPUT_IN_CONSOLE) 
+      == true) {
       try {
         page.showView(PHPConsole.CONSOLE_ID);
         if (console == null) {
@@ -383,7 +392,8 @@ public class PHPConsole extends ViewPart {
             IStatus.ERROR,
             PHPeclipsePlugin.getPluginId(),
             0,
-            PHPActionMessages.getString("PHPStartApacheAction.consoleViewOpeningProblem"),
+            PHPActionMessages.getString(
+              "PHPStartApacheAction.consoleViewOpeningProblem"),
             e));
       }
     }
@@ -400,7 +410,8 @@ public class PHPConsole extends ViewPart {
   /**
    * Creates a string buffer from the given input stream
    */
-  public static String getStringFromStream(InputStream stream) throws IOException {
+  public static String getStringFromStream(InputStream stream)
+    throws IOException {
     StringBuffer buffer = new StringBuffer();
     byte[] b = new byte[100];
     int finished = 0;
@@ -451,7 +462,8 @@ public class PHPConsole extends ViewPart {
 
     public void run() {
       try {
-        BufferedReader in = new BufferedReader(new InputStreamReader(fInputStream));
+        BufferedReader in =
+          new BufferedReader(new InputStreamReader(fInputStream));
 
         String line;
         while ((line = in.readLine()) != null) {