Skip to content

Commit 0d1c9a4

Browse files
committed
Use GitHubIcons instead of each icon for class
1 parent ed3759b commit 0d1c9a4

6 files changed

Lines changed: 16 additions & 31 deletions

File tree

src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/CreatePullRequestPanel.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
*/
4242
package com.junichi11.netbeans.modules.github.issues.issue.ui;
4343

44+
import com.junichi11.netbeans.modules.github.issues.GitHubIcons;
4445
import java.awt.Component;
4546
import java.awt.event.ItemEvent;
4647
import java.awt.event.ItemListener;
4748
import java.util.List;
4849
import java.util.Map;
4950
import javax.swing.DefaultComboBoxModel;
5051
import javax.swing.DefaultListCellRenderer;
51-
import javax.swing.Icon;
5252
import javax.swing.JLabel;
5353
import javax.swing.JList;
5454
import javax.swing.JPanel;
@@ -58,7 +58,6 @@
5858
import org.eclipse.egit.github.core.Repository;
5959
import org.eclipse.egit.github.core.RepositoryBranch;
6060
import org.openide.util.ChangeSupport;
61-
import org.openide.util.ImageUtilities;
6261
import org.parboiled.common.StringUtils;
6362

6463
/**
@@ -68,7 +67,6 @@
6867
public final class CreatePullRequestPanel extends JPanel {
6968

7069
private static final long serialVersionUID = 5695111005863831097L;
71-
private static final Icon ERROR_ICON = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/error_icon_16.png", true); // NOI18N
7270
private final DefaultComboBoxModel<Repository> baseRepositoryComboBoxModel = new DefaultComboBoxModel();
7371
private final DefaultComboBoxModel<RepositoryBranch> baseComboBoxModel = new DefaultComboBoxModel();
7472
private final DefaultComboBoxModel<Repository> headRepositoryComboBoxModel = new DefaultComboBoxModel();
@@ -177,7 +175,7 @@ public void setErrorMessage(String errorMessage) {
177175
if (errorMessage == null || errorMessage.isEmpty()) {
178176
errorLabel.setIcon(null);
179177
} else {
180-
errorLabel.setIcon(ERROR_ICON);
178+
errorLabel.setIcon(GitHubIcons.ERROR_ICON_16);
181179
}
182180
errorLabel.setText(errorMessage);
183181
}

src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/GitHubIssuePanel.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
package com.junichi11.netbeans.modules.github.issues.issue.ui;
4343

4444
import com.junichi11.netbeans.modules.github.issues.GitHubCache;
45+
import com.junichi11.netbeans.modules.github.issues.GitHubIcons;
4546
import com.junichi11.netbeans.modules.github.issues.GitHubIssueState;
4647
import com.junichi11.netbeans.modules.github.issues.GitHubIssues;
4748
import static com.junichi11.netbeans.modules.github.issues.GitHubIssues.CLOSED_STATE_COLOR;
@@ -102,7 +103,6 @@
102103
import org.openide.DialogDisplayer;
103104
import org.openide.NotifyDescriptor;
104105
import org.openide.util.ChangeSupport;
105-
import org.openide.util.ImageUtilities;
106106
import org.openide.util.NbBundle;
107107
import org.openide.util.RequestProcessor;
108108
import org.pegdown.PegDownProcessor;
@@ -124,11 +124,6 @@ public class GitHubIssuePanel extends JPanel {
124124
private final DefaultComboBoxModel<Milestone> milestoneComboBoxModel = new DefaultComboBoxModel<>();
125125
private final DefaultComboBoxModel<User> assigneeComboBoxModel = new DefaultComboBoxModel<>();
126126
private final DefaultListModel<Label> labelsListModel = new DefaultListModel<>();
127-
private static final Icon ISSUE_OPENED_ICON = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/issue_opened_16.png", true); // NOI18N
128-
private static final Icon ISSUE_CLOSED_ICON = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/issue_closed_16.png", true); // NOI18N
129-
private static final Icon PULL_REQUEST_ICON = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/git_pull_request_16.png", true); // NOI18N
130-
private static final Icon ERROR_ICON = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/error_icon_16.png", true); // NOI18N
131-
private static final Icon ICON_32 = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/icon_32.png", true); // NOI18N
132127
private static final Logger LOGGER = Logger.getLogger(GitHubIssuePanel.class.getName());
133128
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); // NOI18N
134129
private final String repositoryId;
@@ -173,7 +168,7 @@ private void init() {
173168
// change header title size
174169
Font font = headerErrorLabel.getFont();
175170
headerNameLabel.setFont(font.deriveFont((float) (font.getSize() * 1.5)));
176-
headerNameLabel.setIcon(ICON_32);
171+
headerNameLabel.setIcon(GitHubIcons.GITHUB_ICON_32);
177172

178173
headerStatusLabel.setBorder(new EmptyBorder(3, 5, 3, 5));
179174

@@ -640,7 +635,7 @@ private void setHeaderStatus(GitHubIssueState status) {
640635
GitHubIssue issue = getIssue();
641636
boolean isPR = GitHubIssuesUtils.isPullRequest(issue.getIssue());
642637
text = "Open"; // NOI18N
643-
icon = isPR ? PULL_REQUEST_ICON : ISSUE_OPENED_ICON;
638+
icon = isPR ? GitHubIcons.GIT_PULL_REQUEST_ICON_16 : GitHubIcons.ISSUE_OPENED_ICON_16;
644639
opaque = true;
645640
visible = true;
646641
background = OPEN_STATE_COLOR;
@@ -651,7 +646,7 @@ private void setHeaderStatus(GitHubIssueState status) {
651646
isPR = GitHubIssuesUtils.isPullRequest(issue.getIssue());
652647
PullRequest pullRequest = getPullRequest();
653648
text = isMerged() ? "Merged" : "Closed"; // NOI18N
654-
icon = isPR ? PULL_REQUEST_ICON : ISSUE_CLOSED_ICON;
649+
icon = isPR ? GitHubIcons.GIT_PULL_REQUEST_ICON_16 : GitHubIcons.ISSUE_CLOSED_ICON_16;
655650
opaque = true;
656651
visible = true;
657652
background = (isPR && pullRequest != null && pullRequest.isMerged()) ? MERGED_STATE_COLOR : CLOSED_STATE_COLOR;
@@ -763,7 +758,7 @@ public void setErrorMessage(String errorMessage) {
763758
headerErrorLabel.setIcon(null);
764759
headerSubmitButton.setEnabled(true);
765760
} else {
766-
headerErrorLabel.setIcon(ERROR_ICON);
761+
headerErrorLabel.setIcon(GitHubIcons.ERROR_ICON_16);
767762
headerSubmitButton.setEnabled(false);
768763
}
769764
headerErrorLabel.setText(errorMessage);

src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/LabelPanel.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
*/
4242
package com.junichi11.netbeans.modules.github.issues.issue.ui;
4343

