Example usage for org.eclipse.jface.dialogs MessageDialog INFORMATION

List of usage examples for org.eclipse.jface.dialogs MessageDialog INFORMATION

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog INFORMATION.

Prototype

int INFORMATION

To view the source code for org.eclipse.jface.dialogs MessageDialog INFORMATION.

Click Source Link

Document

Constant for the info image, or a simple dialog with the info image and a single OK button (value 2).

Usage

From source file:net.sf.jasperreports.eclipse.ui.util.UIUtils.java

License:Open Source License

public static void showInformation(final String title, final String message) {
    Display.getDefault().asyncExec(new Runnable() {
        public void run() {
            MessageDialog.open(MessageDialog.INFORMATION, getShell(), title, message, SWT.SHEET);
        }/*from  w w  w.  j av  a2  s .c  o  m*/
    });
}

From source file:net.sf.jmoney.gnucashXML.actions.GnucashXMLExportAction.java

License:Open Source License

/**
 * The action has been activated. The argument of the
 * method represents the 'real' action sitting
 * in the workbench UI./*from w  w  w  .  j  av a 2  s.c  om*/
 * @see IWorkbenchWindowActionDelegate#run
 */
public void run(IAction action) {
    Session session = JMoneyPlugin.getDefault().getSession();

    // Original JMoney disabled the export menu items when no
    // session was open.  I don't know how to do that in Eclipse,
    // so we display a message instead.
    if (session == null) {
        MessageDialog waitDialog = new MessageDialog(window.getShell(), "Disabled Action Selected", null, // accept the default window icon
                "You cannot export data unless you have a session open.  You must first open a session or create a new session.",
                MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
        waitDialog.open();
        return;
    }

    // Display a warning
    // TODO Remove this warning when the problem is resolved 
    MessageBox diag = new MessageBox(window.getShell());
    diag.setText("Warning");
    diag.setMessage(
            "Warning:\nFor this time, the export as a GnuCash file produce a file which can't be imported under GnuCash. The file can only be imported in the current JMoney application.");
    diag.open();

    FileDialog xmlFileChooser = new FileDialog(window.getShell());
    xmlFileChooser.setText(GnucashXMLPlugin.getResourceString("MainFrame.export"));
    xmlFileChooser.setFilterExtensions(new String[] { "*.xml;*.xac" });
    xmlFileChooser.setFilterNames(new String[] { "XML Gnucash Files (*.xml; *.xac)" });
    // TODO: Faucheux - delete Directory 
    xmlFileChooser.setFilterPath("D:\\Documents and Settings\\Administrateur\\Mes documents\\Mes comptes");
    String fileName = xmlFileChooser.open();

    if (fileName != null) {
        GnucashXML export = GnucashXML.getSingleton(window);
        export.export(session, fileName);
    }

}

From source file:net.sf.jmoney.gnucashXML.actions.GnucashXMLImportAction.java

License:Open Source License

/**
 * The action has been activated. The argument of the
 * method represents the 'real' action sitting
 * in the workbench UI./*from   w  w w .ja v  a  2  s.co  m*/
 * @see IWorkbenchWindowActionDelegate#run
 */
public void run(IAction action) {
    Session session = JMoneyPlugin.getDefault().getSession();

    // Original JMoney disabled the import menu items when no
    // session was open.  I don't know how to do that in Eclipse,
    // so we display a message instead.
    if (session == null) {
        MessageDialog waitDialog = new MessageDialog(window.getShell(), "Disabled Action Selected", null, // accept the default window icon
                "You cannot import data into an accounting session unless you have a session open.  You must first open a session or create a new session.",
                MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
        waitDialog.open();
        return;
    }

    FileDialog xmlFileChooser = new FileDialog(window.getShell());
    xmlFileChooser.setText(GnucashXMLPlugin.getResourceString("MainFrame.import"));
    xmlFileChooser.setFilterExtensions(new String[] { "*.xml;*.xac" });
    xmlFileChooser.setFilterNames(new String[] { "XML Gnucash Files (*.xml; *.xac)" });
    // TODO: Faucheux - delete Directory 
    xmlFileChooser.setFilterPath("D:\\Documents and Settings\\Administrateur\\Mes documents\\Mes comptes");
    String fileName = xmlFileChooser.open();

    if (fileName != null) {
        File qifFile = new File(fileName);
        GnucashXML gnucashXML = GnucashXML.getSingleton(window);
        gnucashXML.importFile(session, qifFile);
    }

}

From source file:net.sf.jmoney.gnucashXML.wizards.GnucashImportWizard.java

License:Open Source License

public void init(IWorkbench workbench, IStructuredSelection selection) {
    this.window = workbench.getActiveWorkbenchWindow();

    this.session = JMoneyPlugin.getDefault().getSession();

    // Original JMoney disabled the import menu items when no
    // session was open. I don't know how to do that in Eclipse,
    // so we display a message instead.
    if (session == null) {
        MessageDialog waitDialog = new MessageDialog(window.getShell(), "Disabled Action Selected", null, // accept the default window icon
                "You cannot import data into an accounting session unless you have a session open.  You must first open a session or create a new session.",
                MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
        waitDialog.open();/*from  ww  w .  j  ava  2 s  .  c  o m*/
        return;
    }

    mainPage = new GnucashImportWizardPage(window);
    addPage(mainPage);
}

From source file:net.sf.jmoney.paypal.CsvImportWizard.java

License:Open Source License

/**
 * We will cache window object in order to be able to provide parent shell
 * for the message dialog.//from  w w  w  .j  a  v a  2s . c om
 */
public void init(IWorkbench workbench, IStructuredSelection selection) {

    this.window = workbench.getActiveWorkbenchWindow();

    DatastoreManager sessionManager = (DatastoreManager) window.getActivePage().getInput();

    // Original JMoney disabled the import menu items when no
    // session was open. I don't know how to do that in Eclipse,
    // so we display a message instead.
    if (sessionManager == null) {
        MessageDialog waitDialog = new MessageDialog(window.getShell(), "Disabled Action Selected", null, // accept the default window icon
                "You cannot import data into an accounting session unless you have a session open.  You must first open a session or create a new session.",
                MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
        waitDialog.open();
        return;
    }

    /*
     * Create a transaction to be used to import the entries.  This allows the entries to
     * be more efficiently written to the back-end datastore and it also groups
     * the entire import as a single change for undo/redo purposes.
     */
    transactionManager = new TransactionManager(sessionManager);
    session = transactionManager.getSession();

    /*
     * Find the Paypal account. Currently this assumes that there is
     * only one Paypal account. If you have more than one then you will
     * need to implement some changes, perhaps require the account be
     * selected before the wizard is run, or add a wizard page that asks
     * which of the Paypal accounts is to be used.
     */
    PaypalAccount accountOutside = null;
    for (Iterator<CapitalAccount> iter = sessionManager.getSession().getCapitalAccountIterator(); iter
            .hasNext();) {
        CapitalAccount eachAccount = iter.next();
        if (eachAccount instanceof PaypalAccount) {
            if (accountOutside != null) {
                MessageDialog.openError(window.getShell(), "Problem",
                        "Multiple Paypal accounts.  Don't know which to use.  If you have multiple Paypal accounts, please submit a patch.");
                return;
            }
            accountOutside = (PaypalAccount) eachAccount;
        }
    }

    if (accountOutside == null) {
        MessageDialog.openError(window.getShell(), "Problem", "No Paypal account has been created");
        return;
    }

    paypalAccount = transactionManager.getCopyInTransaction(accountOutside);

    filePage = new CsvImportWizardPage(window);
    addPage(filePage);
}

From source file:oic.simulator.clientcontroller.view.ResourceManagerView.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    Composite compContent = new Composite(parent, SWT.NONE);
    compContent.setLayout(new GridLayout());
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    compContent.setLayoutData(gd);/*www.j  a v a  2 s. c o  m*/

    Composite buttonComp = new Composite(compContent, SWT.NONE);
    buttonComp.setLayout(new GridLayout(2, false));

    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;

    buttonComp.setLayoutData(gd);

    findResButton = new Button(buttonComp, SWT.PUSH);
    findResButton.setText("Find Resources");
    findResButton.setToolTipText("Find OIC resources");

    gd = new GridData();
    gd.widthHint = 130;
    findResButton.setLayoutData(gd);

    refreshButton = new Button(buttonComp, SWT.PUSH);
    refreshButton.setText("Refresh");
    refreshButton.setToolTipText("Restart the search once again");

    gd = new GridData();
    gd.widthHint = 90;
    refreshButton.setLayoutData(gd);

    // Create a Tab Folder.
    folder = new CTabFolder(compContent, SWT.BORDER);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    folder.setLayoutData(gd);
    folder.setSimple(false);
    folder.setUnselectedCloseVisible(false);
    folder.setUnselectedImageVisible(false);
    folder.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // Tab is switched.
            treeViewer.setSelection(null);
            favTreeViewer.setSelection(null);
            resourceManager.resourceSelectionChanged(null);
        }
    });

    createFoundResourcesArea();

    createFavoriteResourcesArea();

    folder.setSelection(foundResTab);

    findDialog = new MessageDialog(Display.getDefault().getActiveShell(), "Finding Servers", null,
            "Finding the requested servers\nPlease wait...", MessageDialog.INFORMATION,
            new String[] { "Cancel" }, 0);
    // findDialog.setBlockOnOpen(false);

    refreshDialog = new MessageDialog(Display.getDefault().getActiveShell(), "Finding Servers", null,
            "Refreshing the search and finding the requested servers once again\nPlease wait...",
            MessageDialog.INFORMATION, new String[] { "Cancel" }, 0);
    // refreshDialog.setBlockOnOpen(false);

    addUIListeners();

    addManagerListeners();

    // Setting the initial visibility of refresh based on the last known
    // search operation.
    Set<String> prevSearchTypes = resourceManager.getLastKnownSearchTypes();
    if (null == prevSearchTypes || prevSearchTypes.size() < 1) {
        refreshButton.setEnabled(false);
    } else {
        refreshButton.setEnabled(true);
    }
}

