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.android.ide.eclipse.gldebugger.ShaderEditor.java

License:Apache License

void uploadShader() {
    current.source = styledText.getText();

    // optional syntax check by glsl_compiler, built from external/mesa3d
    if (new File("./glsl_compiler").exists())
        try {//from  w  w w. j  av  a 2  s .  c om
            File file = File.createTempFile("shader",
                    current.type == GLEnum.GL_VERTEX_SHADER ? ".vert" : ".frag");
            FileWriter fileWriter = new FileWriter(file, false);
            fileWriter.write(current.source);
            fileWriter.close();

            ProcessBuilder processBuilder = new ProcessBuilder("./glsl_compiler", "--glsl-es",
                    file.getAbsolutePath());
            final Process process = processBuilder.start();
            InputStream is = process.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader br = new BufferedReader(isr);
            String line;
            String infolog = "";

            styledText.setLineBackground(0, styledText.getLineCount(), null);

            while ((line = br.readLine()) != null) {
                infolog += line;
                if (!line.startsWith("0:"))
                    continue;
                String[] details = line.split(":|\\(|\\)");
                final int ln = Integer.parseInt(details[1]);
                if (ln > 0) // usually line 0 means errors other than syntax
                    styledText.setLineBackground(ln - 1, 1, new Color(Display.getCurrent(), 255, 230, 230));
            }
            file.delete();
            if (infolog.length() > 0) {
                if (!MessageDialog.openConfirm(getShell(), "Shader Syntax Error, Continue?", infolog))
                    return;
            }
        } catch (IOException e) {
            mGLFramesView.showError(e);
        }

    // add the initial command, which when read by server will set
    // expectResponse for the message loop and go into message exchange
    synchronized (shadersToUpload) {
        for (GLShader shader : shadersToUpload) {
            if (shader.context.context.contextId != current.context.context.contextId)
                continue;
            MessageDialog.openWarning(this.getShell(),
                    "Context 0x" + Integer.toHexString(current.context.context.contextId),
                    "Previous shader upload not complete, try again");
            return;
        }
        shadersToUpload.add(current);
        final int contextId = current.context.context.contextId;
        Message.Builder builder = getBuilder(contextId);
        MessageParserEx.instance.parse(builder,
                String.format("glShaderSource(%d,1,\"%s\",0)", current.name, current.source));
        mGLFramesView.messageQueue.addCommand(builder.build());
    }
}

From source file:com.android.ide.eclipse.gldebugger.ShaderEditor.java

License:Apache License

public boolean processMessage(final MessageQueue queue, final Message msg) throws IOException {
    GLShader shader = null;/*w w w  .ja va  2 s  . c  o m*/
    final int contextId = msg.getContextId();
    synchronized (shadersToUpload) {
        if (shadersToUpload.size() == 0)
            return false;
        boolean matchingContext = false;
        for (int i = 0; i < shadersToUpload.size(); i++) {
            shader = shadersToUpload.get(i);
            for (Context ctx : shader.context.context.shares)
                if (ctx.contextId == contextId) {
                    matchingContext = true;
                    break;
                }
            if (matchingContext) {
                shadersToUpload.remove(i);
                break;
            }
        }
        if (!matchingContext)
            return false;
    }

    // glShaderSource was already sent to trigger set expectResponse
    assert msg.getType() == Type.AfterGeneratedCall;
    assert msg.getFunction() == Function.glShaderSource;

    exchangeMessage(contextId, queue, "glCompileShader(%d)", shader.name);

    // the 0, "" and {0} are dummies for the parser
    Message rcv = exchangeMessage(contextId, queue, "glGetShaderiv(%d, GL_COMPILE_STATUS, {0})", shader.name);
    assert rcv.hasData();
    if (rcv.getData().asReadOnlyByteBuffer().getInt() == 0) {
        // compile failed
        rcv = exchangeMessage(contextId, queue, "glGetShaderInfoLog(%d, 0, 0, \"\")", shader.name);
        final String title = String.format("Shader %d in 0x%s failed to compile", shader.name,
                Integer.toHexString(shader.context.context.contextId));
        final String message = rcv.getData().toStringUtf8();
        mGLFramesView.getSite().getShell().getDisplay().syncExec(new Runnable() {
            public void run() {
                MessageDialog.openWarning(getShell(), title, message);
            }
        });
    } else
        for (int programName : shader.programs) {
            GLProgram program = shader.context.getProgram(programName);
            exchangeMessage(contextId, queue, "glLinkProgram(%d)", program.name);
            rcv = exchangeMessage(contextId, queue, "glGetProgramiv(%d, GL_LINK_STATUS, {0})", program.name);
            assert rcv.hasData();
            if (rcv.getData().asReadOnlyByteBuffer().getInt() != 0)
                continue;
            // link failed
            rcv = exchangeMessage(contextId, queue, "glGetProgramInfoLog(%d, 0, 0, \"\")", program.name);
            final String title = String.format("Program %d in 0x%s failed to link", program.name,
                    Integer.toHexString(program.context.context.contextId));
            final String message = rcv.getData().toStringUtf8();
            mGLFramesView.getSite().getShell().getDisplay().syncExec(new Runnable() {
                public void run() {
                    MessageDialog.openWarning(getShell(), title, message);
                }
            });
            // break;
        }

    // TODO: add to upload results if failed

    Message.Builder builder = getBuilder(contextId);
    builder.setExpectResponse(false);
    if (queue.getPartialMessage(contextId) != null)
        // the glShaderSource interrupted a BeforeCall, so continue
        builder.setFunction(Function.CONTINUE);
    else
        builder.setFunction(Function.SKIP);
    queue.sendMessage(builder.build());

    return true;
}

From source file:com.android.ide.eclipse.hierarchyviewer.HierarchyViewerPlugin.java

