Package org.openquark.util.ui

Examples of org.openquark.util.ui.DetailsDialog


            String details = capturedStatus.getDebugMessage();
           
            DetailsDialog.MessageType messageType = capturedStatus.getSeverity() == Status.Severity.WARNING ?
                        DetailsDialog.MessageType.WARNING : DetailsDialog.MessageType.ERROR;
           
            DetailsDialog dialog = new DetailsDialog(this, title, message, details, messageType);
            dialog.doModal();
        }
       
        return new GemGenerator.GeneratedDefinitions() {

            public ModuleDefn getModuleDefn() {
View Full Code Here


            String details = initStatus.getDebugMessage();
           
            DetailsDialog.MessageType messageType = initStatus.getSeverity() == Status.Severity.WARNING ?
                        DetailsDialog.MessageType.WARNING : DetailsDialog.MessageType.ERROR;
           
            DetailsDialog dialog = new DetailsDialog(this, title, message, details, messageType);
            dialog.doModal();
           
            if (initStatus.getSeverity().compareTo(Status.Severity.ERROR) >= 0) {
                System.exit(-1);
            }
        }
View Full Code Here

                        if (saveStatus.getSeverity() == Status.Severity.ERROR) {
                            String errTitle = getResourceString("CannotSaveDialogTitle");
                            String errMessage = getResourceString("ErrorSavingGemDefinition");

                            DetailsDialog dialog = new DetailsDialog(GemCutter.this, errTitle, errMessage,
                                    saveStatus.getDebugMessage(), DetailsDialog.MessageType.ERROR);

                            dialog.doModal();
   
                            // Don't bother trying to save the other gems.
                            break;
                        }
                    }
                }

                Status generationStatus = new Status("Generation status.");
               
                SourceModel.ModuleDefn moduleDefn = definitions.getModuleDefn();
                if (moduleDefn != null) {
                    // There was a generated module defn.
                   
                    ModuleName generatedModuleName = SourceModel.Name.Module.toModuleName(moduleDefn.getModuleName());

                    // Can't overwrite the prelude.
                    if (generatedModuleName.equals(CAL_Prelude.MODULE_NAME)) {
                        String errTitle = getResourceString("CannotSaveDialogTitle");
                        String errMessage = getResourceString("CannotClobberPrelude");
                        JOptionPane.showMessageDialog(GemCutter.this, errMessage, errTitle, JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                   
                    // Check whether the module name exists, and if so confirm that the user wished to clobber.
                    // This goes to the workspace source manager -- so it's a bit hacky.
                    // We can't just ask the workspace if it has the module though, since it might be the case where the workspace isn't
                    //   using a module in the nullary case.
                    if (getWorkspace().getSourceManager(generatedModuleName).getResourceStore().hasFeature(
                            new ResourceName(CALFeatureName.getModuleFeatureName(generatedModuleName)))) {
                       
                        // TODOEL: Ideally, if the user does not want to clobber the existing module, we should
                        //   go back to the dialog with the existing inputs.
                       
                        String warningTitle = getResourceString("WarningDialogTitle");
                        String errMessage = getResourceString("ModuleExistsWarning");
                        int continueChoice = JOptionPane.showConfirmDialog(GemCutter.this, errMessage, warningTitle, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                        if (continueChoice != JOptionPane.OK_OPTION) {
                            return;
                        }
                    }
                   
                   
                    // *** HACK ***
                    // *** Fix me when we can handle modules without vault info.
                   
                    // Ok, now we have the generated module defn.  Where do we put it?
                    // It should go into the workspace, but the workspace can't handle modules without any vault info.
                    // So for now we create a temp file first, and add from there.

                    // We could use NonExistentVault instead, but that requires some work to implement StoredVaultElement.Module.
                   
                    String tmpDir = System.getProperty("java.io.tmpdir");
                    String fileName = generatedModuleName + ".cal";
                   
                    File tempFile = new File(tmpDir, fileName);
                    String sourceText = moduleDefn.toSourceText();
                    Writer writer = null;
                    try {
                        writer = new BufferedWriter(new FileWriter(tempFile));
                        writer.write(sourceText);
                    } catch (IOException ioe) {
                        generationStatus.add(new Status(Status.Severity.ERROR, "Error writing file: " + tempFile, ioe));

                    } finally {
                        if (writer != null) {
                            try {
                                writer.flush();
                                writer.close();
                            } catch (IOException ioe) {
                                // Not much we can do about this.
                            }
                        }
                    }
                   
                    // Add the module to the workspace.
                    // Note: this can result in errors in cases where the module is erroneous.
                    //  For instance, if generating a foreign import module, this can result in errors if the module refers to
                    //    foreign classes which are not on the classpath.
                    boolean addModuleAttemptSuccessful = false;
                    if (generationStatus.getSeverity().compareTo(Status.Severity.ERROR) < 0) {

                        SimpleCALFileVault simpleCALFileVault = SimpleCALFileVault.getSimpleCALFileVault(tempFile);
                       
                        // This call also calls recompileWorkspace(true).
                        if (simpleCALFileVault != null) {
                            handleAddModuleAttempt(simpleCALFileVault, generatedModuleName, -1, false);
                            addModuleAttemptSuccessful = true;
                        } else {
                            String details = getResourceString("CannotCreateSimpleCALFileVault");
                            showProblemsGeneratingModuleDialog(DetailsDialog.MessageType.ERROR, details);
                        }
                    }
                   
                    // Delete the tempFile.  Don't worry too much about if this fails..
                    tempFile.delete();
                   
                    // Select the module which was compiled, if any.
                    if (addModuleAttemptSuccessful && generationStatus.getSeverity().compareTo(Status.Severity.ERROR) < 0) {
                        getGemBrowser().getBrowserTree().selectDrawerNode(generatedModuleName);
                       
                        // Also display a message.
                        String statusMessage = GemCutterMessages.getString("SM_ModuleGenerated", generatedModuleName);
                        statusMessageManager.displayMessage(this, statusMessage, StatusMessageDisplayer.MessageType.TRANSIENT, true);

                    }
                   
                    if (generationStatus.getSeverity().compareTo(Status.Severity.WARNING) >= 0) {
                        String details = generationStatus.getDebugMessage();
                        DetailsDialog.MessageType messageType = generationStatus.getSeverity() == Status.Severity.WARNING ?
                                DetailsDialog.MessageType.WARNING : DetailsDialog.MessageType.ERROR;
                       
                        showProblemsGeneratingModuleDialog(messageType, details);
                    }
                   
                } else {
                    // No generated module defn.
               
                    // Recompile the workspace.
                    recompileWorkspace(true);
                   
                    if (lastGemName != null) {
                       
                        // Select the last gem that was saved in the GemBrowser.
                        GemEntity newEntity = perspective.resolveGemEntity(lastGemName);
                       
                        if (newEntity != null) {
                           
                            // The entity may be null if the recompile failed
                            // or the generated source contained some sort of error.
                            getGemBrowser().getBrowserTree().selectGemNode(newEntity);
                        }                   
                    }
                }
            }

            private void showProblemsGeneratingModuleDialog(DetailsDialog.MessageType messageType, String details) {
                String title = getResourceString("WindowTitle");
                String message = getResourceString("ProblemsGeneratingModule");
               
                DetailsDialog dialog = new DetailsDialog(GemCutter.this, title, message, details, messageType);
                dialog.doModal();
            }
        };
       
        return factoryAction;
    }
