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

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

Introduction

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

Prototype

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

Source Link

Document

Convenience method to open a standard warning dialog.

Usage

From source file:com.example.app.bootstrapper.ApplicationWorkbenchAdvisor.java

License:Open Source License

public String getInitialWindowPerspectiveId() {
    String perspectiveId = System.getProperty("initialWindowPerspectiveId");
    if (getWorkbenchConfigurer().getWorkbench().getPerspectiveRegistry()
            .findPerspectiveWithId(perspectiveId) != null) {
        return perspectiveId;
    } else {// w w w.jav  a2 s .  c om
        MessageDialog.openWarning(null, "Startup Warning",
                "The initial perspective has either not been specified or is not valid.");
        return null;
    }
}

From source file:com.fiorano.services.feeder.cps.MessagePropertiesPage.java

License:Open Source License

private void validateXML() {

        try {//w w w .j a  va  2  s  .c o  m
            if (newConfiguration.getMessageFormat() == FeederPM.XML) {
                if (!(controller.getSchemaDefinition() == null)) {
                    if (validateXML(defaultMsg.getText(), controller.getSchemaDefinition())) {
                        MessageDialog.openInformation(getShell(), Messages_Feeder.MessagePropertiesPage_44,
                                Messages_Feeder.MessagePropertiesPage_44);
                    }
                }
            }
        } catch (Exception e1) {
            MessageDialog.openWarning(getShell(), Messages_Feeder.MessagePropertiesPage_46, e1.getMessage());
        }
    }

From source file:com.flagleader.builder.BuilderManager.java

public void showWarning(String paramString) {
    MessageDialog.openWarning(getShell(), ResourceTools.getMessage("warning.dialog"), paramString);
}

From source file:com.generalrobotix.ui.GrxPluginManager.java

License:Open Source License

/**
 * @brief/*from  ww  w.ja  v a2s .c om*/
 * @param m
 * @param e
 */
private void showExceptionTrace(String m, Exception e) {
    GrxDebugUtil.printErr(m, e);

    Throwable cause = e.getCause();
    StackTraceElement[] trace = null;
    String msg = m + "\n\n"; //$NON-NLS-1$
    if (cause != null) {
        msg = cause.toString() + "\n\n"; //$NON-NLS-1$
        trace = cause.getStackTrace();
    } else {
        trace = e.getStackTrace();
    }

    for (int i = 0; i < trace.length; i++) {
        msg += "at " + trace[i].getClassName() + "." + trace[i].getMethodName() + "("; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

        if (trace[i].isNativeMethod()) {
            msg += "(Native Method)\n"; //$NON-NLS-1$
        } else if (trace[i].getFileName() == null) {
            msg += "(No source code)\n"; //$NON-NLS-1$
        } else {
            msg += trace[i].getFileName() + ":" + trace[i].getLineNumber() + ")\n"; //$NON-NLS-1$ //$NON-NLS-2$
        }
    }
    MessageDialog.openWarning(null, "Exception Occered", msg); //$NON-NLS-1$
}

From source file:com.generalrobotix.ui.item.GrxModelItem.java

License:Open Source License

