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

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

Introduction

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

Prototype

public static void openInformation(Shell parent, String title, String message) 

Source Link

Document

Convenience method to open a standard information dialog.

Usage

From source file:ch.medshare.mediport.MediportClientSetsPrefPage.java

License:Open Source License

@Override
protected void showReloadInfo() {
    if (props != null) {
        MessageDialog.openInformation(getShell(),
                Messages.getString("MediportClientSetsPrefPage.info.title.MediPortCommunicator"), //$NON-NLS-1$
                Messages.getString("MediportClientSetsPrefPage.info.reloadInfo1") //$NON-NLS-1$
                        + Messages.getString("MediportClientSetsPrefPage.info.reloadInfo2")); //$NON-NLS-1$
    }//w w  w.jav a 2s .  c  om
}

From source file:ch.mlutz.plugins.t4e.handlers.CommandHandler.java

License:Open Source License

/**
 * the command has been executed, so extract extract the needed information
 * from the application context.// w  ww.j  a  v  a  2  s  .  co m
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
    if (event.getCommand().getId().equals(Command.SWITCH_TO_COMPLEMENT_FILE)) {
        try {
            final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
            final IWorkbenchPage activePage = window.getActivePage();

            if (activePage == null) {
                MessageDialog.openInformation(window.getShell(), Constants.PLUGIN_DISPLAYNAME,
                        "No active page found.");
                return null;
            }

            IEditorPart part = activePage.getActiveEditor();

            if (part != null && !(part instanceof ITextEditor)) {
                part = (IEditorPart) part.getAdapter(ITextEditor.class);
            }

            if (!(part instanceof ITextEditor)) {
                MessageDialog.openInformation(window.getShell(), Constants.PLUGIN_DISPLAYNAME,
                        "No file open in text editor.");
                return null;
            }

            final IFile currentFile = (IFile) part.getEditorInput().getAdapter(IFile.class);

            switchToComplementFileCommand(currentFile, activePage);

        } catch (ExecutionException e) {
            // one of the workbench objects could not be retrieved
            return null;
        } catch (Exception e) {
            log.error("Couldn't switch to corresponding file: ", e);
        }
    }

    return null;
}

From source file:ch.ngiger.elexis.text.utilities.handlers.StressTestAllDocuments.java

License:Open Source License

/**
 * the command has been executed, so extract extract the needed information from the application
 * context.//from  w w  w.jav  a 2 s.  c o m
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
    window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    if (!Preferences.getMustRunStressTest()) {
        MessageDialog.openInformation(window.getShell(), Messages.Stresstest,
                Messages.StresstestInPreferencesDisallowed);
        return null;
    }
    selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();

    if (selection != null & selection instanceof IStructuredSelection) {
        IStructuredSelection strucSelection = (IStructuredSelection) selection;
        for (Iterator<Object> iterator = strucSelection.iterator(); iterator.hasNext();) {
            Object element = iterator.next();
        }
    }
    try {
        tv = (TextView) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().showView(TextView.ID);
    } catch (PartInitException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    stressTestAction.run();
    return null;
}

From source file:ch.novcom.elexis.mednet.plugin.ui.commands.ContactLinkRecordEdit.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    try {/*from www . j ava 2 s  . com*/

        // get the parameter
        String param = event.getParameter(ContactLinkRecordEdit.PARAMETERID);

        PersistentObject contactLinkRecord = (PersistentObject) event.getCommand()
                .getParameterType(ContactLinkRecordEdit.PARAMETERID).getValueConverter().convertToObject(param);
        String objString = event.getCommand().getParameterType(ContactLinkRecordEdit.PARAMETERID)
                .getValueConverter().convertToString(param);

        // create and open the dialog with the parameter
        Shell parent = HandlerUtil.getActiveShell(event);

        MessageDialog.openInformation(parent, "Parameter", param);
        if (objString != null) {
            MessageDialog.openInformation(parent, "Parameter as String", objString);
        }

        ContactLinkRecordEditDialog dialog = new ContactLinkRecordEditDialog(parent,
                (ContactLinkRecord) contactLinkRecord);
        dialog.open();
    } catch (Exception ex) {
        throw new RuntimeException(ContactLinkRecordEdit.COMMANDID, ex);
    }
    return null;
}

From source file:ch.ntb.inf.deep.eclipse.ui.view.FPRView.java

License:Apache License

public void showMessage(String message) {
    MessageDialog.openInformation(viewer.getControl().getShell(), "Floating Point Registers", message);
}

From source file:ch.unibe.iam.scg.archie.actions.OpenStatisticsPerspective.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  ww  .  j av a 2s . c om
 * @param action
 * 
 * @see IWorkbenchWindowActionDelegate#run
 */
public void run(final IAction action) {
    try {
        this.window.getWorkbench().showPerspective(StatisticsPerspective.ID, this.window);
    } catch (WorkbenchException e) {
        MessageDialog.openInformation(this.window.getShell(), ArchieActivator.PLUGIN_NAME,
                "Error while opening the statistics perspective.");
    }
}

From source file:ch.wess.ezclipse.communication.properties.internal.CommunicationPage.java

License:Open Source License

/**
 * Create the GUI.//ww  w.ja v a 2 s . co m
 * 
 * @param parent
 */
