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;
/**
*/
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;
* @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);
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");
}
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() {
}
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) {
IStatus.ERROR,
PHPeclipsePlugin.getPluginId(),
0,
- PHPActionMessages.getString("PHPStartApacheAction.consoleViewOpeningProblem"),
+ PHPActionMessages.getString(
+ "PHPStartApacheAction.consoleViewOpeningProblem"),
e));
}
}
/**
* 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;
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) {