public ProtobufFacetEditor( FacetEditorContext editorContext, FacetValidatorsManager validatorsManager, ProtobufFacetConfiguration configuration) { this.configuration = configuration; final Project project = editorContext.getProject(); final Module module = editorContext.getModule(); commonSettingsEditor .getEnableCompilationCheckbox() .setSelected(configuration.isCompilationEnabled()); commonSettingsEditor .getProtobufCompilerOutputPathField() .setText(configuration.getCompilerOutputPath()); commonSettingsEditor .getProtobufCompilerOutputPathField() .addBrowseFolderListener( project, new CompilerOutputBrowseFolderActionListener( project, module, commonSettingsEditor.getProtobufCompilerOutputPathField())); commonSettingsEditor .getProtobufCompilerRunInFixedDirectory() .setSelected(configuration.isCompilationUseGivenRunDirectory()); commonSettingsEditor .getProtobufCompilerRunDirectory() .setText(configuration.getCompilationRunDirectory()); commonSettingsEditor .getProtobufCompilerRunDirectory() .addBrowseFolderListener( project, new CompilerOutputBrowseFolderActionListener( project, module, commonSettingsEditor.getProtobufCompilerRunDirectory())); }
@Override public void apply() throws ConfigurationException { configuration.setIsCompilationEnabled( commonSettingsEditor.getEnableCompilationCheckbox().isSelected()); configuration.setCompilerOutputPath( FileUtil.toSystemIndependentName( commonSettingsEditor.getProtobufCompilerOutputPathField().getText().trim())); configuration.setCompilationUseGivenRunDirectory( commonSettingsEditor.getProtobufCompilerRunInFixedDirectory().isSelected()); configuration.setCompilationRunDirectory( FileUtil.toSystemIndependentName( commonSettingsEditor.getProtobufCompilerRunDirectory().getText().trim())); }
@Override public boolean isModified() { boolean compilationEnabled = commonSettingsEditor.getEnableCompilationCheckbox().isSelected(); String outputPath = commonSettingsEditor.getProtobufCompilerOutputPathField().getText().trim(); boolean compileInGivenPath = commonSettingsEditor.getProtobufCompilerRunInFixedDirectory().isSelected(); String runDirectory = commonSettingsEditor.getProtobufCompilerRunDirectory().getText().trim(); return (configuration.isCompilationEnabled() != compilationEnabled || !Comparing.equal( configuration.getCompilerOutputPath(), FileUtil.toSystemIndependentName(outputPath)) || configuration.isCompilationUseGivenRunDirectory() != compileInGivenPath || !Comparing.equal( configuration.getCompilationRunDirectory(), FileUtil.toSystemIndependentName(runDirectory))); }
public JCheckBox getEnableCompilationCheckbox() { return commonSettingsEditor.getEnableCompilationCheckbox(); }