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:com.amalto.workbench.editors.RoutingEngineV2BrowserMainPage.java

License:Open Source License

protected WSRoutingOrderV2[] getResults() {

    Cursor waitCursor = null;/*from  w  ww .ja  v  a2  s  . co  m*/

    try {

        Display display = getEditor().getSite().getPage().getWorkbenchWindow().getWorkbench().getDisplay();
        waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
        this.getSite().getShell().setCursor(waitCursor);
        TMDMService service = getMDMService();
        long from = -1;
        long to = -1;
        Pattern pattern = Pattern.compile("^\\d{4}\\d{2}\\d{2} \\d{2}:\\d{2}:\\d{2}$");//$NON-NLS-1$

        if (!BLANK.equals(fromText.getText())) {
            String dateTimeText = fromText.getText().trim();
            Matcher matcher = pattern.matcher(dateTimeText);
            if (!matcher.matches()) {
                MessageDialog.openWarning(this.getSite().getShell(), Messages.Warning,
                        Messages.RoutingEngineV2BrowserMainPage_FormatIllegal);
                return new WSRoutingOrderV2[0];
            }
            try {
                Date d = sdf.parse(fromText.getText());
                from = d.getTime();
            } catch (ParseException pe) {
            }
        }

        if (!BLANK.equals(toText.getText())) {
            String dateTimeText = toText.getText().trim();
            Matcher matcher = pattern.matcher(dateTimeText);
            if (!matcher.matches()) {
                MessageDialog.openWarning(this.getSite().getShell(), Messages.Warning,
                        Messages.RoutingEngineV2BrowserMainPage_FormatIllegal);
                return new WSRoutingOrderV2[0];
            }
            try {
                Date d = sdf.parse(toText.getText());
                to = d.getTime();
            } catch (ParseException pe) {
            }
        }

        long timeCreatedMin = -1;
        long timeCreatedMax = -1;
        long timeScheduledMin = -1;
        long timeScheduledMax = -1;
        long timeLastRunStartedMin = -1;
        long timeLastRunStartedMax = -1;
        long timeLastRunCompletedMin = -1;
        long timeLastRunCompletedMax = -1;
        WSRoutingOrderV2Status status = null;

        String statusText = statusCombo.getItem(statusCombo.getSelectionIndex());
        if ("COMPLETED".equals(statusText)) {//$NON-NLS-1$
            timeLastRunCompletedMin = from;
            timeLastRunCompletedMax = to;
            status = WSRoutingOrderV2Status.COMPLETED;
        } else if ("FAILED".equals(statusText)) {//$NON-NLS-1$
            timeLastRunCompletedMin = from;
            timeLastRunCompletedMax = to;
            status = WSRoutingOrderV2Status.FAILED;
        } else {
            throw new XtentisException(Messages.RoutingEngineV2BrowserMainPage_ExceptionInfo + statusText
                    + Messages.RoutingEngineV2BrowserMainPage_ExceptionInfoA);
        }

        String serviceJNDI = serviceCombo.getItem(serviceCombo.getSelectionIndex());
        if (BLANK.equals(serviceJNDI)) {
            serviceJNDI = null;
        }

        int start = pageToolBar.getStart();
        int limit = pageToolBar.getLimit();
        List<WSRoutingOrderV2> wsRoutingOrder = service.getRoutingOrderV2ByCriteriaWithPaging(
                new WSGetRoutingOrderV2ByCriteriaWithPaging(new WSRoutingOrderV2SearchCriteriaWithPaging("*" //$NON-NLS-1$
                        .equals(anyFieldText.getText()) || BLANK.equals(anyFieldText.getText()) ? null
                                : anyFieldText.getText(),
                        "*".equals(documentTypeText.getText()) || BLANK.equals(documentTypeText.getText()) //$NON-NLS-1$
                                ? null : documentTypeText.getText(),
                        "*".equals(idText.getText()) || BLANK.equals(idText.getText()) ? null //$NON-NLS-1$
                                : idText.getText(),
                        limit, null, null, serviceJNDI, null, start, status, timeCreatedMax, timeCreatedMin,
                        timeLastRunCompletedMax, timeLastRunCompletedMin, timeLastRunStartedMax,
                        timeLastRunStartedMin, timeScheduledMax, timeScheduledMin, true)))
                .getWsRoutingOrder();

        if (wsRoutingOrder.size() == 1) {
            MessageDialog.openInformation(this.getSite().getShell(),
                    Messages.RoutingEngineV2BrowserMainPage_Info,
                    Messages.RoutingEngineV2BrowserMainPage_SorryNoResult);
            return new WSRoutingOrderV2[0];
        }

        int totalSize = Integer.parseInt(wsRoutingOrder.get(0).getName());

        pageToolBar.setTotalsize(totalSize);
        pageToolBar.refreshUI();

        WSRoutingOrderV2[] resultOrderV2s = new WSRoutingOrderV2[wsRoutingOrder.size() - 1];
        System.arraycopy(wsRoutingOrder.toArray(new WSRoutingOrderV2[0]), 1, resultOrderV2s, 0,
                resultOrderV2s.length);

        return resultOrderV2s;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        if ((e.getLocalizedMessage() != null) && e.getLocalizedMessage().contains("10000")) {
            MessageDialog.openError(this.getSite().getShell(),
                    Messages.RoutingEngineV2BrowserMainPage_TooManyResults,
                    Messages.RoutingEngineV2BrowserMainPage_ErrorMsg1);
        } else if (!Util.handleConnectionException(this.getSite().getShell(), e, null)) {
            MessageDialog.openError(this.getSite().getShell(), Messages.ErrorTitle1, e.getLocalizedMessage());
        }
        return null;
    } finally {
        try {
            this.getSite().getShell().setCursor(null);
            if (waitCursor != null) {
                waitCursor.dispose();
            }
        } catch (Exception e) {
            // do nothing
        }
    }

}

