Package org.openquark.cal.services

Examples of org.openquark.cal.services.Status


     * @return a Set of the names of the "discoverable" modules.
     */
    private SortedSet<ModuleName> getDiscoverableModules() {
        // Get the available modules in the standard vault.
        // Use a sorted set to that the modules will be sorted alphabetically.
        SortedSet<ModuleName> moduleSet = new TreeSet<ModuleName>(Arrays.asList(StandardVault.getInstance().getAvailableModules(new Status("Add Status."))));
       
        // Remove the names of modules already in the program.
        moduleSet.removeAll(Arrays.asList(getWorkspaceManager().getModuleNamesInProgram()));
        return moduleSet;
    }
View Full Code Here


                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();
                            for (int u = 0; u < msgs.length; ++u) {
                                iceLogger.log(Level.INFO, msgs[u].getMessage());
                            }
                        }
                    } else {
                        Status removeStatus = new Status("Remove Status");
                        workspaceManager.removeModule(moduleToRemove, true, removeStatus);
                    }
                    if (!getWorkspaceManager().hasModuleInProgram(targetModule)) {
                        targetModule = getDefaultWorkingModuleName();
                        preferredWorkingModuleName = targetModule;
View Full Code Here

                    }

                    return;
                }

                Status addStatus = new Status("Add status");

                StoredVaultElement.Module moduleToAdd = StandardVault.getInstance().getStoredModule(moduleName, -1, addStatus);

                if (moduleToAdd == null) {
                    iceLogger.log(Level.INFO, "Cannot find a module named: " + moduleName);
                    if (!addStatus.isOK()) {
                        iceLogger.log(Level.INFO, addStatus.getDebugMessage());
                    }
                    return;
                }

                iceLogger.log(Level.INFO, "Adding module: " + moduleName);
               
                Status addModuleStatus = new Status("Add module status");

                if (!workspaceManager.getWorkspace().addModule(moduleToAdd, true, addModuleStatus)) {
                    iceLogger.log(Level.INFO, "Unable to compile module: " + moduleName);
                    if (!addModuleStatus.isOK()) {
                        iceLogger.log(Level.INFO, addModuleStatus.getDebugMessage());
                    }
                    return;
                }

                compileWorkspace(false, true, false);
View Full Code Here

     *          newline-terminated lines, including blank lines, comments, etc.
     * @throws IOException
     */
    static int getLineCount(ModuleName moduleName, CALWorkspace workspace) throws IOException {
        int count = 1;
        Reader reader = workspace.getSourceDefinition(moduleName).getSourceReader(new Status("reading source for refactoring"));
        if (reader == null) {
            throw new IllegalArgumentException("module " + moduleName + " is not in the workspace");
        }
       
        BufferedReader sourceReader = new BufferedReader(reader);
View Full Code Here

                public InputStream getInputStream(VaultRegistry vaultRegistry, Status status) {
                    try {
                        return new FileInputStream(file);
                       
                    } catch (FileNotFoundException e) {
                        status.add(new Status(Status.Severity.ERROR, "Could not access file: " + getName(), e));
                        return null;
                    }
                }

                public String getLocation() {
View Full Code Here

        synchronized (this.workspaceManager) {
            CompilerMessageLogger ml = new MessageLogger();
           
            if (initialize) {
                // Init and compile the workspace.
                Status initStatus = new Status("Init status.");
                workspaceManager.initWorkspace(streamProvider, initStatus);
               
                if (initStatus.getSeverity() != Status.Severity.OK) {
                    ml.logMessage(initStatus.asCompilerMessage());
                }
            }
           
            ModuleLoadListener moduleLoadListener = new ModuleLoadListener();
           
View Full Code Here

     * @param moduleSourceDefn The source definition to read the source text for
     * @return The source text of a module as a single String
     */
    private static String readModuleSource(ModuleSourceDefinition moduleSourceDefn) {

        Reader reader = moduleSourceDefn.getSourceReader(new Status("reading module source"));
        if (reader == null) {
            System.err.println("Failed to read module " + moduleSourceDefn.getModuleName());
            return null;
        }
        BufferedReader bufferedReader = new BufferedReader(reader);
View Full Code Here

       
        // Compile the module.
        workspaceManager.makeModule(sourceDef, logger);
       
        // Remove the module.
        leccCALServices.getWorkspaceManager().removeModule(tempModuleName, new Status("Remove module status."));
       
        // Check that we got an error message of the expected type.
        CompilerMessage error = logger.getFirstError();
        Assert.assertTrue("No errors logged.", error != null);
        Assert.assertEquals(errorClass, error.getMessageKind().getClass());
View Full Code Here

     * @return the pair of tree models.
     */
    private Pair<TreeModel, TreeModel> makeTreeModels(ModuleName moduleName) {
        ModuleSourceDefinition moduleSource = calServices.getCALWorkspace().getSourceDefinition(moduleName);

        Status status = new Status("Proccessing module " + moduleSource.getModuleName());
        Reader reader = moduleSource.getSourceReader(status);

        BufferedReader bufferedReader = new BufferedReader(reader);
        StringBuilder stringBuf = new StringBuilder();

View Full Code Here

        void setResult(ModuleName moduleName, SourceRange sourceRange) {
           
            // Update text if necessary
            if (currentModuleName == null || !currentModuleName.equals(moduleName)) {

                Reader sourceReader = workspaceManager.getWorkspace().getSourceDefinition(moduleName).getSourceReader(new Status("reading source for search hit display"));
                if (sourceReader == null) {
                    System.err.println("Could not read source definition for source: " + moduleName);
                    return;
                }
                sourceReader = new BufferedReader(sourceReader);
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.