當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript store.OutputSectionsStore類代碼示例

本文整理匯總了TypeScript中eez-studio-shared/model/store.OutputSectionsStore的典型用法代碼示例。如果您正苦於以下問題:TypeScript OutputSectionsStore類的具體用法?TypeScript OutputSectionsStore怎麽用?TypeScript OutputSectionsStore使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了OutputSectionsStore類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: showCheckResult

function showCheckResult() {
    let outputSection = OutputSectionsStore.getSection(Section.OUTPUT);

    let checkResultMassage: string;

    if (outputSection.numErrors == 0) {
        checkResultMassage = "No error";
    } else if (outputSection.numErrors == 1) {
        checkResultMassage = "1 error";
    } else {
        checkResultMassage = `${outputSection.numErrors} errors`;
    }

    checkResultMassage += " and ";

    if (outputSection.numWarnings == 0) {
        checkResultMassage += " no warning";
    } else if (outputSection.numWarnings == 1) {
        checkResultMassage += " 1 warning";
    } else {
        checkResultMassage += ` ${outputSection.numWarnings} warnings`;
    }

    checkResultMassage += " detected";

    OutputSectionsStore.write(Section.OUTPUT, Type.INFO, checkResultMassage);
}
開發者ID:eez-open,項目名稱:studio,代碼行數:27,代碼來源:build.ts

示例2: setInterval

            this.interval = setInterval(() => {
                let startTime = new Date().getTime();

                while (true) {
                    let searchResult = searchResultsGenerator.next();
                    if (searchResult.done) {
                        clearInterval(this.interval);
                        this.interval = undefined;
                        return;
                    }

                    let valueObject = searchResult.value;
                    if (valueObject) {
                        OutputSectionsStore.write(
                            Section.SEARCH,
                            Type.INFO,
                            objectToString(valueObject),
                            valueObject
                        );
                    }

                    if (new Date().getTime() - startTime > 10) {
                        return;
                    }
                }
            }, 20);
開發者ID:eez-open,項目名稱:studio,代碼行數:26,代碼來源:search.ts

示例3: startNewSearch

    startNewSearch(root: EezObject, patternOrObject: string | EezObject) {
        OutputSectionsStore.clear(Section.SEARCH);

        if (this.interval) {
            clearInterval(this.interval);
            this.interval = undefined;
        }

        if (
            root &&
            patternOrObject &&
            (typeof patternOrObject != "string" || patternOrObject.length > 0)
        ) {
            let searchResultsGenerator =
                typeof patternOrObject == "string"
                    ? searchForPattern(root, patternOrObject, true)
                    : searchForReference(root, patternOrObject, true);

            this.interval = setInterval(() => {
                let startTime = new Date().getTime();

                while (true) {
                    let searchResult = searchResultsGenerator.next();
                    if (searchResult.done) {
                        clearInterval(this.interval);
                        this.interval = undefined;
                        return;
                    }

                    let valueObject = searchResult.value;
                    if (valueObject) {
                        OutputSectionsStore.write(
                            Section.SEARCH,
                            Type.INFO,
                            objectToString(valueObject),
                            valueObject
                        );
                    }

                    if (new Date().getTime() - startTime > 10) {
                        return;
                    }
                }
            }, 20);
        }
    }
開發者ID:eez-open,項目名稱:studio,代碼行數:46,代碼來源:search.ts

示例4: build

export async function build(onlyCheck: boolean) {
    OutputSectionsStore.setActiveSection(Section.OUTPUT);
    OutputSectionsStore.clear(Section.OUTPUT);

    if (!anythingToBuild()) {
        OutputSectionsStore.write(Section.OUTPUT, Type.INFO, `Nothing to build!`);
        return;
    }

    try {
        let sectionNames: string[] | undefined = undefined;

        let destinationFolderPath;
        if (!onlyCheck) {
            destinationFolderPath = ProjectStore.getAbsoluteFilePath(
                ProjectStore.project.settings.build.destinationFolder || "."
            );
            if (!fs.existsSync(destinationFolderPath)) {
                throw new BuildException("Cannot find destination folder.");
            }

            sectionNames = getSectionNames();
        }

        let buildResults = await getBuildResults(sectionNames);

        showCheckResult();

        if (onlyCheck) {
            return;
        }

        await doBuild(destinationFolderPath, buildResults);

        await extensionDefinitionBuild();

        OutputSectionsStore.write(Section.OUTPUT, Type.INFO, "Build successfully finished.");
    } catch (err) {
        if (err instanceof BuildException) {
            OutputSectionsStore.write(Section.OUTPUT, Type.ERROR, err.message, err.object);
        } else {
            OutputSectionsStore.write(Section.OUTPUT, Type.ERROR, `Module build error: ${err}`);
        }

        showCheckResult();
    }
}
開發者ID:eez-open,項目名稱:studio,代碼行數:47,代碼來源:build.ts

