1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.ui.wizards;
14 //import net.sourceforge.phpdt.externaltools.internal.ui.StatusInfo;
15 import net.sourceforge.phpeclipse.ui.StatusInfo;
16 import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
18 import org.eclipse.core.runtime.IStatus;
19 import org.eclipse.jface.wizard.WizardPage;
22 * Base class for wizard page responsible to create PHP elements. The class
23 * provides API to update the wizard's statis line and OK button according to
24 * the value of a <code>IStatus</code> object.
28 public abstract class NewElementWizardPage extends WizardPage {
30 private IStatus fCurrStatus;
32 private boolean fPageVisible;
35 * Creates a <code>NewElementWizardPage</code>.
38 * the wizard page's name
40 public NewElementWizardPage(String name) {
43 fCurrStatus = new StatusInfo();
46 // ---- WizardPage ----------------
49 * @see WizardPage#becomesVisible
51 public void setVisible(boolean visible) {
52 super.setVisible(visible);
53 fPageVisible = visible;
54 // policy: wizards are not allowed to come up with an error message
55 if (visible && fCurrStatus.matches(IStatus.ERROR)) {
56 StatusInfo status = new StatusInfo();
57 status.setError(""); //$NON-NLS-1$
60 updateStatus(fCurrStatus);
64 * Updates the status line and the ok button according to the given status
69 protected void updateStatus(IStatus status) {
71 setPageComplete(!status.matches(IStatus.ERROR));
73 StatusUtil.applyToStatusLine(this, status);
78 * Updates the status line and the ok button according to the status
79 * evaluate from an array of status. The most severe error is taken. In case
80 * that two status with the same severity exists, the status with lower
86 protected void updateStatus(IStatus[] status) {
87 updateStatus(StatusUtil.getMostSevere(status));