Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set current project directory for the "Baseline File" and "Configuration File" browse file dialog window #51

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package io.gitlab.arturbosch.detekt.config;

import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.TextComponentAccessor;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.Comparing;
import com.intellij.ui.IdeBorderFactory;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
* @author Dmytro Primshyts
Expand All @@ -26,6 +25,11 @@ public class DetektConfigurationForm {
private TextFieldWithBrowseButton baselineFilePath;

private DetektConfigStorage detektConfigStorage;
private final Project project;

public DetektConfigurationForm(Project project) {
this.project = project;
}

@NotNull
public JComponent createPanel(@NotNull DetektConfigStorage detektConfigStorage) {
Expand Down Expand Up @@ -54,15 +58,15 @@ public JComponent createPanel(@NotNull DetektConfigStorage detektConfigStorage)
configurationFilePath.addBrowseFolderListener(
"",
"Detekt rules file",
null,
project,
fileChooserDescriptor,
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT
);

baselineFilePath.addBrowseFolderListener(
"",
"Detekt baseline file",
null,
project,
fileChooserDescriptor,
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import javax.swing.JComponent
class DetektConfig(private val project: Project) : SearchableConfigurable {

private val detektConfigStorage: DetektConfigStorage = DetektConfigStorage.instance(project)
private val detektConfigurationForm: DetektConfigurationForm = DetektConfigurationForm()
private val detektConfigurationForm: DetektConfigurationForm = DetektConfigurationForm(project)

override fun isModified(): Boolean = detektConfigurationForm.isModified

Expand Down