44+
import com.junichi11.netbeans.modules.github.issues.GitHubIcons;
4445
import java.awt.Color;
4546
import java.awt.Dialog;
4647
import java.util.Collections;
4748
import java.util.List;
48-
import javax.swing.Icon;
4949
import javax.swing.JColorChooser;
5050
import javax.swing.UIManager;
5151
import javax.swing.event.ChangeEvent;
@@ -57,7 +57,6 @@
5757
import org.openide.DialogDescriptor;
5858
import org.openide.DialogDisplayer;
5959
import org.openide.util.ChangeSupport;
60-
import org.openide.util.ImageUtilities;
6160
import org.openide.util.NbBundle;
6261

6362
/**
@@ -67,7 +66,6 @@
6766
public class LabelPanel extends javax.swing.JPanel {
6867

6968
private static final long serialVersionUID = -9122329677222779787L;
70-
private static final Icon ERROR_ICON = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/error_icon_16.png", true); // NOI18N
7169
private final ChangeSupport changeSupport = new ChangeSupport(this);
7270
private String errorMessage;
7371
private final List<Label> filter;
@@ -140,7 +138,7 @@ public final void setError(String errorMessage) {
140138
return;
141139
}
142140
errorLabel.setText(errorMessage);
143-
errorLabel.setIcon(ERROR_ICON);
141+
errorLabel.setIcon(GitHubIcons.ERROR_ICON_16);
144142
}
145143

146144
void fireChange() {

src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/MergePanel.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@
4141
*/
4242
package com.junichi11.netbeans.modules.github.issues.issue.ui;
4343

44+
import com.junichi11.netbeans.modules.github.issues.GitHubIcons;
4445
import com.junichi11.netbeans.modules.github.issues.GitHubIssues;
4546
import java.awt.Color;
4647
import java.awt.Component;
4748
import java.awt.Graphics;
4849
import java.awt.Insets;
49-
import javax.swing.Icon;
5050
import javax.swing.JPanel;
5151
import javax.swing.border.Border;
52-
import org.openide.util.ImageUtilities;
5352

