Java 类org.eclipse.swt.widgets.MessageBox 实例源码

项目:eZooKeeper    文件:BaseDeleteAction.java   
@Override
public void runWithObject(Object object) throws Exception {
    String typeName = getObjectTypeName(object);
    if (typeName == null) {
        return;
    }

    String name = getObjectName(object);
    if (name == null) {
        return;
    }

    MessageBox messageBox = new MessageBox(getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
    messageBox.setMessage("Are you sure you want to delete the " + typeName + " '" + name + "'?");
    messageBox.setText("Confirm Delete");
    int response = messageBox.open();
    if (response == SWT.YES) {
        try {
            delete(object);
        }
        catch (Exception e) {
            throw new Exception("Failed to delete the " + typeName + " '" + name + "'.", e);
        }
    }
}
项目:pmTrans    文件:PmTrans.java   
/**
 * @return true if the transcription was closed, false if the operation was
 *         cancelled
 */
protected boolean closeTranscription() {
    if (!textEditor.isDisposed()) {
        if (textEditor.isChanged()) {
            MessageBox diag = new MessageBox(shell,
                    SWT.APPLICATION_MODAL | SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL);
            diag.setMessage("You have unsaved changes, would you like to save them?");
            int opt = diag.open();
            if (opt == SWT.YES)
                saveTranscription();
            if (opt == SWT.CANCEL)
                return false;
        }
        textEditor.clear();
        transcriptionFile = null;
    }
    return true;
}
项目:pmTrans    文件:PmTrans.java   
protected void openTranscriptionFile(File f) {
    if (!textEditor.isDisposed()) {
        try {
            closeTranscription();
            transcriptionFile = f;
            textEditor.loadTranscription(transcriptionFile);
            textFilesCache.add(transcriptionFile);
            shell.setText(f.getName());
        } catch (Exception e) {
            textEditor.clear();
            textFilesCache.remove(transcriptionFile);
            MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
            diag.setMessage("Unable to open file " + f.getPath());
            diag.open();
            transcriptionFile = null;
        }
    }
}
项目:pmTrans    文件:PmTrans.java   
protected void exportTextFile() {
    boolean done = false;
    while (!done)
        if (!textEditor.isDisposed()) {
            FileDialog fd = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);
            fd.setFilterNames(new String[] { "Plain text file (*.txt)", "All Files (*.*)" });
            fd.setFilterExtensions(new String[] { "*.txt", "*.*" });
            String lastPath = Config.getInstance().getString(Config.LAST_EXPORT_TRANSCRIPTION_PATH);
            if (lastPath != null && !lastPath.isEmpty())
                fd.setFileName(lastPath);
            String file = fd.open();
            try {
                if (file != null) {
                    Config.getInstance().putValue(Config.LAST_EXPORT_TRANSCRIPTION_PATH, file);
                    File destFile = new File(file);
                    boolean overwrite = true;
                    if (destFile.exists())
                        overwrite = MessageDialog.openConfirm(shell, "Overwrite current file?",
                                "Would you like to overwrite " + destFile.getName() + "?");
                    if (overwrite) {
                        textEditor.exportText(new File(file));
                        done = true;
                    }
                } else
                    done = true;
            } catch (Exception e) {
                e.printStackTrace();
                MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
                diag.setMessage("Unable to export to file " + transcriptionFile.getPath());
                diag.open();
            }
        }
}
项目:pmTrans    文件:PmTrans.java   
protected void importTextFile(File f) {
    if (!textEditor.isDisposed()) {
        FileDialog fd = new FileDialog(shell, SWT.OPEN);
        fd.setText("Import text");
        fd.setFilterExtensions(new String[] { "*.txt;*.TXT" });
        fd.setFilterNames(new String[] { "Plain text files (*.txt)" });
        String selected = fd.open();
        if (selected != null) {
            try {
                textEditor.importText(new File(selected));
            } catch (IOException e) {
                e.printStackTrace();
                MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
                diag.setMessage("Unable to open file " + transcriptionFile.getPath());
                diag.open();
            }
        }
    }
}
项目:convertigo-eclipse    文件:BuildLocallyAction.java   
/***
 * Dialog yes/no which ask to user if we want
 * remove the cordova directory present into "_private" directory
 * We also explain, what we do and how to recreate the cordova environment
 */
