Package org.openquark.cal.services

Examples of org.openquark.cal.services.CALWorkspace


     * @param info
     */
    private void command_showDiscoverableWorkspaces(String info) {
        List<String> cwsNames = new ArrayList<String>();
       
        CALWorkspace workspace = workspaceManager.getWorkspace();
       
        WorkspaceDeclarationManager workspaceDeclarationManager = workspace.getWorkspaceDeclarationManager();
       
        if (workspaceDeclarationManager != null) {
            ResourceStore resourceStore = workspaceDeclarationManager.getResourceStore();
           
           
View Full Code Here


       
        String workspaceName = info.trim();
       
        WorkspaceDeclaration.StreamProvider newStreamProvider = null;
       
        CALWorkspace workspace = workspaceManager.getWorkspace();
       
        final String workspaceLocation = workspace.getWorkspaceLocationString();
       
        WorkspaceDeclarationManager workspaceDeclarationManager = workspace.getWorkspaceDeclarationManager();
       
        if (workspaceDeclarationManager != null) {
            ResourceStore resourceStore = workspaceDeclarationManager.getResourceStore();
           
            for (Iterator<WorkspaceResource> it = resourceStore.getResourceIterator(); it.hasNext(); ) {
View Full Code Here

            synchronized (this.workspaceManager) {
               
                ModuleName moduleToRemove = resolveModuleNameInWorkspace(moduleToRemoveString, true);
               
                if (moduleToRemove != null) {
                    CALWorkspace wkspc = workspaceManager.getWorkspace();
                    if (wkspc.containsModule(moduleToRemove)) {
                        Status s = new Status("Remove Status");
                        workspaceManager.removeModule(moduleToRemove, s);
                        if (s.getSeverity().getLevel() > Status.Severity.INFO.getLevel()) {
                            iceLogger.log(Level.INFO, "Failure removing module: " + moduleToRemove);
                            Status[] msgs = s.getChildren();
View Full Code Here

     * a set of modules specified by the user.
     * @param argument
     */
    private void command_showModuleImports(String argument) {
        String[] moduleNameStrings = argument.split(" ");
        CALWorkspace workspace = getWorkspaceManager().getWorkspace();

        List<ModuleName> moduleNames = new ArrayList<ModuleName>();
       
        // Let's just do a sanity check before we start processing
        for (final String moduleNameString : moduleNameStrings) {
           
            ModuleName moduleName = resolveModuleNameInWorkspace(moduleNameString, true);
           
            if(moduleName == null) {
                // the module name cannot be resolved, so we simply return (resolveModuleNameInWorkspace would have printed an error message already).
                return;
            }
           
            moduleNames.add(moduleName);
        }
       
        CALWorkspace.DependencyFinder finder = workspace.getDependencyFinder(moduleNames);
        SortedSet<ModuleName> rootModules = finder.getRootSet();
        SortedSet<ModuleName> importedModules = finder.getImportedModulesSet();
       
        int rootLines = 0;
        int importedLines = 0;
View Full Code Here

            return;
        }
       
        ModuleName[] moduleNames = new ModuleName[moduleNameStrings.length];

        CALWorkspace workspace = getWorkspaceManager().getWorkspace();
        for(int i = 0, nModules = moduleNameStrings.length; i < nModules; i++) {
            moduleNames[i] = ModuleName.maybeMake(moduleNameStrings[i]);
            if (moduleNames[i] == null) {
                iceLogger.log(Level.INFO, "Invalid module name '" + moduleNameStrings[i] + "'");
                return;
            }
           
            if(!workspace.containsModule(moduleNames[i])) {
                iceLogger.log(Level.INFO, moduleNames[i] + " is not a valid module.  Use :lm to display a list of available modules.");
                return;
            }
        }
View Full Code Here

        if(moduleNameStrings.length == 0) {
            iceLogger.log(Level.INFO, "At least one module name should be provided");
            return;
        }

        CALWorkspace workspace = getWorkspaceManager().getWorkspace();
       
        ModuleName[] moduleNames = new ModuleName[moduleNameStrings.length];
       
        // Let's just do a sanity check before we start processing
        for(int i = 0, nModules = moduleNameStrings.length; i < nModules; i++) {
View Full Code Here

     * Get the name of the module to use as the default - this will be the first module encountered when the workspace declaration files are read
     * @return the name of default working module, or null if there are no modules.
     */
    private ModuleName getDefaultWorkingModuleName() {
       
        CALWorkspace workspace = getWorkspaceManager().getWorkspace();       
       
        ModuleName firstModule = workspace.getFirstModuleName();
        if (firstModule != null)
            return firstModule;
        else
            return NO_MODULE;
    }
View Full Code Here

    /**
     * @param moduleName base dependee module
     * @return list of ModuleNames of all module names dependent on the specified module
     */
    private List<ModuleName> findDependentModules(ModuleName moduleName) {
        CALWorkspace workspace = perspective.getWorkspace();
       
        List<MetaModule> allModules = new ArrayList<MetaModule>();
        allModules.addAll(perspective.getInvisibleMetaModules());
        allModules.addAll(perspective.getVisibleMetaModules());
       
View Full Code Here

     */
    private WorkspaceDeclaration.StreamProvider[] getWorkspaceDeclarationStreamProvidersFromEnvironment() {
       
        List<WorkspaceDeclaration.StreamProvider> providers = new ArrayList<WorkspaceDeclaration.StreamProvider>();
       
        CALWorkspace workspace = workspaceManager.getWorkspace();
       
        final String workspaceLocation = workspace.getWorkspaceLocationString();
       
        WorkspaceDeclarationManager workspaceDeclarationManager = workspace.getWorkspaceDeclarationManager();
       
        if (workspaceDeclarationManager != null) {
            ResourceStore resourceStore = workspaceDeclarationManager.getResourceStore();
            Iterator<WorkspaceResource> it = resourceStore.getResourceIterator();
           
View Full Code Here

     * Updates all the designs stored in the given workspace to reflect the renaming.
     * @param workspaceManager The workspace manager containing all the design the user wishes to update
     * @return True if any designs were updated
     */
    public boolean updateDesigns(WorkspaceManager workspaceManager) {
        CALWorkspace workspace = workspaceManager.getWorkspace();
        List<Pair<GemDesign, Document>> undoList = new ArrayList<Pair<GemDesign, Document>>();    // A list of designs that have been updated and should be undone if an error is encountered.
        try {
            ModuleName[] workspaceModuleNames = workspaceManager.getModuleNamesInProgram();
           
            // loop through each module in the workspace
            for (final ModuleName moduleName : workspaceModuleNames) {
               
                if (workspace.getMetaModule(moduleName) == null) {
                    // the program contains the module but the workspace doesn't, so we cannot process it
                    continue;
                }
               
                ModuleNameResolver moduleNameResolver = workspaceManager.getModuleTypeInfo(moduleName).getModuleNameResolver();
                GemDesignManager designManager = (GemDesignManager)workspace.getResourceManager(moduleName, WorkspaceResource.GEM_DESIGN_RESOURCE_TYPE);
               
                // 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));
                }
View Full Code Here

TOP

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

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.