Package org.openquark.cal.services

Examples of org.openquark.cal.services.Status


            } else if (levelValue >= Level.WARNING.intValue()) {
                severity = Status.Severity.WARNING;
            }
           
            if (severity != null) {
                capturingStatus.add(new Status(severity, message));
            }
        }
View Full Code Here


        if(renameResult != null){
            QualifiedName qualifiedFromName = QualifiedName.makeFromCompoundName(renameResult.getFromName());
            QualifiedName qualifiedToName = QualifiedName.makeFromCompoundName(renameResult.getToName());
           
            try {
                GemCutterRenameUpdater designUpdater = new GemCutterRenameUpdater(new Status("GemGraph update status"), gemCutter.getTypeChecker(), qualifiedToName, qualifiedFromName, renameResult.getCategory());
                designUpdater.updateTableTop(gemCutter);
            } catch( GemEntityNotPresentException fanpe) {
                // Couldn't reload the functional agent for one of the gems.              
                JOptionPane.showMessageDialog(gemCutter, "Error reloading functional agent: " + fanpe.getEntityName(),
                        "Reload error", JOptionPane.WARNING_MESSAGE);
View Full Code Here

        if(renameResult != null){
            QualifiedName qualifiedFromName = QualifiedName.makeFromCompoundName(renameResult.getFromName());
            QualifiedName qualifiedToName = QualifiedName.makeFromCompoundName(renameResult.getToName());
           
            try {
                GemCutterRenameUpdater designUpdater = new GemCutterRenameUpdater(new Status("GemGraph update status"), gemCutter.getTypeChecker(), qualifiedToName, qualifiedFromName, renameResult.getCategory());
                designUpdater.updateTableTop(gemCutter);
            } catch( GemEntityNotPresentException fanpe) {
                // Couldn't reload the functional agent for one of the gems.              
                JOptionPane.showMessageDialog(gemCutter, "Error reloading functional agent: " + fanpe.getEntityName(),
                        "Reload error", JOptionPane.WARNING_MESSAGE);
View Full Code Here

                                      ", since its module context " + moduleContext + " is not in the workspace.";
               
                // Add a warning.
                // Unfortunately, warnings are ignored. 
                // However, throwing a RenamingException will cause renaming to fail, which is not what we want.
                status.add(new Status(Status.Severity.WARNING, errorMessage));
                continue;
               
//                throw new RenamingException(errorMessage);
            }
           
            ModuleNameResolver oldExpressionContextModuleNameResolver = moduleTypeInfo.getModuleNameResolver();
            String newExpressionString = typeChecker.calculateUpdatedCodeExpression(oldExpression.getExpressionText(), oldExpression.getModuleContext(), oldExpressionContextModuleNameResolver, oldExpression.getQualificationMap(), oldName, newName, category, null);
           
            CodeAnalyser codeAnalyser = new CodeAnalyser(typeChecker, moduleTypeInfo, false, false);
            MessageLogger logger = new MessageLogger();
            QualificationResults qualificationResults = codeAnalyser.qualifyExpression(newExpressionString, null, oldExpression.getQualificationMap(), logger);
            if (qualificationResults == null) {
                // failed to parse.
                String featureName = functionalAgentMetadata.getFeatureName().getName();
                String errorMessage =
                    "Can not update the metadata for " + featureName + ", example " + (i + 1) + ", since it could not be parsed.\n" +
                    "Compiler messages (if any): " + logger.getCompilerMessages(Severity.ERROR);
               
                status.add(new Status(Status.Severity.WARNING, errorMessage));
                continue;
            }
           
            String qualifiedNewExpressionString = qualificationResults.getQualifiedCode();
           
View Full Code Here

                    if (metadataUpdated) {
                        if (!metadataManager.getResourceStore().isWriteable(oldMetadataResourceName)) {
                            throw new RenamingException("Can not update the metadata for " + newMetadata.getFeatureName().getName() + " because it is not writeable.");
                        }
                       
                        Status saveMetadataStatus = new Status("Save metadata status");
                        metadataManager.saveMetadata(newMetadata, oldMetadata.getFeatureName(), metadataLocale, saveMetadataStatus);
                        if (saveMetadataStatus.getSeverity().equals(Status.Severity.ERROR)) {
                            throw new RenamingException("Error saving the updated metadata for " + newMetadata.getFeatureName().getName() + ".");
                        }
                       
                        undoList.add(oldMetadata);
                    }
                   
                    if (statusListener != null) {
                        statusListener.doneUsingResource(metadataResource);
                    }
                }
            }
           
            // Return true if the undoList has contents (ie. changes have been made)
            return !undoList.isEmpty();
       
        } catch (RenamingException e) {
            status.add(new Status(Status.Severity.ERROR, e.getErrorMessage()));
           
            for (int i = undoList.size() - 1; i >= 0; i--) {
                CALFeatureMetadata metadata = undoList.get(i);
               
                Status undoStatus = new Status("Undo metadata update status");
                moduleContainer.saveMetadata(metadata, undoStatus);
               
                if (undoStatus.getSeverity().equals(Status.Severity.ERROR)) {
                    String msg = "FATAL: Error undoing the metadata update for " + metadata.getDisplayName();
                    status.add(new Status(Status.Severity.ERROR, msg));
                }
            }
            return false;
        }
    }