public void removeCordovaDirectory() {
    String mobilePlatformName = mobilePlatform.getName();
    if (parentShell != null) {
        MessageBox customDialog = new MessageBox(parentShell, SWT.ICON_INFORMATION | SWT.YES | SWT.NO);

        customDialog.setText("Remove cordova directory");
        customDialog.setMessage("Do you want to remove the Cordova directory located in \"_private\\localbuild\\" + 
                mobilePlatformName + "\" directory?\n\n" +
                "It will also remove this project's Cordova environment!\n\n" +
                "To recreate the project's Cordova environment, you just need to run a new local build."
        );

        if (customDialog.open() == SWT.YES) {
            buildLocally.removeCordovaDirectory();
        } else {
            return;
        }   
    } else {
        //TODO
    }
}
项目:convertigo-eclipse    文件:JavelinConnectorComposite.java   
public void reset() {
    JavelinConnector javelinConnector = (JavelinConnector) connector;
    Javelin javelin = javelinConnector.javelin;

    int emulatorID = (int) javelinConnector.emulatorID;

    switch (emulatorID) {
    case Session.EmulIDSNA:
    case Session.EmulIDAS400:
        MessageBox messageBox = new MessageBox(getShell(), SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION
                | SWT.APPLICATION_MODAL);
        String message = "This will send a KEY_RESET to the emulator.";
        messageBox.setMessage(message);
        int ret = messageBox.open();
        if (ret == SWT.OK) {
            javelin.doAction("KEY_RESET");
            Engine.logEmulators
                    .info("KEY_RESET has been sent to the emulator, because of an user request.");
        }
        break;
    default:
        ConvertigoPlugin
                .warningMessageBox("The Reset function is only available for IBM emulators (3270 and AS/400).");
        break;
    }
}
项目:avoCADo    文件:ToolPartBuildView.java   
@Override
public void toolSelected() {
    Sketch sketch = AvoGlobal.project.getActiveSketch();
    if(sketch == null || sketch.isConsumed){
        MessageBox m = new MessageBox(AvoGlobal.menuet.getShell(), SWT.ICON_QUESTION | SWT.OK);
        m.setMessage(   "You must select an unconsumed sketch before\n" +
                        "any 2Dto3D operations can be performed.\n\n" +
                        "Please create a new sketch or select one\n" +
                        "by double-clicking on it in the project's\n" +
                        "list of elements.");
        m.setText("Please select a sketch");
        m.open();
    }else{          
        // there is a sketch active!

        changeMenuetToolMode(Menuet.MENUET_MODE_BUILD);

        // TODO: Building should not be done in the view!!
        sketch.buildRegions();

        int i = AvoGlobal.project.getActivePart().addNewFeat2D3D(sketch.getUniqueID());
        AvoGlobal.project.getActivePart().setActiveSubPart(i);

    }
}
项目:pgcodekeeper    文件:DbStoreEditorDialog.java   
@Override
protected void okPressed() {
    int dbport;
    String port = txtDbPort.getText();
    if(txtDbPort.getText().isEmpty()) {
        dbport = 0;
    } else {
        try {
            dbport = Integer.parseInt(port);
        } catch (NumberFormatException ex) {
            MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR);
            mb.setText(Messages.dbStoreEditorDialog_cannot_save_entry);
            mb.setMessage(MessageFormat.format(
                    Messages.dbStoreEditorDialog_not_valid_port_number,
                    port));
            mb.open();
            return;
        }
    }

    dbInfo = new DbInfo(txtName.getText(), txtDbName.getText(),
            txtDbUser.getText(), txtDbPass.getText(),
            txtDbHost.getText(), dbport);
    super.okPressed();
}
项目:pgcodekeeper    文件:UpdateDdl.java   
@Override
public Object execute(ExecutionEvent event) {
    IWorkbenchPart part = HandlerUtil.getActiveEditor(event);

    if (part instanceof SQLEditor){
        SQLEditor sqlEditor = (SQLEditor) part;

        if (sqlEditor.getCurrentDb() != null) {
            sqlEditor.updateDdl();
        } else {
            MessageBox mb = new MessageBox(HandlerUtil.getActiveShell(event), SWT.ICON_INFORMATION);
            mb.setText(Messages.UpdateDdl_select_source);
            mb.setMessage(Messages.UpdateDdl_select_source_msg);
            mb.open();
        }
    }
    return null;
}
项目:Hydrograph    文件:MultiParameterFileDialog.java   
private void populateViewParameterFileBox(ParameterFile parameterFile) {
    //parameterFileTextBox.setText(file.getPath());
    try {
        Map<String, String> parameterMap = new LinkedHashMap<>();
        parameterMap = ParameterFileManager.getInstance().getParameterMap(getParamterFileLocation(parameterFile));
        setGridData(parameters, parameterMap);
        parameterTableViewer.setData("CURRENT_PARAM_FILE", getParamterFileLocation(parameterFile));
    } catch (IOException ioException) {

        MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR
                | SWT.OK);

        messageBox.setText(MessageType.ERROR.messageType());
        messageBox.setMessage(ErrorMessages.UNABLE_TO_POPULATE_PARAM_FILE
                + ioException.getMessage());
        messageBox.open();

        logger.debug("Unable to populate parameter file", ioException);

    }

    parameterTableViewer.refresh();
}
项目:Hydrograph    文件:ConverterUiHelper.java   
/**
**
 * This methods loads schema from external schema file
 * 
 * @param externalSchemaFilePath
 * @param schemaType
 * @return
 */
