Skip to content

Commit

Permalink
[JENKINS-38960 Follow-up] Switch to IconSet
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenc committed Oct 13, 2016
1 parent ac752a2 commit c94b4f0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Expand Up @@ -47,6 +47,9 @@
import jenkins.scm.api.SCMNavigatorDescriptor;
import jenkins.scm.api.SCMSourceObserver;
import jenkins.scm.api.SCMSourceOwner;
import org.jenkins.ui.icon.Icon;
import org.jenkins.ui.icon.IconSet;
import org.jenkins.ui.icon.IconSpec;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.github.GHMyself;
Expand Down Expand Up @@ -323,7 +326,7 @@ private void add(TaskListener listener, SCMSourceObserver observer, GHRepository
projectObserver.complete();
}

@Extension public static class DescriptorImpl extends SCMNavigatorDescriptor {
@Extension public static class DescriptorImpl extends SCMNavigatorDescriptor implements IconSpec {

private static final Logger LOGGER = Logger.getLogger(DescriptorImpl.class.getName());

Expand Down Expand Up @@ -353,7 +356,13 @@ public String getIconFilePathPattern() {
return "plugin/github-branch-source/images/:size/github-scmnavigator.png";
}

@Override public SCMNavigator newInstance(String name) {
@Override
public String getIconClassName() {
return "icon-github-scm-navigator";
}

@Override
public SCMNavigator newInstance(String name) {
return new GitHubSCMNavigator("", name, "", GitHubSCMSource.DescriptorImpl.SAME);
}

Expand Down Expand Up @@ -442,6 +451,24 @@ public FormValidation doCheckBuildOriginPRHead(@QueryParameter boolean buildOrig
return delegate.doCheckBuildForkPRHead(buildOriginBranch, buildOriginBranchWithPR, buildOriginPRMerge, buildOriginPRHead, buildForkPRMerge, buildForkPRHead);
}

static {
IconSet.icons.addIcon(
new Icon("icon-github-scm-navigator icon-sm",
"plugin/github-branch-source/images/16x16/github-scmnavigator.png",
Icon.ICON_SMALL_STYLE));
IconSet.icons.addIcon(
new Icon("icon-github-scm-navigator icon-md",
"plugin/github-branch-source/images/24x24/github-scmnavigator.png",
Icon.ICON_MEDIUM_STYLE));
IconSet.icons.addIcon(
new Icon("icon-github-scm-navigator icon-lg",
"plugin/github-branch-source/images/32x32/github-scmnavigator.png",
Icon.ICON_LARGE_STYLE));
IconSet.icons.addIcon(
new Icon("icon-github-scm-navigator icon-xlg",
"plugin/github-branch-source/images/48x48/github-scmnavigator.png",
Icon.ICON_XLARGE_STYLE));
}
}

}
Binary file modified src/main/webapp/images/48x48/github-scmnavigator.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c94b4f0

Please sign in to comment.