License:Apache License

@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    sPlugin = this;

    // set the consoles.
    final MessageConsole messageConsole = new MessageConsole("Hierarchy Viewer", null); //$NON-NLS-1$
    ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { messageConsole });

    final MessageConsoleStream consoleStream = messageConsole.newMessageStream();
    final MessageConsoleStream errorConsoleStream = messageConsole.newMessageStream();
    mRedColor = new Color(Display.getDefault(), 0xFF, 0x00, 0x00);

    // because this can be run, in some cases, by a non UI thread, and
    // because/*  www.ja  v a  2 s  . c  om*/
    // changing the console properties update the UI, we need to make this
    // change
    // in the UI thread.
    Display.getDefault().asyncExec(new Runnable() {
        @Override
        public void run() {
            errorConsoleStream.setColor(mRedColor);
        }
    });

    // set up the ddms log to use the ddms console.
    Log.setLogOutput(new ILogOutput() {
        @Override
        public void printLog(LogLevel logLevel, String tag, String message) {
            if (logLevel.getPriority() >= LogLevel.ERROR.getPriority()) {
                printToStream(errorConsoleStream, tag, message);
                ConsolePlugin.getDefault().getConsoleManager().showConsoleView(messageConsole);
            } else {
                printToStream(consoleStream, tag, message);
            }
        }

        @Override
        public void printAndPromptLog(final LogLevel logLevel, final String tag, final String message) {
            printLog(logLevel, tag, message);
            // dialog box only run in UI thread..
            Display.getDefault().asyncExec(new Runnable() {
                @Override
                public void run() {
                    Shell shell = Display.getDefault().getActiveShell();
                    if (logLevel == LogLevel.ERROR) {
                        MessageDialog.openError(shell, tag, message);
                    } else {
                        MessageDialog.openWarning(shell, tag, message);
                    }
                }
            });
        }

    });

    final HierarchyViewerDirector director = HierarchyViewerPluginDirector.createDirector();
    director.startListenForDevices();

    // make the director receive change in ADB.
    AndroidDebugBridge.addDebugBridgeChangeListener(new IDebugBridgeChangeListener() {
        @Override
        public void bridgeChanged(AndroidDebugBridge bridge) {
            director.acquireBridge(bridge);
        }
    });

    // get the current ADB if any
    director.acquireBridge(AndroidDebugBridge.getBridge());

    // populate the UI with current devices (if any) in a thread
    new Thread() {
        @Override
        public void run() {
            director.populateDeviceSelectionModel();
        }
    }.start();
}

From source file:com.android.uiautomator.UiAutomatorView.java

License:Apache License