5453
/**
5554
*
@@ -59,7 +58,6 @@ public final class MergePanel extends JPanel {
5958

6059
public static final String PROP_MERGE_CHANGED = "github.issues.confirm.merge"; // NOI18N
6160
private static final long serialVersionUID = 4232217025134323257L;
62-
private static final Icon GIT_MERGE_ICON = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/git_merge_16.png", true); // NOI18N
6361

6462
/**
6563
* Creates new form MergePanel
@@ -70,12 +68,12 @@ public MergePanel() {
7068
}
7169

7270
private void init() {
73-
mergePullRequestButton.setIcon(GIT_MERGE_ICON);
71+
mergePullRequestButton.setIcon(GitHubIcons.GIT_MERGE_ICON_16);
7472
mergePullRequestButton.setContentAreaFilled(false);
7573
mergePullRequestButton.setForeground(Color.WHITE);
7674
mergePullRequestButton.setBackground(GitHubIssues.GREEN_COLOR);
7775
mergePullRequestButton.setOpaque(true);
78-
confirmMergeButton.setIcon(GIT_MERGE_ICON);
76+
confirmMergeButton.setIcon(GitHubIcons.GIT_MERGE_ICON_16);
7977
confirmMergeButton.setContentAreaFilled(false);
8078
confirmMergeButton.setBackground(GitHubIssues.GREEN_COLOR);
8179
confirmMergeButton.setForeground(Color.white);

src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/MilestonePanel.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141
*/
4242
package com.junichi11.netbeans.modules.github.issues.issue.ui;
4343

44+
import com.junichi11.netbeans.modules.github.issues.GitHubIcons;
4445
import java.awt.Dialog;
4546
import java.text.SimpleDateFormat;
4647
import java.util.Collections;
4748
import java.util.Date;
4849
import java.util.List;
49-
import javax.swing.Icon;
5050
import javax.swing.UIManager;
5151
import javax.swing.event.ChangeEvent;
5252
import javax.swing.event.ChangeListener;
@@ -57,7 +57,6 @@
5757
import org.openide.DialogDescriptor;
5858
import org.openide.DialogDisplayer;
5959
import org.openide.util.ChangeSupport;
60-
import org.openide.util.ImageUtilities;
6160
import org.openide.util.NbBundle;
6261

6362
/**
@@ -66,7 +65,6 @@
6665
*/
6766
public class MilestonePanel extends javax.swing.JPanel {
6867

69-
private static final Icon ERROR_ICON = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/error_icon_16.png", true); // NOI18N
7068
private static final long serialVersionUID = -4759519190789532723L;
7169
private final ChangeSupport changeSupport = new ChangeSupport(this);
7270
private String errorMessage;
@@ -150,7 +148,7 @@ public final void setError(String errorMessage) {
150148
return;
151149
}
152150
errorLabel.setText(errorMessage);
153-
errorLabel.setIcon(ERROR_ICON);
151+
errorLabel.setIcon(GitHubIcons.ERROR_ICON_16);
154152
}
155153

156154
void fireChange() {

src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/TemplatePanel.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@
4141
*/
4242
package com.junichi11.netbeans.modules.github.issues.issue.ui;
4343

44-
import javax.swing.Icon;
44+
import com.junichi11.netbeans.modules.github.issues.GitHubIcons;
4545
import javax.swing.UIManager;
4646
import javax.swing.event.ChangeListener;
4747
import javax.swing.event.DocumentEvent;
4848
import javax.swing.event.DocumentListener;
4949
import org.openide.util.ChangeSupport;
50-
import org.openide.util.ImageUtilities;
5150

5251
/**
5352
*
@@ -57,7 +56,6 @@ public class TemplatePanel extends javax.swing.JPanel {
5756

5857
private static final long serialVersionUID = 799388642653499961L;
5958
private final ChangeSupport changeSupport = new ChangeSupport(this);
60-
private static final Icon ERROR_ICON = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/error_icon_16.png", true); // NOI18N
6159

6260
/**
6361
* Creates new form TemplatePanel
@@ -101,7 +99,7 @@ public void setErrorMessage(String errorMessage) {
10199
errorMessage = ""; // NOI18N
102100
errorLabel.setIcon(null);
103101
} else {
104-
errorLabel.setIcon(ERROR_ICON);
102+
errorLabel.setIcon(GitHubIcons.ERROR_ICON_16);
105103
}
106104
errorLabel.setText(errorMessage);
107105
}

0 commit comments

Comments
 (0)