View Full Code Here

     */
    private void handleWorkspaceVaultStatusAction() {

        // Just dump the text to a details dialog.
        VaultStatus vaultStatus = getWorkspace().getVaultStatus();
        DetailsDialog detailsDialog = new DetailsDialog(GemCutter.this, getResourceString("WorkspaceVaultStatusDialogTitle"), getResourceString("WorkspaceCurrentVaultStatus"),
                                                        vaultStatus.getStatusString(), DetailsDialog.MessageType.PLAIN);
        detailsDialog.setDetailsVisible(true);
        detailsDialog.doModal();
    }
View Full Code Here

    private void handleUserSyncPerformed(CALWorkspace.SyncInfo syncInfo, Status syncStatus) {
       
        if (syncStatus.getSeverity().compareTo(Status.Severity.WARNING) >= 0) {
            String title = getResourceString("SyncWorkspaceWarningTitle");
            String message = getResourceString("SyncWorkspaceWarningMessage");
            DetailsDialog detailsDialog = new DetailsDialog(GemCutter.this, title, message,
                                                            syncStatus.getDebugMessage(), DetailsDialog.MessageType.WARNING);
            detailsDialog.setDetailsVisible(true);
            detailsDialog.doModal();
        }
       
        // Display the result of the sync.
        Set<ResourceIdentifier> updatedResourceIdentifierSet = syncInfo.getUpdatedResourceIdentifiers();
        Set<ResourceIdentifier> resourceImportFailureSet = syncInfo.getResourceImportFailures();
        Set<ResourceIdentifier> syncConflictIdentifierSet = syncInfo.getSyncConflictIdentifiers();
        Set<ResourceIdentifier> deletedResourceIdentifierSet = syncInfo.getDeletedResourceIdentifiers();
       
        StringBuilder sb = new StringBuilder();
        sb.append(getResourceString("SyncWorkspaceUpdatedResources"));
        dumpIdentifierSet(updatedResourceIdentifierSet, sb);
       
        if (!deletedResourceIdentifierSet.isEmpty()) {
            sb.append(getResourceString("SyncWorkspaceDeletedResources"));
            dumpIdentifierSet(deletedResourceIdentifierSet, sb);
        }
       
        if (!syncConflictIdentifierSet.isEmpty()) {
            sb.append(getResourceString("SyncWorkspaceConflicts"));
            dumpIdentifierSet(syncConflictIdentifierSet, sb);
        }
       
        if (!resourceImportFailureSet.isEmpty()) {
            sb.append(getResourceString("SyncWorkspaceFailed"));
            dumpIdentifierSet(resourceImportFailureSet, sb);
        }
       
        String syncResultMessage = sb.toString();
       
        String title = getResourceString("SyncWorkspaceResultTitle");
        String message = getResourceString("SyncWorkspaceResultMessage");
        DetailsDialog detailsDialog = new DetailsDialog(GemCutter.this, title, message,
                                                        syncResultMessage, DetailsDialog.MessageType.PLAIN);
       
        detailsDialog.setDetailsVisible(true);
        detailsDialog.doModal();
       
        // Compile modified modules.
        recompileWorkspace(true);
    }
