X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusDialog.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusDialog.java index 5b19da3..b809c79 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusDialog.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/internal/ui/StatusDialog.java @@ -1,11 +1,11 @@ package net.sourceforge.phpdt.externaltools.internal.ui; /********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. All rights reserved. -This file is made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html -**********************************************************************/ + Copyright (c) 2000, 2002 IBM Corp. All rights reserved. + This file is made available under the terms of the Common Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/cpl-v10.html + **********************************************************************/ import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.dialogs.Dialog; @@ -21,16 +21,20 @@ import org.eclipse.swt.widgets.Shell; /** * An abstract base class for dialogs with a status bar and ok/cancel buttons. - * The status message must be passed over as StatusInfo object and can be - * an error, warning or ok. The OK button is enabled or disabled depending - * on the status. + * The status message must be passed over as StatusInfo object and can be an + * error, warning or ok. The OK button is enabled or disabled depending on the + * status. */ public abstract class StatusDialog extends Dialog { private Button fOkButton; + private MessageLine fStatusLine; + private IStatus fLastStatus; + private String fTitle; + private Image fImage; private boolean fStatusLineAboveButtons; @@ -40,27 +44,28 @@ public abstract class StatusDialog extends Dialog { */ public StatusDialog(Shell parent) { super(parent); - fStatusLineAboveButtons= false; - fLastStatus= new StatusInfo(); + fStatusLineAboveButtons = false; + fLastStatus = new StatusInfo(); } /** - * Specifies whether status line appears to the left of the buttons (default) - * or above them. - * - * @param aboveButtons if true status line is placed above buttons; if - * false to the right + * Specifies whether status line appears to the left of the buttons + * (default) or above them. + * + * @param aboveButtons + * if true status line is placed above buttons; if + * false to the right */ public void setStatusLineAboveButtons(boolean aboveButtons) { - fStatusLineAboveButtons= aboveButtons; + fStatusLineAboveButtons = aboveButtons; } /** - * Update the dialog's status line to reflect the given status. - * It is save to call this method before the dialog has been opened. + * Update the dialog's status line to reflect the given status. It is save + * to call this method before the dialog has been opened. */ protected void updateStatus(IStatus status) { - fLastStatus= status; + fLastStatus = status; if (fStatusLine != null && !fStatusLine.isDisposed()) { updateButtonsEnableState(status); fStatusLine.setErrorStatus(status); @@ -77,7 +82,9 @@ public abstract class StatusDialog extends Dialog { /** * Updates the status of the ok button to reflect the given status. * Subclasses may override this method to update additional buttons. - * @param status the status. + * + * @param status + * the status. */ protected void updateButtonsEnableState(IStatus status) { if (fOkButton != null && !fOkButton.isDisposed()) @@ -101,9 +108,9 @@ public abstract class StatusDialog extends Dialog { if (fLastStatus != null) { // policy: dialogs are not allowed to come up with an error message if (fLastStatus.matches(IStatus.ERROR)) { - StatusInfo status= new StatusInfo(); + StatusInfo status = new StatusInfo(); status.setError(""); //$NON-NLS-1$ - fLastStatus= status; + fLastStatus = status; } updateStatus(fLastStatus); } @@ -113,23 +120,25 @@ public abstract class StatusDialog extends Dialog { * @see Dialog#createButtonsForButtonBar(Composite) */ protected void createButtonsForButtonBar(Composite parent) { - fOkButton= createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + fOkButton = createButton(parent, IDialogConstants.OK_ID, + IDialogConstants.OK_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, + IDialogConstants.CANCEL_LABEL, false); } /* * @see Dialog#createButtonBar(Composite) */ protected Control createButtonBar(Composite parent) { - Composite composite= new Composite(parent, SWT.NULL); - GridLayout layout= new GridLayout(); - layout.numColumns= 1; - layout.marginHeight= 0; - layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + Composite composite = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.marginHeight = 0; + layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - fStatusLine= new MessageLine(composite); + fStatusLine = new MessageLine(composite); fStatusLine.setAlignment(SWT.LEFT); fStatusLine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fStatusLine.setErrorStatus(null); //$NON-NLS-1$ @@ -140,22 +149,26 @@ public abstract class StatusDialog extends Dialog { /** * Sets the title for this dialog. - * @param title the title. + * + * @param title + * the title. */ public void setTitle(String title) { - fTitle= title != null ? title : ""; //$NON-NLS-1$ - Shell shell= getShell(); + fTitle = title != null ? title : ""; //$NON-NLS-1$ + Shell shell = getShell(); if ((shell != null) && !shell.isDisposed()) shell.setText(fTitle); } /** * Sets the image for this dialog. - * @param image the image. + * + * @param image + * the image. */ public void setImage(Image image) { - fImage= image; - Shell shell= getShell(); + fImage = image; + Shell shell = getShell(); if ((shell != null) && !shell.isDisposed()) shell.setImage(fImage); }