Skip to content

Commit ed3759b

Browse files
committed
Add GitHubIcons
1 parent 0c9ec79 commit ed3759b

2 files changed

Lines changed: 102 additions & 6 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/*
2+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3+
*
4+
* Copyright 2015 Oracle and/or its affiliates. All rights reserved.
5+
*
6+
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7+
* Other names may be trademarks of their respective owners.
8+
*
9+
* The contents of this file are subject to the terms of either the GNU
10+
* General Public License Version 2 only ("GPL") or the Common
11+
* Development and Distribution License("CDDL") (collectively, the
12+
* "License"). You may not use this file except in compliance with the
13+
* License. You can obtain a copy of the License at
14+
* http://www.netbeans.org/cddl-gplv2.html
15+
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16+
* specific language governing permissions and limitations under the
17+
* License. When distributing the software, include this License Header
18+
* Notice in each file and include the License file at
19+
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
20+
* particular file as subject to the "Classpath" exception as provided
21+
* by Oracle in the GPL Version 2 section of the License file that
22+
* accompanied this code. If applicable, add the following below the
23+
* License Header, with the fields enclosed by brackets [] replaced by
24+
* your own identifying information:
25+
* "Portions Copyrighted [year] [name of copyright owner]"
26+
*
27+
* If you wish your version of this file to be governed by only the CDDL
28+
* or only the GPL Version 2, indicate your decision by adding
29+
* "[Contributor] elects to include this software in this distribution
30+
* under the [CDDL or GPL Version 2] license." If you do not indicate a
31+
* single choice of license, a recipient has the option to distribute
32+
* your version of this file under either the CDDL, the GPL Version 2 or
33+
* to extend the choice of license to its licensees as provided above.
34+
* However, if you add GPL Version 2 code and therefore, elected the GPL
35+
* Version 2 license, then the option applies only if the new code is
36+
* made subject to such option by the copyright holder.
37+
*
38+
* Contributor(s):
39+
*
40+
* Portions Copyrighted 2015 Sun Microsystems, Inc.
41+
*/
42+
package com.junichi11.netbeans.modules.github.issues;
43+
44+
import javax.swing.Icon;
45+
import org.netbeans.api.annotations.common.StaticResource;
46+
import org.openide.util.ImageUtilities;
47+
48+
/**
49+
*
50+
* @author junichi11
51+
*/
52+
public final class GitHubIcons {
53+
54+
@StaticResource
55+
private static final String CLOSED_ISSUE_16 = "com/junichi11/netbeans/modules/github/issues/resources/closed_issue_16.png"; // NOI18N
56+
@StaticResource
57+
private static final String CLOSED_PULL_REQUEST_16 = "com/junichi11/netbeans/modules/github/issues/resources/closed_pull_request_16.png"; // NOI18N
58+
@StaticResource
59+
private static final String ERROR_16 = "com/junichi11/netbeans/modules/github/issues/resources/error_icon_16.png"; // NOI18N
60+
@StaticResource
61+
private static final String GIT_MERGE_16 = "com/junichi11/netbeans/modules/github/issues/resources/git_merge_16.png"; // NOI18N
62+
@StaticResource
63+
private static final String GIT_PULL_REQUEST_16 = "com/junichi11/netbeans/modules/github/issues/resources/git_pull_request_16.png"; // NOI18N
64+
@StaticResource
65+
private static final String GITHUB_16 = "com/junichi11/netbeans/modules/github/issues/resources/icon_16.png"; // NOI18N
66+
@StaticResource
67+
private static final String GITHUB_32 = "com/junichi11/netbeans/modules/github/issues/resources/icon_32.png"; // NOI18N
68+
@StaticResource
69+
private static final String ISSUE_CLOSED_16 = "com/junichi11/netbeans/modules/github/issues/resources/issue_closed_16.png"; // NOI18N
70+
@StaticResource
71+
private static final String ISSUE_OPENED_16 = "com/junichi11/netbeans/modules/github/issues/resources/issue_opened_16.png"; // NOI18N
72+
@StaticResource
73+
private static final String MERGED_PULL_REQUEST_16 = "com/junichi11/netbeans/modules/github/issues/resources/merged_pull_request_16.png"; // NOI18N
74+
@StaticResource
75+
private static final String OPEN_ISSUE_16 = "com/junichi11/netbeans/modules/github/issues/resources/open_issue_16.png"; // NOI18N
76+
@StaticResource
77+
private static final String OPEN_PULL_REQUEST_16 = "com/junichi11/netbeans/modules/github/issues/resources/open_pull_request_16.png"; // NOI18N
78+
@StaticResource
79+
private static final String TEMPLATE_16 = "com/junichi11/netbeans/modules/github/issues/resources/template_16.png"; // NOI18N
80+
@StaticResource
81+
private static final String TEMPLATE_SETTINGS_16 = "com/junichi11/netbeans/modules/github/issues/resources/template_settings_16.png"; // NOI18N
82+
public static final Icon CLOSED_ISSUE_ICON_16 = ImageUtilities.loadImageIcon(CLOSED_ISSUE_16, true);
83+
public static final Icon CLOSED_PULL_REQUEST_ICON_16 = ImageUtilities.loadImageIcon(CLOSED_PULL_REQUEST_16, true);
84+
public static final Icon ERROR_ICON_16 = ImageUtilities.loadImageIcon(ERROR_16, true);
85+
public static final Icon GIT_MERGE_ICON_16 = ImageUtilities.loadImageIcon(GIT_MERGE_16, true);
86+
public static final Icon GIT_PULL_REQUEST_ICON_16 = ImageUtilities.loadImageIcon(GIT_PULL_REQUEST_16, true);
87+
public static final Icon GITHUB_ICON_16 = ImageUtilities.loadImageIcon(GITHUB_16, true);
88+
public static final Icon GITHUB_ICON_32 = ImageUtilities.loadImageIcon(GITHUB_32, true);
89+
public static final Icon ISSUE_OPENED_ICON_16 = ImageUtilities.loadImageIcon(ISSUE_OPENED_16, true);
90+
public static final Icon ISSUE_CLOSED_ICON_16 = ImageUtilities.loadImageIcon(ISSUE_CLOSED_16, true);
91+
public static final Icon MERGE_PULL_REQUEST_ICON_16 = ImageUtilities.loadImageIcon(MERGED_PULL_REQUEST_16, true);
92+
public static final Icon OPEN_ISSUE_ICON_16 = ImageUtilities.loadImageIcon(OPEN_ISSUE_16, true);
93+
public static final Icon OPEN_PULL_REQUEST_ICON_16 = ImageUtilities.loadImageIcon(OPEN_PULL_REQUEST_16, true);
94+
public static final Icon TEMPLATE_ICON_16 = ImageUtilities.loadImageIcon(TEMPLATE_16, true);
95+
public static final Icon TEMPLATE_SETTINGS_ICON_16 = ImageUtilities.loadImageIcon(TEMPLATE_SETTINGS_16, true);
96+
97+
private GitHubIcons() {
98+
}
99+
}

