/** * {@inheritDoc} * * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { ui = new PageSettingsPageUI(parent, SWT.NULL); ui.getTitleText().addModifyListener(this); ui.getContentText().addModifyListener(this); setPageComplete(validatePage()); setControl(ui); }
/** * Validates the input of this page. * * @return Whether enough info has been provided or not. */ private boolean validatePage() { this.pageTitle = ui.getTitleText().getText().trim(); this.pageContent = ui.getContentText().getText(); if (pageTitle.equals("")) { setErrorMessage(" Page Title Cannot be Empty."); return false; } // check whether page already exists. if (space.searchPage(pageTitle) != null) { setErrorMessage(" Page Title Must be Unique : " + pageTitle); return false; } else if (pageContent.trim().equals("")) { setErrorMessage(" Initial Page Content Cannot be Empty."); return false; } else { setErrorMessage(null); return true; } }