|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2006 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 119-124
Link Here
|
| 119 |
} |
119 |
} |
| 120 |
|
120 |
|
| 121 |
/** |
121 |
/** |
|
|
122 |
* The day of month variable evaluates to the current day of the month. |
| 123 |
*/ |
| 124 |
public static class DayOfMonth extends SimpleTemplateVariableResolver { |
| 125 |
|
| 126 |
/** Name of the day of month variable. */ |
| 127 |
public static final String NAME = "day_of_month"; //$NON-NLS-1$ |
| 128 |
|
| 129 |
/** |
| 130 |
* Creates a new day of month variable |
| 131 |
*/ |
| 132 |
public DayOfMonth() { |
| 133 |
super(NAME, TextTemplateMessages.getString("GlobalVariables.variable.description.dayOfMonth")); //$NON-NLS-1$ |
| 134 |
} |
| 135 |
protected String resolve(TemplateContext context) { |
| 136 |
String dayOfMonth = Integer.toString(Calendar.getInstance().get(Calendar.DAY_OF_MONTH)); |
| 137 |
return dayOfMonth.length() > 1 ? dayOfMonth : "0" + dayOfMonth; //$NON-NLS-1$ |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
/** |
| 142 |
* The month variable evaluates to the current month. |
| 143 |
*/ |
| 144 |
public static class Month extends SimpleTemplateVariableResolver { |
| 145 |
|
| 146 |
/** Name of the month variable. */ |
| 147 |
public static final String NAME = "month"; //$NON-NLS-1$ |
| 148 |
|
| 149 |
/** |
| 150 |
* Creates a new month variable |
| 151 |
*/ |
| 152 |
public Month() { |
| 153 |
super(NAME, TextTemplateMessages.getString("GlobalVariables.variable.description.month")); //$NON-NLS-1$ |
| 154 |
} |
| 155 |
protected String resolve(TemplateContext context) { |
| 156 |
String month = Integer.toString(Calendar.getInstance().get(Calendar.MONTH) + 1); |
| 157 |
return month.length() > 1 ? month : "0" + month; //$NON-NLS-1$ |
| 158 |
} |
| 159 |
} |
| 160 |
|
| 161 |
/** |
| 122 |
* The year variable evaluates to the current year. |
162 |
* The year variable evaluates to the current year. |
| 123 |
*/ |
163 |
*/ |
| 124 |
public static class Year extends SimpleTemplateVariableResolver { |
164 |
public static class Year extends SimpleTemplateVariableResolver { |