From source file:com.amalto.workbench.editors.ViewMainPage.java

License:Open Source License

@Override
public void doSave(IProgressMonitor monitor) {
    super.doSave(monitor);
    if (this.viewName != null && this.viewName.length() > 0) {
        if (viewName.matches("Browse_items.*")) {//$NON-NLS-1$
            // lastDataModelName=XpathSelectDialog.getDataModelName();
            String concept = viewName.replaceAll("Browse_items_", "").replaceAll("#.*", "");//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
            java.util.List<String> avaiList = getAvailableDataModel();
            if (avaiList.size() > 0) {
                lastDataModelName = avaiList.get(0);
            }//from  w  w w  .  j av a 2  s.  c om
            if (concept != null && concept.length() > 0 && lastDataModelName != null
                    && lastDataModelName.length() > 0) {
                // if(concept!=null&&concept.length()>0&&lastDataModelName!=null&&lastDataModelName.length()>0){

                // keys validate
                java.util.List<String> toAddViewableList = new ArrayList<String>();

                WSGetBusinessConceptKey wsGetBusinessConceptKey = new WSGetBusinessConceptKey(concept,
                        new WSDataModelPK(lastDataModelName));
                WSConceptKey wsConceptKey = null;
                try {
                    wsConceptKey = getBusinessConceptKey(wsGetBusinessConceptKey);
                } catch (XtentisException e) {
                    log.error(e.getMessage(), e);
                }

                if (wsConceptKey != null) {

                    java.util.List<String> viewableList = new ArrayList<String>();
                    java.util.List<Line> vlines = (java.util.List<Line>) viewableViewer.getViewer().getInput();
                    for (int j = 0; j < vlines.size(); j++) {
                        Line item = vlines.get(j);
                        viewableList.add(item.keyValues.get(0).value);
                    }

                    java.util.List<String> keys = wsConceptKey.getFields();
                    for (int i = 0; i < keys.size(); i++) {
                        if (".".equals(wsConceptKey.getSelector())) {
                            keys.set(i, "/" + concept + "/" + keys.get(i));//$NON-NLS-1$//$NON-NLS-2$
                        } else {
                            keys.set(i, wsConceptKey.getSelector() + keys.get(i));
                        }
                    }

                    java.util.List<String> ids = wsConceptKey.getFields();
                    for (String id : ids) {

                        // need to care about more case
                        if (id.startsWith("/")) {//$NON-NLS-1$
                            id = id.substring(1);
                        } else if (id.startsWith("//")) {//$NON-NLS-1$
                            id = id.substring(2);
                        }

                        if (!viewableList.contains(id)) {
                            toAddViewableList.add(0, id);
                        }
                    }
                }
                // show verify report
                if (toAddViewableList.size() > 0) {

                    String msg = Messages.ViewMainPage_Msg;
                    for (Object element : toAddViewableList) {
                        String toAddItem = (String) element;
                        msg += (toAddItem + "\n"); //$NON-NLS-1$
                    }
                    msg += Messages.ViewMainPage_Addtions;

                    MessageDialog.openInformation(this.getSite().getShell(), Messages.ViewMainPage_VerifyReport,
                            msg);
                }

                // auto fix
                IRunnableWithProgress autoFixProcess = new AutoFixProgress(toAddViewableList, viewableViewer,
                        this.getSite().getShell());

                try {
                    new ProgressMonitorDialog(this.getSite().getShell()).run(false, true, autoFixProcess);
                } catch (InvocationTargetException e) {
                    log.error(e.getMessage(), e);
                } catch (InterruptedException e) {
                    log.error(e.getMessage(), e);
                }

            }
        }
    }

}