private boolean registerCharacter() {
    manager_.focusedItem(null);//from   w  ww . j  a  va  2s. c om
    manager_.setSelectedItem(this, false);
    bgRoot_.detach();
    bgRoot_ = new BranchGroup();
    bgRoot_.setCapability(BranchGroup.ALLOW_DETACH);
    bgRoot_.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
    bgRoot_.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
    bgRoot_.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);

    LinkInfo[] linkInfoList = bInfo_.links();

    // delete existing model data
    if (rootLink() != null) {
        rootLink().delete();
    }

    for (int i = 0; i < cameraList_.size(); i++) {
        cameraList_.get(i).destroy();
    }
    cameraList_.clear();

    int jointCount = 0;
    nameToLink_.clear();

    int massZeroLink = -1;
    for (int i = 0; i < linkInfoList.length; i++) {
        GrxLinkItem link = new GrxLinkItem(linkInfoList[i].name, manager_, this, linkInfoList[i]);
        manager_.itemChange(link, GrxPluginManager.ADD_ITEM);
        if (link.jointId_ >= 0) {
            jointCount++;
        }
        nameToLink_.put(link.getName(), link);
        if (linkInfoList[i].mass <= 0.0)
            massZeroLink = i;
    }
    if (massZeroLink >= 0)
        MessageDialog.openWarning(null, getName(), linkInfoList[massZeroLink].name + "::"
                + MessageBundle.get("GrxModelItem.dialog.message.massZero"));
    System.out.println("links_.size() = " + links_.size()); //$NON-NLS-1$

    // Search root node.
    int rootIndex = -1;
    for (int i = 0; i < links_.size(); i++) {
        if (links_.get(i).parentIndex_ < 0) {
            if (rootIndex < 0) {
                rootIndex = i;
            } else {
                System.out.println("Error. Two or more root node exist."); //$NON-NLS-1$
            }
        }
    }
    if (rootIndex < 0) {
        System.out.println("Error, root node doesn't exist."); //$NON-NLS-1$
    }

    createLink(rootIndex);

    jointToLink_ = new int[jointCount];
    for (int i = 0; i < jointCount; i++) {
        for (int j = 0; j < links_.size(); j++) {
            if (links_.get(j).jointId_ == i) {
                jointToLink_[i] = j;
            }
        }
    }

    ExtraJointInfo[] extraJointList = bInfo_.extraJoints();
    extraJoints_.clear();
    for (int i = 0; i < extraJointList.length; i++) {
        GrxExtraJointItem extraJoint = new GrxExtraJointItem(extraJointList[i].name, manager_, this,
                extraJointList[i]);
        extraJoints_.add(extraJoint);
        manager_.itemChange(extraJoint, GrxPluginManager.ADD_ITEM);
    }

    long stime = System.currentTimeMillis();
    try {
        _loadVrmlScene(linkInfoList);
    } catch (BadLinkStructureException e) {
        e.printStackTrace();
        return false;
    }
    long etime = System.currentTimeMillis();
    System.out.println("_loadVrmlScene time = " + (etime - stime) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$

    calcForwardKinematics();
    updateInitialTransformRoot();
    updateInitialJointValues();

    _setupMarks();
    setProperty("isRobot", Boolean.toString(isRobot_)); //$NON-NLS-1$
    for (int i = 0; i < links_.size(); i++) {
        GrxLinkItem l = links_.get(i);
        if (!l.jointType_.equals("fixed")) {
            setProperty(l.getName() + ".mode", "Torque"); //$NON-NLS-1$
            l.setProperty("mode", "Torque");
        }
    }

    manager_.setSelectedItem(this, true);
    cancelModified();
    return true;
}

From source file:com.generalrobotix.ui.view.Grx3DView.java

License:Open Source License

public void saveScreenShot(File file) {
    if (file == null)
        return;//from  ww w.  j  a  v a 2s  .c  o m

    //onScreen?
    Raster raster = null;
    // ?? : type int, Alpha:8bit, R:8bit, G:8bit, B:8bit
    BufferedImage bimageRead = new BufferedImage(canvas_.getWidth(), canvas_.getHeight(),
            BufferedImage.TYPE_INT_RGB);
    ImageComponent2D readImage = new ImageComponent2D(ImageComponent.FORMAT_RGB, bimageRead);
    // ??
    raster = new Raster(new Point3f(0.0f, 0.0f, 0.0f), Raster.RASTER_COLOR, 0, 0, bimageRead.getWidth(),
            bimageRead.getHeight(), readImage, null
    //readDepthFloat
    //readDepthInt
    );
    //raster.setCapability(Raster.ALLOW_DEPTH_COMPONENT_READ);
    raster.setCapability(Raster.ALLOW_IMAGE_READ);
    canvas_.getGraphicsContext3D().readRaster(raster);
    // ??
    BufferedImage image = raster.getImage().getImage();

    /*
    //offScreen?
    if(imageChooser_.showSaveDialog(GUIManager.this) == JFileChooser.APPROVE_OPTION ){
    //
    recordingMgr_ = RecordingManager.getInstance();   // ?
    recordingMgr_.setView(viewer_[currentViewer_].getDrawable());
    //
    ImageCamera camera = recordingMgr_.getImageCamera();
    //
    Dimension d = viewer_[currentViewer_].getCanvas3D().getSize();
    camera.setSize(d.width,d.height);
    //??
    java.awt.image.BufferedImage image = camera.getImage();
    */

    //?
    try {
        javax.imageio.ImageIO.write(image, "PNG", file); //$NON-NLS-1$
    } catch (IOException ex) {
        // ???SWT?EDT????SWT.syncExec()???????????
        MessageDialog.openWarning(getParent().getShell(), "", MessageBundle.get("message.ioexception")); //$NON-NLS-1$ //$NON-NLS-2$
    }
}

