Examples of GemDesign


Examples of org.openquark.cal.services.GemDesign

               
                // 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

Examples of org.openquark.cal.services.GemDesign

            getPreferences().put(OPEN_DESIGN_DIRECTORY_PREF_KEY, lastDir);
   
            String fileName = fileChooser.getSelectedFile().getAbsolutePath();
            File designFile = new File(fileName);
           
            GemDesign gemDesign = GemDesign.loadGemDesign(designFile, loadStatus);
            QualifiedName designName = gemDesign.getDesignName();
           
            if (designName != null && getWorkspace().getMetaModule(designName.getModuleName()) == null) {

                // If the module the design is from does not exist, ask the user if he wants
                // to load the design in the current module.
View Full Code Here

Examples of org.openquark.cal.services.GemDesign

     * Load a gem's design and put it on the table top.
     * @param gemEntity the entity whose design to load.
     * @param loadStatus a Status object for storing the status of the load operation
     */
    void loadGemDesign(GemEntity gemEntity, Status loadStatus) {
        GemDesign gemDesign = gemEntity.getDesign(loadStatus);
        if (gemDesign != null) {
            loadGemDesign(gemDesign, loadStatus);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.