public List<GridRow> loadSchemaFromExternalFile(String externalSchemaFilePath,String schemaType) {
    IPath filePath=new Path(externalSchemaFilePath);
    IPath copyOfFilePath=filePath;
    if (!filePath.isAbsolute()) {
        filePath = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath).getRawLocation();
    }
    if(filePath!=null && filePath.toFile().exists()){
    GridRowLoader gridRowLoader=new GridRowLoader(schemaType, filePath.toFile());
    return gridRowLoader.importGridRowsFromXML();

    }else{
        MessageBox messageBox=new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR);
        messageBox.setMessage(Messages.FAILED_TO_IMPORT_SCHEMA_FILE+"\n"+copyOfFilePath.toString());
        messageBox.setText(Messages.ERROR);
        messageBox.open();
    }
    return null;
}
项目:Hydrograph    文件:UiConverterUtil.java   
/**
 * Create a Message Box displays a currentJob UniqueId and a message to
 * generate new Unique Id.
 * @param container
 * @param jobFile
 * @param isSubjob
 * @return {@link Integer}
 */
private int showMessageForGeneratingUniqueJobId(Container container, IFile jobFile, boolean isSubJob) {
    int buttonId = SWT.NO;
    if(StringUtils.isBlank(container.getUniqueJobId())){
        return SWT.YES;
    }
    MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
            SWT.ICON_QUESTION | SWT.YES | SWT.NO);
    messageBox.setText("Question");
    String previousUniqueJobId = container.getUniqueJobId();
    if (isSubJob) {
        messageBox.setMessage(Messages.bind(Messages.GENERATE_NEW_UNIQUE_JOB_ID_FOR_SUB_JOB, jobFile.getName(),
                previousUniqueJobId));
    } else {
        messageBox.setMessage(
                Messages.bind(Messages.GENERATE_NEW_UNIQUE_JOB_ID_FOR_JOB, jobFile.getName(), previousUniqueJobId));
    }
    buttonId = messageBox.open();
    return buttonId;
}
项目:parabuild-ci    文件:ChartComposite.java   
/**
 * Creates a print job for the chart.
 */
