Search in sources :

Example 1 with TemplateOption

use of org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption in project gemoc-studio by eclipse.

the class OptionTemplateSection method flagMissingRequiredOption.

/**
 * Locates the page that this option is presented in and flags that the
 * option is required and is currently not set. The flagging is done by
 * setting the page incomplete and setting the error message that uses
 * option's message label.
 *
 * @param option
 *            the option that is required and currently not set
 */
protected void flagMissingRequiredOption(TemplateOption option) {
    WizardPage page = null;
    for (int i = 0; i < pages.size(); i++) {
        TemplatePage tpage = pages.get(i);
        ArrayList<TemplateOption> list = tpage.options;
        if (list.contains(option)) {
            page = tpage.page;
            break;
        }
    }
    if (page != null) {
        page.setPageComplete(false);
        String message = NLS.bind(PDEUIMessages.OptionTemplateSection_mustBeSet, option.getMessageLabel());
        page.setErrorMessage(message);
    }
}
Also used : OptionTemplateWizardPage(org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.OptionTemplateWizardPage) WizardPage(org.eclipse.jface.wizard.WizardPage) TemplateOption(org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption)

Example 2 with TemplateOption

use of org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption in project gemoc-studio by eclipse.

the class OptionTemplateSection method flagErrorOnOption.

/**
 * Locates the page that this option is presented in and flags that the
 * option has an error. The flagging is done by
 * setting the page incomplete and setting the error message with the
 * provided message prefixed by the option's message label.
 *
 * @param option
 *            the option that is required and currently not set
 * @param msg
 *            the message indicating the error for the given option
 */
protected void flagErrorOnOption(TemplateOption option, String msg) {
    WizardPage page = null;
    for (int i = 0; i < pages.size(); i++) {
        TemplatePage tpage = pages.get(i);
        ArrayList<TemplateOption> list = tpage.options;
        if (list.contains(option)) {
            page = tpage.page;
            break;
        }
    }
    if (page != null) {
        page.setPageComplete(false);
        String message = option.getMessageLabel() + ": " + msg;
        page.setErrorMessage(message);
    }
}
Also used : OptionTemplateWizardPage(org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.OptionTemplateWizardPage) WizardPage(org.eclipse.jface.wizard.WizardPage) TemplateOption(org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption)

Example 3 with TemplateOption

use of org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption in project gemoc-studio by eclipse.

the class OptionTemplateSection method validateContainerPage.

private void validateContainerPage(TemplateOption source) {
    TemplateOption[] allPageOptions = getOptions(0);
    for (int i = 0; i < allPageOptions.length; i++) {
        TemplateOption nextOption = allPageOptions[i];
        if (nextOption.isRequired() && nextOption.isEmpty()) {
            flagMissingRequiredOption(nextOption);
            return;
        }
    }
    resetPageState();
}
Also used : TemplateOption(org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption)

Example 4 with TemplateOption

use of org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption in project gemoc-studio by eclipse.

the class OptionTemplateWizardPage method createControl.

/**
 * Creates the page control by creating individual options in the order
 * subject to their position in the list.'
 *
 * @param composite
 */
public void createControl(Composite composite) {
    Composite container = new Composite(composite, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.verticalSpacing = 9;
    container.setLayout(layout);
    for (int i = 0; i < options.size(); i++) {
        TemplateOption option = (TemplateOption) options.get(i);
        option.createControl(container, 3);
    }
    if (helpContextId != null)
        PlatformUI.getWorkbench().getHelpSystem().setHelp(container, helpContextId);
    setControl(container);
    Dialog.applyDialogFont(container);
    container.forceFocus();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) TemplateOption(org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption)

Aggregations

TemplateOption (org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.TemplateOption)4 OptionTemplateWizardPage (org.eclipse.gemoc.commons.eclipse.pde.wizards.pages.pde.ui.templates.OptionTemplateWizardPage)2 WizardPage (org.eclipse.jface.wizard.WizardPage)2 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1