Skip to content
Permalink
Browse files

Merge pull request #16 from jenkinsci/jenkins-38987

[FIXED JENKINS-38987] Add getPronoun() to assist contextual naming
  • Loading branch information...
stephenc committed Oct 14, 2016
2 parents f909068 + 7f70e0a commit 064fcfa23f63b5726f7c9a37b8a412c4c32423ff
@@ -31,6 +31,7 @@
import hudson.model.Actionable;
import hudson.model.Item;
import hudson.model.ItemGroup;
import hudson.util.AlternativeUiTextProvider;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
@@ -51,6 +52,17 @@
@ExportedBean
public class SCMHead implements Comparable<SCMHead>, Serializable {

/**
* Replaceable pronoun of that points to a {@link SCMHead}. Defaults to {@code null} depending on the context.
*
* @since FIXME
*/
public static final AlternativeUiTextProvider.Message<SCMHead> PRONOUN
= new AlternativeUiTextProvider.Message<SCMHead>();

/**
* Our logger.
*/
private static final Logger LOGGER = Logger.getLogger(SCMHead.class.getName());

/**
@@ -85,6 +97,17 @@ public String getName() {
return name;
}

/**
* Get the term used in the UI to represent this kind of {@link SCMHead}. Must start with a capital letter.
*
* @return the term or {@code null} to fall back to the calling context's default.
* @since FIXME
*/
@CheckForNull
public String getPronoun() {
return AlternativeUiTextProvider.get(PRONOUN, this, null);
}

/**
* {@inheritDoc}
*/
@@ -24,9 +24,11 @@

package jenkins.scm.api;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.ExtensionPoint;
import hudson.model.AbstractDescribableImpl;
import hudson.util.AlternativeUiTextProvider;
import java.io.IOException;

/**
@@ -37,6 +39,14 @@
*/
public abstract class SCMNavigator extends AbstractDescribableImpl<SCMNavigator> implements ExtensionPoint {

/**
* Replaceable pronoun of that points to a {@link SCMNavigator}. Defaults to {@code null} depending on the context.
*
* @since FIXME
*/
public static final AlternativeUiTextProvider.Message<SCMNavigator> PRONOUN
= new AlternativeUiTextProvider.Message<SCMNavigator>();

protected SCMNavigator() {}

/**
@@ -53,4 +63,14 @@ public SCMNavigatorDescriptor getDescriptor() {
return (SCMNavigatorDescriptor) super.getDescriptor();
}

/**
* Get the term used in the UI to represent this kind of {@link SCMNavigator}. Must start with a capital letter.
*
* @return the term or {@code null} to fall back to the calling context's default.
* @since FIXME
*/
@CheckForNull
public String getPronoun() {
return AlternativeUiTextProvider.get(PRONOUN, this, getDescriptor().getPronoun());
}
}
@@ -84,11 +84,28 @@ public String getIconFilePathPattern() {
return null;
}

/**
* Get the Item's Icon class specification e.g. 'icon-notepad'.
* Note: do <strong>NOT</strong> include icon size specifications (such as 'icon-sm').
*
* @return The Icon class specification e.g. 'icon-notepad'.
*/
@CheckForNull
public String getIconClassName() {
return null;
}

/**
* Get the term used in the UI to represent this kind of {@link SCMNavigator}. Must start with a capital letter.
*
* @return the term or {@code null} to fall back to the calling context's default.
* @since FIXME
*/
@CheckForNull
public String getPronoun() {
return null;
}

/**
* Creates a default navigator, if there should be one displayed.
* May be interpreted by {@code jenkins.branch.CustomOrganizationFolderDescriptor}.
@@ -27,8 +27,11 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.ExtensionPoint;
import hudson.model.AbstractDescribableImpl;
import hudson.model.AbstractItem;
import hudson.model.Descriptor;
import hudson.model.TaskListener;
import hudson.scm.SCM;
import hudson.util.AlternativeUiTextProvider;
import hudson.util.LogTaskListener;
import net.jcip.annotations.GuardedBy;

@@ -61,6 +64,13 @@
public abstract class SCMSource extends AbstractDescribableImpl<SCMSource>
implements ExtensionPoint {

/**
* Replaceable pronoun of that points to a {@link SCMSource}. Defaults to {@code null} depending on the context.
* @since FIXME
*/
public static final AlternativeUiTextProvider.Message<SCMSource> PRONOUN
= new AlternativeUiTextProvider.Message<SCMSource>();

/**
* The ID of this source.
*/
@@ -451,4 +461,23 @@ public String toString() {
return sb.toString();
}

/**
* {@inheritDoc}
*/
@Override
public SCMSourceDescriptor getDescriptor() {
return (SCMSourceDescriptor) super.getDescriptor();
}

/**
* Get the term used in the UI to represent this kind of {@link SCMSource}. Must start with a capital letter.
*
* @return the term or {@code null} to fall back to the calling context's default.
* @since FIXME
*/
@CheckForNull
public String getPronoun() {
return AlternativeUiTextProvider.get(PRONOUN, this, getDescriptor().getPronoun());
}

}
@@ -27,6 +27,7 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.ExtensionList;
import hudson.model.Descriptor;
import hudson.model.Item;
import org.jenkins.ui.icon.IconSpec;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
@@ -146,4 +147,15 @@ public boolean isUserInstantiable() {
public String getIconClassName() {
return null;
}

/**
* Get the term used in the UI to represent this kind of {@link SCMSource}. Must start with a capital letter.
*
* @return the term or {@code null} to fall back to the calling context's default.
* @since FIXME
*/
@CheckForNull
public String getPronoun() {
return null;
}
}

0 comments on commit 064fcfa

Please sign in to comment.
You can’t perform that action at this time.