Examples of PbFacet


Examples of protobuf.facet.PbFacet

        return FileContentPattern.fileContent().withName(StandardPatterns.string().endsWith(".proto"));
    }

    @Override
    public void setupFacet(@NotNull final PbFacet facet, final ModifiableRootModel model) {
        final PbFacet localFacet = facet;
        final Module module = facet.getModule();
        final Project project = module.getProject();
        final ProtobufFacetConfiguration config = facet.getConfiguration();
        ProtobufFacetConfiguration defaultConfiguration = (ProtobufFacetConfiguration)ProjectFacetManager.getInstance(project).createDefaultConfiguration(facet.getType());
        config.setIsCompilationEnabled(defaultConfiguration.isCompilationEnabled());
View Full Code Here

Examples of protobuf.facet.PbFacet

        final VirtualFile[] files = compileScope.getFiles(PbFileType.PROTOBUF_FILE_TYPE, false);
        final List<GenerationItem> generationItems = new ArrayList<GenerationItem>(files.length);
        for (VirtualFile file : files) {
            if (!compilerConfiguration.isExcludedFromCompilation(file)) {
                Module module = compileContext.getModuleByFile(file);
                final PbFacet facet = PbFacet.getInstance(module);
                if (facet != null) { // Generate if a Protobuf facet has been created for the module.
                    if (facet.getConfiguration().isCompilationEnabled()) {
                        generationItems.add(new PbGenerationItem(file, module, fileIndex.isInTestSourceContent(file)));
                    }
                }
            }
        }
View Full Code Here

Examples of protobuf.facet.PbFacet

            }
        }

        // Force the Virtual files to refresh so generated the module sources will be available to the project and to the UI.
        for (Module module : modulesToRefresh) {
            final PbFacet facet = PbFacet.getInstance(module);
            if (facet != null) {
                ProtobufFacetConfiguration config = facet.getConfiguration();
                if (config.isCompilationEnabled()) {
                    File outputPathFile = new File(facet.getConfiguration().getCompilerOutputPath());
                    CompilerUtil.refreshIOFile(outputPathFile);

                    // Refresh the source root corresponding to the output source path.
                    VirtualFile outputDirectory = LocalFileSystem.getInstance().findFileByIoFile(outputPathFile);
                    if (outputDirectory != null && outputDirectory.exists()) {
View Full Code Here

Examples of protobuf.facet.PbFacet

    public boolean validateConfiguration(CompileScope compileScope) {
        // Allow for usage of just the syntax hilighter if no facets are enabled for compilation.
        boolean hasAnyModulesEnabledForCompilation = false;
        Module[] modules = compileScope.getAffectedModules();
        for (Module module : modules) {
            PbFacet facet = FacetManager.getInstance(module).getFacetByType(PbFacetType.ID);
            if (facet != null && facet.getConfiguration().isCompilationEnabled()) {
                hasAnyModulesEnabledForCompilation = true;
                break;
            }
        }
        if (!hasAnyModulesEnabledForCompilation) {
            // Bail early.
            LOG.info("No facets detected for compilation.  Giving up on configuration check.");
            return true;
        }
       
        // Check if the compiler supports current operating system.
        if (getCompilerExecutableName() == null) {
            Messages.showErrorDialog(PbBundle.message(
                    "compiler.validate.error.unsupported.os"),
                    PbBundle.message("compiler.validate.error.title"));
            return false;
        }

        // Check the to path to the compiler.
        final String pathToCompiler = getPathToCompiler();
        File compilerFile = new File(pathToCompiler);
        if (!compilerFile.exists()) {
            Messages.showErrorDialog(PbBundle.message(
                    "compiler.validate.error.path.to.protoc", pathToCompiler),
                    PbBundle.message("compiler.validate.error.title"));
            return false;
        } else if (!compilerFile.canExecute()) {
            Messages.showErrorDialog(PbBundle.message(
                    "compiler.validate.error.protoc.not.executable", pathToCompiler + "/protoc"),
                    PbBundle.message("compiler.validate.error.title"));
            return false;
        }

        for (Module module : modules) {
            PbFacet facet = FacetManager.getInstance(module).getFacetByType(PbFacetType.ID);
            if (facet != null) {
                String outputPath = facet.getConfiguration().getCompilerOutputPath();

                // Make sure the configuration has a value for the output source directory.
                if (outputPath == null) {
                    Messages.showErrorDialog(PbBundle.message(
                            "compiler.validate.error.output.source.directory.not.set", module.getName()),
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.