public void createChartPrintJob() {
    //FIXME try to replace swing print stuff by swt
    PrinterJob job = PrinterJob.getPrinterJob();
    PageFormat pf = job.defaultPage();
    PageFormat pf2 = job.pageDialog(pf);
    if (pf2 != pf) {
        job.setPrintable(this, pf2);
        if (job.printDialog()) {
            try {
                job.print();
            }
            catch (PrinterException e) {
                MessageBox messageBox = new MessageBox( 
                        canvas.getShell(), SWT.OK | SWT.ICON_ERROR );
                messageBox.setMessage( e.getMessage() );
                messageBox.open();
            }
        }
    }
}
项目:Hydrograph    文件:ELTOperationClassDialog.java   
@Override
protected void cancelPressed() {
    if (applyButton.isEnabled()) {

        if (!isNoPressed) {
            ConfirmCancelMessageBox confirmCancelMessageBox = new ConfirmCancelMessageBox(container);
            MessageBox confirmCancleMessagebox = confirmCancelMessageBox.getMessageBox();

            if (confirmCancleMessagebox.open() == SWT.OK) {
                closeDialog=super.close();
            }
        } else {
            closeDialog=super.close();
        }

    } else {
        closeDialog=super.close();
    }
    isCancelPressed=true;
}
项目:Hydrograph    文件:OperationClassDialog.java   
@Override
protected void cancelPressed() {
    if (applyButton.isEnabled()) {

        if (!isNoPressed) {
            ConfirmCancelMessageBox confirmCancelMessageBox = new ConfirmCancelMessageBox(container);
            MessageBox confirmCancleMessagebox = confirmCancelMessageBox.getMessageBox();

            if (confirmCancleMessagebox.open() == SWT.OK) {
                closeDialog=super.close();
            }
        } else {
            closeDialog=super.close();
        }

    } else {
        closeDialog=super.close();
    }
    isCancelPressed=true;
}
项目:Hydrograph    文件:ELTSchemaGridWidget.java   
private boolean validateXML(InputStream xml, InputStream xsd){
 try
 {
     SchemaFactory factory = 
             SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
     javax.xml.validation.Schema schema = factory.newSchema(new StreamSource(xsd));
     Validator validator = schema.newValidator();

     validator.validate(new StreamSource(xml));
     return true;
 }
 catch( SAXException| IOException ex)
 {
     //MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", Messages.IMPORT_XML_FORMAT_ERROR + "-\n" + ex.getMessage());
     MessageBox dialog = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR | SWT.OK);
     dialog.setText(Messages.ERROR);
     dialog.setMessage(Messages.IMPORT_XML_FORMAT_ERROR + "-\n" + ex.getMessage());
     logger.error(Messages.IMPORT_XML_FORMAT_ERROR);
     return false;
 }
}
项目:Hydrograph    文件:VerifyTeraDataFastLoadOption.java   
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,
        Widget... widgets) {
    final Widget[] widgetList = widgets;

    Listener listener = new Listener() {
        @Override
        public void handleEvent(Event event) {
            if (StringUtils.equalsIgnoreCase(((Button) widgetList[0]).getText(), String.valueOf(FAST_LOAD)) && ((Button) widgetList[0]).getSelection() ) {
                MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
                        SWT.ICON_INFORMATION | SWT.OK);
                messageBox.setText(INFORMATION);
                messageBox.setMessage(Messages.FAST_LOAD_ERROR_MESSAGE);
                messageBox.open();
            }
        }
    };
    return listener;
}
项目:Hydrograph    文件:OverWriteWidgetSelectionListener.java   
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
        Widget... widgets) {
    final Widget[] widgetList = widgets;

    Listener listener = new Listener() {
        @Override
        public void handleEvent(Event event) {
            if (StringUtils.equalsIgnoreCase(((Combo) widgetList[0]).getText(), String.valueOf(Boolean.TRUE))) {
                MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
                        SWT.ICON_INFORMATION | SWT.OK);
                messageBox.setText(INFORMATION);
                messageBox.setMessage("All files at given location will be overwritten.");
                messageBox.open();
            }
        }
    };
    return listener;
}
项目:Hydrograph    文件:JobHandler.java   
private boolean confirmationFromUser() {

    /*MessageDialog messageDialog = new MessageDialog(Display.getCurrent().getActiveShell(),Messages.CONFIRM_FOR_GRAPH_PROPS_RUN_JOB_TITLE, null,
            Messages.CONFIRM_FOR_GRAPH_PROPS_RUN_JOB, MessageDialog.QUESTION, new String[] { "Yes",
      "No" }, 0);*/

    MessageBox dialog = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
    dialog.setText(Messages.CONFIRM_FOR_GRAPH_PROPS_RUN_JOB_TITLE);
    dialog.setMessage(Messages.CONFIRM_FOR_GRAPH_PROPS_RUN_JOB);

    int response = dialog.open();
     if(response == 0){
            return true;
        } else {
            return false;
        }
}
项目:Hydrograph    文件:ELTGraphicalEditor.java   
@Override
public void setInput(IEditorInput input) {
    if(input instanceof FileStoreEditorInput){
        MessageBox messageBox=new MessageBox(Display.getCurrent().getActiveShell(),SWT.ICON_WARNING);
        messageBox.setText(Messages.WARNING);
        messageBox.setMessage(Messages.JOB_OPENED_FROM_OUTSIDE_WORKSPACE_WARNING);
        messageBox.open();
    }   
    try {
        GenrateContainerData genrateContainerData = new GenrateContainerData();
        genrateContainerData.setEditorInput(input, this);
        if(StringUtils.equals(this.getJobName()+Messages.JOBEXTENSION, input.getName()) || StringUtils.equals(this.getJobName(), Messages.ELT_GRAPHICAL_EDITOR)){
            container = genrateContainerData.getContainerData();
        }else{
            this.setPartName(input.getName());
        }
        super.setInput(input);
    } catch (CoreException | IOException ce) {
        logger.error("Exception while setting input", ce);
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().dispose();
        MessageDialog.openError(new Shell(), "Error", "Exception occured while opening the graph -\n"+ce.getMessage());
    }
}
项目:Hydrograph    文件:ELTGraphicalEditor.java   
/**
 * 
 * Validates length of job name
 * 
 * @param {@link SaveAsDialog}
 */