src/main/java/com/junichi11/netbeans/modules/github/issues/query/ui/GitHubQueryPanel.java

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

44+
import com.junichi11.netbeans.modules.github.issues.GitHubIcons;
4445
import com.junichi11.netbeans.modules.github.issues.egit.SearchIssuesParams;
4546
import com.junichi11.netbeans.modules.github.issues.egit.SearchIssuesParams.Is;
4647
import com.junichi11.netbeans.modules.github.issues.egit.SearchIssuesParams.No;
@@ -53,14 +54,12 @@
5354
import java.awt.Font;
5455
import java.awt.event.ActionListener;
5556
import javax.swing.DefaultComboBoxModel;
56-
import javax.swing.Icon;
5757
import javax.swing.JComponent;
5858
import javax.swing.UIManager;
5959
import javax.swing.event.ChangeListener;
6060
import javax.swing.event.DocumentEvent;
6161
import javax.swing.event.DocumentListener;
6262
import org.openide.util.ChangeSupport;
63-
import org.openide.util.ImageUtilities;
6463
import org.openide.util.NbBundle;
6564

6665
/**
@@ -80,8 +79,6 @@ public class GitHubQueryPanel extends javax.swing.JPanel {
8079
private final DefaultComboBoxModel<SearchIssuesParams.Sort> sortComboBoxModel = new DefaultComboBoxModel();
8180
private final DefaultComboBoxModel<SearchIssuesParams.Order> orderComboBoxModel = new DefaultComboBoxModel();
8281
private final ChangeSupport changeSupport = new ChangeSupport(this);
83-
private static final Icon ERROR_ICON = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/error_icon_16.png", true); // NOI18N
84-
private static final Icon ICON_32 = ImageUtilities.loadImageIcon("com/junichi11/netbeans/modules/github/issues/resources/icon_32.png", true); // NOI18N
8582

8683
/**
8784
* Creates new form GitHubQueryPanel
@@ -96,7 +93,7 @@ public GitHubQueryPanel(GitHubQuery query, JComponent table) {
9693

9794
Font font = headerErrorLabel.getFont();
9895
headerNameLabel.setFont(font.deriveFont((float) (font.getSize() * 1.5)));
99-
headerNameLabel.setIcon(ICON_32);
96+
headerNameLabel.setIcon(GitHubIcons.GITHUB_ICON_32);
10097

10198
// state
10299
stateComboBoxModel.addElement(null);
@@ -211,7 +208,7 @@ public final void setErrorMessage(String errorMessage) {
211208
errorMessage = ""; // NOI18N
212209
headerErrorLabel.setIcon(null);
213210
} else {
214-
headerErrorLabel.setIcon(ERROR_ICON);
211+
headerErrorLabel.setIcon(GitHubIcons.ERROR_ICON_16);
215212
}
216213
headerErrorLabel.setText(errorMessage);
217214
}

0 commit comments

Comments
 (0)