From source file:org.apache.directory.studio.common.ui.CommonUIUtils.java

License:Apache License

/**
 * Opens an Information {@link MessageDialog} with the given title and message.
 *
 * @param title the title//from ww w.j a v  a  2 s . c om
 * @param message the message
 */
public static void openInformationDialog(String title, String message) {
    MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            title, null, message, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL },
            MessageDialog.OK);
    dialog.open();
}

From source file:org.apache.directory.studio.ldapservers.actions.CreateConnectionActionHelper.java

License:Apache License

public static void createLdapBrowserConnection(LdapServer server, Connection connection) {
    // Adding the connection to the connection manager
    ConnectionCorePlugin.getDefault().getConnectionManager().addConnection(connection);

    // Adding the connection to the root connection folder
    ConnectionCorePlugin.getDefault().getConnectionFolderManager().getRootConnectionFolder()
            .addConnectionId(connection.getId());

    // Getting the window, LDAP perspective and current perspective
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IPerspectiveDescriptor ldapPerspective = getLdapPerspective();
    IPerspectiveDescriptor currentPerspective = window.getActivePage().getPerspective();

    // Checking if we are already in the LDAP perspective
    if ((ldapPerspective != null) && (ldapPerspective.equals(currentPerspective))) {
        // As we're already in the LDAP perspective, we only indicate to the user 
        // the name of the connection that has been created
        MessageDialog dialog = new MessageDialog(window.getShell(),
                Messages.getString("CreateConnectionActionHelper.ConnectionCreated"), null, //$NON-NLS-1$
                NLS.bind(Messages.getString("CreateConnectionActionHelper.ConnectionCalledCreated"), //$NON-NLS-1$
                        new String[] { connection.getName() }),
                MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, MessageDialog.OK);
        dialog.open();/*from www .  ja  v  a  2  s  .  c  o  m*/
    } else {
        // We're not already in the LDAP perspective, we indicate to the user
        // the name of the connection that has been created and we ask him
        // if we wants to switch to the LDAP perspective
        MessageDialog dialog = new MessageDialog(window.getShell(),
                Messages.getString("CreateConnectionActionHelper.ConnectionCreated"), null, //$NON-NLS-1$
                NLS.bind(Messages.getString("CreateConnectionActionHelper.ConnectionCalledCreatedSwitch"), //$NON-NLS-1$
                        new String[] { connection.getName() }), MessageDialog.INFORMATION,
                new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, MessageDialog.OK);
        if (dialog.open() == MessageDialog.OK) {
            // Switching to the LDAP perspective
            window.getActivePage().setPerspective(ldapPerspective);
        }
    }
}

