java类org.eclipse.swt.widgets.MessageBox的实例源码

BaseDeleteAction.java 文件源码 项目:eZooKeeper 阅读 22 收藏 0 点赞 0 评论 0
@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.java 文件源码 项目:pmTrans 阅读 27 收藏 0 点赞 0 评论 0
/**
 * @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.java 文件源码 项目:pmTrans 阅读 44 收藏 0 点赞 0 评论 0
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.java 文件源码 项目:pmTrans 阅读 37 收藏 0 点赞 0 评论 0
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.java 文件源码 项目:pmTrans 阅读 29 收藏 0 点赞 0 评论 0
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();
            }
        }
    }
}
BuildLocallyAction.java 文件源码 项目:convertigo-eclipse 阅读 33 收藏 0 点赞 0 评论 0
/***
 * 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
    }
}
JavelinConnectorComposite.java 文件源码 项目:convertigo-eclipse 阅读 19 收藏 0 点赞 0 评论 0
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;
    }
}
ToolPartBuildView.java 文件源码 项目:avoCADo 阅读 29 收藏 0 点赞 0 评论 0
@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);

    }
}
DbStoreEditorDialog.java 文件源码 项目:pgcodekeeper 阅读 32 收藏 0 点赞 0 评论 0
@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();
}
UpdateDdl.java 文件源码 项目:pgcodekeeper 阅读 29 收藏 0 点赞 0 评论 0
@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;
}
MultiParameterFileDialog.java 文件源码 项目:Hydrograph 阅读 30 收藏 0 点赞 0 评论 0
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();
}
ConverterUiHelper.java 文件源码 项目:Hydrograph 阅读 35 收藏 0 点赞 0 评论 0
/**
**
 * 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;
}
UiConverterUtil.java 文件源码 项目:Hydrograph 阅读 46 收藏 0 点赞 0 评论 0
/**
 * 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;
}
ChartComposite.java 文件源码 项目:parabuild-ci 阅读 37 收藏 0 点赞 0 评论 0
/**
 * 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();
            }
        }
    }
}
ELTOperationClassDialog.java 文件源码 项目:Hydrograph 阅读 34 收藏 0 点赞 0 评论 0
@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;
}
OperationClassDialog.java 文件源码 项目:Hydrograph 阅读 25 收藏 0 点赞 0 评论 0
@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;
}
ELTSchemaGridWidget.java 文件源码 项目:Hydrograph 阅读 36 收藏 0 点赞 0 评论 0
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;
 }
}
VerifyTeraDataFastLoadOption.java 文件源码 项目:Hydrograph 阅读 31 收藏 0 点赞 0 评论 0
@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;
}
OverWriteWidgetSelectionListener.java 文件源码 项目:Hydrograph 阅读 31 收藏 0 点赞 0 评论 0
@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;
}
JobHandler.java 文件源码 项目:Hydrograph 阅读 36 收藏 0 点赞 0 评论 0
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;
        }
}
ELTGraphicalEditor.java 文件源码 项目:Hydrograph 阅读 40 收藏 0 点赞 0 评论 0
@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());
    }
}
ELTGraphicalEditor.java 文件源码 项目:Hydrograph 阅读 38 收藏 0 点赞 0 评论 0
/**
 * 
 * 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;
            }
        }
    }
}
FindReplaceDialog.java 文件源码 项目:pmTrans 阅读 45 收藏 0 点赞 0 评论 0
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.java 文件源码 项目:pmTrans 阅读 38 收藏 0 点赞 0 评论 0
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.java 文件源码 项目:pmTrans 阅读 41 收藏 0 点赞 0 评论 0
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();
    }
}
TransactionTreeObject.java 文件源码 项目:convertigo-eclipse 阅读 38 收藏 0 点赞 0 评论 0
/** 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+"\"");
                    }

                }
            }
        }
    }
}
TraceDeleteAction.java 文件源码 项目:convertigo-eclipse 阅读 26 收藏 0 点赞 0 评论 0
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();
       }
}
ConnectorEditor.java 文件源码 项目:convertigo-eclipse 阅读 30 收藏 0 点赞 0 评论 0
@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;
}
SequenceEditor.java 文件源码 项目:convertigo-eclipse 阅读 28 收藏 0 点赞 0 评论 0
@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;
}
ToolSketchCancelView.java 文件源码 项目:avoCADo 阅读 28 收藏 0 点赞 0 评论 0
@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;
    }

}


问题


面经


文章

微信
公众号

扫码关注公众号