Skip to content
Permalink
Browse files
Merge pull request #84 from stephenc/jenkins-38960-followup
[JENKINS-38960 Follow-up] Switch to IconSpec
  • Loading branch information
stephenc committed Oct 20, 2016
2 parents 4b29ab8 + d658fe9 commit 6fcec84df690187a104d57c1b40916053d42fdad
@@ -0,0 +1,19 @@
#!/bin/sh -e

dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
for src in "$dir"/*.svg
do
echo "Processing $(basename "$src")..."
file=$(basename "$src" | sed -e s/.svg/.png/ )
for sz in 16 24 32 48
do
mkdir -p "${dir}/../../src/main/webapp/images/${sz}x${sz}"
dst="${dir}/../../src/main/webapp/images/${sz}x${sz}/${file}"
if [ ! -e "$dst" -o "$src" -nt "$dst" ]
then
echo -n " generating ${sz}x${sz}..."
mkdir "${dir}/../../src/main/webapp/images/${sz}x${sz}" > /dev/null 2>&1 || true
inkscape -z -C -w ${sz} -h ${sz} -e "$dst" "$src" 2>&1 | grep "Bitmap saved as"
fi
done
done
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -45,7 +45,6 @@
import hudson.model.Executor;
import hudson.model.Item;
import hudson.model.ItemGroup;
import static hudson.model.ItemGroupMixIn.loadChildren;
import hudson.model.Job;
import hudson.model.Queue;
import hudson.model.Queue.Task;
@@ -102,6 +101,9 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.maven.model.building.ModelBuildingRequest;
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.stapler.HttpResponse;
@@ -111,6 +113,8 @@
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;

import static hudson.model.ItemGroupMixIn.loadChildren;

/**
* Group of {@link MavenModule}s.
*
@@ -1300,7 +1304,7 @@ public DescriptorImpl getDescriptor() {
@Extension(ordinal=900)
public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl();

public static final class DescriptorImpl extends AbstractProjectDescriptor {
public static final class DescriptorImpl extends AbstractProjectDescriptor implements IconSpec {
/**
* Globally-defined MAVEN_OPTS.
*/
@@ -1403,6 +1407,15 @@ public String getIconFilePathPattern() {
return "plugin/maven-plugin/images/:size/mavenmoduleset.png";
}

/**
* {@inheritDoc}
*/
@Override
public String getIconClassName() {
return "icon-maven-moduleset";
}


public MavenModuleSet newInstance(ItemGroup parent, String name) {
MavenModuleSet mms = new MavenModuleSet(parent,name);
mms.setSettings(GlobalMavenConfig.get().getSettingsProvider());
@@ -1442,6 +1455,21 @@ public boolean isApplicable(Descriptor descriptor) {
Mailer.class, // for historical reasons, Maven uses MavenMailer
JUnitResultArchiver.class // done by SurefireArchiver
));

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

private static final Logger LOGGER = Logger.getLogger(MavenModuleSet.class.getName());
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 6fcec84

Please sign in to comment.