public void validateLengthOfJobName(SaveAsDialog saveAsDialog) {
    String jobName=saveAsDialog.getResult().removeFileExtension().lastSegment();
    while(jobName.length()>50)
    {
        jobName=saveAsDialog.getResult().removeFileExtension().lastSegment();
        if(jobName.length()>50)
        {
            MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
            messageBox.setText("Error");
            messageBox.setMessage("File Name Too Long");
            if(messageBox.open()==SWT.OK)
            {
                saveAsDialog.setOriginalName(jobName+".job");
                IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(saveAsDialog.getResult());
                saveAsDialog.setOriginalFile(file);
                saveAsDialog.open();
                if(saveAsDialog.getReturnCode()==1)
                    break;
            }
        }
    }
}
项目:pmTrans    文件:FindReplaceDialog.java   
private List<WordIndexerWrapper> findAll(String keyWord, boolean matchCase, boolean wholeWord, boolean regex,
        Point searchBounds) {

    String wholeText = text.getText();
    if (!matchCase) {
        keyWord = keyWord.toLowerCase();
        wholeText = wholeText.toLowerCase();
    }
    if (!regex) {
        String temp = "";
        for (int i = 0; i < keyWord.length(); i++)
            temp += ("[" + keyWord.charAt(i) + "]");
        keyWord = temp;
    }
    if (wholeWord)
        keyWord = "\\b" + keyWord + "\\b";
    System.out.println("looking for: " + keyWord);
    WordIndexer finder = new WordIndexer(wholeText);
    List<WordIndexerWrapper> indexes = new LinkedList<WordIndexerWrapper>();
    try {
        indexes = finder.findIndexesForKeyword(keyWord, searchBounds.x, searchBounds.y);
    } catch (PatternSyntaxException e) {
        MessageBox diag = new MessageBox(Display.getCurrent().getActiveShell(),
                SWT.APPLICATION_MODAL | SWT.ICON_ERROR | SWT.OK);
        diag.setMessage("Regular expression error.\n\n" + e.getMessage());
        diag.open();
    }
    return indexes;
}
项目:pmTrans    文件:PmTrans.java   
protected void openAudioFile(File file) {
    // Add new file to cache and refresh the list
    closePlayer();

    // Create the player
    try {
        if (file != null && file.exists()) {

            player = new AudioPlayerTarsosDSP(file);
            GridData gd = new GridData();
            gd.grabExcessHorizontalSpace = true;
            gd.horizontalAlignment = SWT.FILL;
            gd.verticalAlignment = SWT.FILL;
            player.initGUI(shell, gd);

            audioFilesCache.add(file);
            shell.layout();
        } else {
            createNewDummyPlayer();
            audioFilesCache.remove(file);
            MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
            diag.setMessage("Unable to open file " + file.getPath());
            diag.open();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:pmTrans    文件:PmTrans.java   
public void preferences() {
    try {
        Config.getInstance().showConfigurationDialog(shell);
    } catch (PmTransException e) {
        MessageBox diag = new MessageBox(Display.getCurrent().getActiveShell(),
                SWT.APPLICATION_MODAL | SWT.ICON_ERROR | SWT.OK);
        diag.setMessage("Unable to save preferences");
        diag.open();
    }
}
项目:convertigo-eclipse    文件:TransactionTreeObject.java   
/** SQL TRANSACTION **/
private void detectVariables( String queries, String oldQueries, 
        List<RequestableVariable> listVariables ){

    if (queries != null && !queries.equals("")) {
        // We create an another List which permit to compare and update variables
        Set<String> newSQLQueriesVariablesNames = getSetVariableNames(queries);
        Set<String> oldSQLQueriesVariablesNames = getSetVariableNames(oldQueries);

        // Modify variables definition if needed
        if ( listVariables != null && 
                !oldSQLQueriesVariablesNames.equals(newSQLQueriesVariablesNames) ) {

            for ( RequestableVariable variable : listVariables ) {
                String variableName = variable.getName();

                if (oldSQLQueriesVariablesNames.contains(variableName) &&
                        !newSQLQueriesVariablesNames.contains(variableName)) {

                    try {
                        MessageBox messageBox = new MessageBox(viewer.getControl().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); 
                        messageBox.setMessage("Do you really want to delete the variable \""+variableName+"\"?");
                        messageBox.setText("Delete \""+variableName+"\"?");

                        if (messageBox.open() == SWT.YES) {
                            variable.delete();
                        }
                    } catch (EngineException e) {
                        ConvertigoPlugin.logException(e, "Error when deleting the variable \""+variableName+"\"");
                    }

                }
            }
        }
    }
}
项目:convertigo-eclipse    文件:TraceDeleteAction.java   
public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);       

    Shell shell = getParentShell();
    shell.setCursor(waitCursor);

    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TraceTreeObject traceObject = (TraceTreeObject)explorerView.getFirstSelectedTreeObject();

            MessageBox messageBox = new MessageBox(shell,SWT.YES | SWT.NO | SWT.CANCEL | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
            String message = java.text.MessageFormat.format("Do you really want to delete the trace \"{0}\"?", new Object[] {traceObject.getName()});
            messageBox.setMessage(message);
            if (messageBox.open() == SWT.YES) {
                File file = (File) traceObject.getObject();
                if (file.exists()) {
                    if (file.delete()) {
                        TreeParent treeParent = traceObject.getParent();
                        treeParent.removeChild(traceObject);
                        explorerView.refreshTreeObject(treeParent);
                    }
                    else {
                        throw new Exception("Unable to delete file \""+ file.getAbsolutePath() + "\"");
                    }
                }
            }

        }
    }
    catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to delete the trace file!");
    }
       finally {
        shell.setCursor(null);
        waitCursor.dispose();
       }
}
项目:convertigo-eclipse    文件:ConnectorEditor.java   
@Override
public int promptToSaveOnClose() {
    MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING);
    messageBox.setText("Convertigo");
    messageBox.setMessage("A transaction is currently running.\nThe connector editor can't be closed.");
    messageBox.open();

    return CANCEL;
}
项目:convertigo-eclipse    文件:SequenceEditor.java   
@Override
public int promptToSaveOnClose() {
    MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING);
    messageBox.setText("Convertigo");
    messageBox.setMessage("A sequence is currently running.\nThe sequence editor can't be closed.");
    messageBox.open();

    return CANCEL;
}
项目:avoCADo    文件:ToolSketchCancelView.java   
@Override
public void toolSelected() {        
    MessageBox m = new MessageBox(AvoGlobal.menuet.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
    m.setMessage("Are you sure you want to discard ALL changes\nand exit the Sketch drawing mode?");
    m.setText("Discard ALL Changes?");
    if(m.open() == SWT.YES){
        Sketch sketch = AvoGlobal.project.getActiveSketch();
        if(sketch != null){
            sketch.deselectAllFeat2D();
        }
        changeMenuetToolMode(Menuet.MENUET_MODE_PART);
        AvoGlobal.glView.updateGLView = true;
    }

}
项目:AppleCommander    文件:DiskExplorerTab.java   
/**
 * Display the Save error dialog box.
 * @see #save
 * @see #saveAs
 */
protected void showSaveError(IOException ex) {
    Shell finalShell = shell;
    String errorMessage = ex.getMessage();
    if (errorMessage == null) {
        errorMessage = ex.getClass().getName();
    }
    MessageBox box = new MessageBox(finalShell, 
        SWT.ICON_ERROR | SWT.CLOSE);
    box.setText(textBundle.get("SaveDiskImageErrorTitle")); //$NON-NLS-1$
    box.setMessage(textBundle.format("SaveDiskImageErrorMessage", //$NON-NLS-1$
            new Object[] { getDisk(0).getFilename(), errorMessage }));
    box.open();
}
项目:KettleUtil    文件:JobEntryEasyExpandDialog.java   
private void ok() {
  if ( Const.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setText( BaseMessages.getString( PKG, "System.StepJobEntryNameMissing.Title" ) );
    mb.setMessage( BaseMessages.getString( PKG, "System.JobEntryNameMissing.Msg" ) );
    mb.open();
    return;
  }
  jobEntry.setName( wName.getText() );
  jobEntry.setConfigInfo( wConfigInfo.getText() );
  jobEntry.setClassName( wClassName.getText() );
  dispose();
}
项目:bdf2    文件:SelectClassPage.java   
private void alert(String info) {
    MessageBox messageBox = new MessageBox(
            JavaPlugin.getActiveWorkbenchShell());
    messageBox.setText("提示");
    messageBox.setMessage(info);
    messageBox.open();
}
项目:AppleCommander    文件:SwtUtil.java   
/**
 * Display a dialog box with the question icon and a yes/no button selection.
 */
public static int showYesNoDialog(Shell shell, String title, String message) {
    MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
    messageBox.setText(title);
    messageBox.setMessage(message);
    return messageBox.open();
}
项目:AppleCommander    文件:SwtUtil.java   
/**
 * Display a dialog box with the error icon and a ok/cancel button selection.
 */
public static int showOkCancelErrorDialog(Shell shell, String title, String message) {
    MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK | SWT.CANCEL);
    messageBox.setText(title);
    messageBox.setMessage(message);
    return messageBox.open();
}
项目:AppleCommander    文件:SwtUtil.java   
/**
 * Display a dialog box with the error icon and only the ok button.
 */