From source file:com.amalto.workbench.widgets.ComplexTableViewer.java

License:Open Source License

protected void createRightmostPortion(Composite parent) {
    addButton = toolkit.createButton(parent, "", SWT.PUSH | SWT.CENTER);//$NON-NLS-1$
    addButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
    addButton.setImage(ImageCache.getCreatedImage(EImage.ADD_OBJ.getPath()));
    addButton.setToolTipText(Messages.ComplexTableViewer_Add);
    addButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        };/*from  w  ww  .j  a va 2 s. c om*/

        @SuppressWarnings("unchecked")
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {

            String uniqueVal = "";//$NON-NLS-1$
            String keyVal = "";//$NON-NLS-1$
            // Make sure texts are not nill (empty) where not authorized
            for (ComplexTableViewerColumn column : columns) {
                String text = "";//$NON-NLS-1$
                if (column.isCombo()) {
                    text = ((CCombo) column.getControl()).getText();
                } else if (column.isText()) {
                    text = ((Text) column.getControl()).getText();
                } else if (column.isXPATH()) {
                    Control text1 = ((Composite) column.getControl()).getChildren()[0];
                    if (text1 instanceof Text) {
                        text = ((Text) text1).getText();
                    }
                }
                if (text.length() == 0) {
                    if (column.isNillable()) {
                        text = column.getNillValue();
                        if (column.isCombo()) {
                            ((CCombo) column.getControl()).setText(text);
                        } else {
                            ((Text) column.getControl()).setText(text);
                        }
                    } else {
                        MessageDialog.openError(ComplexTableViewer.this.getViewer().getControl().getShell(),
                                Messages.ComplexTableViewer_InputError, Messages.ComplexTableViewer_ErrorMsg
                                        + column.getName() + Messages.ComplexTableViewer_ErrorMsgA);
                        return;
                    }
                }
                if (keyColumns != null && Arrays.asList(keyColumns).indexOf(column) >= 0) {
                    keyVal += text;
                }
                uniqueVal += "." + text;//$NON-NLS-1$
            }

            // check uniqueness by concatenating all the values
            List<Line> list = (List<Line>) getViewer().getInput();
            for (Line line : list) {
                String thisLineVal = "";//$NON-NLS-1$
                for (KeyValue keyvalue : line.keyValues) {
                    thisLineVal += "." + keyvalue.value;//$NON-NLS-1$
                }
                if (thisLineVal.equals(uniqueVal)
                        || (keyVal.length() > 0 && thisLineVal.indexOf(keyVal) >= 0)) {
                    MessageDialog.openInformation(null, ERROR_ITEMALREADYEXISTS_TITLE,
                            ERROR_ITEMALREADYEXISTS_CONTENT);
                    return;
                }
            }

            // Update the model
            Line line = new Line(columns.toArray(new ComplexTableViewerColumn[columns.size()]),
                    getTextValues());
            list.add(line);
            // update the instances viewer
            markDirty();
            viewer.setSelection(null);
            viewer.refresh();
            viewer.getTable().select(viewer.getTable().getItemCount() - 1);
        };
    });
}

