/* (non-Javadoc) * @see org.eclipse.jface.wizard.IWizardPage#getNextPage() * It makes all the setting before go to the next page */ public IWizardPage getNextPage() { indication.setName(txtName.getText()); indication.setDescription(txtDescription.getText()); if (wizard.newIndication) wizard.mainPage.setChanged(true); else wizard.mainPage.setChanged(false); wizard.mainPage.onEnterPage(); return wizard.mainPage; }
/* (non-Javadoc) * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) * Events are handled here. */ public void handleEvent(Event event) { Status status = new Status(IStatus.OK, "not_used", 0, "", null); // Is name field empty? if (txtName.getText().length() == 0) status = new Status(IStatus.ERROR, "not_used", 0, "Enter an indication name or sumary", null); // Is description empty? else if (txtDescription.getText().length() == 0) status = new Status( IStatus.WARNING, "not_used", 0, "It's recommended enter an indication description", null); // Everything is alright (I guess) else status = new Status(IStatus.OK, "not_used", 0, "Click Next to proceed", null); // Is the indication name duplicated? if (wizard.findIndication(txtName.getText()) != null) { if (wizard.newIndication || ((indication != null) && !txtName.getText().equals(indication.getName()))) status = new Status( IStatus.ERROR, "not_used", 0, "The indication " + txtName.getText() + " already exists. Choose another name or sumary", null); } // Update interface applyToStatusLine(status); wizard.getContainer().updateButtons(); wizard.canFinish = false; }
/** Before show this page, the interface can be set. */ public void onEnterPage() { this.indication = wizard.currentIndication; // Disable Finish wizard.canFinish = false; if (!wizard.newIndication) { txtName.setText(indication.getName()); txtDescription.setText(indication.getDescription()); setDescription("You may update name and description. Click Next to proceed"); } else { txtName.setText(""); txtDescription.setText(""); setDescription("Enter a indication name"); } applyToStatusLine(new Status(IStatus.OK, "not_used", 0, "", null)); wizard.getContainer().updateButtons(); }