/*******************************************************************************
*
* Copyright (c) 2010, InfraDNA, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*
*
*
*
*******************************************************************************/
package hudson.matrix;
import hudson.Extension;
import hudson.model.Hudson;
import org.kohsuke.stapler.DataBoundConstructor;
import java.util.List;
/**
* {@link Axis} that selects label expressions.
*
* @author Kohsuke Kawaguchi
*/
public class LabelAxis extends Axis {
@DataBoundConstructor
public LabelAxis(String name, List<String> values) {
super(name, values);
}
@Override
public boolean isSystem() {
return true;
}
@Extension
public static class DescriptorImpl extends AxisDescriptor {
@Override
public String getDisplayName() {
return Messages.LabelAxis_DisplayName();
}
/**
* If there's no distributed build set up, it's pointless to provide
* this axis.
*/
@Override
public boolean isInstantiable() {
Hudson h = Hudson.getInstance();
return !h.getNodes().isEmpty() || !h.clouds.isEmpty();
}
}
}