public static void showErrorDialog(Shell shell, String title, String message) {
    MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
    messageBox.setText(title);
    messageBox.setMessage(message);
    messageBox.open();
}
项目:AppleCommander    文件:Sleak.java   
void refreshDifference () {
    DeviceData info = display.getDeviceData ();
    if (!info.tracking) {
        MessageBox dialog = new MessageBox (shell, SWT.ICON_WARNING | SWT.OK);
        dialog.setText (shell.getText ());
        dialog.setMessage ("Warning: Device is not tracking resource allocation"); //$NON-NLS-1$
        dialog.open ();
    }
    Object [] newObjects = info.objects;
    Error [] newErrors = info.errors;
    Object [] diffObjects = new Object [newObjects.length];
    Error [] diffErrors = new Error [newErrors.length];
    int count = 0;
    for (int i=0; i<newObjects.length; i++) {
        int index = 0;
        while (index < oldObjects.length) {
            if (newObjects [i] == oldObjects [index]) break;
            index++;
        }
        if (index == oldObjects.length) {
            diffObjects [count] = newObjects [i];
            diffErrors [count] = newErrors [i];
            count++;
        }
    }
    objects = new Object [count];
    errors = new Error [count];
    System.arraycopy (diffObjects, 0, objects, 0, count);
    System.arraycopy (diffErrors, 0, errors, 0, count);
    list.removeAll ();
    text.setText (""); //$NON-NLS-1$
    canvas.redraw ();
    for (int i=0; i<objects.length; i++) {
        list.add (objectName (objects [i]));
    }
    refreshLabel ();
    layout ();
}
项目:pgcodekeeper    文件:OpenProjectUtils.java   
/**
 * Shows a message box with version warning.
 * @param isError does the error block the project from opening
 */