public UiAutomatorView(Composite parent, int style) {
    super(parent, SWT.NONE);
    setLayout(new FillLayout());

    SashForm baseSash = new SashForm(this, SWT.HORIZONTAL);

    mOrginialCursor = getShell().getCursor();
    mCrossCursor = new Cursor(getDisplay(), SWT.CURSOR_CROSS);
    mScreenshotComposite = new Composite(baseSash, SWT.BORDER);
    mStackLayout = new StackLayout();
    mScreenshotComposite.setLayout(mStackLayout);
    // draw the canvas with border, so the divider area for sash form can be highlighted
    mScreenshotCanvas = new Canvas(mScreenshotComposite, SWT.BORDER);
    mStackLayout.topControl = mScreenshotCanvas;
    mScreenshotComposite.layout();//from  w ww.j a va 2 s  . c om

    // set cursor when enter canvas
    mScreenshotCanvas.addListener(SWT.MouseEnter, new Listener() {
        @Override
        public void handleEvent(Event arg0) {
            getShell().setCursor(mCrossCursor);
        }
    });
    mScreenshotCanvas.addListener(SWT.MouseExit, new Listener() {
        @Override
        public void handleEvent(Event arg0) {
            getShell().setCursor(mOrginialCursor);
        }
    });

    mScreenshotCanvas.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseUp(MouseEvent e) {
            if (mModel != null) {
                mModel.toggleExploreMode();
                redrawScreenshot();
            }
            if (e.button == 3) {
                //set menus
                Menu menu = new Menu(mScreenshotCanvas);
                mScreenshotCanvas.setMenu(menu);

                Menu menu1 = new Menu(menu);
                Menu menu2 = new Menu(menu);
                Menu menu3 = new Menu(menu);
                Menu menu4 = new Menu(menu);
                Menu menu5 = new Menu(menu);
                Menu menu6 = new Menu(menu);
                Menu menu7 = new Menu(menu);
                Menu menu8 = new Menu(menu);
                Menu menu9 = new Menu(menu);

                //set items
                MenuItem item1 = new MenuItem(menu, SWT.CASCADE);
                MenuItem item2 = new MenuItem(menu, SWT.CASCADE);
                MenuItem item3 = new MenuItem(menu, SWT.CASCADE);
                MenuItem item4 = new MenuItem(menu, SWT.CASCADE);
                MenuItem item5 = new MenuItem(menu, SWT.CASCADE);
                MenuItem item6 = new MenuItem(menu, SWT.CASCADE);
                MenuItem item7 = new MenuItem(menu, SWT.CASCADE);
                MenuItem item8 = new MenuItem(menu, SWT.CASCADE);
                MenuItem item9 = new MenuItem(menu, SWT.CASCADE);
                MenuItem item43 = new MenuItem(menu, SWT.CASCADE);
                MenuItem item10 = new MenuItem(menu1, SWT.NONE);
                MenuItem item11 = new MenuItem(menu1, SWT.NONE);
                MenuItem item12 = new MenuItem(menu1, SWT.NONE);
                MenuItem item13 = new MenuItem(menu1, SWT.NONE);
                MenuItem item14 = new MenuItem(menu1, SWT.NONE);
                MenuItem item15 = new MenuItem(menu2, SWT.NONE);
                MenuItem item16 = new MenuItem(menu2, SWT.NONE);
                MenuItem item17 = new MenuItem(menu2, SWT.NONE);
                MenuItem item18 = new MenuItem(menu2, SWT.NONE);
                MenuItem item19 = new MenuItem(menu2, SWT.NONE);
                MenuItem item20 = new MenuItem(menu3, SWT.NONE);
                MenuItem item21 = new MenuItem(menu3, SWT.NONE);
                MenuItem item22 = new MenuItem(menu3, SWT.NONE);
                MenuItem item23 = new MenuItem(menu3, SWT.NONE);
                MenuItem item24 = new MenuItem(menu3, SWT.NONE);
                MenuItem item25 = new MenuItem(menu4, SWT.NONE);
                MenuItem item26 = new MenuItem(menu4, SWT.NONE);
                MenuItem item27 = new MenuItem(menu4, SWT.NONE);
                MenuItem item28 = new MenuItem(menu4, SWT.NONE);
                MenuItem item29 = new MenuItem(menu4, SWT.NONE);
                MenuItem item30 = new MenuItem(menu6, SWT.NONE);
                MenuItem item31 = new MenuItem(menu6, SWT.NONE);
                MenuItem item32 = new MenuItem(menu6, SWT.NONE);
                MenuItem item33 = new MenuItem(menu5, SWT.NONE);
                MenuItem item34 = new MenuItem(menu5, SWT.NONE);
                MenuItem item35 = new MenuItem(menu5, SWT.NONE);
                MenuItem item36 = new MenuItem(menu5, SWT.NONE);
                MenuItem item37 = new MenuItem(menu5, SWT.NONE);
                MenuItem item38 = new MenuItem(menu8, SWT.NONE);
                MenuItem item39 = new MenuItem(menu8, SWT.NONE);
                MenuItem item40 = new MenuItem(menu8, SWT.NONE);
                MenuItem item41 = new MenuItem(menu8, SWT.NONE);
                MenuItem item42 = new MenuItem(menu8, SWT.NONE);
                MenuItem item44 = new MenuItem(menu6, SWT.NONE);
                //set item text
                item1.setText("Click");
                item2.setText("Click(Refresh)");
                item3.setText("longClick");
                item4.setText("longClick(Refresh)");
                item5.setText("editText");
                item6.setText("SystemCommand");
                item7.setText("SystemCommand(Refresh)");
                item43.setText("Sleep");
                item8.setText("Check");
                item9.setText("Find");
                item10.setText("id");
                item11.setText("text");
                item12.setText("desc");
                item13.setText("class");
                item14.setText("xpath");
                item15.setText("id");
                item16.setText("text");
                item17.setText("desc");
                item18.setText("class");
                item19.setText("xpath");
                item20.setText("id");
                item21.setText("text");
                item22.setText("desc");
                item23.setText("class");
                item24.setText("xpath");
                item25.setText("id");
                item26.setText("text");
                item27.setText("desc");
                item28.setText("class");
                item29.setText("xpath");
                item30.setText("Home");
                item31.setText("Back");
                item32.setText("Power");
                item33.setText("id");
                item34.setText("text");
                item35.setText("desc");
                item36.setText("class");
                item37.setText("xpath");
                item38.setText("id");
                item39.setText("text");
                item40.setText("desc");
                item41.setText("class");
                item42.setText("xpath");
                item44.setText("Other");
                //bind menu
                item1.setMenu(menu1);
                //item2.setMenu(menu2);
                item3.setMenu(menu3);
                //item4.setMenu(menu4);
                item5.setMenu(menu5);
                item6.setMenu(menu6);
                //item7.setMenu(menu7);
                item8.setMenu(menu8);
                //item9.setMenu(menu9);                           

                //add item listener
                //click item10-14
                item10.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByAction(item10.getText(), item1.getText());
                        chargeText(script);
                        //scriptTextarea.setText(script);                        
                    }
                });

                item11.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByAction(item11.getText(), item1.getText());
                        chargeText(script);

                    }
                });
                item12.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByAction(item12.getText(), item1.getText());
                        chargeText(script);
                    }
                });
                item13.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByAction(item13.getText(), item1.getText());
                        chargeText(script);
                    }
                });
                item14.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByAction(item14.getText(), item1.getText());
                        chargeText(script);
                    }
                });

                //click(refresh) item15-19

                item2.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        objectClick(item2.getText(), "");
                        UiAutomatorViewer window = UiAutomatorViewer.getInstance();
                        ScreenshotAction screenshot = new ScreenshotAction(window, false);
                        screenshot.run();
                    }
                });

                //longclick item20-24
                item20.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByAction(item20.getText(), item3.getText());
                        chargeText(script);
                    }
                });
                item21.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByAction(item21.getText(), item3.getText());
                        chargeText(script);
                    }
                });
                item22.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByAction(item22.getText(), item3.getText());
                        chargeText(script);
                    }
                });
                item23.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByAction(item23.getText(), item3.getText());
                        chargeText(script);
                    }
                });
                item24.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByAction(item24.getText(), item3.getText());
                        chargeText(script);
                    }
                });

                //longclick(refresh)
                item4.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        objectClick(item4.getText(), "");
                        UiAutomatorViewer window = UiAutomatorViewer.getInstance();
                        ScreenshotAction screenshot = new ScreenshotAction(window, false);
                        screenshot.run();
                    }

                });

                //edittext item33-37
                item33.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        InputDialog dialog = new InputDialog(getShell(), "please input id", "please input",
                                null, null);
                        if (dialog.open() == InputDialog.OK) {
                            String script = getScriptByValue(item33.getText(), dialog.getValue());
                            chargeText(script);
                        }
                    }
                });
                item34.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        InputDialog dialog = new InputDialog(getShell(), "please input text", "please input",
                                null, null);
                        if (dialog.open() == InputDialog.OK) {
                            String script = getScriptByValue(item34.getText(), dialog.getValue());
                            chargeText(script);
                        }
                    }
                });
                item35.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        InputDialog dialog = new InputDialog(getShell(), "please input desc", "please input",
                                null, null);
                        if (dialog.open() == InputDialog.OK) {
                            String script = getScriptByValue(item35.getText(), dialog.getValue());
                            chargeText(script);
                        }
                    }
                });
                item36.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        InputDialog dialog = new InputDialog(getShell(), "please input class", "please input",
                                null, null);
                        if (dialog.open() == InputDialog.OK) {
                            String script = getScriptByValue(item36.getText(), dialog.getValue());
                            chargeText(script);
                        }
                    }
                });
                item37.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        InputDialog dialog = new InputDialog(getShell(), "please input xpath", "please input",
                                null, null);
                        if (dialog.open() == InputDialog.OK) {
                            String script = getScriptByValue(item37.getText(), dialog.getValue());
                            chargeText(script);
                        }
                    }
                });
                //systemcommand
                item30.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByCommand(item30.getText(), "3");
                        chargeText(script);
                    }
                });
                item31.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByCommand(item31.getText(), "4");
                        chargeText(script);
                    }
                });
                item32.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        String script = getScriptByCommand(item32.getText(), "26");
                        chargeText(script);
                    }
                });
                item44.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        InputDialog dialog = new InputDialog(getShell(), "please input text", "please input",
                                null, null);
                        if (dialog.open() == InputDialog.OK && dialog.getValue() != "") {
                            String script = getScriptByCommand(item44.getText(), dialog.getValue());
                            chargeText(script);
                        } else {
                            //MessageDialog mdialog=new MessageDialog(getShell(), null, null, "please enter text", MessageDialog.WARNING, null, MessageDialog.WARNING);
                            //mdialog.open();
                            dialog.open();
                        }
                    }
                });

                //systemcommand(refresh)
                item7.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        InputDialog dialog = new InputDialog(getShell(), "please input keyevent",
                                "please input", null, null);
                        if (dialog.open() == InputDialog.OK) {
                            objectClick(item7.getText(), dialog.getValue());
                            UiAutomatorViewer window = UiAutomatorViewer.getInstance();
                            ScreenshotAction screenshot = new ScreenshotAction(window, false);
                            screenshot.run();
                        }
                    }
                });
            }
        }

        private String getRes(String res) {
            String Res = ((UiNode) mModel.getSelectedNode()).getAttribute(res);
            return Res;

        }

        private String getScriptByAction(String id, String ac) {
            // TODO Auto-generated methoad stub
            String script = "driver";
            String res = "";
            switch (id) {
            case "id":
                res = getRes("resource-id");
                script += ".findElementById(\"" + res + "\").";
                script += chargeAction(ac);
                break;
            case "text":
                res = getRes("text");
                script += ".findElementByText(\"" + res + "\").";
                script += chargeAction(ac);
                break;
            case "class":
                res = getRes("class");
                script += ".findElementByClassName(\"" + res + "\").";
                script += chargeAction(ac);
                break;
            case "desc":
                res = getRes("content-desc");
                script += ".findElementByContent(\"" + res + "\").";
                script += chargeAction(ac);
                break;
            case "xpath":
                res = getRes("xpath");
                script += ".findElementByXpath(\"" + res + "\").";
                script += chargeAction(ac);
                break;
            }
            return script;
        }

        private String getScriptByCommand(String id, String value) {
            String script = "driver";
            switch (id) {
            case "Home":
                script += ".sendKeys(\"" + value + "\")";
                break;
            case "Back":
                script += ".sendKeys(\"" + value + "\")";
                break;
            case "Power":
                script += ".sendKeys(\"" + value + "\")";
                break;
            case "Other":
                script += ".sendKeys(\"" + value + "\")";
                break;
            }
            return script;
        }

        private String getScriptByValue(String id, String value) {
            // TODO Auto-generated method stub
            String script = "driver";
            String res = "";
            switch (id) {
            case "id":
                res = getRes("resource-id");
                script += ".findElementById(\"" + res + "\").sendKeys(\"" + value + "\")";
                break;
            case "text":
                res = getRes("text");
                script += ".findElementByText(\"" + res + "\").sendKeys(\"" + value + "\")";
                break;
            case "class":
                res = getRes("class");
                script += ".findElementByClassName(\"" + res + "\").sendKeys(\"" + value + "\")";
                break;
            case "desc":
                res = getRes("content-desc");
                script += ".findElementByContent(\"" + res + "\").sendKeys(\"" + value + "\")";
                break;
            case "xpath":
                res = getRes("xpath");
                script += ".findElementByXpath(\"" + res + "\").sendKeys(\"" + value + "\")";
                break;
            }
            return script;
        }

        private String chargeAction(String ac) {
            String ca = "";
            switch (ac) {
            case "Click":
                ca = "click();";
                break;
            case "longClick":
                ca = "longclick();";
                break;
            }
            return ca;
        }

        private void chargeText(String res) {
            if (scriptTextarea.getText().isEmpty()) {
                scriptTextarea.append(res);
            } else {
                scriptTextarea.append(System.getProperty("line.separator") + res);
            }
        }

        private void objectClick(String ac, String value) {
            Rectangle rect = mModel.getCurrentDrawingRect();
            String adbStr = "";
            switch (ac) {
            case "Click(Refresh)":
                adbStr = "adb shell input tap " + (rect.x + rect.width / 2) + " " + (rect.y + rect.height / 2);
                break;
            case "LongClick(Refresh)":
                adbStr = "adb shell input tap " + (rect.x + rect.width / 2) + " " + (rect.y + rect.height / 2);
                break;
            case "SystemCommand(Refresh)":
                adbStr = "adb shell input keyevent " + value + "";
                break;
            }
            try {
                System.out.println(adbStr);
                Runtime.getRuntime().exec(adbStr);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    });
    mScreenshotCanvas.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    mScreenshotCanvas.addPaintListener(new PaintListener() {
        @Override
        public void paintControl(PaintEvent e) {
            if (mScreenshot != null) {
                updateScreenshotTransformation();
                // shifting the image here, so that there's a border around screen shot
                // this makes highlighting red rectangles on the screen shot edges more visible
                Transform t = new Transform(e.gc.getDevice());
                t.translate(mDx, mDy);
                t.scale(mScale, mScale);
                e.gc.setTransform(t);
                e.gc.drawImage(mScreenshot, 0, 0);
                // this resets the transformation to identity transform, i.e. no change
                // we don't use transformation here because it will cause the line pattern
                // and line width of highlight rect to be scaled, causing to appear to be blurry
                e.gc.setTransform(null);
                if (mModel.shouldShowNafNodes()) {
                    // highlight the "Not Accessibility Friendly" nodes
                    e.gc.setForeground(e.gc.getDevice().getSystemColor(SWT.COLOR_YELLOW));
                    e.gc.setBackground(e.gc.getDevice().getSystemColor(SWT.COLOR_YELLOW));
                    for (Rectangle r : mModel.getNafNodes()) {
                        e.gc.setAlpha(50);
                        e.gc.fillRectangle(mDx + getScaledSize(r.x), mDy + getScaledSize(r.y),
                                getScaledSize(r.width), getScaledSize(r.height));
                        e.gc.setAlpha(255);
                        e.gc.setLineStyle(SWT.LINE_SOLID);
                        e.gc.setLineWidth(2);
                        e.gc.drawRectangle(mDx + getScaledSize(r.x), mDy + getScaledSize(r.y),
                                getScaledSize(r.width), getScaledSize(r.height));
                    }
                }

                // draw the search result rects
                if (mSearchResult != null) {
                    for (BasicTreeNode result : mSearchResult) {
                        if (result instanceof UiNode) {
                            UiNode uiNode = (UiNode) result;
                            Rectangle rect = new Rectangle(uiNode.x, uiNode.y, uiNode.width, uiNode.height);
                            e.gc.setForeground(e.gc.getDevice().getSystemColor(SWT.COLOR_YELLOW));
                            e.gc.setLineStyle(SWT.LINE_DASH);
                            e.gc.setLineWidth(1);
                            e.gc.drawRectangle(mDx + getScaledSize(rect.x), mDy + getScaledSize(rect.y),
                                    getScaledSize(rect.width), getScaledSize(rect.height));
                        }
                    }
                }

                // draw the mouseover rects
                Rectangle rect = mModel.getCurrentDrawingRect();
                if (rect != null) {
                    e.gc.setForeground(e.gc.getDevice().getSystemColor(SWT.COLOR_RED));
                    if (mModel.isExploreMode()) {
                        // when we highlight nodes dynamically on mouse move,
                        // use dashed borders
                        e.gc.setLineStyle(SWT.LINE_DASH);
                        e.gc.setLineWidth(1);
                    } else {
                        // when highlighting nodes on tree node selection,
                        // use solid borders
                        e.gc.setLineStyle(SWT.LINE_SOLID);
                        e.gc.setLineWidth(2);
                    }
                    e.gc.drawRectangle(mDx + getScaledSize(rect.x), mDy + getScaledSize(rect.y),
                            getScaledSize(rect.width), getScaledSize(rect.height));
                }
            }
        }
    });
    mScreenshotCanvas.addMouseMoveListener(new MouseMoveListener() {
        @Override
        public void mouseMove(MouseEvent e) {
            if (mModel != null) {
                int x = getInverseScaledSize(e.x - mDx);
                int y = getInverseScaledSize(e.y - mDy);
                // show coordinate
                coordinateLabel.setText(String.format("(%d,%d)", x, y));
                if (mModel.isExploreMode()) {
                    BasicTreeNode node = mModel.updateSelectionForCoordinates(x, y);
                    if (node != null) {
                        updateTreeSelection(node);
                    }
                }
            }
        }
    });

    mSetScreenshotComposite = new Composite(mScreenshotComposite, SWT.NONE);
    mSetScreenshotComposite.setLayout(new GridLayout());

    final Button setScreenshotButton = new Button(mSetScreenshotComposite, SWT.PUSH);
    setScreenshotButton.setText("Specify Screenshot...");
    setScreenshotButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent arg0) {
            FileDialog fd = new FileDialog(setScreenshotButton.getShell());
            fd.setFilterExtensions(new String[] { "*.png" });
            if (mModelFile != null) {
                fd.setFilterPath(mModelFile.getParent());
            }
            String screenshotPath = fd.open();
            if (screenshotPath == null) {
                return;
            }

            ImageData[] data;
            try {
                data = new ImageLoader().load(screenshotPath);
            } catch (Exception e) {
                return;
            }

            // "data" is an array, probably used to handle images that has multiple frames
            // i.e. gifs or icons, we just care if it has at least one here
            if (data.length < 1) {
                return;
            }

            mScreenshot = new Image(Display.getDefault(), data[0]);
            redrawScreenshot();
        }
    });

    // right sash is split into 2 parts: upper-right and lower-right
    // both are composites with borders, so that the horizontal divider can be highlighted by
    // the borders
    SashForm rightSash = new SashForm(baseSash, SWT.VERTICAL);

    // upper-right base contains the toolbar and the tree
    Composite upperRightBase = new Composite(rightSash, SWT.BORDER);
    upperRightBase.setLayout(new GridLayout(1, false));

    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    toolBarManager.add(new ExpandAllAction(this));
    toolBarManager.add(new ToggleNafAction(this));
    ToolBar searchtoolbar = toolBarManager.createControl(upperRightBase);

    // add search box and navigation buttons for search results
    ToolItem itemSeparator = new ToolItem(searchtoolbar, SWT.SEPARATOR | SWT.RIGHT);
    searchTextarea = new Text(searchtoolbar, SWT.BORDER | SWT.SINGLE | SWT.SEARCH);
    searchTextarea.pack();
    itemSeparator.setWidth(searchTextarea.getBounds().width);
    itemSeparator.setControl(searchTextarea);
    itemPrev = new ToolItem(searchtoolbar, SWT.SIMPLE);
    itemPrev.setImage(ImageHelper.loadImageDescriptorFromResource("images/prev.png").createImage());
    itemNext = new ToolItem(searchtoolbar, SWT.SIMPLE);
    itemNext.setImage(ImageHelper.loadImageDescriptorFromResource("images/next.png").createImage());
    itemDeleteAndInfo = new ToolItem(searchtoolbar, SWT.SIMPLE);
    itemDeleteAndInfo.setImage(ImageHelper.loadImageDescriptorFromResource("images/delete.png").createImage());
    itemDeleteAndInfo.setToolTipText("Clear search results");
    coordinateLabel = new ToolItem(searchtoolbar, SWT.SIMPLE);
    coordinateLabel.setText("");
    coordinateLabel.setEnabled(false);

    // add search function
    searchTextarea.addKeyListener(new KeyListener() {
        @Override
        public void keyReleased(KeyEvent event) {
            if (event.keyCode == SWT.CR) {
                String term = searchTextarea.getText();
                if (!term.isEmpty()) {
                    if (term.equals(mLastSearchedTerm)) {
                        nextSearchResult();
                        return;
                    }
                    clearSearchResult();
                    mSearchResult = mModel.searchNode(term);
                    if (!mSearchResult.isEmpty()) {
                        mSearchResultIndex = 0;
                        updateSearchResultSelection();
                        mLastSearchedTerm = term;
                    }
                }
            }
        }

        @Override
        public void keyPressed(KeyEvent event) {
        }
    });
    SelectionListener l = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent se) {
            if (se.getSource() == itemPrev) {
                prevSearchResult();
            } else if (se.getSource() == itemNext) {
                nextSearchResult();
            } else if (se.getSource() == itemDeleteAndInfo) {
                searchTextarea.setText("");
                clearSearchResult();
            }
        }
    };
    itemPrev.addSelectionListener(l);
    itemNext.addSelectionListener(l);
    itemDeleteAndInfo.addSelectionListener(l);

    searchtoolbar.pack();
    searchtoolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    mTreeViewer = new TreeViewer(upperRightBase, SWT.NONE);
    mTreeViewer.setContentProvider(new BasicTreeNodeContentProvider());
    // default LabelProvider uses toString() to generate text to display
    mTreeViewer.setLabelProvider(new LabelProvider());
    mTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            BasicTreeNode selectedNode = null;
            if (event.getSelection() instanceof IStructuredSelection) {
                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
                Object o = selection.getFirstElement();
                if (o instanceof BasicTreeNode) {
                    selectedNode = (BasicTreeNode) o;
                }
            }

            mModel.setSelectedNode(selectedNode);
            redrawScreenshot();
            if (selectedNode != null) {
                loadAttributeTable();
            }
        }
    });
    Tree tree = mTreeViewer.getTree();
    tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    // move focus so that it's not on tool bar (looks weird)
    tree.setFocus();

    // lower-right base contains the detail group
    Composite lowerRightBase = new Composite(rightSash, SWT.BORDER);
    lowerRightBase.setLayout(new FillLayout());
    Group grpNodeDetail = new Group(lowerRightBase, SWT.NONE);
    grpNodeDetail.setLayout(new FillLayout(SWT.HORIZONTAL));
    grpNodeDetail.setText("Node Detail");

    Composite tableContainer = new Composite(grpNodeDetail, SWT.NONE);

    TableColumnLayout columnLayout = new TableColumnLayout();
    tableContainer.setLayout(columnLayout);

    mTableViewer = new TableViewer(tableContainer, SWT.NONE | SWT.FULL_SELECTION);
    Table table = mTableViewer.getTable();
    table.setLinesVisible(true);
    // use ArrayContentProvider here, it assumes the input to the TableViewer
    // is an array, where each element represents a row in the table
    mTableViewer.setContentProvider(new ArrayContentProvider());

    TableViewerColumn tableViewerColumnKey = new TableViewerColumn(mTableViewer, SWT.NONE);
    TableColumn tblclmnKey = tableViewerColumnKey.getColumn();
    tableViewerColumnKey.setLabelProvider(new ColumnLabelProvider() {
        @Override
        public String getText(Object element) {
            if (element instanceof AttributePair) {
                // first column, shows the attribute name
                return ((AttributePair) element).key;
            }
            return super.getText(element);
        }
    });
    columnLayout.setColumnData(tblclmnKey, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));

    TableViewerColumn tableViewerColumnValue = new TableViewerColumn(mTableViewer, SWT.NONE);
    tableViewerColumnValue.setEditingSupport(new AttributeTableEditingSupport(mTableViewer));
    TableColumn tblclmnValue = tableViewerColumnValue.getColumn();
    columnLayout.setColumnData(tblclmnValue, new ColumnWeightData(2, ColumnWeightData.MINIMUM_WIDTH, true));
    tableViewerColumnValue.setLabelProvider(new ColumnLabelProvider() {
        @Override
        public String getText(Object element) {
            if (element instanceof AttributePair) {
                // second column, shows the attribute value
                return ((AttributePair) element).value;
            }
            return super.getText(element);
        }
    });
    SashForm downSash = new SashForm(baseSash, SWT.VERTICAL | SWT.BORDER);
    scriptTextarea = new Text(downSash, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
    downSash.setMaximizedControl(scriptTextarea);
    scriptTextarea.pack();
    scriptTextarea.addKeyListener(new KeyListener() {
        @Override
        public void keyReleased(KeyEvent event) {
            if (event.keyCode == SWT.CR) {
                String lastterm = scriptTextarea.getText();
                if (!lastterm.isEmpty()) {
                    if (count == 0) {

                        MessageDialog.openWarning(shell, "", "");
                        term = lastterm;
                        scriptTextarea.setText(term);
                        count++;
                    } else {
                        term += lastterm;
                        scriptTextarea.setText(term);
                        count++;
                    }
                }
            }
        }

        @Override
        public void keyPressed(KeyEvent event) {
        }
    });
    baseSash.setWeights(new int[] { 4, 3, 3 });
    // sets the ratio of the vertical split: left 5 vs right 3

    //baseSash.setWeights(new int[] {5,3});
}

