KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > ui > refactoring > history > RefactoringHistoryControlConfiguration


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ltk.ui.refactoring.history;
12
13 import org.eclipse.core.resources.IProject;
14
15 import org.eclipse.ltk.ui.refactoring.RefactoringUI;
16
17 import org.eclipse.ltk.internal.ui.refactoring.RefactoringUIMessages;
18
19 /**
20  * Configuration object for a refactoring history control.
21  * <p>
22  * Note: this class is intended to be subclassed by clients wishing to control
23  * the configuration behavior of their refactoring history control.
24  * </p>
25  *
26  * @see RefactoringUI#createRefactoringHistoryControl(org.eclipse.swt.widgets.Composite,
27  * RefactoringHistoryControlConfiguration)
28  *
29  * @see IRefactoringHistoryControl
30  * @see RefactoringHistoryLabelProvider
31  * @see RefactoringHistoryContentProvider
32  *
33  * @since 3.2
34  */

35 public class RefactoringHistoryControlConfiguration {
36
37     /** Should the refactorings be checkable? */
38     protected final boolean fCheckable;
39
40     /** The project, or <code>null</code> for the workspace */
41     protected final IProject fProject;
42
43     /** Should time information be displayed? */
44     protected final boolean fTime;
45
46     /**
47      * Creates a new refactoring history control configuration.
48      *
49      * @param project
50      * the project, or <code>null</code> for the workspace
51      * @param time
52      * <code>true</code> to display time information,
53      * <code>false</code> otherwise
54      * @param checkable
55      * <code>true</code> if the refactorings should be checkable,
56      * <code>false</code> otherwise
57      */

58     public RefactoringHistoryControlConfiguration(final IProject project, final boolean time, final boolean checkable) {
59         fProject= project;
60         fTime= time;
61         fCheckable= checkable;
62     }
63
64     /**
65      * Returns the label of a collection of refactorings.
66      *
67      * @return the collection label
68      */

69     public String JavaDoc getCollectionLabel() {
70         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_collection_label;
71     }
72
73     /**
74      * Returns the text of the comment field below the refactoring history tree,
75      * if the currently selected refactoring descriptor provides no comment.
76      *
77      * @return the comment caption
78      */

79     public String JavaDoc getCommentCaption() {
80         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_comment_caption;
81     }
82
83     /**
84      * Returns the content provider to use.
85      *
86      * @return the content provider to use
87      */

88     public RefactoringHistoryContentProvider getContentProvider() {
89         return new RefactoringHistoryContentProvider(this);
90     }
91
92     /**
93      * Returns the message format pattern to use for days.
94      * <p>
95      * Arguments:
96      * <ul>
97      * <li> {0}: formatted date </li>
98      * </ul>
99      * </p>
100      *
101      * @return the day pattern
102      */

103     public String JavaDoc getDayPattern() {
104         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_day_pattern;
105     }
106
107     /**
108      * Returns the label provider to use.
109      *
110      * @return the label provider to use
111      */

112     public RefactoringHistoryLabelProvider getLabelProvider() {
113         return new RefactoringHistoryLabelProvider(this);
114     }
115
116     /**
117      * Returns the message format pattern to use for last month.
118      * <p>
119      * Arguments:
120      * <ul>
121      * <li> {0}: month name </li>
122      * </ul>
123      * </p>
124      *
125      * @return the last month pattern
126      */

127     public String JavaDoc getLastMonthPattern() {
128         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_last_month_label;
129     }
130
131     /**
132      * Returns the message format pattern to use for last week.
133      * <p>
134      * Arguments:
135      * <ul>
136      * <li> {0}: week number </li>
137      * </ul>
138      * </p>
139      *
140      * @return the last week pattern
141      */

142     public String JavaDoc getLastWeekPattern() {
143         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_last_week_label;
144     }
145
146     /**
147      * Returns the message format pattern to use for months.
148      * <p>
149      * Arguments:
150      * <ul>
151      * <li> {0}: month name </li>
152      * </ul>
153      * </p>
154      *
155      * @return the month pattern
156      */

157     public String JavaDoc getMonthPattern() {
158         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_month_pattern;
159     }
160
161     /**
162      * Returns the project of the refactoring history being displayed.
163      *
164      * @return the project, or <code>null</code> for the workspace
165      */

166     public final IProject getProject() {
167         return fProject;
168     }
169
170     /**
171      * Returns the message format pattern to use if refactorings of exactly one
172      * project are displayed.
173      * <p>
174      * Arguments:
175      * <ul>
176      * <li> {0}: name of project </li>
177      * </ul>
178      * </p>
179      *
180      * @return the project pattern
181      */

182     public String JavaDoc getProjectPattern() {
183         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_project_pattern;
184     }
185
186     /**
187      * Returns the message format pattern to use for refactorings.
188      * <p>
189      * Arguments:
190      * <ul>
191      * <li> {0}: formatted date </li>
192      * <li> {0}: description of refactoring</li>
193      * </ul>
194      * </p>
195      *
196      * @return the refactoring pattern
197      */

198     public String JavaDoc getRefactoringPattern() {
199         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_refactoring_pattern;
200     }
201
202     /**
203      * Returns the message format pattern to use for this month.
204      * <p>
205      * Arguments:
206      * <ul>
207      * <li> {0}: month name </li>
208      * </ul>
209      * </p>
210      *
211      * @return the this month pattern
212      */

213     public String JavaDoc getThisMonthPattern() {
214         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_this_month_pattern;
215     }
216
217     /**
218      * Returns the message format pattern to use for this week.
219      * <p>
220      * Arguments:
221      * <ul>
222      * <li> {0}: week number </li>
223      * </ul>
224      * </p>
225      *
226      * @return the this week pattern
227      */

228     public String JavaDoc getThisWeekPattern() {
229         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_this_week_pattern;
230     }
231
232     /**
233      * Returns the message format pattern to use for today.
234      * <p>
235      * Arguments:
236      * <ul>
237      * <li> {0}: formatted date </li>
238      * </ul>
239      * </p>
240      *
241      * @return the today pattern
242      */

243     public String JavaDoc getTodayPattern() {
244         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_today_pattern;
245     }
246
247     /**
248      * Returns the message format pattern to use for weeks.
249      * <p>
250      * Arguments:
251      * <ul>
252      * <li> {0}: week number </li>
253      * </ul>
254      * </p>
255      *
256      * @return the week pattern
257      */

258     public String JavaDoc getWeekPattern() {
259         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_week_pattern;
260     }
261
262     /**
263      * Returns the caption of the refactoring history tree if refactorings of
264      * more than one project are displayed.
265      *
266      * @return the workspace caption
267      */

268     public String JavaDoc getWorkspaceCaption() {
269         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_workspace_caption;
270     }
271
272     /**
273      * Returns the message format pattern to use for years.
274      * <p>
275      * Arguments:
276      * <ul>
277      * <li> {0}: year number </li>
278      * </ul>
279      * </p>
280      *
281      * @return the year pattern
282      */

283     public String JavaDoc getYearPattern() {
284         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_year_pattern;
285     }
286
287     /**
288      * Returns the message format pattern to use for yesterday.
289      * <p>
290      * Arguments:
291      * <ul>
292      * <li> {0}: formatted date </li>
293      * </ul>
294      * </p>
295      *
296      * @return the yesterday pattern
297      */

298     public String JavaDoc getYesterdayPattern() {
299         return RefactoringUIMessages.RefactoringHistoryControlConfiguration_yesterday_pattern;
300     }
301
302     /**
303      * Returns whether the control should make the refactorings checkable.
304      *
305      * @return <code>true</code> if the control should make refactorings
306      * checkable, <code>false</code> otherwise
307      */

308     public final boolean isCheckableViewer() {
309         return fCheckable;
310     }
311
312     /**
313      * Returns whether the control should display time information.
314      *
315      * @return <code>true</code> to display time information,
316      * <code>false</code> otherwise
317      */

318     public final boolean isTimeDisplayed() {
319         return fTime;
320     }
321 }
322
Popular Tags