private static void warnVersion(Shell parent, String error, boolean isError) {
    MessageBox mb = new MessageBox(
            parent, isError? SWT.ICON_ERROR : SWT.ICON_WARNING);
    mb.setText(Messages.OpenProjectUtils_version_error);

    String msg = isError? Messages.OpenProjectUtils_proj_version_unsupported :
        Messages.OpenProjectUtils_proj_version_warn;
    mb.setMessage(msg + error);
    mb.open();
}
项目:pgcodekeeper    文件:ProjectEditorDiffer.java   
/**
 * @return number of checked elements
 */
private int warnCheckedElements() {
    int checked = diffTable.getCheckedElementsCount();
    if (checked < 1) {
        MessageBox mb = new MessageBox(parent.getShell(), SWT.ICON_INFORMATION);
        mb.setMessage(Messages.please_check_at_least_one_row);
        mb.setText(Messages.empty_selection);
        mb.open();
    }
    return checked;
}
项目:Hydrograph    文件:SubJobAction.java   
private boolean notConfirmedByUser() {
    MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_QUESTION | SWT.YES
            | SWT.NO);
    messageBox.setMessage(Messages.CONFIRM_TO_CREATE_SUBJOB_MESSAGE);
    messageBox.setText(Messages.CONFIRM_TO_CREATE_SUBJOB_WINDOW_TITLE);
    int response = messageBox.open();
    if (response == SWT.YES) {
        return false;
    } else
        return true;
}