From source file:com.antimatterstudios.esftp.ui.Project.java

License:Open Source License

public boolean performOk() {
    //store all the preferences
    if (m_interface.close() == false) {
        //   Open message box informing the user to test these settings before proceeding
        Shell shell = new Shell();
        MessageDialog.openWarning(shell, "SFTP Not Verified",
                "The SFTP details are not verified.  It is recommended that you test them before you proceed");
    }//from  w w  w  . j a  v  a 2s. c o m

    return super.performOk();
}

From source file:com.antimatterstudios.esftp.ui.Workbench.java

License:Open Source License

public boolean performOk() {
    //   store all the preferences
    if (m_interface.close() == false) {
        //   Open message box informing the user to test these settings before proceeding
        Shell shell = new Shell();
        MessageDialog.openWarning(shell, "SFTP Not Verified",
                "The SFTP details are not verified.  It is recommended that you test them before you proceed");
    }//  ww  w .  j av a  2 s .  c  om

    return super.performOk();
}

From source file:com.application.areca.launcher.gui.DecrytionFileWindow.java

License:Open Source License

public Thread decrpyt(String _source, String _algorithm, String _password, String _destination,
        String _fileNameEnc, Text _txtLog, Shell _shell) {

    final String source = _source;
    final String algorithm = _algorithm;
    final String password = _password;
    final String destination = _destination;
    final String fileNameEnc = _fileNameEnc;
    final Text txtLog = _txtLog;
    ;//from  w ww  .  j  a v  a2s. c o m
    final Shell shell = _shell;

    return new Thread() {
        public void run() {
            final StringBuffer message = new StringBuffer();

            try {

                //Logger.defaultLogger().info("Looking for decrpyt for..." +source+" ,destination="+destination);         
                //target.processBackup(manifest, backupScheme, disablePreCheck, checkParams, transactionPoint, context);
                String dir = System.getProperty("user.dir");

                String[] array = new String[5];
                array[0] = "-source=" + source;
                array[1] = "-algorithm=" + algorithm;
                array[2] = "-password=" + password;
                array[3] = "-destination=" + destination;
                if (fileNameEnc.equals(NO))
                    array[4] = "-r";
                else
                    array[4] = "";

                String queryString = "-source=" + source + " " + "-algorithm=" + algorithm + " " + "-password="
                        + password + " " + "-destination=" + destination;
                if (fileNameEnc.equals(NO))
                    queryString = queryString + " -r";

                CmdLineDeCipherInternal.getInstance().decryt(array);

                message.append("Sifre acma islemi tamamladi.\nDosyanin kaydedildigi yer = " + destination);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                message.append("hata: " + e.getMessage());
            }

            shell.getDisplay().asyncExec(new Runnable() {
                public void run() {
                    try {
                        //                  String dir = System.getProperty("user.dir"); 
                        //                 
                        //                  File url=new File(dir, "decrypt.exe");
                        //                  MessageDialog.openWarning(shell, "Warning", url.getAbsolutePath());
                        //                  Process p = Runtime.getRuntime().exec(url.getAbsolutePath());
                        //               
                        //               
                        //               BufferedReader bri = new BufferedReader
                        //                 (new InputStreamReader(p.getInputStream()));
                        //               BufferedReader bre = new BufferedReader
                        //                 (new InputStreamReader(p.getErrorStream()));
                        //                
                        //                
                        //                
                        //                String line;
                        //                //MessageDialog.openWarning(shell, "Warning", message+"---");
                        //                while ((line = bri.readLine()) != null) {
                        //                   txtLog.append(line+"\n");
                        //                 }
                        //                 bri.close();
                        //                 while ((line = bre.readLine()) != null) {
                        //                    txtLog.append(line+"\n");
                        //                 }
                        //                 
                        //               bre.close();
                        //               p.waitFor();

                        MessageDialog.openWarning(shell, "Warning", message.toString());
                    } catch (Exception e) {
                        MessageDialog.openWarning(shell, "Warning", e.getMessage());
                    }

                }
            });
        }
    };
}