View Full Code Here

            return metadata;
   
           
        } catch (XMLPersistenceHelper.DocumentConstructionException ex) {
            // This can happen for invalid metadata files.
            importStatus.add(new Status(Status.Severity.WARNING, "Metadata file is invalid for: " + featureName, ex));
           
        } catch (BadXMLDocumentException ex) {
            // This can happen for invalid metadata files.
            importStatus.add(new Status(Status.Severity.WARNING, "Metadata file is invalid for: " + featureName, ex));
       
        } catch (Exception ex) {
            // Not sure what happened here.
            importStatus.add(new Status(Status.Severity.WARNING, "Unknown exception while loading metadata for: " + featureName, ex));
        }
       
        // An error occurred during loading so return the default empty metadata.
        return MetadataManager.getEmptyMetadata(featureName, locale);
    }
View Full Code Here

        } else {
            qualifiedFromName = QualifiedName.make(moduleName, fromName);
            qualifiedToName = QualifiedName.make(moduleName, toName);
        }
       
        Status updateDesignStatus = new Status("Update design status");
        GemCutterRenameUpdater designRenamer = new GemCutterRenameUpdater(updateDesignStatus, workspaceManager.getTypeChecker(), qualifiedToName, qualifiedFromName, category);
        designRenamer.updateDesigns(workspaceManager);
       
        return !setErrorStatus(updateDesignStatus);
    }
View Full Code Here

        } else {
            qualifiedFromName = QualifiedName.make(moduleName, toName);
            qualifiedToName = QualifiedName.make(moduleName, fromName);
        }
       
        Status updateDesignStatus = new Status("Update design status");
        GemCutterRenameUpdater designRenamer = new GemCutterRenameUpdater(updateDesignStatus, workspaceManager.getTypeChecker(), qualifiedToName, qualifiedFromName, category);
        designRenamer.updateDesigns(workspaceManager);
       
        if (updateDesignStatus.getSeverity().compareTo(Status.Severity.ERROR) >= 0) {
            DefaultListModel listModel = (DefaultListModel) errorsList.getModel();
            listModel.addElement(GemCutterMessages.getString("RNRD_ErrorUndoingDesignUpdating"));
        }
    }
View Full Code Here

        /** {@inheritDoc} */
        public InputStream getInputStream(VaultRegistry vaultRegistry, Status status) {
            try {
                return new FileInputStream(file);
            } catch (FileNotFoundException e) {
                status.add(new Status(Status.Severity.ERROR, "The specified workspace declaration file cannot be found.", e));
                return null;
            }
        }
View Full Code Here

               
                // loop through the resources for this module
                for (Iterator<WorkspaceResource> it = ((GemDesignStore)designManager.getResourceStore()).getResourceIterator(moduleName); it.hasNext(); ) {
                    WorkspaceResource designResource = it.next();
                   
                    GemDesign gemDesign = GemDesign.loadGemDesign(designResource, new Status("Load Design Status"));
                   
                    Document designDoc = gemDesign.getDesignDocument();
                    Document oldDesignDoc = (Document)designDoc.cloneNode(true);
                   
                    boolean changesMade = updateDesignDocument(designDoc, gemDesign.getDesignName(), moduleNameResolver);
                   
                    if (changesMade) {                   
                        if (!designManager.getResourceStore().isWriteable(new ResourceName(CALFeatureName.getFunctionFeatureName(gemDesign.getDesignName())))) {
                            throw new RenamingException("Can not update the design for " + gemDesign.getDesignName().getQualifiedName() + " because it is not writeable.");
                           
                        }
                       
                        Status saveGemStatus = new Status("Save gem design status");
                        workspace.saveDesign(gemDesign, saveGemStatus);
                        if (saveGemStatus.getSeverity().equals(Status.Severity.ERROR)) {
                            throw new RenamingException("Error saving the updated design for " + gemDesign.getDesignName().getQualifiedName() + ".");
                        }
                       
                        undoList.add(new Pair<GemDesign, Document>(gemDesign, oldDesignDoc));
                    }
                }
            }
           
            // Return true if the undoList has contents (ie. changes have been made)
            return !undoList.isEmpty();
           
        } catch (RenamingException e) {
            status.add(new Status(Status.Severity.ERROR, e.getErrorMessage()));
           
            for (int i = undoList.size() - 1; i >= 0; i--) {
                Pair<GemDesign, Document> designDocPair = undoList.get(i);
                GemDesign gemDesign = designDocPair.fst();
                Document oldDesignDoc = designDocPair.snd();
                replaceDocumentChildren(gemDesign.getDesignDocument(), oldDesignDoc);
               
                Status undoStatus = new Status("Undo design update status");
                workspace.saveDesign(gemDesign, undoStatus);
               
                if (undoStatus.getSeverity().equals(Status.Severity.ERROR)) {
                    String msg = "FATAL: Error undoing the design update for " + gemDesign.getDesignName().getQualifiedName();
                    status.add(new Status(Status.Severity.ERROR, msg));
                }
            }
            return false;
        }
    }
View Full Code Here

TOP

Related Classes of org.openquark.cal.services.Status

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.