View Full Code Here

            }
        } else {           
            details.append(getResourceString("WorkspaceInfo_None"));
        }
       
        DetailsDialog dialog = new DetailsDialog(GemCutter.this, title, message, details.toString(), (Icon)null);
        dialog.setDetailsVisible(true);
        dialog.doModal();
    }
View Full Code Here

       
        if (!loadStatus.isOK()) {
            String title = getResourceString("WarningDialogTitle");
            String message = getResourceString("OpenErrorsWarning");
            String details = loadStatus.getDebugMessage();
            DetailsDialog dialog = new DetailsDialog(this, title, message, details, DetailsDialog.MessageType.WARNING);
            dialog.doModal();
        }
           
        // reset the table top explorer
        getTableTop().addGemGraphChangeListener(getTableTopExplorer());
        getTableTopExplorerAdapter().getTableTopExplorer().rebuildTree();
View Full Code Here

            StringBuilder details = new StringBuilder();
            for (final String message : messages) {
                details.append(message).append('\n');
            }
           
            DetailsDialog dialog = new DetailsDialog(
                GemCutter.this,
                getResourceString("ExportCarMessagesDialogTitle"),
                getResourceString("ExportCarMessagesDialogMessage"),
                details.toString(),
                DetailsDialog.MessageType.INFORMATION);
           
            dialog.doModal();
        }
View Full Code Here

TOP

Related Classes of org.openquark.util.ui.DetailsDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.