Use JB colors to avoid problems with different color schemes

- Fix KT-4725 Project wizard: bad font color
- Some warnings fixed

 #KT-4725 Fixed
This commit is contained in:
Nikolay Krasko
2014-03-22 01:35:19 +04:00
parent 287c1f4c71
commit de891ebc6e
3 changed files with 16 additions and 14 deletions
@@ -1,5 +1,6 @@
package org.jetbrains.jet.plugin.framework.ui;
import com.intellij.ui.JBColor;
import com.intellij.util.EventDispatcher;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -29,7 +30,7 @@ public class ChooseLibraryPathPanel {
ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
public void actionPerformed(@NotNull ActionEvent e) {
actionDispatcher.getMulticaster().actionPerformed(e);
updateComponents();
}
@@ -74,10 +75,10 @@ public class ChooseLibraryPathPanel {
private void updateComponents() {
copyFilePanel.setEnabled(copyToRadioButton.isSelected());
if (copyToRadioButton.isSelected() && copyFilePanel.hasErrors()) {
copyToRadioButton.setForeground(Color.RED);
copyToRadioButton.setForeground(JBColor.red);
}
else {
copyToRadioButton.setForeground(Color.BLACK);
copyToRadioButton.setForeground(JBColor.foreground());
}
}
}
@@ -20,6 +20,7 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.JBColor;
import com.intellij.util.EventDispatcher;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -47,7 +48,7 @@ public class CopyIntoPanel {
FileChooserDescriptorFactory.createSingleFolderDescriptor());
copyIntoField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(final DocumentEvent e) {
protected void textChanged(DocumentEvent e) {
updateComponents();
}
});
@@ -89,10 +90,10 @@ public class CopyIntoPanel {
private void updateComponents() {
boolean isError = false;
copyIntoLabel.setForeground(Color.BLACK);
copyIntoLabel.setForeground(JBColor.foreground());
if (copyIntoField.isEnabled()) {
if (copyIntoField.getText().trim().isEmpty()) {
copyIntoLabel.setForeground(Color.RED);
copyIntoLabel.setForeground(JBColor.red);
isError = true;
}
}
@@ -16,7 +16,7 @@
package org.jetbrains.jet.plugin.k2jsrun;
import com.intellij.ide.browsers.BrowserFamily;
import com.intellij.ide.browsers.BrowserFamily;
import com.intellij.ide.browsers.WebBrowser;
import com.intellij.ide.browsers.WebBrowserManager;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
@@ -27,13 +27,13 @@ import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.ui.JBColor;
import com.intellij.ui.ListCellRendererWrapper;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
@@ -94,26 +94,26 @@ public final class K2JSRunConfigurationEditor extends SettingsEditor<K2JSRunConf
final JTextField textField = generatedChooseFile.getTextField();
textField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
public void insertUpdate(@NotNull DocumentEvent e) {
onChange();
}
@Override
public void removeUpdate(DocumentEvent e) {
public void removeUpdate(@NotNull DocumentEvent e) {
onChange();
}
@Override
public void changedUpdate(DocumentEvent e) {
public void changedUpdate(@NotNull DocumentEvent e) {
onChange();
}
private void onChange() {
File file = new File(generatedChooseFile.getText());
if (!file.isDirectory()) {
textField.setForeground(Color.RED);
textField.setForeground(JBColor.red);
} else {
textField.setForeground(Color.BLACK);
textField.setForeground(JBColor.foreground());
}
}
});
@@ -122,7 +122,7 @@ public final class K2JSRunConfigurationEditor extends SettingsEditor<K2JSRunConf
private void setUpShowInBrowserCheckBox() {
openInBrowserCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
public void itemStateChanged(@NotNull ItemEvent e) {
boolean selected = openInBrowserCheckBox.isSelected();
htmlChooseFile.setEnabled(selected);
browserComboBox.setEnabled(selected);