1 11 package org.eclipse.jdt.ui.wizards; 12 13 import org.eclipse.core.runtime.IStatus; 14 15 import org.eclipse.jface.wizard.WizardPage; 16 17 import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; 18 import org.eclipse.jdt.internal.ui.dialogs.StatusUtil; 19 20 31 public abstract class NewElementWizardPage extends WizardPage { 32 33 private IStatus fCurrStatus; 34 35 private boolean fPageVisible; 36 37 42 public NewElementWizardPage(String name) { 43 super(name); 44 fPageVisible= false; 45 fCurrStatus= new StatusInfo(); 46 } 47 48 50 53 public void setVisible(boolean visible) { 54 super.setVisible(visible); 55 fPageVisible= visible; 56 if (visible && fCurrStatus.matches(IStatus.ERROR)) { 58 StatusInfo status= new StatusInfo(); 59 status.setError(""); fCurrStatus= status; 61 } 62 updateStatus(fCurrStatus); 63 } 64 65 70 protected void updateStatus(IStatus status) { 71 fCurrStatus= status; 72 setPageComplete(!status.matches(IStatus.ERROR)); 73 if (fPageVisible) { 74 StatusUtil.applyToStatusLine(this, status); 75 } 76 } 77 78 85 protected void updateStatus(IStatus[] status) { 86 updateStatus(StatusUtil.getMostSevere(status)); 87 } 88 89 } 90 | Popular Tags |