From source file:com.aptana.formatter.ui.preferences.AbstractFormatterSelectionBlock.java

License:Open Source License

protected void doImport(Composite group) {
    final FileDialog dialog = new FileDialog(group.getShell(), SWT.OPEN);
    dialog.setText(FormatterMessages.AbstractFormatterSelectionBlock_importProfileLabel);
    dialog.setFilterExtensions(new String[] { "*.xml" }); //$NON-NLS-1$
    final String path = dialog.open();
    if (path == null)
        return;/*  w w  w .  ja  v a2s .c o m*/

    final File file = new File(path);
    // IScriptFormatterFactory factory = getSelectedExtension();
    Collection<IProfile> profiles = null;
    IProfileStore store = profileManager.getProfileStore();
    try {
        profiles = store.readProfilesFromFile(file);
    } catch (CoreException e) {
        IdeLog.logError(FormatterUIEplPlugin.getDefault(),
                FormatterMessages.AbstractFormatterSelectionBlock_notValidProfile, e, IDebugScopes.DEBUG);
    }
    if (profiles == null || profiles.isEmpty())
        return;

    final IProfile profile = profiles.iterator().next();

    IProfileVersioner versioner = profileManager.getProfileVersioner();

    if (profile.getVersion() > versioner.getCurrentVersion()) {
        final String title = FormatterMessages.AbstractFormatterSelectionBlock_importingProfile;
        final String message = FormatterMessages.AbstractFormatterSelectionBlock_moreRecentVersion;
        MessageDialog.openWarning(group.getShell(), title, message);
    }

    final IProfileManager profileManager = getProfileManager();
    if (profileManager.containsName(profile.getName())) {
        final AlreadyExistsDialog aeDialog = new AlreadyExistsDialog(group.getShell(), profile, profileManager,
                fProject);
        if (aeDialog.open() != Window.OK)
            return;
    }
    ((IProfile.ICustomProfile) profile).setVersion(versioner.getCurrentVersion());
    profileManager.addProfile(fProject, profile);
    updateComboFromProfiles();
    applyPreferences();
}

