Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
reverted settings change (it should be present in Intellij 12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Plushnikov committed Sep 10, 2014
1 parent d54060d commit 831a8ba
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.plushnikov.intellij.plugin.settings.ProjectSettingsPage">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="701" height="280"/>
Expand All @@ -22,8 +22,8 @@
</constraints>
<properties>
<selected value="false"/>
<text value="Enable Lombok plugin for this project (Don't forget to enable annotation processing under Compiler settings for lombok itself)"/>
<toolTipText value="This checkbox only enables plugin functionality, not the lombok-annotation-processors!"/>
<text value="Enable Lombok support for this project "/>
<toolTipText value=""/>
</properties>
</component>
<component id="642bd" class="javax.swing.JLabel">
Expand All @@ -43,9 +43,67 @@
</vspacer>
</children>
</grid>
<grid id="fd9ac" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="95f20" class="javax.swing.JLabel" binding="myAnnotationConfigurationInfo1Label">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font style="1"/>
<foreground color="-65485"/>
<text value="Lombok plugin only works with Javac compiler. "/>
</properties>
</component>
<component id="52b00" class="javax.swing.JLabel" binding="myAnnotationConfigurationInfo2Label">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font style="1"/>
<foreground color="-65485"/>
<text value="You should activate external compiler option and enable annotation processors"/>
</properties>
</component>
<component id="a5847" class="javax.swing.JButton" binding="checkButton">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Verify IntelliJ configuration for Lombok support"/>
</properties>
</component>
<component id="cfb0f" class="javax.swing.JLabel" binding="myAnnotationConfigurationOkLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font style="1"/>
<foreground color="-16724941"/>
<text value="Configuration of IntelliJ seems to be ok"/>
</properties>
</component>
<component id="a6564" class="javax.swing.JLabel" binding="myAnnotationConfigurationInfo3Label">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font style="1"/>
<foreground color="-65485"/>
<text value="or disable external compiler and disable all of annotation compilers to work with lombok."/>
</properties>
</component>
</children>
</grid>
<vspacer id="55035">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package de.plushnikov.intellij.plugin.settings;

import com.intellij.compiler.CompilerConfiguration;
import com.intellij.compiler.CompilerConfigurationImpl;
import com.intellij.compiler.CompilerWorkspaceConfiguration;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
Expand All @@ -9,16 +12,34 @@
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
*
*/
public class ProjectSettingsPage implements SearchableConfigurable, Configurable.NoScroll {
public static final String JAVAC_COMPILER_ID = "Javac";

private JPanel myPanel;
private JCheckBox myEnableLombokInProject;
private JLabel myAnnotationConfigurationInfo1Label;
private JLabel myAnnotationConfigurationInfo2Label;
private JLabel myAnnotationConfigurationInfo3Label;
private JLabel myAnnotationConfigurationOkLabel;
private JButton checkButton;

private Project myProject;

public ProjectSettingsPage(Project project) {
myProject = project;

checkButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateAnnotationConfigurationInfo();
}
});
}

@Nls
Expand All @@ -40,9 +61,29 @@ public String getHelpTopic() {
@Override
public JComponent createComponent() {
myEnableLombokInProject.setSelected(ProjectSettings.isEnabledInProject(myProject));
updateAnnotationConfigurationInfo();

return myPanel;
}

private void updateAnnotationConfigurationInfo() {
boolean annotationProcessingPossible = isLombokAnnotationProcessingPossible();

myAnnotationConfigurationOkLabel.setVisible(annotationProcessingPossible);
myAnnotationConfigurationInfo1Label.setVisible(!annotationProcessingPossible);
myAnnotationConfigurationInfo2Label.setVisible(!annotationProcessingPossible);
myAnnotationConfigurationInfo3Label.setVisible(!annotationProcessingPossible);
}

private boolean isLombokAnnotationProcessingPossible() {
final CompilerConfiguration compilerConfiguration = CompilerConfiguration.getInstance(myProject);
boolean javacCompiler = JAVAC_COMPILER_ID.equals(((CompilerConfigurationImpl) compilerConfiguration).getDefaultCompiler().getId());
boolean annotationProcessorsEnabled = compilerConfiguration.isAnnotationProcessorsEnabled();
boolean externBuild = CompilerWorkspaceConfiguration.getInstance(myProject).useOutOfProcessBuild();

return (externBuild && annotationProcessorsEnabled) || (!externBuild && !annotationProcessorsEnabled && javacCompiler);
}

@Override
public boolean isModified() {
return myEnableLombokInProject.isSelected() != ProjectSettings.isEnabledInProject(myProject);
Expand Down

0 comments on commit 831a8ba

Please sign in to comment.