Example usage for org.eclipse.jface.dialogs InputDialog create

List of usage examples for org.eclipse.jface.dialogs InputDialog create

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs InputDialog create.

Prototype

@Override
    public void create() 

Source Link

Usage

From source file:ac.soton.eventb.roseEditor.propertySections.abstracts.AbstractTablePropertySection.java

License:Open Source License

protected String getNewDataValue() {
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    InputDialog inputDialog = new InputDialog(shell, "Add new " + getFeature().getName(),
            "Input new value for " + getFeature().getName(), "", null);
    inputDialog.create();
    inputDialog.open();//from   www. j  a  va  2 s.  com
    return inputDialog.getValue();
}

From source file:com.b3dgs.lionengine.editor.factory.AssignFactoryImplementationHandler.java

License:Open Source License

/**
 * Execute the handler.//from ww w  . jav a  2 s  .c  o m
 * 
 * @param partService The part service reference.
 */
@Execute
public void execute(EPartService partService) {
    final InputDialog dialog = new InputDialog(null, Messages.AssignFactory_Title, Messages.AssignFactory_Text,
            AssignFactoryImplementationHandler.DEFAULT_NAME, new InputValidator(InputValidator.NAME_MATCH,
                    com.b3dgs.lionengine.editor.Messages.InputValidator_Error_Name));
    dialog.create();
    if (dialog.open() == Window.OK) {
        AssignFactoryImplementationHandler.assignFactory(partService, dialog.getValue());
    }
}

From source file:com.windowtester.test.eclipse.locator.DialogMessageLocatorSmokeTest.java

License:Open Source License

public void testInputDialogAssertion() throws WidgetSearchException {
    Display.getDefault().asyncExec(new Runnable() {
        public void run() {
            InputDialog dialog = new InputDialog(getShell(), "Input", "Enter: ", "", new IInputValidator() {
                public String isValid(String newText) {
                    return "Does not compute";
                }//  www.  j  a va2s  .c  o  m
            });
            dialog.create();
            dialog.open();
        }
    });

    IUIContext ui = getUI();
    ui.wait(new ShellShowingCondition("Input"));
    ui.enterText("blah");
    ui.assertThat(new DialogMessageLocator().hasText("Does not compute"));
    ui.click(new ButtonLocator("Cancel"));
    ui.wait(new ShellDisposedCondition("Input"));
}

From source file:org.eclipse.birt.report.designer.ui.cubebuilder.page.CubeGroupContent.java

License:Open Source License

/**
 * @deprecated// ww w  . j  av  a2s  .  c o  m
 */
private InputDialog createInputDialog(ReportElementHandle handle, String title, String message) {
    InputDialog inputDialog = new InputDialog(getShell(), title, message, handle.getName(), null) {

        public int open() {

            return super.open();
        }
    };
    inputDialog.create();
    return inputDialog;
}

From source file:org.eclipse.mylyn.reviews.r4e.mail.smtp.mailVersion.internal.preferences.SmtpHostPreferencePage.java

License:Open Source License

/**
 * Create the Server host information GUI
 * /*from  ww  w. j a va 2s  . co m*/
 * @param Composite
 *            aPrefsContainer
 */
private void createServerHostInformation(Composite aPrefsContainer) {
    // Create a Group to hold SMTP user preferences
    final Group smtpHostPrefsGroup = new Group(aPrefsContainer, SWT.BORDER_SOLID);
    final GridData smtpHostPrefsGroupData = new GridData(GridData.FILL, GridData.FILL, true, false);
    smtpHostPrefsGroupData.horizontalSpan = FGROUP_PREFS_SERVER_DATA_SPAN;
    smtpHostPrefsGroup.setText(PreferenceConstants.FP_SERVER_HOST_GROUP);
    smtpHostPrefsGroup.setLayoutData(smtpHostPrefsGroupData);
    smtpHostPrefsGroup.setLayout(new GridLayout(FGROUP_PREFS_SERVER_DATA_SPAN, false));

    // dummy spacer label
    final Label smtpPrefsSpacer = new Label(smtpHostPrefsGroup, SWT.FILL);
    final GridData smtpPrefsSpacerData = new GridData(GridData.FILL, GridData.FILL, true, false);
    smtpPrefsSpacerData.horizontalSpan = FGROUP_PREFS_SERVER_DATA_SPAN;
    smtpPrefsSpacer.setLayoutData(smtpPrefsSpacerData);

    fserverlListBox = new ListEditor(PreferenceConstants.FP_SMTP_SERVER_LIST_ID,
            PreferenceConstants.FP_SMTP_SERVER_LABEL, smtpHostPrefsGroup) {

        @Override
        protected String createList(String[] aItems) {
            StringBuilder sb = new StringBuilder();
            int itemSize = aItems.length;
            for (int i = 0; i < itemSize; i++) {
                sb.append(aItems[i]);
                if (i + 1 < itemSize) {
                    sb.append(fLIST_SEPARATOR);
                }
            }
            return sb.toString();
        }

        @Override
        protected String getNewInputObject() {
            // New button selected

            InputDialog dialog = new InputDialog(getShell(), SMTPHostString.getString("smtp_pref_title"),
                    SMTPHostString.getString("smtp_pref_dialog_msg"), "", SmtpInputValidator());
            dialog.create();
            dialog.open();
            String text = dialog.getValue();
            return text;

        }

        private IInputValidator SmtpInputValidator() {
            // No validation yet
            return null;
        }

        @Override
        protected String[] parseString(String aStringList) {
            String[] star = aStringList.split(fLIST_SEPARATOR);
            return star;
        }
    };

    addField(fserverlListBox);

}

From source file:org.jboss.tools.struts.validator.ui.wizard.depends.DependencyLRView.java

License:Open Source License

private void addNew() {
    InputDialog d = new InputDialog(control.getShell(), StrutsUIMessages.ADD_VALIDATOR, "name", "", null); //$NON-NLS-2$ //$NON-NLS-3$
    d.create();
    if (d.open() != InputDialog.OK)
        return;//from   w ww.j  a v  a 2 s  . c  o  m
    String s = d.getValue();
    if (s != null && targetModel.getList().indexOf(s) < 0) {
        targetModel.getList().addElement(s);
        targetModel.fireStructureChanged();
        int si = targetModel.getRowCount() - 1;
        if (si >= 0)
            targetList.setSelection(si);
        updateSelectionDependentActions();
    }
}

From source file:ui.TSView.java

License:Apache License

private void showReParseDialog() {
    final IInputValidator val = new IInputValidator() {
        private static final long serialVersionUID = 1L;

        public String isValid(final String newText) {
            String result = null;
            long size = 0;
            try {
                size = Integer.parseInt(newText);
            } catch (NumberFormatException e) {
                result = "Please input number";
            }/*  w  w w.  j av a2  s.c  om*/
            if (size < 0) {
                result = "Please input number";
            }
            return result;
        }
    };
    String title = "Reparse File:" + this.bitStream.getFile().getAbsolutePath();
    String mesg = "Enter size[M] for parse ";
    String def = null;

    def = new String("5");
    final InputDialog dlg;
    dlg = new InputDialog(this.getSite().getShell(), title, mesg, def, val);
    dlg.create();
    int returnCode = dlg.open();

    if (returnCode == Window.OK) {
        try {
            long size = Integer.parseInt(dlg.getValue()) * 1024 * 1024;
            parseFile(bitStream.getFile().getAbsolutePath(), size);
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }
}