Skip to content

Commit

Permalink
Merge pull request #34 from olivergondza/JENKINS-43179
Browse files Browse the repository at this point in the history
[FIXED JENKINS-43179] Get rid of the fragile side-by-side pattern layout
  • Loading branch information
olivergondza committed Apr 24, 2017
2 parents 9169aec + b8b1eed commit b1c0585
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
53 changes: 28 additions & 25 deletions src/main/java/hudson/plugins/ws_cleanup/Pattern.java
Expand Up @@ -8,12 +8,14 @@
import java.io.Serializable;

import jenkins.model.Jenkins;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.DataBoundConstructor;

/**
* @author <a href="mailto:nicolas.deloof@cloudbees.com">Nicolas De loof</a>
*/
public class Pattern implements Serializable, Describable<Pattern>{
public class Pattern implements Serializable, Describable<Pattern> {

private final String pattern;
private PatternType type;
Expand All @@ -25,44 +27,45 @@ public Pattern(String pattern, PatternType type) {
}

public Object readResolve(){
if(type == null)
type = PatternType.INCLUDE;
return this;
if(type == null)
type = PatternType.INCLUDE;
return this;
}

public String getPattern() {
return pattern;
}

public PatternType getType(){
return type;
return type;
}

@Override
public DescriptorImpl getDescriptor() {
return (DescriptorImpl) Jenkins.getActiveInstance().getDescriptor(getClass());
}
@Extension
public DescriptorImpl getDescriptor() {
return (DescriptorImpl) Jenkins.getActiveInstance().getDescriptor(getClass());
}

@Extension
public static final class DescriptorImpl extends Descriptor<Pattern>{

public static final ListBoxModel TYPES = new ListBoxModel(
new ListBoxModel.Option("Include", PatternType.INCLUDE.toString()),
new ListBoxModel.Option("Exclude", PatternType.EXCLUDE.toString())
);

@Override
public String getDisplayName(){
return "Directory scanner pattern";
}

public ListBoxModel doFillTypeItems(){
ListBoxModel model = new ListBoxModel(2);
model.add("Include",PatternType.INCLUDE.toString());
model.add("Exclude",PatternType.EXCLUDE.toString());
return model;
}
}

public enum PatternType{
INCLUDE,
EXCLUDE;
return "Directory scanner pattern";
}

@Restricted(NoExternalUse.class)
public ListBoxModel doFillTypeItems() {
return TYPES;
}
}

private static final long serialVerisonUID = 1L;
public enum PatternType {
INCLUDE,
EXCLUDE
}
}
@@ -1,9 +1,5 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<table style="width: 100%">
<tr>
<td style="width: 8em;"><f:select field="type" /></td>
<td><f:textbox field="pattern"/></td>
</tr>
</table>
<f:select field="type" />
<f:textbox field="pattern"/>
</j:jelly>

0 comments on commit b1c0585

Please sign in to comment.