From source file:org.apache.directory.studio.schemaeditor.view.ViewUtils.java

License:Apache License

/**
 * Displays a information message dialog with the given title and message.
 *
 * @param title the title of the window//from w  w w.  j a  va 2s .co m
 * @param message the message to display
 * @return <code>true</code> if the user presses the OK or Yes button,
 *         <code>false</code> otherwise
 */
public static boolean displayInformationMessageDialog(String title, String message) {
    return displayMessageDialog(MessageDialog.INFORMATION, title, message);
}

From source file:org.apache.directory.studio.valueeditors.password.PasswordDialog.java

License:Apache License

/**
 * Verifies the current password./*from ww w .  j a v a  2s .c o m*/
 */
private void verifyCurrentPassword() {
    String testPassword = testPasswordText.getText();
    if (currentPassword != null) {
        if (currentPassword.verify(testPassword)) {
            MessageDialog dialog = new MessageDialog(getShell(),
                    Messages.getString("PasswordDialog.PasswordVerification"), getShell().getImage(), //$NON-NLS-1$
                    Messages.getString("PasswordDialog.PasswordVerifiedSuccessfully"), //$NON-NLS-1$
                    MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
        } else {
            IStatus status = new Status(IStatus.ERROR, ValueEditorsConstants.PLUGIN_ID, 1,
                    Messages.getString("PasswordDialog.PasswordVerificationFailed"), null); //$NON-NLS-1$
            ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(status);
        }
    }
}