From source file:com.aptana.ide.core.ui.actions.SubmitBugAction.java

License:Open Source License

private void showOfflineWarning() {
    MessageDialog.openWarning(CoreUIUtils.getActiveShell(), Messages.SubmitBugAction_Offline_Title,
            Messages.SubmitBugAction_Offline_Message);
}

From source file:com.aptana.ide.debug.internal.ui.InstallDebuggerPromptStatusHandler.java

License:Open Source License

/**
 * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
 */// w w  w.  ja v  a 2  s .c o m
public Object handleStatus(IStatus status, Object source) throws CoreException {
    Shell shell = DebugUiPlugin.getActiveWorkbenchShell();
    String title = Messages.InstallDebuggerPromptStatusHandler_InstallDebuggerExtension;

    if ("install".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_AcceptExtensionInstallation_Quit);
        return null;
    } else if ("postinstall".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_Quit);
        return null;
    } else if ("nopdm".equals(source)) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null, Messages.InstallDebuggerPromptStatusHandler_PDMNotInstalled, MessageDialog.WARNING,
                new String[] { StringUtils.ellipsify(Messages.InstallDebuggerPromptStatusHandler_Download),
                        CoreStrings.CONTINUE, CoreStrings.CANCEL, CoreStrings.HELP },
                0);
        switch (md.open()) {
        case 0:
            WorkbenchHelper.launchBrowser("http://www.aptana.com/pro/pdm.php", "org.eclipse.ui.browser.ie"); //$NON-NLS-1$ //$NON-NLS-2$
            /* continue */
        case 1:
            return new Boolean(true);
        case 3:
            WorkbenchHelper.launchBrowser("http://www.aptana.com/docs/index.php/Installing_the_IE_debugger"); //$NON-NLS-1$
            return new Boolean(true);
        default:
            break;
        }
        return null;
    } else if (source instanceof String && ((String) source).startsWith("quit_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_BrowserIsRunning,
                        new String[] { ((String) source).substring(5) }));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("installed_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstalled,
                        new String[] { ((String) source).substring(10) }));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("warning_")) { //$NON-NLS-1$
        MessageDialog.openWarning(shell, title, ((String) source).substring(8));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("failed_")) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null,
                MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstallFailed,
                        new Object[] { ((String) source).substring(7) }),
                MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, CoreStrings.HELP }, 0);
        while (true) {
            switch (md.open()) {
            case IDialogConstants.OK_ID:
                return null;
            default:
                break;
            }
            WorkbenchHelper.launchBrowser(((String) source).indexOf("Internet Explorer") != -1 //$NON-NLS-1$
                    ? "http://www.aptana.com/docs/index.php/Installing_the_IE_debugger" //$NON-NLS-1$
                    : "http://www.aptana.com/docs/index.php/Installing_the_JavaScript_debugger"); //$NON-NLS-1$
        }
    }
    IPreferenceStore store = DebugUiPlugin.getDefault().getPreferenceStore();

    String pref = store.getString(IDebugUIConstants.PREF_INSTALL_DEBUGGER);
    if (pref != null) {
        if (pref.equals(MessageDialogWithToggle.ALWAYS)) {
            return new Boolean(true);
        }
    }
    String message = StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionNotInstalled,
            new String[] { (String) source });

    MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message,
            MessageDialog.INFORMATION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, CoreStrings.HELP }, 2, null,
            false);
    dialog.setPrefKey(IDebugUIConstants.PREF_INSTALL_DEBUGGER);
    dialog.setPrefStore(store);

    while (true) {
        switch (dialog.open()) {
        case IDialogConstants.YES_ID:
            return new Boolean(true);
        case IDialogConstants.NO_ID:
            return new Boolean(false);
        default:
            break;
        }
        WorkbenchHelper.launchBrowser(((String) source).indexOf("Internet Explorer") != -1 //$NON-NLS-1$
                ? "http://www.aptana.com/docs/index.php/Installing_the_IE_debugger" //$NON-NLS-1$
                : "http://www.aptana.com/docs/index.php/Installing_the_JavaScript_debugger"); //$NON-NLS-1$
    }
}