From source file:com.amazonaws.eclipse.core.diagnostic.ui.AwsToolkitErrorSupportProvider.java

License:Apache License

private static void showSuccessDialog(Shell parentShell) {
    MessageDialog.openInformation(parentShell, "Successfully sent error report",
            "Thanks for reporting the error. " + "Our team will investigate this as soon as possible.");
}

From source file:com.amazonaws.eclipse.lambda.project.wizard.util.LambdaFunctionGroup.java

License:Open Source License

private void onHandlerTypeSelectionChange() {
    final String handlerType = handlerTypeCombo.getText();
    final Object handlerTypeData = handlerTypeCombo.getData(handlerType);

    if (STREAM_REQUEST_HANDLER == handlerTypeData) {
        customHandlerInputTypeText.setEnabled(false);
        enableCustomHandlerInputTypeValidation.setValue(false);

        handlerOutputTypeText.setEnabled(false);
        predefinedHandlerInputCombo.setEnabled(false);

        handlerTypeDescriptionLink.setText(createHandlerTypeDescriptionLink(STREAM_REQUEST_HANDLER));

    } else if (REQUEST_HANDLER == handlerTypeData) {

        String selectedText = predefinedHandlerInputCombo.getText();
        Object selectedData = predefinedHandlerInputCombo.getData(selectedText);

        boolean customHandlerInputTypeTextEnabled = selectedData == CUSTOM_INPUT_TYPE_COMBO_DATA;
        customHandlerInputTypeText.setEnabled(customHandlerInputTypeTextEnabled);
        enableCustomHandlerInputTypeValidation.setValue(customHandlerInputTypeTextEnabled);

        handlerOutputTypeText.setEnabled(true);
        predefinedHandlerInputCombo.setEnabled(true);

        handlerTypeDescriptionLink.setText(createHandlerTypeDescriptionLink(REQUEST_HANDLER));

    } else {//w ww.  ja v  a 2  s .co  m
        LambdaHandlerType lambdaHandlerType = (LambdaHandlerType) handlerTypeData;
        MessageDialog.openInformation(parentWizard.getShell(), "Unsupported handler type combo selection.",
                "The handler type " + handlerType
                        + " is not yet supported in the toolkit! For more information, see "
                        + lambdaHandlerType.getDocUrl() + ".");
        handlerTypeCombo.select(0);
        onHandlerTypeSelectionChange();
    }
}

From source file:com.amazonaws.eclipse.opsworks.deploy.wizard.DeployProjectToOpsworksWizard.java

License:Open Source License