示例5: Promise

    return new Promise((resolve, reject) => {
        const result: any = {};

        // warn about enum not used in the project
        const scpi = (project as any).scpi as Scpi;
        const enums = scpi.enums;
        for (const scpiEnum of enums._array) {
            if (!isReferenced(scpiEnum)) {
                OutputSectionsStore.write(
                    output.Section.OUTPUT,
                    output.Type.WARNING,
                    `enum not used in the project`,
                    scpiEnum
                );
            }
        }

        if (!sectionNames || sectionNames.indexOf("SCPI_COMMANDS_DECL") !== -1) {
            result.SCPI_COMMANDS_DECL = buildScpiCommandsDecl(project);
        }

        resolve(result);
    });
開發者ID:eez-open,項目名稱:studio,代碼行數:23,代碼來源:build.ts

示例6: toJS

        extensionsToBuild.map(async extensionDefinition => {
            const idfFromProject = toJS(extensionDefinition);

            const instrumentIdf: InstrumentIdfProperties = idfFromProject as any;

            // collect extension properties
            let properties: any = {};

            // from configuration
            const configuration = ProjectStore.project.settings.build.configurations._array.find(
                configuration => configuration.name == extensionDefinition.buildConfiguration
            );
            if (configuration && configuration.properties) {
                properties = Object.assign(properties, JSON.parse(configuration.properties));
            }

            // from extension definition
            if (idfFromProject.properties) {
                properties = Object.assign(properties, JSON.parse(idfFromProject.properties));
            }

            // from other project extensions
            properties = Object.assign(
                {
                    properties
                },
                getInstrumentExtensionProperties(idfFromProject)
            );

            if (configuration) {
                properties.moreDescription = configuration.description;
            }

            if (instrumentIdf.extensionName && instrumentIdf.idfGuid) {
                let idfFileName = `${instrumentIdf.extensionName}-${
                    instrumentIdf.idfRevisionNumber
                }.zip`;

                let idfFilePath;
                if (extensionDefinition.buildFolder) {
                    let buildFolderPath = ProjectStore.getAbsoluteFilePath(
                        extensionDefinition.buildFolder
                    );
                    await makeFolder(buildFolderPath);
                    idfFilePath = buildFolderPath + "/" + idfFileName;
                } else {
                    idfFilePath = ProjectStore.getAbsoluteFilePath(idfFileName);
                }

                const scpi = getProperty(ProjectStore.project, "scpi") as Scpi;
                const subsystems = objectToJS(scpi.subsystems);
                const enums = objectToJS(scpi.enums);

                await buildInstrumentExtension(
                    instrumentIdf,

                    subsystems,

                    enums,

                    idfFilePath,

                    instrumentIdf.image && ProjectStore.getAbsoluteFilePath(instrumentIdf.image),

                    ProjectStore.project.settings.general.scpiDocFolder &&
                        ProjectStore.getAbsoluteFilePath(
                            ProjectStore.project.settings.general.scpiDocFolder
                        ),

                    properties
                );

                OutputSectionsStore.write(
                    Section.OUTPUT,
                    Type.INFO,
                    `Instrument definition file "${idfFileName}" builded.`
                );
            }
        })
開發者ID:eez-open,項目名稱:studio,代碼行數:79,代碼來源:build.ts

示例7: findAllReferences

export function findAllReferences(object: EezObject) {
    OutputSectionsStore.setActiveSection(Section.SEARCH);
    startNewSearch(DocumentStore.document, object);
}
開發者ID:eez-open,項目名稱:studio,代碼行數:4,代碼來源:search.ts

示例8: startSearch

export function startSearch(pattern: string) {
    OutputSectionsStore.setActiveSection(Section.SEARCH);
    startNewSearch(DocumentStore.document, pattern);
}
開發者ID:eez-open,項目名稱:studio,代碼行數:4,代碼來源:search.ts

示例9: backgroundCheck

export function backgroundCheck() {
    OutputSectionsStore.setMessages(Section.CHECKS, checkTransformer(ProjectStore.project));
}
開發者ID:eez-open,項目名稱:studio,代碼行數:3,代碼來源:build.ts


注:本文中的eez-studio-shared/model/store.OutputSectionsStore類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。