├── .github
└── FUNDING.yml
├── .gitignore
├── README.md
├── license.txt
├── nb-configuration.xml
├── pom.xml
└── src
├── main
├── java
│ └── com
│ │ └── junichi11
│ │ └── netbeans
│ │ └── modules
│ │ └── github
│ │ └── issues
│ │ ├── GitHubCache.java
│ │ ├── GitHubIcons.java
│ │ ├── GitHubIssueState.java
│ │ ├── GitHubIssues.java
│ │ ├── GitHubIssuesConfig.java
│ │ ├── GitHubIssuesConnector.java
│ │ ├── egit
│ │ ├── SearchIssues.java
│ │ ├── SearchIssuesParams.java
│ │ └── SearchService.java
│ │ ├── issue
│ │ ├── CreateIssueParams.java
│ │ ├── GetIssuesParams.java
│ │ ├── GitHubIssue.java
│ │ ├── GitHubIssueController.java
│ │ ├── GitHubIssueFinder.java
│ │ ├── GitHubIssueNode.java
│ │ ├── GitHubIssuePriorityProvider.java
│ │ ├── GitHubIssueProvider.java
│ │ ├── GitHubIssueScheduleProvider.java
│ │ ├── GitHubIssueStatusProvider.java
│ │ ├── GitHubIssueSupport.java
│ │ └── ui
│ │ │ ├── AttributesViewPanel.form
│ │ │ ├── AttributesViewPanel.java
│ │ │ ├── CommentPanel.form
│ │ │ ├── CommentPanel.java
│ │ │ ├── CommentTabbedPanel.form
│ │ │ ├── CommentTabbedPanel.java
│ │ │ ├── CommentsPanel.form
│ │ │ ├── CommentsPanel.java
│ │ │ ├── CommitPanel.form
│ │ │ ├── CommitPanel.java
│ │ │ ├── CommitsPanel.form
│ │ │ ├── CommitsPanel.java
│ │ │ ├── CreatePullRequestPanel.form
│ │ │ ├── CreatePullRequestPanel.java
│ │ │ ├── DiffTopComponent.java
│ │ │ ├── FileChangedPanel.form
│ │ │ ├── FileChangedPanel.java
│ │ │ ├── FilesChangedPanel.form
│ │ │ ├── FilesChangedPanel.java
│ │ │ ├── GitHubIssuePanel.form
│ │ │ ├── GitHubIssuePanel.java
│ │ │ ├── InsertTemplatePanel.form
│ │ │ ├── InsertTemplatePanel.java
│ │ │ ├── LabelPanel.form
│ │ │ ├── LabelPanel.java
│ │ │ ├── ManageTemplatesPanel.form
│ │ │ ├── ManageTemplatesPanel.java
│ │ │ ├── MergePanel.form
│ │ │ ├── MergePanel.java
│ │ │ ├── MilestonePanel.form
│ │ │ ├── MilestonePanel.java
│ │ │ ├── TemplatePanel.form
│ │ │ └── TemplatePanel.java
│ │ ├── options
│ │ ├── GitHubIssuesOptions.java
│ │ ├── GitHubIssuesOptionsPanel.form
│ │ ├── GitHubIssuesOptionsPanel.java
│ │ └── GitHubIssuesOptionsPanelController.java
│ │ ├── query
│ │ ├── GitHubAssignedToMeQuery.java
│ │ ├── GitHubCreatedByMeQuery.java
│ │ ├── GitHubDefaultQueries.java
│ │ ├── GitHubDefaultQuery.java
│ │ ├── GitHubOpenQuery.java
│ │ ├── GitHubQuery.java
│ │ ├── GitHubQueryController.java
│ │ ├── GitHubQueryProvider.java
│ │ └── ui
│ │ │ ├── GitHubQueryListCellRenderer.java
│ │ │ ├── GitHubQueryPanel.form
│ │ │ └── GitHubQueryPanel.java
│ │ ├── repository
│ │ ├── GitHubRepository.java
│ │ ├── GitHubRepositoryController.java
│ │ ├── GitHubRepositoryInfo.java
│ │ ├── GitHubRepositoryManager.java
│ │ ├── GitHubRepositoryProvider.java
│ │ └── ui
│ │ │ ├── GitHubRepositoryListPanel.form
│ │ │ ├── GitHubRepositoryListPanel.java
│ │ │ ├── GitHubRepositoryPanel.form
│ │ │ └── GitHubRepositoryPanel.java
│ │ ├── ui
│ │ ├── AttributesListCellRenderer.java
│ │ ├── ColorIcon.java
│ │ └── IssueTableCellRenderer.java
│ │ └── utils
│ │ ├── DateUtils.java
│ │ ├── GitHubIssuesUtils.java
│ │ ├── StringUtils.java
│ │ ├── UiUtils.java
│ │ └── ValidateUtils.java
├── nbm
│ └── manifest.mf
└── resources
│ └── com
│ └── junichi11
│ └── netbeans
│ └── modules
│ └── github
│ └── issues
│ ├── Bundle.properties
│ ├── issue
│ └── ui
│ │ └── Bundle.properties
│ ├── options
│ └── Bundle.properties
│ ├── query
│ └── ui
│ │ └── Bundle.properties
│ ├── repository
│ └── ui
│ │ └── Bundle.properties
│ └── resources
│ ├── Bundle.properties
│ ├── closed_issue_16.png
│ ├── closed_pull_request_16.png
│ ├── error_16.png
│ ├── git_merge_16.png
│ ├── git_pull_request_16.png
│ ├── icon_16.png
│ ├── icon_32.png
│ ├── issue_closed_16.png
│ ├── issue_opened_16.png
│ ├── layer.xml
│ ├── merged_pull_request_16.png
│ ├── open_issue_16.png
│ ├── open_pull_request_16.png
│ ├── template_16.png
│ └── template_settings_16.png
└── test
└── java
└── com
└── junichi11
└── netbeans
└── modules
└── github
└── issues
└── utils
├── StringUtilsTest.java
└── ValidateUtilsTest.java
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: junichi11
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | nbproject/private/
3 | nbactions-netbeans-ide.xml
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NetBeans GitHub Issues Plugin
2 |
3 | This plugin provides support for GitHub Issue Tracker.
4 |
5 | ## Requirements
6 |
7 | - NetBeans 8.2+
8 |
9 | ## Features
10 |
11 | - Create a new issue
12 | - Edit an issue
13 | - Create queries
14 | - Edit an issue comment
15 | - Delete an issue comment
16 | - Create a new pull request
17 | - Change an existing issue to a pull request
18 | - Search issues with issue number or keywords
19 | - Create a new label
20 | - Create a new milestone
21 | - Add issues to schedule categories
22 | - Insert and manage templates
23 |
24 | ## Usage
25 |
26 | ### Add a repository
27 |
28 | 1. Open a task window (Windows > Task)
29 | 2. Click add repository icon
30 | 3. Select the GitHub Issues Connector
31 | 4. Input display name, your user name, OAuth token and repository information
32 | 5. Click Connect button (If you can't connect a repository, please try to check input values)
33 | 6. Click OK button
34 |
35 | ### Schedules
36 |
37 | If an issue has a milestone and it has a due date, the issue is added to schedule category.
38 |
39 | ### Insert and manage templates
40 |
41 | You can insert a template and manage templates using buttons below the description.
42 | All templates are used globally. (i.e. It isn't templates per repository.)
43 |
44 | **NOTE:**You cannot remove the default template. If you remove it, it will be initilized.
45 | You cannot edit a template name. So, if you want to change it, just remove it, then add a new template.
46 |
47 | ## Default queries
48 |
49 | 1. Open
50 | 2. Assigned to me
51 | 3. Created by me
52 |
53 | If you want to enable/disable these queries, Please change them on the Options panel.(Tools > Options > Team > GitHub Issues)
54 |
55 | ## .github file
56 |
57 | .github file can be set login name and oauth token. They are used as default values when we create a new repository.
58 | It must be put in the user home directory.
59 | The format is the following:
60 |
61 | ```
62 | login=junichi11
63 | oauth=*****************************
64 | ```
65 |
66 | ## GitHub OAuth Token
67 |
68 | You can get a your OAuth token from the following: Settings > Developer settings > Personal access tokens > Generate new token
69 |
70 | - Check `repo`
71 | - Input token description
72 | - Click generate token
73 |
74 | ## GitHub Enterprise
75 |
76 | `api.github.com` is used as the default hostname. If you are using GitHub Enterprise, please set your hostname (e.g. github.example.com).
77 |
78 | ## Resources
79 |
80 | - [egit-github](https://github.com/eclipse/egit-github)
81 | - [octicons](https://octicons.github.com/)
82 |
83 | ## Donation
84 |
85 | - https://github.com/sponsors/junichi11
86 |
87 | ## License
88 |
89 | [Common Development and Distribution License (CDDL) v1.0 and GNU General Public License (GPL) v2](http://netbeans.org/cddl-gplv2.html)
90 |
--------------------------------------------------------------------------------
/nb-configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
16 | cddl-netbeans-sun
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/GitHubIssueState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues;
43 |
44 | import java.util.HashMap;
45 | import java.util.Map;
46 |
47 | /**
48 | *
49 | * @author junichi11
50 | */
51 | public enum GitHubIssueState {
52 |
53 | NEW("new"), // NOI18N
54 | OPEN("open"), // NOI18N
55 | CLOSED("closed"); // NOI18N
56 |
57 | private final String state;
58 | private static final Map states = new HashMap<>();
59 |
60 | static {
61 | for (GitHubIssueState s : GitHubIssueState.values()) {
62 | states.put(s.toString(), s);
63 | }
64 | }
65 |
66 | private GitHubIssueState(String state) {
67 | this.state = state;
68 | }
69 |
70 | public static GitHubIssueState toEnum(String name) {
71 | if (name == null || name.isEmpty()) {
72 | return NEW;
73 | }
74 | return states.get(name);
75 | }
76 |
77 | @Override
78 | public String toString() {
79 | return state;
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/GitHubIssuesConnector.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.issue.GitHubIssue;
45 | import com.junichi11.netbeans.modules.github.issues.query.GitHubQuery;
46 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepository;
47 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepositoryManager;
48 | import org.netbeans.modules.bugtracking.api.Repository;
49 | import org.netbeans.modules.bugtracking.spi.BugtrackingConnector;
50 | import org.netbeans.modules.bugtracking.spi.BugtrackingSupport;
51 | import org.netbeans.modules.bugtracking.spi.RepositoryInfo;
52 | import org.openide.util.NbBundle;
53 |
54 | /**
55 | *
56 | * @author junichi11
57 | */
58 | @BugtrackingConnector.Registration(
59 | id = GitHubIssuesConnector.ID,
60 | displayName = "#LBL_DisplayName",
61 | tooltip = "#LBL_Tooltip",
62 | iconPath = "com/junichi11/netbeans/modules/github/issues/resources/icon_16.png"
63 | )
64 | @NbBundle.Messages({
65 | "LBL_DisplayName=GitHub Issues",
66 | "LBL_Tooltip=GitHub Issues"
67 | })
68 | public class GitHubIssuesConnector implements BugtrackingConnector {
69 |
70 | public static final String ID = "com.junichi11.netbeans.modules.github.issues"; // NOI18N
71 |
72 | @Override
73 | public Repository createRepository() {
74 | GitHubRepository repository = new GitHubRepository();
75 | return createRepository(repository);
76 | }
77 |
78 | @Override
79 | public Repository createRepository(RepositoryInfo info) {
80 | GitHubRepository repository = new GitHubRepository(info);
81 | GitHubRepositoryManager.getInstance().add(repository);
82 | return createRepository(repository);
83 | }
84 |
85 | private Repository createRepository(GitHubRepository repository) {
86 | GitHubIssues githubIssues = GitHubIssues.getInstance();
87 | BugtrackingSupport bugtrackingSupport = githubIssues.getBugtrackingSupport();
88 | return bugtrackingSupport.createRepository(
89 | repository,
90 | githubIssues.getIssueStatusProvider(),
91 | githubIssues.getIssueScheduleProvider(),
92 | githubIssues.getIssuePriorityProvider(),
93 | githubIssues.getIssueFinder()
94 | );
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/egit/SearchIssues.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.egit;
43 |
44 | import java.util.List;
45 | import org.eclipse.egit.github.core.Issue;
46 |
47 | /**
48 | *
49 | * @author junichi11
50 | */
51 | public class SearchIssues {
52 |
53 | private long totalCount;
54 | private boolean incompleteResults;
55 | private List items;
56 |
57 | public long getTotalCount() {
58 | return totalCount;
59 | }
60 |
61 | public boolean isIncompleteResults() {
62 | return incompleteResults;
63 | }
64 |
65 | public List getItems() {
66 | return items;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/egit/SearchService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.egit;
43 |
44 | import java.io.IOException;
45 | import java.util.Collections;
46 | import java.util.List;
47 | import org.eclipse.egit.github.core.Issue;
48 | import org.eclipse.egit.github.core.client.GitHubClient;
49 | import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_ISSUES;
50 | import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_SEARCH;
51 | import org.eclipse.egit.github.core.client.PagedRequest;
52 | import org.eclipse.egit.github.core.service.GitHubService;
53 |
54 | /**
55 | *
56 | * @author junichi11
57 | */
58 | public class SearchService extends GitHubService {
59 |
60 | public SearchService() {
61 | super();
62 | }
63 |
64 | public SearchService(GitHubClient client) {
65 | super(client);
66 | }
67 |
68 | public List searchIssues(SearchIssuesParams params) throws IOException {
69 | StringBuilder uri = new StringBuilder(SEGMENT_SEARCH + SEGMENT_ISSUES);
70 | String query = params.getParameters(true);
71 | uri.append(query);
72 |
73 | PagedRequest request = createPagedRequest();
74 | request.setUri(uri);
75 | request.setType(SearchIssues.class);
76 | List searchIssues = getAll(request);
77 | for (SearchIssues searchIssue : searchIssues) {
78 | return searchIssue.getItems();
79 | }
80 | return Collections.emptyList();
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/CreateIssueParams.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.issue;
43 |
44 | import java.util.Collections;
45 | import java.util.List;
46 | import org.eclipse.egit.github.core.Label;
47 | import org.eclipse.egit.github.core.Milestone;
48 | import org.eclipse.egit.github.core.User;
49 |
50 | /**
51 | *
52 | * @author junichi11
53 | */
54 | public final class CreateIssueParams {
55 |
56 | private final String title;
57 | private String body;
58 | private User assignee;
59 | private Milestone milestone;
60 | private List labels;
61 |
62 | CreateIssueParams(String title) {
63 | this.title = title;
64 | }
65 |
66 | CreateIssueParams body(String body) {
67 | this.body = body;
68 | return this;
69 | }
70 |
71 | CreateIssueParams assignee(User assignee) {
72 | this.assignee = assignee;
73 | return this;
74 | }
75 |
76 | CreateIssueParams labels(List labels) {
77 | this.labels = labels;
78 | return this;
79 | }
80 |
81 | CreateIssueParams milestone(Milestone milestone) {
82 | this.milestone = milestone;
83 | return this;
84 | }
85 |
86 | public String getTitle() {
87 | return title;
88 | }
89 |
90 | public String getBody() {
91 | if (body == null) {
92 | return ""; // NOI18N
93 | }
94 | return body;
95 | }
96 |
97 | public User getAssignee() {
98 | return assignee;
99 | }
100 |
101 | public List getLabels() {
102 | if (labels == null) {
103 | return Collections.emptyList();
104 | }
105 | return labels;
106 | }
107 |
108 | public Milestone getMilestone() {
109 | return milestone;
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/GitHubIssueFinder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.issue;
43 |
44 | import org.netbeans.modules.bugtracking.commons.SimpleIssueFinder;
45 | import org.netbeans.modules.bugtracking.spi.IssueFinder;
46 |
47 | /**
48 | *
49 | * @author junichi11
50 | */
51 | public class GitHubIssueFinder implements IssueFinder {
52 |
53 | @Override
54 | public int[] getIssueSpans(CharSequence cs) {
55 | return SimpleIssueFinder.getInstance().getIssueSpans(cs);
56 | }
57 |
58 | @Override
59 | public String getIssueId(String string) {
60 | return SimpleIssueFinder.getInstance().getIssueId(string);
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/GitHubIssuePriorityProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.issue;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.GitHubIcons;
45 | import com.junichi11.netbeans.modules.github.issues.GitHubIssueState;
46 | import com.junichi11.netbeans.modules.github.issues.utils.GitHubIssuesUtils;
47 | import java.awt.Image;
48 | import java.util.ArrayList;
49 | import java.util.List;
50 | import org.eclipse.egit.github.core.Issue;
51 | import org.netbeans.modules.bugtracking.spi.IssuePriorityInfo;
52 | import org.netbeans.modules.bugtracking.spi.IssuePriorityProvider;
53 |
54 | /**
55 | *
56 | * @author junichi11
57 | */
58 | public class GitHubIssuePriorityProvider implements IssuePriorityProvider {
59 |
60 | /**
61 | * GitHub Issues doesn't have priorities. Use this feature to show icons.
62 | */
63 | public enum GitHubIssuePriority {
64 | Open("open", "Open", GitHubIcons.OPEN_ISSUE_IMAGE_16), // NOI18N
65 | Closed("closed", "Closed", GitHubIcons.CLOSED_ISSUE_IMAGE_16), // NOI18N
66 | OpenPullRequest("open.pull.request", "Open", GitHubIcons.OPEN_PULL_REQUEST_IMAGE_16), // NOI18N
67 | ClosedPullRequest("closed.pull.request", "Closed", GitHubIcons.CLOSED_PULL_REQUEST_IMAGE_16), // NOI18N
68 | MergedPullRequest("merged.pull.request", "Merged", GitHubIcons.MERGED_PULL_REQUEST_IMAGE_16), // NOI18N
69 | None("", "", null); // NOI18N
70 |
71 | private final String id;
72 | private final String state;
73 | private final Image image;
74 |
75 | private GitHubIssuePriority(String id, String state, Image image) {
76 | this.id = id;
77 | this.state = state;
78 | this.image = image;
79 | }
80 |
81 | public String getId() {
82 | return id;
83 | }
84 |
85 | public String getState() {
86 | return state;
87 | }
88 |
89 | public Image getImage() {
90 | return image;
91 | }
92 |
93 | }
94 |
95 | @Override
96 | public String getPriorityID(GitHubIssue githubIssue) {
97 | Issue issue = githubIssue.getIssue();
98 | if (issue == null) {
99 | return ""; // NOI18N
100 | }
101 | GitHubIssuePriority priority = GitHubIssuePriority.None;
102 | GitHubIssueState state = GitHubIssueState.toEnum(issue.getState());
103 | boolean isPullRequest = GitHubIssuesUtils.isPullRequest(issue);
104 | switch (state) {
105 | case CLOSED:
106 | if (isPullRequest) {
107 | // XXX merged should be added.
108 | // But set the same priority as the closed becase many requests are sent via API.
109 | priority = GitHubIssuePriority.ClosedPullRequest;
110 | } else {
111 | priority = GitHubIssuePriority.Closed;
112 | }
113 | break;
114 | case OPEN:
115 | if (isPullRequest) {
116 | priority = GitHubIssuePriority.OpenPullRequest;
117 | } else {
118 | priority = GitHubIssuePriority.Open;
119 | }
120 | default:
121 | break;
122 | }
123 | return priority.getId();
124 | }
125 |
126 | @Override
127 | public IssuePriorityInfo[] getPriorityInfos() {
128 | List info = new ArrayList<>();
129 | for (GitHubIssuePriority priority : GitHubIssuePriority.values()) {
130 | Image image = priority.getImage();
131 | if (image != null) {
132 | info.add(new IssuePriorityInfo(priority.getId(), priority.getState(), image));
133 | } else {
134 | info.add(new IssuePriorityInfo(priority.getId(), priority.getState()));
135 | }
136 | }
137 | return info.toArray(new IssuePriorityInfo[info.size()]);
138 | }
139 |
140 | }
141 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/GitHubIssueProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.issue;
43 |
44 | import java.beans.PropertyChangeListener;
45 | import java.io.File;
46 | import java.util.Collection;
47 | import org.netbeans.modules.bugtracking.spi.IssueController;
48 | import org.netbeans.modules.bugtracking.spi.IssueProvider;
49 |
50 | /**
51 | *
52 | * @author junichi11
53 | */
54 | public class GitHubIssueProvider implements IssueProvider {
55 |
56 | @Override
57 | public String getDisplayName(GitHubIssue issue) {
58 | return issue.getDisplayName();
59 | }
60 |
61 | @Override
62 | public String getTooltip(GitHubIssue issue) {
63 | return issue.getTooltip();
64 | }
65 |
66 | @Override
67 | public String getID(GitHubIssue issue) {
68 | return issue.getID();
69 | }
70 |
71 | @Override
72 | public Collection getSubtasks(GitHubIssue issue) {
73 | return issue.getSubtasks();
74 | }
75 |
76 | @Override
77 | public String getSummary(GitHubIssue issue) {
78 | return issue.getSummary();
79 | }
80 |
81 | @Override
82 | public boolean isNew(GitHubIssue issue) {
83 | return issue.isNew();
84 | }
85 |
86 | @Override
87 | public boolean isFinished(GitHubIssue issue) {
88 | return issue.isFinished();
89 | }
90 |
91 | @Override
92 | public boolean refresh(GitHubIssue issue) {
93 | return issue.refresh();
94 | }
95 |
96 | @Override
97 | public void addComment(GitHubIssue issue, String comment, boolean resolveAsFixed) {
98 | issue.addComment(comment, resolveAsFixed);
99 | }
100 |
101 | @Override
102 | public void attachFile(GitHubIssue issue, File file, String string, boolean bln) {
103 | issue.attachFile(file, string, bln);
104 | }
105 |
106 | @Override
107 | public IssueController getController(GitHubIssue issue) {
108 | return issue.getController();
109 | }
110 |
111 | @Override
112 | public void addPropertyChangeListener(GitHubIssue issue, PropertyChangeListener listener) {
113 | issue.addPropertyChangeListener(listener);
114 | }
115 |
116 | @Override
117 | public void removePropertyChangeListener(GitHubIssue issue, PropertyChangeListener listener) {
118 | issue.removePropertyChangeListener(listener);
119 | }
120 |
121 | }
122 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/GitHubIssueScheduleProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.issue;
43 |
44 | import java.util.Date;
45 | import org.netbeans.modules.bugtracking.spi.IssueScheduleInfo;
46 | import org.netbeans.modules.bugtracking.spi.IssueScheduleProvider;
47 |
48 | /**
49 | *
50 | * @author junichi11
51 | */
52 | public class GitHubIssueScheduleProvider implements IssueScheduleProvider {
53 |
54 | @Override
55 | public void setSchedule(GitHubIssue issue, IssueScheduleInfo info) {
56 | issue.setSchedule(info);
57 | }
58 |
59 | @Override
60 | public Date getDueDate(GitHubIssue issue) {
61 | return issue.getDueDate();
62 | }
63 |
64 | @Override
65 | public IssueScheduleInfo getSchedule(GitHubIssue issue) {
66 | return issue.getSchedule();
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/GitHubIssueStatusProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.issue;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepository;
45 | import java.beans.PropertyChangeListener;
46 | import java.util.Collection;
47 | import java.util.Collections;
48 | import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
49 |
50 | /**
51 | *
52 | * @author junichi11
53 | */
54 | public class GitHubIssueStatusProvider implements IssueStatusProvider {
55 |
56 | @Override
57 | public Status getStatus(GitHubIssue issue) {
58 | return issue.getIssueStatus();
59 | }
60 |
61 | @Override
62 | public void setSeenIncoming(GitHubIssue issue, boolean seen) {
63 | Status status = getStatus(issue);
64 | if (!seen) {
65 | issue.setIssueStatus(Status.INCOMING_NEW);
66 | return;
67 | }
68 | if (status != Status.SEEN && seen) {
69 | issue.setIssueStatus(Status.SEEN);
70 | }
71 | }
72 |
73 | @Override
74 | public Collection getUnsubmittedIssues(GitHubRepository repository) {
75 | return Collections.emptyList();
76 | }
77 |
78 | @Override
79 | public void discardOutgoing(GitHubIssue issue) {
80 | }
81 |
82 | @Override
83 | public boolean submit(GitHubIssue issue) {
84 | // TODO
85 | return true;
86 | }
87 |
88 | @Override
89 | public void addPropertyChangeListener(GitHubIssue issue, PropertyChangeListener listener) {
90 | issue.addPropertyChangeListener(listener);
91 | }
92 |
93 | @Override
94 | public void removePropertyChangeListener(GitHubIssue issue, PropertyChangeListener listener) {
95 | issue.removePropertyChangeListener(listener);
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/AttributesViewPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
112 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/CommentTabbedPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
122 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/CommentsPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/CommitPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
88 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/CommitsPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/CommitsPanel.java:
--------------------------------------------------------------------------------
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.issue.ui;
43 |
44 | import java.awt.EventQueue;
45 | import javax.swing.Icon;
46 | import javax.swing.JPanel;
47 | import org.eclipse.egit.github.core.Commit;
48 |
49 | /**
50 | *
51 | * @author junichi11
52 | */
53 | public class CommitsPanel extends JPanel {
54 |
55 | private static final long serialVersionUID = -6067465889360927986L;
56 |
57 | /**
58 | * Creates new form CommitsPane
59 | */
60 | public CommitsPanel() {
61 | initComponents();
62 | }
63 |
64 | public void addCommit(Commit commit, Icon commiterIcon) {
65 | assert EventQueue.isDispatchThread();
66 | CommitPanel commitPanel = new CommitPanel(commit, commiterIcon);
67 | add(commitPanel);
68 | }
69 |
70 | public void removeAllCommits() {
71 | assert EventQueue.isDispatchThread();
72 | removeAll();
73 | }
74 |
75 | /**
76 | * This method is called from within the constructor to initialize the form.
77 | * WARNING: Do NOT modify this code. The content of this method is always
78 | * regenerated by the Form Editor.
79 | */
80 | @SuppressWarnings("unchecked")
81 | // //GEN-BEGIN:initComponents
82 | private void initComponents() {
83 |
84 | setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.Y_AXIS));
85 | }// //GEN-END:initComponents
86 |
87 | // Variables declaration - do not modify//GEN-BEGIN:variables
88 | // End of variables declaration//GEN-END:variables
89 | }
90 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/DiffTopComponent.java:
--------------------------------------------------------------------------------
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.issue.ui;
43 |
44 | import org.openide.windows.TopComponent;
45 |
46 | /**
47 | *
48 | * @author junichi11
49 | */
50 | public class DiffTopComponent extends TopComponent {
51 |
52 | private static final long serialVersionUID = 4350425104822562373L;
53 |
54 | @Override
55 | public int getPersistenceType() {
56 | return PERSISTENCE_NEVER;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/FileChangedPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
95 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/FilesChangedPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
118 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/InsertTemplatePanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
44 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/InsertTemplatePanel.java:
--------------------------------------------------------------------------------
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.issue.ui;
43 |
44 | /**
45 | *
46 | * @author junichi11
47 | */
48 | public class InsertTemplatePanel extends javax.swing.JPanel {
49 |
50 | private static final long serialVersionUID = 9141701783165717038L;
51 |
52 | /**
53 | * Creates new form InsertTemplatePanel
54 | */
55 | public InsertTemplatePanel() {
56 | initComponents();
57 | }
58 |
59 | public void setTemplates(String[] templates) {
60 | for (String template : templates) {
61 | templatesComboBox.addItem(template);
62 | }
63 | }
64 |
65 | public String getSelectedTemplateName() {
66 | return (String) templatesComboBox.getSelectedItem();
67 | }
68 |
69 | /**
70 | * This method is called from within the constructor to initialize the form.
71 | * WARNING: Do NOT modify this code. The content of this method is always
72 | * regenerated by the Form Editor.
73 | */
74 | @SuppressWarnings("unchecked")
75 | // //GEN-BEGIN:initComponents
76 | private void initComponents() {
77 |
78 | templatesComboBox = new javax.swing.JComboBox();
79 |
80 | templatesComboBox.setPreferredSize(new java.awt.Dimension(200, 27));
81 |
82 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
83 | this.setLayout(layout);
84 | layout.setHorizontalGroup(
85 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
86 | .addComponent(templatesComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
87 | );
88 | layout.setVerticalGroup(
89 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
90 | .addComponent(templatesComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
91 | );
92 | }// //GEN-END:initComponents
93 |
94 | // Variables declaration - do not modify//GEN-BEGIN:variables
95 | private javax.swing.JComboBox templatesComboBox;
96 | // End of variables declaration//GEN-END:variables
97 | }
98 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/ManageTemplatesPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
77 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/MergePanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
96 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/issue/ui/TemplatePanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
89 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/options/GitHubIssuesOptions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.options;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.query.GitHubDefaultQueries;
45 | import com.junichi11.netbeans.modules.github.issues.query.GitHubDefaultQueries.Type;
46 | import java.util.HashMap;
47 | import java.util.Map;
48 | import java.util.prefs.Preferences;
49 | import org.openide.util.NbPreferences;
50 |
51 | /**
52 | *
53 | * @author junichi11
54 | */
55 | public final class GitHubIssuesOptions {
56 |
57 | public static final String SUB_PATH = "Team/GitHubIssues"; // NOI18N
58 | private static final String PREFERENCES_PATH = "github.issues"; // NOI18N
59 |
60 | // repositories
61 | private static final String SHOW_PARENT_REPO = "show.parent.repo"; // NOI18N
62 |
63 | // issues
64 | private static final String INSERT_DEFAULT_TEMPLATE = "insert.default.template"; // NOI18N
65 | private static final GitHubIssuesOptions INSTANCE = new GitHubIssuesOptions();
66 |
67 | private GitHubIssuesOptions() {
68 | }
69 |
70 | public static GitHubIssuesOptions getInstance() {
71 | return INSTANCE;
72 | }
73 |
74 | public void setOpenQuery(boolean isEnabled) {
75 | getPreferences().putBoolean(Type.OPEN.getOptionKey(), isEnabled);
76 | }
77 |
78 | public boolean isOpenQuery() {
79 | return isDefaultQuery(Type.OPEN);
80 | }
81 |
82 | public void setAssignedToMeQuery(boolean isEnabled) {
83 | getPreferences().putBoolean(Type.ASSIGNED_TO_ME.getOptionKey(), isEnabled);
84 | }
85 |
86 | public boolean isAssignedToMeQuery() {
87 | return isDefaultQuery(Type.ASSIGNED_TO_ME);
88 | }
89 |
90 | public void setCreatedByMeQuery(boolean isEnabled) {
91 | getPreferences().putBoolean(Type.CREATED_BY_ME.getOptionKey(), isEnabled);
92 | }
93 |
94 | public boolean isCreatedByMeQuery() {
95 | return isDefaultQuery(Type.CREATED_BY_ME);
96 | }
97 |
98 | private boolean isDefaultQuery(Type type) {
99 | boolean defaultValue = false;
100 | if (type == Type.OPEN) {
101 | defaultValue = true;
102 | }
103 | return getPreferences().getBoolean(type.getOptionKey(), defaultValue);
104 | }
105 |
106 | public Map getDefaultQueryOptions() {
107 | Map map = new HashMap<>();
108 | for (GitHubDefaultQueries.Type type : GitHubDefaultQueries.Type.values()) {
109 | map.put(type, isDefaultQuery(type));
110 | }
111 | return map;
112 | }
113 |
114 | // repositories
115 | public boolean showParentRepository() {
116 | return getPreferences().getBoolean(SHOW_PARENT_REPO, false);
117 | }
118 |
119 | public void setShowParentRepository(boolean showParent) {
120 | getPreferences().putBoolean(SHOW_PARENT_REPO, showParent);
121 | }
122 |
123 | // issues
124 | public boolean insertDefaultTemplate() {
125 | return getPreferences().getBoolean(INSERT_DEFAULT_TEMPLATE, false);
126 | }
127 |
128 | public void setInsertDefaultTemplate(boolean insert) {
129 | getPreferences().putBoolean(INSERT_DEFAULT_TEMPLATE, insert);
130 | }
131 |
132 | private Preferences getPreferences() {
133 | return NbPreferences.forModule(GitHubIssuesOptions.class).node(PREFERENCES_PATH);
134 | }
135 |
136 | }
137 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/options/GitHubIssuesOptionsPanelController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.options;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepository;
45 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepositoryManager;
46 | import java.beans.PropertyChangeListener;
47 | import java.beans.PropertyChangeSupport;
48 | import javax.swing.JComponent;
49 | import javax.swing.SwingUtilities;
50 | import org.netbeans.spi.options.OptionsPanelController;
51 | import org.openide.util.HelpCtx;
52 | import org.openide.util.Lookup;
53 | import org.openide.util.NbBundle;
54 |
55 | @OptionsPanelController.SubRegistration(
56 | id = "GitHubIssues",
57 | location = "Team",
58 | displayName = "#AdvancedOption_DisplayName_GitHubIssues",
59 | keywords = "#AdvancedOption_Keywords_GitHubIssues",
60 | keywordsCategory = GitHubIssuesOptions.SUB_PATH
61 | )
62 | @NbBundle.Messages({
63 | "AdvancedOption_DisplayName_GitHubIssues=GitHub Issues",
64 | "AdvancedOption_Keywords_GitHubIssues=GitHub Issues, github issues"
65 | })
66 | public final class GitHubIssuesOptionsPanelController extends OptionsPanelController {
67 |
68 | private GitHubIssuesOptionsPanel panel;
69 | private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
70 | private boolean changed;
71 |
72 | @Override
73 | public void update() {
74 | getPanel().load();
75 | changed = false;
76 | }
77 |
78 | @Override
79 | public void applyChanges() {
80 | SwingUtilities.invokeLater(new Runnable() {
81 | @Override
82 | public void run() {
83 | getPanel().store();
84 | GitHubRepositoryManager manager = GitHubRepositoryManager.getInstance();
85 | for (GitHubRepository repository : manager.getRepositories()) {
86 | repository.optionsChanged();
87 | }
88 | changed = false;
89 | }
90 | });
91 | }
92 |
93 | @Override
94 | public void cancel() {
95 | // need not do anything special, if no changes have been persisted yet
96 | }
97 |
98 | @Override
99 | public boolean isValid() {
100 | return getPanel().valid();
101 | }
102 |
103 | @Override
104 | public boolean isChanged() {
105 | return changed;
106 | }
107 |
108 | @Override
109 | public HelpCtx getHelpCtx() {
110 | return null; // new HelpCtx("...ID") if you have a help set
111 | }
112 |
113 | @Override
114 | public JComponent getComponent(Lookup masterLookup) {
115 | return getPanel();
116 | }
117 |
118 | @Override
119 | public void addPropertyChangeListener(PropertyChangeListener l) {
120 | pcs.addPropertyChangeListener(l);
121 | }
122 |
123 | @Override
124 | public void removePropertyChangeListener(PropertyChangeListener l) {
125 | pcs.removePropertyChangeListener(l);
126 | }
127 |
128 | private GitHubIssuesOptionsPanel getPanel() {
129 | if (panel == null) {
130 | panel = new GitHubIssuesOptionsPanel(this);
131 | }
132 | return panel;
133 | }
134 |
135 | void changed() {
136 | if (!changed) {
137 | changed = true;
138 | pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
139 | }
140 | pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
141 | }
142 |
143 | }
144 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/query/GitHubAssignedToMeQuery.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.query;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.issue.GetIssuesParams;
45 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepository;
46 | import java.util.Map;
47 | import org.openide.util.NbBundle;
48 |
49 | class GitHubAssignedToMeQuery extends GitHubDefaultQuery {
50 |
51 | public GitHubAssignedToMeQuery(GitHubRepository repository) {
52 | super(repository);
53 | }
54 |
55 | public GitHubAssignedToMeQuery(GitHubRepository repository, String name) {
56 | super(repository, name);
57 | }
58 |
59 | @Override
60 | @NbBundle.Messages({
61 | "GitHubAssignedToMeQuery.displayName=Assigned to me"
62 | })
63 | public String getDisplayName() {
64 | return Bundle.GitHubAssignedToMeQuery_displayName();
65 | }
66 |
67 | @Override
68 | protected Map getFilter() {
69 | GitHubRepository repository = getRepository();
70 | String userName = repository.getUserName();
71 | GetIssuesParams issuesParams = new GetIssuesParams()
72 | .assignee(userName)
73 | .state(GetIssuesParams.State.OPEN);
74 | return issuesParams.toFilterMap();
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/query/GitHubCreatedByMeQuery.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.query;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.issue.GetIssuesParams;
45 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepository;
46 | import java.util.Map;
47 | import org.openide.util.NbBundle;
48 |
49 | class GitHubCreatedByMeQuery extends GitHubDefaultQuery {
50 |
51 | public GitHubCreatedByMeQuery(GitHubRepository repository) {
52 | super(repository);
53 | }
54 |
55 | public GitHubCreatedByMeQuery(GitHubRepository repository, String name) {
56 | super(repository, name);
57 | }
58 |
59 | @Override
60 | @NbBundle.Messages({
61 | "GitHubCreatedByMeQuery.displayName=Created by me"
62 | })
63 | public String getDisplayName() {
64 | return Bundle.GitHubCreatedByMeQuery_displayName();
65 | }
66 |
67 | @Override
68 | protected Map getFilter() {
69 | GitHubRepository gitHubRepository = getRepository();
70 | String userName = gitHubRepository.getUserName();
71 | GetIssuesParams issuesParams = new GetIssuesParams()
72 | .creator(userName)
73 | .state(GetIssuesParams.State.OPEN);
74 | return issuesParams.toFilterMap();
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/query/GitHubDefaultQueries.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.query;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepository;
45 | import java.util.Collections;
46 | import java.util.HashMap;
47 | import java.util.Map;
48 | import java.util.logging.Level;
49 | import java.util.logging.Logger;
50 | import org.netbeans.api.annotations.common.NonNull;
51 |
52 | /**
53 | *
54 | * @author junichi11
55 | */
56 | public final class GitHubDefaultQueries {
57 |
58 | public enum Type {
59 |
60 | // must not change option key name
61 | OPEN("query.open"), // NOI18N
62 | ASSIGNED_TO_ME("query.assigned.to.me"), // NOI18N
63 | CREATED_BY_ME("query.created.by.me"); // NOI18N
64 | private final String optionKey;
65 |
66 | private Type(String optionKey) {
67 | this.optionKey = optionKey;
68 | }
69 |
70 | public String getOptionKey() {
71 | return optionKey;
72 | }
73 |
74 | }
75 |
76 | private static final Map DEFAULT_QUERIES = Collections.synchronizedMap(new HashMap());
77 | private static final Logger LOGGER = Logger.getLogger(GitHubDefaultQueries.class.getName());
78 | private final Map defaultQueries = new HashMap<>();
79 |
80 | private GitHubDefaultQueries() {
81 | }
82 |
83 | private static GitHubDefaultQueries create(GitHubRepository repository) {
84 | GitHubDefaultQueries gitHubDefaultQueries = DEFAULT_QUERIES.get(repository);
85 | if (gitHubDefaultQueries == null) {
86 | gitHubDefaultQueries = new GitHubDefaultQueries();
87 | DEFAULT_QUERIES.put(repository, gitHubDefaultQueries);
88 | }
89 | return gitHubDefaultQueries;
90 | }
91 |
92 | public static GitHubQuery create(GitHubRepository repository, Type type) {
93 | GitHubDefaultQueries gitHubDefaultQueries = create(repository);
94 | return gitHubDefaultQueries.getQuery(repository, type);
95 | }
96 |
97 | public static boolean isDefaultQuery(GitHubQuery query) {
98 | return query instanceof GitHubDefaultQuery;
99 | }
100 |
101 | public static void remove(GitHubRepository repository) {
102 | GitHubDefaultQueries gitHubDefaultQueries = create(repository);
103 | if (gitHubDefaultQueries == null) {
104 | return;
105 | }
106 | gitHubDefaultQueries.clear();
107 | DEFAULT_QUERIES.remove(repository);
108 | }
109 |
110 | private GitHubQuery getQuery(@NonNull GitHubRepository repository, @NonNull Type type) {
111 | GitHubQuery query = defaultQueries.get(type);
112 | if (query == null) {
113 | switch (type) {
114 | case OPEN:
115 | query = new GitHubOpenQuery(repository);
116 | break;
117 | case ASSIGNED_TO_ME:
118 | query = new GitHubAssignedToMeQuery(repository);
119 | break;
120 | case CREATED_BY_ME:
121 | query = new GitHubCreatedByMeQuery(repository);
122 | break;
123 | default:
124 | LOGGER.log(Level.WARNING, "The query type({0}) is not supported!", type.name()); // NOI18N
125 | return new GitHubDefaultQuery(repository) {
126 | };
127 | }
128 | defaultQueries.put(type, query);
129 | }
130 | return query;
131 | }
132 |
133 | private void clear() {
134 | defaultQueries.clear();
135 | }
136 |
137 | }
138 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/query/GitHubDefaultQuery.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.query;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepository;
45 | import com.junichi11.netbeans.modules.github.issues.utils.UiUtils;
46 | import javax.swing.SwingUtilities;
47 |
48 | abstract class GitHubDefaultQuery extends GitHubQuery {
49 |
50 | public GitHubDefaultQuery(GitHubRepository repository) {
51 | super(repository);
52 | }
53 |
54 | public GitHubDefaultQuery(GitHubRepository repository, String name) {
55 | super(repository, name, null);
56 | }
57 |
58 | @Override
59 | public final boolean canRename() {
60 | return false;
61 | }
62 |
63 | @Override
64 | public void rename(String string) {
65 | // noop
66 | }
67 |
68 | @Override
69 | public final boolean canRemove() {
70 | return false;
71 | }
72 |
73 | @Override
74 | public void remove() {
75 | // XXX can remove a query even if canRemove is false
76 | // open options panel as a workaround
77 | SwingUtilities.invokeLater(new Runnable() {
78 | @Override
79 | public void run() {
80 | UiUtils.showOptions();
81 | }
82 | });
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/query/GitHubOpenQuery.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.query;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.issue.GetIssuesParams;
45 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepository;
46 | import java.util.Map;
47 | import org.openide.util.NbBundle;
48 |
49 | public class GitHubOpenQuery extends GitHubDefaultQuery {
50 |
51 | public GitHubOpenQuery(GitHubRepository repository) {
52 | super(repository);
53 | }
54 |
55 | private GitHubOpenQuery(GitHubRepository repository, String name) {
56 | super(repository, name);
57 | }
58 |
59 | @Override
60 | @NbBundle.Messages({
61 | "GitHubOpenQuery.displayName=Open"
62 | })
63 | public String getDisplayName() {
64 | return Bundle.GitHubOpenQuery_displayName();
65 | }
66 |
67 | @Override
68 | protected Map getFilter() {
69 | GetIssuesParams issuesParams = new GetIssuesParams()
70 | .state(GetIssuesParams.State.OPEN);
71 | return issuesParams.toFilterMap();
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/query/GitHubQueryProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.query;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.issue.GitHubIssue;
45 | import org.netbeans.modules.bugtracking.spi.QueryController;
46 | import org.netbeans.modules.bugtracking.spi.QueryProvider;
47 |
48 | /**
49 | *
50 | * @author junichi11
51 | */
52 | public class GitHubQueryProvider implements QueryProvider {
53 |
54 | @Override
55 | public String getDisplayName(GitHubQuery query) {
56 | return query.getDisplayName();
57 | }
58 |
59 | @Override
60 | public String getTooltip(GitHubQuery query) {
61 | return query.getTooltip();
62 | }
63 |
64 | @Override
65 | public QueryController getController(GitHubQuery query) {
66 | return query.getController();
67 | }
68 |
69 | @Override
70 | public boolean canRemove(GitHubQuery query) {
71 | return query.canRemove();
72 | }
73 |
74 | @Override
75 | public void remove(GitHubQuery query) {
76 | query.remove();
77 | }
78 |
79 | @Override
80 | public boolean canRename(GitHubQuery query) {
81 | return query.canRename();
82 | }
83 |
84 | @Override
85 | public void rename(GitHubQuery query, String string) {
86 | query.rename(string);
87 | }
88 |
89 | @Override
90 | public void setIssueContainer(GitHubQuery query, IssueContainer issueContainer) {
91 | query.setIssueContainer(issueContainer);
92 | }
93 |
94 | @Override
95 | public void refresh(GitHubQuery query) {
96 | query.refresh();
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/query/ui/GitHubQueryListCellRenderer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.query.ui;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.egit.SearchIssuesParams.Is;
45 | import com.junichi11.netbeans.modules.github.issues.egit.SearchIssuesParams.No;
46 | import com.junichi11.netbeans.modules.github.issues.egit.SearchIssuesParams.Order;
47 | import com.junichi11.netbeans.modules.github.issues.egit.SearchIssuesParams.Sort;
48 | import com.junichi11.netbeans.modules.github.issues.egit.SearchIssuesParams.State;
49 | import com.junichi11.netbeans.modules.github.issues.egit.SearchIssuesParams.Type;
50 | import java.awt.Component;
51 | import javax.swing.DefaultListCellRenderer;
52 | import javax.swing.JList;
53 | import javax.swing.ListCellRenderer;
54 | import org.eclipse.egit.github.core.Milestone;
55 |
56 | /**
57 | *
58 | * @author junichi11
59 | */
60 | public class GitHubQueryListCellRenderer extends DefaultListCellRenderer {
61 |
62 | private static final long serialVersionUID = 5752807710023572203L;
63 |
64 | private final ListCellRenderer renderer;
65 |
66 | public GitHubQueryListCellRenderer(ListCellRenderer renderer) {
67 | this.renderer = renderer;
68 | }
69 |
70 | @Override
71 | public Component getListCellRendererComponent(JList> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
72 | String text = null;
73 | if (value instanceof Sort) {
74 | Sort sort = (Sort) value;
75 | text = sort.getValue();
76 | } else if (value instanceof Order) {
77 | Order order = (Order) value;
78 | text = order.getValue();
79 | } else if (value instanceof State) {
80 | State state = (State) value;
81 | text = state.getValue();
82 | } else if (value instanceof Type) {
83 | Type type = (Type) value;
84 | text = type.getValue();
85 | } else if (value instanceof Is) {
86 | Is is = (Is) value;
87 | text = is.getValue();
88 | } else if (value instanceof No) {
89 | No no = (No) value;
90 | text = no.getValue();
91 | } else if (value instanceof Milestone) {
92 | Milestone milestone = (Milestone) value;
93 | text = milestone.getTitle();
94 | }
95 | if (text == null) {
96 | text = " "; // NOI18N
97 | }
98 | return renderer.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus);
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/repository/GitHubRepositoryInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.repository;
43 |
44 | /**
45 | *
46 | * @author junichi11
47 | */
48 | public final class GitHubRepositoryInfo {
49 |
50 | private String hostname;
51 | private String displayName;
52 | private String oauthToken;
53 | private String userName;
54 | private String repositoryAuthor;
55 | private String repositoryName;
56 | private boolean isPropertyFile;
57 |
58 | public GitHubRepositoryInfo setHostname(String hostname) {
59 | this.hostname = hostname;
60 | return this;
61 | }
62 |
63 | public GitHubRepositoryInfo setDisplayName(String displayName) {
64 | this.displayName = displayName;
65 | return this;
66 | }
67 |
68 | public GitHubRepositoryInfo setUserName(String userName) {
69 | this.userName = userName;
70 | return this;
71 | }
72 |
73 | public GitHubRepositoryInfo setOAuthToken(String oauthToken) {
74 | this.oauthToken = oauthToken;
75 | return this;
76 | }
77 |
78 | public GitHubRepositoryInfo setPropertyFile(boolean isPropertyFile) {
79 | this.isPropertyFile = isPropertyFile;
80 | return this;
81 | }
82 |
83 | public GitHubRepositoryInfo setRepositoryAuthor(String repositoryAuthor) {
84 | this.repositoryAuthor = repositoryAuthor;
85 | return this;
86 | }
87 |
88 | public GitHubRepositoryInfo setRepositoryName(String repositoryName) {
89 | this.repositoryName = repositoryName;
90 | return this;
91 | }
92 |
93 | String getHostname() {
94 | return hostname;
95 | }
96 |
97 | String getDisplayName() {
98 | return displayName;
99 | }
100 |
101 | String getUserName() {
102 | return userName;
103 | }
104 |
105 | String getOAuthToken() {
106 | return oauthToken;
107 | }
108 |
109 | boolean isPropertyFile() {
110 | return isPropertyFile;
111 | }
112 |
113 | String getRepositoryAuthor() {
114 | return repositoryAuthor;
115 | }
116 |
117 | String getRepositoryName() {
118 | return repositoryName;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/repository/GitHubRepositoryManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.repository;
43 |
44 | import java.util.Collection;
45 | import java.util.Collections;
46 | import java.util.HashMap;
47 | import java.util.Map;
48 |
49 | /**
50 | *
51 | * @author junichi11
52 | */
53 | public class GitHubRepositoryManager {
54 |
55 | private static final GitHubRepositoryManager INSTANCE = new GitHubRepositoryManager();
56 | private static final Map REPOSITORIES = Collections.synchronizedMap(new HashMap());
57 |
58 | private GitHubRepositoryManager() {
59 | }
60 |
61 | public static final GitHubRepositoryManager getInstance() {
62 | return INSTANCE;
63 | }
64 |
65 | public synchronized Collection getRepositories() {
66 | return REPOSITORIES.values();
67 | }
68 |
69 | public synchronized GitHubRepository getRepository(String repositoryId) {
70 | return REPOSITORIES.get(repositoryId);
71 | }
72 |
73 | public synchronized void add(GitHubRepository repository) {
74 | if (repository == null) {
75 | return;
76 | }
77 | REPOSITORIES.put(repository.getID(), repository);
78 | }
79 |
80 | synchronized void remove(GitHubRepository repository) {
81 | if (repository == null) {
82 | return;
83 | }
84 | REPOSITORIES.remove(repository.getID());
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/repository/GitHubRepositoryProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.repository;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.issue.GitHubIssue;
45 | import com.junichi11.netbeans.modules.github.issues.query.GitHubDefaultQueries;
46 | import com.junichi11.netbeans.modules.github.issues.query.GitHubQuery;
47 | import java.awt.Image;
48 | import java.beans.PropertyChangeListener;
49 | import java.util.Collection;
50 | import org.netbeans.modules.bugtracking.spi.RepositoryController;
51 | import org.netbeans.modules.bugtracking.spi.RepositoryInfo;
52 | import org.netbeans.modules.bugtracking.spi.RepositoryProvider;
53 |
54 | /**
55 | *
56 | * @author junichi11
57 | */
58 | public class GitHubRepositoryProvider implements RepositoryProvider {
59 |
60 | @Override
61 | public RepositoryInfo getInfo(GitHubRepository repository) {
62 | return repository.getRepositoryInfo();
63 | }
64 |
65 | @Override
66 | public Image getIcon(GitHubRepository repository) {
67 | return repository.getIcon();
68 | }
69 |
70 | /**
71 | * Returns issues with the given IDs.
72 | *
73 | * @param repository repository
74 | * @param ids key ids
75 | * @return issues
76 | */
77 | @Override
78 | public Collection getIssues(GitHubRepository repository, String... ids) {
79 | return repository.getIssues(ids);
80 | }
81 |
82 | @Override
83 | public void removed(GitHubRepository repository) {
84 | repository.removed();
85 | GitHubRepositoryManager.getInstance().remove(repository);
86 | GitHubDefaultQueries.remove(repository);
87 | }
88 |
89 | @Override
90 | public RepositoryController getController(GitHubRepository repository) {
91 | return repository.getController();
92 | }
93 |
94 | @Override
95 | public GitHubQuery createQuery(GitHubRepository repository) {
96 | return repository.createQuery();
97 | }
98 |
99 | @Override
100 | public GitHubIssue createIssue(GitHubRepository repository) {
101 | return repository.createIssue();
102 | }
103 |
104 | @Override
105 | public GitHubIssue createIssue(GitHubRepository repository, String string, String string1) {
106 | throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
107 | }
108 |
109 | @Override
110 | public Collection getQueries(GitHubRepository repository) {
111 | return repository.getQueries();
112 | }
113 |
114 | @Override
115 | public Collection simpleSearch(GitHubRepository repository, String word) {
116 | return repository.simpleSearch(word);
117 | }
118 |
119 | @Override
120 | public boolean canAttachFiles(GitHubRepository repository) {
121 | return false;
122 | }
123 |
124 | @Override
125 | public void addPropertyChangeListener(GitHubRepository repository, PropertyChangeListener listener) {
126 | repository.addPropertyChangeListener(listener);
127 | }
128 |
129 | @Override
130 | public void removePropertyChangeListener(GitHubRepository repository, PropertyChangeListener listener) {
131 | repository.removePropertyChangeListener(listener);
132 | }
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/repository/ui/GitHubRepositoryListPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
49 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/ui/AttributesListCellRenderer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.ui;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.GitHubCache;
45 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepository;
46 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepositoryManager;
47 | import java.awt.Component;
48 | import javax.swing.DefaultListCellRenderer;
49 | import javax.swing.Icon;
50 | import javax.swing.JLabel;
51 | import javax.swing.JList;
52 | import javax.swing.ListCellRenderer;
53 | import org.eclipse.egit.github.core.Label;
54 | import org.eclipse.egit.github.core.Milestone;
55 | import org.eclipse.egit.github.core.User;
56 |
57 | /**
58 | *
59 | * @author junichi11
60 | */
61 | public class AttributesListCellRenderer extends DefaultListCellRenderer {
62 |
63 | private static final long serialVersionUID = -7361150610203379058L;
64 |
65 | private final ListCellRenderer renderer;
66 | private final String repositoryId;
67 |
68 | public AttributesListCellRenderer(ListCellRenderer renderer) {
69 | this(renderer, null);
70 | }
71 |
72 | public AttributesListCellRenderer(ListCellRenderer renderer, String repositoryId) {
73 | this.renderer = renderer;
74 | this.repositoryId = repositoryId;
75 | }
76 |
77 | @Override
78 | public Component getListCellRendererComponent(JList> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
79 | String text = null;
80 | Icon icon = null;
81 | if (value instanceof Milestone) {
82 | Milestone milestone = (Milestone) value;
83 | text = milestone.getTitle();
84 | } else if (value instanceof User) {
85 | User user = (User) value;
86 | text = user.getLogin();
87 | if (text != null && repositoryId != null && !repositoryId.isEmpty()) {
88 | GitHubRepository repository = GitHubRepositoryManager.getInstance().getRepository(repositoryId);
89 | if (repository != null) {
90 | GitHubCache cache = GitHubCache.create(repository);
91 | icon = cache.getUserIcon(user);
92 | }
93 | }
94 | } else if (value instanceof Label) {
95 | Label label = (Label) value;
96 | text = label.getName();
97 | icon = new ColorIcon(String.format("#%s", label.getColor())); // NOI18N
98 | }
99 | if (text == null) {
100 | text = " "; // NOI18N
101 | }
102 | JLabel label = (JLabel) renderer.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus);
103 | label.setIcon(icon);
104 | return label;
105 | }
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/ui/ColorIcon.java:
--------------------------------------------------------------------------------
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.ui;
43 |
44 | import java.awt.Color;
45 | import java.awt.Component;
46 | import java.awt.Graphics;
47 | import java.awt.Graphics2D;
48 | import javax.swing.Icon;
49 |
50 | /**
51 | *
52 | * @author junichi11
53 | */
54 | final class ColorIcon implements Icon {
55 |
56 | private final int width;
57 | private final int height;
58 |
59 | private final String color;
60 |
61 | public ColorIcon(String color) {
62 | this(16, 16, color);
63 | }
64 |
65 | public ColorIcon(int width, int height, String color) {
66 | this.width = width;
67 | this.height = height;
68 | this.color = color;
69 | }
70 |
71 | @Override
72 | public void paintIcon(Component component, Graphics g, int x, int y) {
73 | int h = component.getHeight();
74 | int defaultSize = h - y * 2;
75 | Graphics2D g2d = (Graphics2D) g.create();
76 | g2d.setColor(Color.decode(color));
77 | if (defaultSize < height) {
78 | g2d.fillRect(x, y, width, height);
79 | } else {
80 | g2d.fillRect(x, y, defaultSize, defaultSize);
81 | }
82 | g2d.dispose();
83 | }
84 |
85 | @Override
86 | public int getIconWidth() {
87 | return width;
88 | }
89 |
90 | @Override
91 | public int getIconHeight() {
92 | return height;
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/ui/IssueTableCellRenderer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.ui;
43 |
44 | import java.awt.Component;
45 | import javax.swing.JLabel;
46 | import javax.swing.JTable;
47 | import javax.swing.table.TableCellRenderer;
48 | import org.netbeans.modules.bugtracking.issuetable.QueryTableCellRenderer;
49 |
50 | /**
51 | *
52 | * @author junichi11
53 | */
54 | public class IssueTableCellRenderer implements TableCellRenderer {
55 |
56 | private final QueryTableCellRenderer defaultRenderer;
57 |
58 | public IssueTableCellRenderer(QueryTableCellRenderer defaultRenderer) {
59 | this.defaultRenderer = defaultRenderer;
60 | }
61 |
62 | @Override
63 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
64 | JLabel label = (JLabel) defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
65 | if (value == null) {
66 | label.setText(""); // NOI18N
67 | }
68 | return label;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/utils/DateUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.utils;
43 |
44 | import java.text.DateFormat;
45 | import java.text.SimpleDateFormat;
46 |
47 | /**
48 | *
49 | * @author junichi11
50 | */
51 | public final class DateUtils {
52 |
53 | public static final String DATE_FORMAT_YYYY_MM_DD = "yyyy-MM-dd"; // NOI18N
54 | public static final String DATE_FORMAT_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; // NOI18N
55 | public static final DateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat(DATE_FORMAT_YYYY_MM_DD);
56 | public static final DateFormat DEFAULT_DATE_TIME_FORMAT = new SimpleDateFormat(DATE_FORMAT_YYYY_MM_DD_HH_MM_SS);
57 |
58 | private DateUtils() {
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/utils/GitHubIssuesUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.utils;
43 |
44 | import java.io.File;
45 | import java.io.FileInputStream;
46 | import java.io.IOException;
47 | import java.util.Properties;
48 | import org.eclipse.egit.github.core.Issue;
49 | import org.netbeans.api.annotations.common.CheckForNull;
50 |
51 | /**
52 | *
53 | * @author junichi11
54 | */
55 | public final class GitHubIssuesUtils {
56 |
57 | public static final String PROPERTY_USER_NAME = "login"; // NOI18N
58 | public static final String PROPERTY_OAUTH_TOKEN = "oauth"; // NOI18N
59 | private static final String DOT_GITHUB_NAME = ".github"; // NOI18N
60 |
61 | private GitHubIssuesUtils() {
62 | }
63 |
64 | public static boolean isPullRequest(Issue issue) {
65 | return issue != null && issue.getPullRequest() != null;
66 | }
67 |
68 | public static File getDotGithub() {
69 | File homeDir = new File(System.getProperty("user.home")); // NOI18N
70 | return new File(homeDir, DOT_GITHUB_NAME);
71 | }
72 |
73 | public static Properties getProperties() throws IOException {
74 | return getProperties(null);
75 | }
76 |
77 | public static Properties getProperties(File propertyFile) throws IOException {
78 | if (propertyFile == null) {
79 | propertyFile = getDotGithub();
80 | }
81 | Properties properties = new Properties();
82 | if (!propertyFile.exists()) {
83 | return properties;
84 | }
85 | try (FileInputStream in = new FileInputStream(propertyFile)) {
86 | properties.load(in);
87 | }
88 | return properties;
89 | }
90 |
91 | /**
92 | * Get a user name from a .github file. The .github file must be put the
93 | * user home directory.
94 | *
95 | * @return user name if .github file exists and name is set, otherwise
96 | * {@code null}
97 | * @throws IOException
98 | */
99 | @CheckForNull
100 | public static String getUserName() throws IOException {
101 | Properties properties = getProperties();
102 | return properties.getProperty(GitHubIssuesUtils.PROPERTY_USER_NAME, null);
103 | }
104 |
105 | /**
106 | * Get an OAuth token from a .github file. The .github file must be put the
107 | * user home directory.
108 | *
109 | * @return OAuth token if .github file exists and the token is set,
110 | * otherwise {@code null}
111 | * @throws IOException
112 | */
113 | @CheckForNull
114 | public static String getOAuthToken() throws IOException {
115 | Properties properties = getProperties();
116 | return properties.getProperty(GitHubIssuesUtils.PROPERTY_OAUTH_TOKEN, null);
117 | }
118 |
119 | }
120 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/utils/StringUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.utils;
43 |
44 | import com.vladsch.flexmark.ast.Node;
45 | import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughExtension;
46 | import com.vladsch.flexmark.ext.tables.TablesExtension;
47 | import com.vladsch.flexmark.html.HtmlRenderer;
48 | import com.vladsch.flexmark.parser.Parser;
49 | import com.vladsch.flexmark.util.options.MutableDataSet;
50 | import java.util.Arrays;
51 | import java.util.List;
52 | import java.util.StringTokenizer;
53 |
54 | /**
55 | *
56 | * @author junichi11
57 | */
58 | public final class StringUtils {
59 |
60 | private static final MutableDataSet OPTIONS = new MutableDataSet();
61 | private static final Parser PARSER = Parser.builder(OPTIONS).build();
62 | private static final HtmlRenderer RENDERER = HtmlRenderer.builder(OPTIONS).build();
63 |
64 | static {
65 | OPTIONS.set(Parser.EXTENSIONS, Arrays.asList(TablesExtension.create(), StrikethroughExtension.create()));
66 | }
67 |
68 | private StringUtils() {
69 | }
70 |
71 | public static String markdownToHtml(String text) {
72 | if (text == null) {
73 | return ""; // NOI18N
74 | }
75 | Node document = PARSER.parse(text);
76 | return RENDERER.render(document);
77 | }
78 |
79 | /**
80 | * Check whether specified string is {@code null} or empty.
81 | *
82 | * @param text text
83 | * @return {@code true} text is {@code null} or empty, otherwise
84 | * {@code false}
85 | */
86 | public static boolean isEmpty(String text) {
87 | return text == null || text.isEmpty();
88 | }
89 |
90 | /**
91 | * Combine tokens with a specified separator.
92 | *
93 | * @param tokens tokens
94 | * @param separator separator
95 | * @return one combined string, empty string if token or separator are
96 | * {@code null}
97 | */
98 | public static String join(List tokens, String separator) {
99 | StringBuilder sb = new StringBuilder();
100 | if (tokens != null && separator != null) {
101 | for (String token : tokens) {
102 | if (sb.length() > 0) {
103 | sb.append(separator);
104 | }
105 | sb.append(token);
106 | }
107 | }
108 | return sb.toString();
109 | }
110 |
111 | /**
112 | * Convert to quote comment text. Add "> " to the top of each lines.Add line
113 | * break(\n) the last position.
114 | *
115 | * @param comment
116 | * @return quote comment if comment is not {@code null} and not empty,
117 | * otherwise empty string
118 | */
119 | public static String toQuoteComment(String comment) {
120 | if (isEmpty(comment)) {
121 | return ""; // NOI18N
122 | }
123 | StringBuilder sb = new StringBuilder();
124 | StringTokenizer tokenizer = new StringTokenizer(comment, "\n"); // NOI18N
125 | while (tokenizer.hasMoreTokens()) {
126 | String token = tokenizer.nextToken();
127 | sb.append("> ").append(token).append("\n"); // NOI18N
128 | }
129 | return sb.toString();
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/utils/UiUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.utils;
43 |
44 | import com.junichi11.netbeans.modules.github.issues.options.GitHubIssuesOptions;
45 | import org.netbeans.api.options.OptionsDisplayer;
46 | import org.openide.DialogDisplayer;
47 | import org.openide.NotifyDescriptor;
48 |
49 | /**
50 | *
51 | * @author junichi11
52 | */
53 | public final class UiUtils {
54 |
55 | private UiUtils() {
56 | }
57 |
58 | public static void showErrorDialog(String message) {
59 | showDialog(message, NotifyDescriptor.ERROR_MESSAGE);
60 | }
61 |
62 | public static void showPlainDialog(String message) {
63 | showDialog(message, NotifyDescriptor.PLAIN_MESSAGE);
64 | }
65 |
66 | public static boolean showQuestionDialog(String message) {
67 | return showDialog(message, NotifyDescriptor.QUESTION_MESSAGE) == NotifyDescriptor.OK_OPTION;
68 | }
69 |
70 | private static Object showDialog(String message, int type) {
71 | NotifyDescriptor descriptor;
72 | if (type == NotifyDescriptor.QUESTION_MESSAGE) {
73 | descriptor = new NotifyDescriptor.Confirmation(message, NotifyDescriptor.OK_CANCEL_OPTION, type);
74 | } else {
75 | descriptor = new NotifyDescriptor.Message(message, type);
76 | }
77 | return DialogDisplayer.getDefault().notify(descriptor);
78 | }
79 |
80 | public static void showOptions() {
81 | OptionsDisplayer.getDefault().open(GitHubIssuesOptions.SUB_PATH);
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/src/main/java/com/junichi11/netbeans/modules/github/issues/utils/ValidateUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.utils;
43 |
44 | import java.util.Arrays;
45 | import java.util.List;
46 |
47 | /**
48 | *
49 | * @author junichi11
50 | */
51 | public final class ValidateUtils {
52 |
53 | private static final List INS = Arrays.asList("body", "title", "comments"); // NOI18N
54 |
55 | private ValidateUtils() {
56 | }
57 |
58 | public static boolean isQueryDateFormat(String date) {
59 | if (date == null || date.isEmpty()) {
60 | return true;
61 | }
62 | return date.matches("\\A(<|>|<=|>=)*\\d{4}-\\d{2}-\\d{2}\\z") // NOI18N
63 | || date.matches("\\A\\d{4}-\\d{2}-\\d{2}\\.\\.\\d{4}-\\d{2}-\\d{2}\\z"); // NOI18N
64 | }
65 |
66 | public static boolean isQueryCommentsFormat(String comments) {
67 | if (comments == null || comments.isEmpty()) {
68 | return true;
69 | }
70 | return comments.matches("\\A(<|>|<=|>=)*\\d+\\z") // NOI18N
71 | || comments.matches("\\A\\d+\\.\\.\\d+\\z"); // NOI18N
72 | }
73 |
74 | public static boolean isQueryInFormat(String in) {
75 | if (in == null || in.isEmpty()) {
76 | return true;
77 | }
78 | String[] ins = in.split(","); // NOI18N
79 | return INS.containsAll(Arrays.asList(ins));
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/main/nbm/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | OpenIDE-Module-Layer: com/junichi11/netbeans/modules/github/issues/resources/layer.xml
3 | OpenIDE-Module-Localizing-Bundle: com/junichi11/netbeans/modules/github/issues/Bundle.properties
4 |
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/Bundle.properties:
--------------------------------------------------------------------------------
1 | #Localized module labels. Defaults taken from POM (, , ) if unset.
2 | #OpenIDE-Module-Name=
3 | #OpenIDE-Module-Short-Description=
4 | #OpenIDE-Module-Long-Description=
5 | OpenIDE-Module-Display-Category=Base IDE
6 |
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/issue/ui/Bundle.properties:
--------------------------------------------------------------------------------
1 |
2 | GitHubIssuePanel.titleLabel.text=Title:
3 | GitHubIssuePanel.titleTextField.text=
4 | GitHubIssuePanel.assigneeLabel.text=Assignee:
5 | GitHubIssuePanel.milestoneLabel.text=Milestone:
6 | GitHubIssuePanel.descriptionLabel.text=Description:
7 | GitHubIssuePanel.labelsLabel.text=Labels:
8 | GitHubIssuePanel.headerSubmitButton.text=Submit
9 | GitHubIssuePanel.headerErrorLabel.text=ERROR
10 | GitHubIssuePanel.headerNameLabel.text=ISSUE
11 | CommentTabbedPanel.commentWritePanel.TabConstraints.tabTitle=Write
12 | CommentTabbedPanel.commentPreviewPanel.TabConstraints.tabTitle=Preview
13 | GitHubIssuePanel.newCommentLabel.text=New Comment:
14 | AttributesViewPanel.assigneeLabel.text=Assignee:
15 | AttributesViewPanel.milestoneLabel.text=Milestone:
16 | AttributesViewPanel.milestoneNameLabel.text=-
17 | AttributesViewPanel.assigneeNameLabel.text=-
18 | AttributesViewPanel.labelsLabel.text=Labels:
19 | GitHubIssuePanel.changeToPullRequestButton.text=Change to PR
20 | GitHubIssuePanel.newCommentButton.text=Comment
21 | GitHubIssuePanel.newCommentCloseReopenIssueButton.text=Close issue
22 | GitHubIssuePanel.headerCreatedLabel.text=Created:
23 | GitHubIssuePanel.headerCreatedDateLabel.text=-
24 | GitHubIssuePanel.headerUpdatedLabel.text=Updated:
25 | GitHubIssuePanel.headerUpdatedDateLabel.text=-
26 | GitHubIssuePanel.headerCreatedByLabel.text=Created by:
27 | GitHubIssuePanel.headerCreatedByUserLabel.text=-
28 | GitHubIssuePanel.headerStatusLabel.text=STATUS
29 | GitHubIssuePanel.headerShowInBrowserLinkButton.text=Show in browser
30 | GitHubIssuePanel.refreshLinkButton.text=Refresh
31 | CommentPanel.userLinkButton.text=USER
32 | CommentPanel.createdLabel.text=Created:
33 | CommentPanel.createdDateLabel.text=-
34 | CommentPanel.updatedLabel.text=Updated:
35 | CommentPanel.updatedDateLabel.text=-
36 | CommentPanel.quoteLinkButton.text=Quote
37 | CommentPanel.editLinkButton.text=Edit
38 | CommentPanel.deleteLinkButton.text=Delete
39 | LabelPanel.nameLabel.text=Name:
40 | LabelPanel.selectColorButton.text=Select
41 | LabelPanel.nameTextField.text=
42 | LabelPanel.colorLabel.text=Color:
43 | LabelPanel.colorTextField.text=
44 | LabelPanel.errorLabel.text=ERROR
45 | MilestonePanel.descriptionLabel.text=Description
46 | MilestonePanel.titleTextField.text=
47 | MilestonePanel.titleLabel.text=Title
48 | MilestonePanel.dueDateLabel.text=Due Date
49 | GitHubIssuePanel.newMilestoneButton.text=New Milestone
50 | MilestonePanel.errorLabel.text=ERROR
51 | GitHubIssuePanel.newLabelButton.text=New Label
52 | CommentPanel.previewLinkButton.text=HTML
53 | GitHubIssuePanel.assignYourselfLinkButton.text=Assign yourself
54 | GitHubIssuePanel.commentsCollapsibleSectionPanel.label=Comments
55 | GitHubIssuePanel.insertTemplateButton.toolTipText=Insert Template
56 | GitHubIssuePanel.insertTemplateButton.text=
57 | GitHubIssuePanel.manageTemplatesButton.toolTipText=Manage Templates
58 | GitHubIssuePanel.manageTemplatesButton.text=
59 | TemplatePanel.nameLabel.text=Name:
60 | TemplatePanel.nameTextField.text=
61 | TemplatePanel.errorLabel.text=ERROR
62 | GitHubIssuePanel.filesChangedcollapsibleSectionPanel.label=Files Changed
63 | FilesChangedPanel.deletionsLabel.text=DELETIONS
64 | FilesChangedPanel.additionsLabel.text=ADDITIONS
65 | FilesChangedPanel.diffButton.text=Show Diff File
66 | FileChangedPanel.fileNameLabel.text=FILE NAME
67 | FileChangedPanel.diffButton.text=Diff
68 | MergePanel.mergePullRequestButton.text=Merge pull request
69 | MergePanel.confirmMergeButton.text=Confirm merge
70 | MergePanel.cancelButton.text=Cancel
71 | GitHubIssuePanel.headerPrBaseHeadLabel.text=PR BASE HEAD
72 | GitHubIssuePanel.commitsCollapsibleSectionPanel.label=Commits
73 | CommitPanel.commiterLabel.text=COMMITER
74 | CommitPanel.messageLabel.text=MESSAGE
75 | CommitPanel.moreButton.text=...
76 | CommitPanel.moreMessageLabel.text=MORE MESSAGE
77 | FileChangedPanel.additionsLabel.text=ADDITIONS
78 | FileChangedPanel.deletionsLabel.text=DELETIONS
79 | CreatePullRequestPanel.errorLabel.text=ERROR
80 | CreatePullRequestPanel.messageLabel.text=MESSAGE
81 | CreatePullRequestPanel.baseLabel.text=base:
82 | CreatePullRequestPanel.compareButton.text=Compare
83 | CreatePullRequestPanel.headLabel.text=head:
84 | GitHubIssuePanel.newPullRequestToggleButton.text=New PR
85 |
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/options/Bundle.properties:
--------------------------------------------------------------------------------
1 |
2 | GitHubIssuesOptionsPanel.defaultQueriesLabel.text=Default queries:
3 | GitHubIssuesOptionsPanel.openCheckBox.text=Open
4 | GitHubIssuesOptionsPanel.createdByMeCheckBox.text=Created by me
5 | GitHubIssuesOptionsPanel.assignedToMeCheckBox.text=Assigned to me
6 | GitHubIssuesOptionsPanel.repositoriesLabel.text=Repositories:
7 | GitHubIssuesOptionsPanel.showParentRepositoryCheckBox.text=Show a parent repository when you add a repository.
8 | GitHubIssuesOptionsPanel.showParentRepositoryCheckBox.toolTipText=If your repository is fork, show a parent repository in the combobox.
9 | GitHubIssuesOptionsPanel.issuesLabel.text=Issues:
10 | GitHubIssuesOptionsPanel.insertTemplateCheckBox.text=Insert the default template when a new issue panel is opened.
11 |
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/query/ui/Bundle.properties:
--------------------------------------------------------------------------------
1 |
2 | GitHubQueryPanel.saveButton.text=Save
3 | GitHubQueryPanel.keywordTextField.text=
4 | GitHubQueryPanel.searchButton.text=Search
5 | GitHubQueryPanel.stateLabel.text=State:
6 | GitHubQueryPanel.keywordLabel.text=Keyword:
7 | GitHubQueryPanel.commentsLabel.text=Comments:
8 | GitHubQueryPanel.commentsTextField.text=
9 | GitHubQueryPanel.labelsLabel.text=Labels:
10 | GitHubQueryPanel.labelsTextField.text=
11 | GitHubQueryPanel.authorLabel.text=Author:
12 | GitHubQueryPanel.authorTextField.text=
13 | GitHubQueryPanel.mentionsLabel.text=Mentions:
14 | GitHubQueryPanel.mentionsTextField.text=
15 | GitHubQueryPanel.assigneeLabel.text=Assignee:
16 | GitHubQueryPanel.assigneeTextField.text=
17 | GitHubQueryPanel.involvesLabel.text=Involves:
18 | GitHubQueryPanel.involvesTextField.text=
19 | GitHubQueryPanel.inLabel.text=In:
20 | GitHubQueryPanel.inTextField.text=
21 | GitHubQueryPanel.noLabel.text=No:
22 | GitHubQueryPanel.isLabel.text=Is:
23 | GitHubQueryPanel.languageLabel.text=Language:
24 | GitHubQueryPanel.languageTextField.text=
25 | GitHubQueryPanel.createdLabel.text=Created:
26 | GitHubQueryPanel.updatedLabel.text=Updated:
27 | GitHubQueryPanel.mergedLabel.text=Merged:
28 | GitHubQueryPanel.closedLabel.text=Closed:
29 | GitHubQueryPanel.createdTextField.text=
30 | GitHubQueryPanel.updatedTextField.text=
31 | GitHubQueryPanel.mergedTextField.text=
32 | GitHubQueryPanel.closedTextField.text=
33 | GitHubQueryPanel.sortLabel.text=Sort:
34 | GitHubQueryPanel.orderLabel.text=Order:
35 | GitHubQueryPanel.headerNameLabel.text=NAME
36 | GitHubQueryPanel.headerErrorLabel.text=ERROR
37 | GitHubQueryPanel.resetButton.text=Reset
38 | GitHubQueryPanel.resultsLabel.text=RESULTS
39 | GitHubQueryPanel.typeLabel.text=Type:
40 | GitHubQueryPanel.milestoneLabel.text=Milestone:
41 |
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/repository/ui/Bundle.properties:
--------------------------------------------------------------------------------
1 |
2 | GitHubRepositoryPanel.connectButton.text=Connect
3 | GitHubRepositoryPanel.displayNameLabel.text=Name:
4 | GitHubRepositoryPanel.displayNameTextField.text=
5 | GitHubRepositoryPanel.oauthTokenLabel.text=OAuth Token:
6 | GitHubRepositoryPanel.oauthTokenTextField.text=
7 | GitHubRepositoryPanel.propertyFileCheckBox.text=Use property file (~/.github)
8 | GitHubRepositoryPanel.userNameLabel.text=User Name:
9 | GitHubRepositoryPanel.userNameTextField.text=
10 | GitHubRepositoryPanel.repositoryLabel.text=Repository:
11 | GitHubRepositoryPanel.repositoryAuthorTextField.text=
12 | GitHubRepositoryPanel.repositorySeparationLabel.text=/
13 | GitHubRepositoryPanel.repositoryNameTextField.text=
14 | GitHubRepositoryPanel.addRepositoryButton.text=Add Repository
15 | GitHubRepositoryPanel.hostnameLabel.text=Hostname:
16 | GitHubRepositoryPanel.hostnameTextField.text=
17 |
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/Bundle.properties:
--------------------------------------------------------------------------------
1 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2 | #
3 | # Copyright 2015 Oracle and/or its affiliates. All rights reserved.
4 | #
5 | # Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6 | # Other names may be trademarks of their respective owners.
7 | #
8 | # The contents of this file are subject to the terms of either the GNU
9 | # General Public License Version 2 only ("GPL") or the Common
10 | # Development and Distribution License("CDDL") (collectively, the
11 | # "License"). You may not use this file except in compliance with the
12 | # License. You can obtain a copy of the License at
13 | # http://www.netbeans.org/cddl-gplv2.html
14 | # or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15 | # specific language governing permissions and limitations under the
16 | # License. When distributing the software, include this License Header
17 | # Notice in each file and include the License file at
18 | # nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
19 | # particular file as subject to the "Classpath" exception as provided
20 | # by Oracle in the GPL Version 2 section of the License file that
21 | # accompanied this code. If applicable, add the following below the
22 | # License Header, with the fields enclosed by brackets [] replaced by
23 | # your own identifying information:
24 | # "Portions Copyrighted [year] [name of copyright owner]"
25 | #
26 | # If you wish your version of this file to be governed by only the CDDL
27 | # or only the GPL Version 2, indicate your decision by adding
28 | # "[Contributor] elects to include this software in this distribution
29 | # under the [CDDL or GPL Version 2] license." If you do not indicate a
30 | # single choice of license, a recipient has the option to distribute
31 | # your version of this file under either the CDDL, the GPL Version 2 or
32 | # to extend the choice of license to its licensees as provided above.
33 | # However, if you add GPL Version 2 code and therefore, elected the GPL
34 | # Version 2 license, then the option applies only if the new code is
35 | # made subject to such option by the copyright holder.
36 | #
37 | # Contributor(s):
38 | #
39 | # Portions Copyrighted 2015 Sun Microsystems, Inc.
40 |
41 | # import/export
42 | LBL_GitHubIssuesExportName=GitHub Issues
43 |
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/closed_issue_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/closed_issue_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/closed_pull_request_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/closed_pull_request_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/error_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/error_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/git_merge_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/git_merge_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/git_pull_request_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/git_pull_request_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/icon_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/icon_32.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/issue_closed_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/issue_closed_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/issue_opened_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/issue_opened_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/layer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/merged_pull_request_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/merged_pull_request_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/open_issue_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/open_issue_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/open_pull_request_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/open_pull_request_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/template_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/template_16.png
--------------------------------------------------------------------------------
/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/template_settings_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/junichi11/netbeans-github-issues-plugin/ae85e8f531b3a199616681d81254e5d9310dd4d9/src/main/resources/com/junichi11/netbeans/modules/github/issues/resources/template_settings_16.png
--------------------------------------------------------------------------------
/src/test/java/com/junichi11/netbeans/modules/github/issues/utils/StringUtilsTest.java:
--------------------------------------------------------------------------------
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.utils;
43 |
44 | import java.util.Arrays;
45 | import java.util.Collections;
46 | import org.junit.After;
47 | import org.junit.AfterClass;
48 | import static org.junit.Assert.assertEquals;
49 | import static org.junit.Assert.assertFalse;
50 | import static org.junit.Assert.assertTrue;
51 | import org.junit.Before;
52 | import org.junit.BeforeClass;
53 | import org.junit.Test;
54 |
55 | /**
56 | *
57 | * @author junichi11
58 | */
59 | public class StringUtilsTest {
60 |
61 | public StringUtilsTest() {
62 | }
63 |
64 | @BeforeClass
65 | public static void setUpClass() {
66 | }
67 |
68 | @AfterClass
69 | public static void tearDownClass() {
70 | }
71 |
72 | @Before
73 | public void setUp() {
74 | }
75 |
76 | @After
77 | public void tearDown() {
78 | }
79 |
80 | /**
81 | * Test of isEmpty method, of class StringUtils.
82 | */
83 | @Test
84 | public void testIsEmpty() {
85 | assertTrue(StringUtils.isEmpty(null));
86 | assertTrue(StringUtils.isEmpty(""));
87 |
88 | assertFalse(StringUtils.isEmpty("test"));
89 | assertFalse(StringUtils.isEmpty(" "));
90 | assertFalse(StringUtils.isEmpty("apple orange"));
91 | }
92 |
93 | /**
94 | * Test of join method, of class StringUtils.
95 | */
96 | @Test
97 | public void testJoin() {
98 | assertEquals("one,two,three,four,five", StringUtils.join(Arrays.asList("one", "two", "three", "four", "five"), ","));
99 | assertEquals("one:two:three:four:five", StringUtils.join(Arrays.asList("one", "two", "three", "four", "five"), ":"));
100 | assertEquals("onetwothreefourfive", StringUtils.join(Arrays.asList("one", "two", "three", "four", "five"), ""));
101 |
102 | assertEquals("", StringUtils.join(Collections.emptyList(), ":"));
103 | assertEquals("", StringUtils.join(null, ":"));
104 | assertEquals("", StringUtils.join(null, null));
105 | assertEquals("", StringUtils.join(Arrays.asList("one", "two"), null));
106 | }
107 |
108 | /**
109 | * Test of toQuoteComment method, of class StringUtils.
110 | */
111 | @Test
112 | public void testToQuoteComment() {
113 | assertEquals("> test\n", StringUtils.toQuoteComment("test"));
114 | assertEquals("> test\n", StringUtils.toQuoteComment("test"));
115 | assertEquals("> one\n> two\n> three\n", StringUtils.toQuoteComment("one\ntwo\nthree"));
116 |
117 | assertEquals("", StringUtils.toQuoteComment(""));
118 | assertEquals("", StringUtils.toQuoteComment(null));
119 | }
120 |
121 | }
122 |
--------------------------------------------------------------------------------
/src/test/java/com/junichi11/netbeans/modules/github/issues/utils/ValidateUtilsTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright 2014 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 2014 Sun Microsystems, Inc.
41 | */
42 | package com.junichi11.netbeans.modules.github.issues.utils;
43 |
44 | import org.junit.After;
45 | import org.junit.AfterClass;
46 | import org.junit.Assert;
47 | import org.junit.Before;
48 | import org.junit.BeforeClass;
49 | import org.junit.Test;
50 |
51 | /**
52 | *
53 | * @author junichi11
54 | */
55 | public class ValidateUtilsTest {
56 |
57 | public ValidateUtilsTest() {
58 | }
59 |
60 | @BeforeClass
61 | public static void setUpClass() {
62 | }
63 |
64 | @AfterClass
65 | public static void tearDownClass() {
66 | }
67 |
68 | @Before
69 | public void setUp() {
70 | }
71 |
72 | @After
73 | public void tearDown() {
74 | }
75 |
76 | /**
77 | * Test of isQueryDateFormat method, of class ValidateUtils.
78 | */
79 | @Test
80 | public void testIsQueryDateFormat() {
81 | Assert.assertTrue(ValidateUtils.isQueryDateFormat("<2014-12-01"));
82 | Assert.assertTrue(ValidateUtils.isQueryDateFormat("<=2014-12-01"));
83 | Assert.assertTrue(ValidateUtils.isQueryDateFormat(">2014-12-01"));
84 | Assert.assertTrue(ValidateUtils.isQueryDateFormat(">=2014-12-01"));
85 | Assert.assertTrue(ValidateUtils.isQueryDateFormat("2014-12-01"));
86 | Assert.assertTrue(ValidateUtils.isQueryDateFormat("2014-12-01..2015-01-01"));
87 | Assert.assertTrue(ValidateUtils.isQueryDateFormat(""));
88 | Assert.assertTrue(ValidateUtils.isQueryDateFormat(null));
89 |
90 | Assert.assertFalse(ValidateUtils.isQueryDateFormat("test"));
91 | Assert.assertFalse(ValidateUtils.isQueryDateFormat("=2014/12/01"));
92 | Assert.assertFalse(ValidateUtils.isQueryDateFormat("2014/12/01"));
93 | Assert.assertFalse(ValidateUtils.isQueryDateFormat("2014-12-01.2015-01-01"));
94 | Assert.assertFalse(ValidateUtils.isQueryDateFormat("2014-12-01...2015-01-01"));
95 | }
96 |
97 | /**
98 | * Test of isQueryCommentsFormat method, of class ValidateUtils.
99 | */
100 | @Test
101 | public void testIsQueryCommentsFormat() {
102 | Assert.assertTrue(ValidateUtils.isQueryCommentsFormat(""));
103 | Assert.assertTrue(ValidateUtils.isQueryCommentsFormat(null));
104 | Assert.assertTrue(ValidateUtils.isQueryCommentsFormat("100"));
105 | Assert.assertTrue(ValidateUtils.isQueryCommentsFormat("<100"));
106 | Assert.assertTrue(ValidateUtils.isQueryCommentsFormat(">100"));
107 | Assert.assertTrue(ValidateUtils.isQueryCommentsFormat("<=100"));
108 | Assert.assertTrue(ValidateUtils.isQueryCommentsFormat(">=100"));
109 | Assert.assertTrue(ValidateUtils.isQueryCommentsFormat("100..200"));
110 |
111 | Assert.assertFalse(ValidateUtils.isQueryCommentsFormat("test"));
112 | Assert.assertFalse(ValidateUtils.isQueryCommentsFormat("-100"));
113 | Assert.assertFalse(ValidateUtils.isQueryCommentsFormat("150test"));
114 | Assert.assertFalse(ValidateUtils.isQueryCommentsFormat("150...250"));
115 | Assert.assertFalse(ValidateUtils.isQueryCommentsFormat("150.250"));
116 | }
117 |
118 | /**
119 | * Test of isQueryInFormat method, of class ValidateUtils.
120 | */
121 | @Test
122 | public void testIsQueryInFormat() {
123 | Assert.assertTrue(ValidateUtils.isQueryInFormat(""));
124 | Assert.assertTrue(ValidateUtils.isQueryInFormat(null));
125 | Assert.assertTrue(ValidateUtils.isQueryInFormat("title"));
126 | Assert.assertTrue(ValidateUtils.isQueryInFormat("body"));
127 | Assert.assertTrue(ValidateUtils.isQueryInFormat("comments"));
128 | Assert.assertTrue(ValidateUtils.isQueryInFormat("title,body"));
129 | Assert.assertTrue(ValidateUtils.isQueryInFormat("body,title,comments"));
130 | Assert.assertTrue(ValidateUtils.isQueryInFormat("title,comments,body"));
131 |
132 | Assert.assertFalse(ValidateUtils.isQueryInFormat("test"));
133 | Assert.assertFalse(ValidateUtils.isQueryInFormat("title,test"));
134 | }
135 | }
136 |
--------------------------------------------------------------------------------