mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Project Structure dialog: improved UI for artifacts error panel
Wrap long error messages, show different icons depending on problem severity.
This commit is contained in:
-34
@@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactErrorPanel">
|
||||
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="1" column-count="3" 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="500" height="56"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="6f1fe" class="javax.swing.JLabel" binding="myErrorLabel">
|
||||
<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>
|
||||
<text value="Label"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="2859f">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="a4714" class="javax.swing.JButton" binding="myFixButton">
|
||||
<constraints>
|
||||
<grid row="0" column="2" 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="Button"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
+16
-7
@@ -18,16 +18,18 @@ package com.intellij.openapi.roots.ui.configuration.artifacts;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ConfigurationErrorQuickFix;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemType;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.ui.popup.PopupStep;
|
||||
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.update.Activatable;
|
||||
import com.intellij.util.ui.update.UiNotifyConnector;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
@@ -36,14 +38,18 @@ import java.util.List;
|
||||
* @author nik
|
||||
*/
|
||||
public class ArtifactErrorPanel {
|
||||
private JPanel myMainPanel;
|
||||
private JButton myFixButton;
|
||||
private JLabel myErrorLabel;
|
||||
private final JPanel myMainPanel;
|
||||
private final JButton myFixButton;
|
||||
private final JLabel myErrorLabel;
|
||||
private List<? extends ConfigurationErrorQuickFix> myCurrentQuickFixes;
|
||||
private String myErrorText;
|
||||
|
||||
public ArtifactErrorPanel(final ArtifactEditorImpl artifactEditor) {
|
||||
myErrorLabel.setIcon(AllIcons.RunConfigurations.ConfigurationWarning);
|
||||
myMainPanel = new JPanel(new BorderLayout());
|
||||
myErrorLabel = new JLabel();
|
||||
myMainPanel.add(myErrorLabel, BorderLayout.CENTER);
|
||||
myFixButton = new JButton();
|
||||
myMainPanel.add(myFixButton, BorderLayout.EAST);
|
||||
new UiNotifyConnector(myMainPanel, new Activatable.Adapter() {
|
||||
@Override
|
||||
public void showNotify() {
|
||||
@@ -86,9 +92,12 @@ public class ArtifactErrorPanel {
|
||||
artifactEditor.queueValidation();
|
||||
}
|
||||
|
||||
public void showError(@NotNull String message, @NotNull List<? extends ConfigurationErrorQuickFix> quickFixes) {
|
||||
public void showError(@NotNull String message, @NotNull ProjectStructureProblemType.Severity severity,
|
||||
@NotNull List<? extends ConfigurationErrorQuickFix> quickFixes) {
|
||||
myErrorLabel.setVisible(true);
|
||||
final String errorText = XmlStringUtil.wrapInHtml(message);
|
||||
myErrorLabel.setIcon(severity == ProjectStructureProblemType.Severity.ERROR ? AllIcons.General.Error :
|
||||
severity == ProjectStructureProblemType.Severity.WARNING ? AllIcons.General.Warning : AllIcons.General.Information);
|
||||
final String errorText = UIUtil.toHtml(message);
|
||||
if (myErrorLabel.isShowing()) {
|
||||
myErrorLabel.setText(errorText);
|
||||
}
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class ArtifactValidationManagerImpl implements Disposable {
|
||||
showProblemInTree(artifactProblem);
|
||||
}
|
||||
}
|
||||
myErrorPanel.showError(message, quickFixes);
|
||||
myErrorPanel.showError(message, description.getSeverity(), quickFixes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user