@Override
public boolean performFinish() {

    try {//from ww  w .j  av a 2s . c om
        getContainer().run(true, false, new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {

                monitor.beginTask(
                        "Deploying local project [" + dataModel.getProject().getName() + "] to OpsWorks", 110);

                final String deploymentId = DeployUtils.runDeployment(dataModel, monitor);

                // Open deployment progress tracker (10/110)
                monitor.subTask("Waiting for the deployment to finish...");

                Job trackProgressJob = new Job("Waiting for the deployment to finish") {
                    @Override
                    protected IStatus run(IProgressMonitor monitor) {

                        monitor.beginTask(String.format("Waiting deployment [%s] to finish...", deploymentId),
                                IProgressMonitor.UNKNOWN);

                        String endpoint = dataModel.getRegion().getServiceEndpoints()
                                .get(ServiceAbbreviations.OPSWORKS);
                        AWSOpsWorks client = AwsToolkitCore.getClientFactory()
                                .getOpsWorksClientByEndpoint(endpoint);

                        try {
                            final Deployment deployment = waitTillDeploymentFinishes(client, deploymentId,
                                    monitor);

                            if ("successful".equalsIgnoreCase(deployment.getStatus())) {
                                final App appDetail = client
                                        .describeApps(
                                                new DescribeAppsRequest().withAppIds(deployment.getAppId()))
                                        .getApps().get(0);

                                Display.getDefault().syncExec(new Runnable() {
                                    public void run() {
                                        MessageDialog.openInformation(Display.getDefault().getActiveShell(),
                                                "Deployment success",
                                                String.format("Deployment [%s] succeeded (Instance count: %d). "
                                                        + "The application will be available at %s://{instance-public-endpoint}/%s/",
                                                        deployment.getDeploymentId(),
                                                        deployment.getInstanceIds().size(),
                                                        appDetail.isEnableSsl() ? "https" : "http",
                                                        appDetail.getShortname()));
                                    }
                                });
                                return ValidationStatus.ok();

                            } else {
                                Display.getDefault().syncExec(new Runnable() {
                                    public void run() {
                                        MessageDialog.openError(Display.getDefault().getActiveShell(),
                                                "Deployment failed", "");
                                    }
                                });
                                return ValidationStatus.error("The deployment failed.");
                            }

                        } catch (Exception e) {
                            return ValidationStatus.error("Unable to query the progress of the deployment", e);
                        }
                    }

                    private Deployment waitTillDeploymentFinishes(AWSOpsWorks client, String deploymentId,
                            IProgressMonitor monitor) throws InterruptedException {

                        while (true) {
                            Deployment deployment = client
                                    .describeDeployments(
                                            new DescribeDeploymentsRequest().withDeploymentIds(deploymentId))
                                    .getDeployments().get(0);

                            monitor.subTask(String.format("Instance count: %d, Last status: %s",
                                    deployment.getInstanceIds().size(), deployment.getStatus()));

                            if ("successful".equalsIgnoreCase(deployment.getStatus())
                                    || "failed".equalsIgnoreCase(deployment.getStatus())) {
                                return deployment;
                            }

                            Thread.sleep(5 * 1000);
                        }
                    }
                };

                trackProgressJob.setUser(true);
                trackProgressJob.schedule();

                monitor.worked(10);

                monitor.done();
            }
        });

    } catch (InvocationTargetException e) {
        OpsWorksPlugin.getDefault().reportException("Unexpected error during deployment", e.getCause());

    } catch (InterruptedException e) {
        OpsWorksPlugin.getDefault().reportException("Unexpected InterruptedException during deployment",
                e.getCause());
    }

    return true;
}

From source file:com.amitinside.e4.rcp.todo.handlers.RemoveTodoHandler.java

License:Apache License

@Execute
public void execute(ITodoService model, @Optional @Named(IServiceConstants.ACTIVE_SELECTION) Todo todo,
        @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
    if (todo != null) {
        model.deleteTodo(todo.getId());/*w  ww.j a  va2  s.co m*/
    } else {
        MessageDialog.openInformation(shell, "Deletion not possible", "No todo selected");
    }
}

From source file:com.amitinside.e4.rcp.todo.parts.DynamicPart.java

License:Apache License

@PostConstruct
public void createControls(Composite parent, final Shell shell) {
    button = new Button(parent, SWT.PUSH);
    button.addSelectionListener(new SelectionAdapter() {
        @Override/* w  ww  . jav a  2 s. co m*/
        public void widgetSelected(SelectionEvent e) {
            MessageDialog.openInformation(shell, "Dynamic", "Dynamics are working");
        }
    });
    button.setText("Validate");
}