From source file:com.generalrobotix.ui.view.GrxServerManagerView.java

License:Open Source License

private boolean checkID(String id) {
    if (id.isEmpty()) {
        MessageDialog.openWarning(composite_.getShell(),
                MessageBundle.get("GrxServerManagerView.dialog.title.warning"), //$NON-NLS-1$
                MessageBundle.get("GrxServerManagerView.dialog.message.emptyID")); //$NON-NLS-1$
        return false;
    }//  w  w  w.j a  v a2  s  .  c om
    boolean ret = true;
    String localID = id.toUpperCase();
    for (TabItem i : vecTabItem_) {
        String srcStr = i.getText().toUpperCase();
        if (srcStr.equals(localID)) {
            ret = false;
            MessageDialog.openWarning(composite_.getShell(),
                    MessageBundle.get("GrxServerManagerView.dialog.title.warning"), //$NON-NLS-1$
                    MessageBundle.get("GrxServerManagerView.dialog.message.sameID")); //$NON-NLS-1$
            break;
        }
    }
    return ret;
}

From source file:com.gigaspaces.azure.runnable.NewHostedServiceWithProgressWindow.java

License:Open Source License

@Override
public void run() {
    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    try {//w ww .  j  a v  a2  s .c  om
        dialog.run(true, true, this);
        dialog.close();
    } catch (InvocationTargetException e) {
        MessageUtil.displayErrorDialog(shell,
                com.gigaspaces.azure.wizards.Messages.createHostedServiceFailedMsg, e.getMessage());
        Activator.getDefault().log(Messages.error, e);
    } catch (InterruptedException e) {
        MessageDialog.openWarning(shell, Messages.interrupt, Messages.newServiceInterrupted);
        Activator.getDefault().log(Messages.error, e);
    }
}

From source file:com.gigaspaces.azure.runnable.NewStorageAccountWithProgressWindow.java

License:Open Source License

@Override
public void run() {
    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    try {/*from  w w  w .  jav  a  2s .  c o  m*/
        dialog.run(true, true, this);
        dialog.close();
    } catch (InvocationTargetException e) {
        MessageUtil.displayErrorDialog(shell,
                com.gigaspaces.azure.wizards.Messages.createStorageAccountFailedTitle, e.getMessage());
        Activator.getDefault().log(Messages.error, e);
    } catch (InterruptedException e) {
        MessageDialog.openWarning(shell, Messages.interrupt, Messages.newStorageInterrupted);
        Activator.getDefault().log(Messages.error, e);
    }
}

From source file:com.github.ko2ic.plugin.eclipse.taggen.core.ui.components.dialog.AsyncMessageDialog.java

License:Open Source License

public static void openWarning(final Shell shell, final String title, final String msg) {
    shell.getDisplay().asyncExec(new Runnable() {
        @Override//from  w  ww .  j a  v  a2  s.c o m
        public void run() {
            MessageDialog.openWarning(shell, title, msg);
        }
    });
}