-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathProjectSettingsComponent.java
More file actions
67 lines (54 loc) · 2.28 KB
/
ProjectSettingsComponent.java
File metadata and controls
67 lines (54 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at https://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.intellij.settings;
import java.awt.BorderLayout;
import javax.swing.JComponent;
import javax.swing.JPanel;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.util.ui.FormBuilder;
import org.mapstruct.intellij.MapStructBundle;
/**
* @author Filip Hrisafov
*/
public class ProjectSettingsComponent {
private final JPanel mainPanel;
private final JBCheckBox preferSourceBeforeTargetInMapping;
private final JBCheckBox ignoreWitherInMapping;
public ProjectSettingsComponent() {
this.preferSourceBeforeTargetInMapping = new JBCheckBox( MapStructBundle.message(
"plugin.settings.quickFix.preferSourceBeforeTargetInMapping" ), false );
this.ignoreWitherInMapping = new JBCheckBox( MapStructBundle.message(
"plugin.settings.quickFix.ignoreWitherInMapping" ), false );
JPanel quickFixProperties = new JPanel( new BorderLayout() );
quickFixProperties.setBorder( IdeBorderFactory.createTitledBorder( MapStructBundle.message(
"plugin.settings.quickFix.title" ), false ) );
quickFixProperties.add( this.preferSourceBeforeTargetInMapping, BorderLayout.NORTH );
quickFixProperties.add( this.ignoreWitherInMapping, BorderLayout.SOUTH );
this.mainPanel = FormBuilder.createFormBuilder()
.addComponent( quickFixProperties )
.addComponentFillVertically( new JPanel(), 0 )
.getPanel();
}
public JPanel getPanel() {
return mainPanel;
}
public JComponent getPreferredFocusedComponent() {
return preferSourceBeforeTargetInMapping;
}
public boolean getPreferSourceBeforeTargetInMapping() {
return preferSourceBeforeTargetInMapping.isSelected();
}
public void setPreferSourceBeforeTargetInMapping(boolean newState) {
preferSourceBeforeTargetInMapping.setSelected( newState );
}
public boolean getIgnoreWitherInMapping() {
return ignoreWitherInMapping.isSelected();
}
public void setIgnoreWitherInMapping(boolean newState) {
ignoreWitherInMapping.setSelected( newState );
}
}