From source file:com.amzi.prolog.ui.actions.AboutActionDelegate.java

public void run(IAction action) {
    String edition, license, version, amziDir;

    LogicServer ls = new LogicServer();
    try {/*from  w w  w . j a  v  a2s.c  o  m*/
        synchronized (ls) {
            ls.Init("");

            /*//         InetAddress hostname[] = InetAddress.getAllByName( InetAddress.getLocalHost().getHostAddress() );
            //         String computer = hostname[0].getHostName();
                     String computer = "Computer Name: ";
                     try {
                        computer += InetAddress.getLocalHost().getHostName();
                     } catch (UnknownHostException ex) {
                        computer = "unknown";
                     } */

            amziDir = PrologCorePlugin.getAmziDir();
            ls.Load(amziDir + "abin" + System.getProperty("file.separator") + "acmp.xpl");
            version = "Version: " + ls.GetVersion();
            ls.Close();
        }

        license = "Open Source Edition   ";

        MessageDialog.openInformation(shell, "Amzi! Prolog + Logic Server",
                version + "\n" + "Running from AMZI_DIR=" + amziDir + "\n\n" + license);
    } catch (LSException ex) {
        // Always close the LogicServer
        try {
            ls.Close();
            System.gc();
        } catch (LSException ex2) {
        }
        MessageDialog.openError(shell, "Error",
                "AMZI_DIR is not set correctly or is not on your system PATH environment variable.");
    }

}

From source file:com.android.ddmuilib.heap.NativeHeapPanel.java

License:Apache License

/** {@inheritDoc} */
@Override/*from  ww  w  .  j  a  v  a  2s. co m*/
public void clientChanged(final Client client, int changeMask) {
    if (client != getCurrentClient()) {
        return;
    }

    if ((changeMask & Client.CHANGE_NATIVE_HEAP_DATA) != Client.CHANGE_NATIVE_HEAP_DATA) {
        return;
    }

    List<NativeAllocationInfo> allocations = client.getClientData().getNativeAllocationList();
    if (allocations.size() == 0) {
        return;
    }

    // We need to clone this list since getClientData().getNativeAllocationList() clobbers
    // the list on future updates
    final List<NativeAllocationInfo> nativeAllocations = shallowCloneList(allocations);

    addNativeHeapSnapshot(new NativeHeapSnapshot(nativeAllocations));
    updateDisplay();

    // Attempt to resolve symbols in a separate thread.
    // The UI should be refreshed once the symbols have been resolved.
    if (USE_OLD_RESOLVER) {
        Thread t = new Thread(
                new SymbolResolverTask(nativeAllocations, client.getClientData().getMappedNativeLibraries()));
        t.setName("Address to Symbol Resolver");
        t.start();
    } else {
        Display.getDefault().asyncExec(new Runnable() {
            @Override
            public void run() {
                resolveSymbols();
                mDetailsTreeViewer.refresh();
                mStackTraceTreeViewer.refresh();
            }

            public void resolveSymbols() {
                Shell shell = Display.getDefault().getActiveShell();
                ProgressMonitorDialog d = new ProgressMonitorDialog(shell);

                NativeSymbolResolverTask resolver = new NativeSymbolResolverTask(nativeAllocations,
                        client.getClientData().getMappedNativeLibraries(), mSymbolSearchPathText.getText(),
                        client.getClientData().getAbi());

                try {
                    d.run(true, true, resolver);
                } catch (InvocationTargetException e) {
                    MessageDialog.openError(shell, "Error Resolving Symbols", e.getCause().getMessage());
                    return;
                } catch (InterruptedException e) {
                    return;
                }

                MessageDialog.openInformation(shell, "Symbol Resolution Status",
                        getResolutionStatusMessage(resolver));
            }
        });
    }
}