@Override
protected Control createContents(final Composite parent) {
    IAdaptable element = getElement();
    project = (IProject) element.getAdapter(IProject.class);

    Composite panel = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    panel.setLayout(layout);
    Group soapGroup = new Group(panel, SWT.NULL);
    soapGroup.setText(Messages.getString("CommunicationPage.0")); //$NON-NLS-1$
    soapGroup.setBounds(25, 25, 520, 300);

    // URL label
    final Label labelUrl = new Label(soapGroup, SWT.NULL);
    labelUrl.setBounds(25, 25, 70, 20);
    labelUrl.setText("URL :"); //$NON-NLS-1$

    // URL text field
    textUrl = new Text(soapGroup, SWT.SINGLE | SWT.LEFT);
    textUrl.setBounds(125, 25, 450, 20);

    // Login label
    final Label labelLogin = new Label(soapGroup, SWT.NULL);
    labelLogin.setBounds(25, 55, 100, 20);
    labelLogin.setText(Messages.getString("CommunicationPage.1")); //$NON-NLS-1$

    // Login text field
    textLogin = new Text(soapGroup, SWT.SINGLE | SWT.LEFT);
    textLogin.setBounds(125, 55, 250, 20);

    // Password label
    final Label labelPass = new Label(soapGroup, SWT.NULL);
    labelPass.setBounds(25, 85, 100, 20);
    labelPass.setText(Messages.getString("CommunicationPage.2")); //$NON-NLS-1$

    // Password text field
    textPass = new Text(soapGroup, SWT.SINGLE | SWT.LEFT | SWT.PASSWORD);
    textPass.setBounds(125, 85, 250, 20);

    final Button buttonCheck = new Button(soapGroup, SWT.CENTER);
    buttonCheck.setBounds(25, 115, 250, 30);
    buttonCheck.setText(Messages.getString("CommunicationPage.3")); //$NON-NLS-1$
    buttonCheck.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ISoapCommunication ezComm = CommunicationActivator.getNewCommunication();
            boolean result = ezComm.testConnection(textUrl.getText(), textLogin.getText(), textPass.getText());
            if (result)
                MessageDialog.openInformation(parent.getShell(), Messages.getString("CommunicationPage.4"), //$NON-NLS-1$
                        ezComm.getErrorMessage());
            else
                MessageDialog.openError(parent.getShell(), Messages.getString("CommunicationPage.5"), ezComm //$NON-NLS-1$
                        .getErrorMessage());
        }
    });

    restoreValues();
    return panel;
}

From source file:clustere.dialogs.ChangeNetworkDialog.java

License:Open Source License

/**
 * //from w ww  .  java  2 s .c o m
 */
public void getRandomNetwork() {
    if (Paramater.NETWORK_STYLE == 2) {
        MessageDialog.openInformation(null, "warning", "current network is a random network!");
        return;
    }
    if (GraphInfo.tempEdges.size() == 0) {
        GraphInfo.tempEdges.addAll(GraphInfo.edgelist);
    }
    int size = GraphInfo.tempEdges.size(); //
    int count = GraphInfo.nodelist.size(); //
    Vector<Edge> edges = new Vector<Edge>();
    Random random = new Random();
    for (int i = 0; i < size; i++) {
        Node n1 = GraphInfo.nodelist.get(random.nextInt(count));
        Node n2 = GraphInfo.nodelist.get(random.nextInt(count));
        Edge edge = new Edge(n1, n2);
        edges.add(edge);
    }
    GraphInfo.edgelist.clear();
    GraphInfo.edgelist.addAll(edges);
    MessageDialog.openInformation(null, "success", "successfully get a random protein network!");
    Paramater.NETWORK_STYLE = 2;
    update();
}

From source file:clustere.dialogs.ChangeNetworkDialog.java

License:Open Source License

/**
 * //  w ww  . j  a v  a2 s  .co m
 */
public void getOriginalNetwork() {
    if (Paramater.NETWORK_STYLE == 1) {
        MessageDialog.openInformation(null, "warning", "current network is the orginal network!");
        return;
    }
    GraphInfo.edgelist.clear();
    GraphInfo.edgelist.addAll(GraphInfo.tempEdges);
    MessageDialog.openInformation(null, "success", "successfully get a original network!");
    Paramater.NETWORK_STYLE = 1;
    update();
}

From source file:clustere.dialogs.ChangeNetworkDialog.java

License:Open Source License

/**
 *   /*from w ww .  j  a  v a2s  . c om*/
 */
public void getIncreasedNetwork() {
    float a = 0;
    try {
        a = Float.parseFloat(text1.getText());
    } catch (Exception e) {
        MessageDialog.openInformation(null, "error", "Number format exception!");
        return;
    }
    Paramater.NETWORK_EXPAND_PERCENT = a;
    if (GraphInfo.tempEdges.size() == 0) {
        GraphInfo.tempEdges.addAll(GraphInfo.edgelist);
    }
    int size = GraphInfo.tempEdges.size();
    size = (int) ((a / (float) 100) * size);
    int count = GraphInfo.nodelist.size();
    Vector<Edge> edges = new Vector<Edge>();
    Random random = new Random();
    edges.addAll(GraphInfo.tempEdges);
    for (int i = 0; i < size;) {
        Node n1 = GraphInfo.nodelist.get(random.nextInt(count));
        Node n2 = GraphInfo.nodelist.get(random.nextInt(count));
        //   if(GraphInfo.edgemap.get(n1.getNodeID()+n2.getNodeID())!=null){
        //      continue;
        //   }else{
        Edge edge = new Edge(n1, n2);
        edges.add(edge);
        i++;
        //   }
    }
    GraphInfo.edgelist.clear();
    GraphInfo.edgelist.addAll(edges);
    MessageDialog.openInformation(null, "success", "successfully get a increased network!");
    Paramater.NETWORK_STYLE = 3;
    update();
    System.out.println("increased******************" + GraphInfo.edgelist.size());
}