KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > core > refactoring > RefactoringStatus


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.core.refactoring;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.Iterator JavaDoc;
15 import java.util.List JavaDoc;
16
17 import org.eclipse.core.runtime.Assert;
18 import org.eclipse.core.runtime.IProgressMonitor;
19 import org.eclipse.core.runtime.IStatus;
20
21 /**
22  * A <code>RefactoringStatus</code> object represents the outcome of a
23  * condition checking operation. It manages a list of <code>
24  * RefactoringStatusEntry</code> objects. Each <code>RefactoringStatusEntry
25  * </code> object describes one particular problem detected during
26  * condition checking.
27  * <p>
28  * Additionally a problem severity is managed. Severities are ordered as follows:
29  * <code>OK</code> &lt; <code>INFO</code> &lt; <code>WARNING</code> &lt; <code>
30  * ERROR</code> &lt; <code>FATAL</code>. The status's problem severity is the maximum
31  * of the severities of all entries. If the status doesn't have any entry the status's
32  * severity is <code>OK</code>.
33  * </p>
34  * <p>
35  * Note: this class is not intended to be extended by clients.
36  * </p>
37  *
38  * @see RefactoringStatusEntry
39  * @see Refactoring#checkAllConditions(IProgressMonitor)
40  *
41  * @since 3.0
42  */

43 public class RefactoringStatus {
44
45     /**
46      * Status severity constant (value 0) indicating this status represents the nominal case.
47      */

48     public static final int OK= 0;
49
50     /**
51      * Status severity constant (value 1) indicating this status is informational only.
52      */

53     public static final int INFO= 1;
54
55     /**
56      * Status severity constant (value 2) indicating this status represents a warning.
57      */

58     public static final int WARNING= 2;
59
60     /**
61      * Status severity constant (value 3) indicating this status represents an error.
62      */

63     public static final int ERROR= 3;
64
65     /**
66      * Status severity constant (value 4) indicating this status represents a fatal error.
67      * This is used when the refactoring can't be executed.
68      */

69     public static final int FATAL= 4;
70
71     /**
72      * List of refactoring status entries.
73      */

74     private List JavaDoc fEntries;
75
76     /**
77      * The status's severity. The following invariant holds for
78      * <code>fSeverity</code>: <code>OK</code> &le; fSeverity &le;
79      * <code>FATAL</code>.
80      */

81     private int fSeverity= OK;
82
83     /**
84      * Creates a new refactoring status with an empty list of
85      * status entries and a severity of <code>OK</code>.
86      */

87     public RefactoringStatus() {
88         fEntries= new ArrayList JavaDoc(0);
89     }
90     
91     /**
92      * Returns the severity.
93      *
94      * @return the severity.
95      */

96     public int getSeverity() {
97         return fSeverity;
98     }
99
100     /**
101      * Returns the list of refactoring status entries.
102      *
103      * @return the list of refactoring status entries. Returns an empty array
104      * if no entries are managed.
105      */

106     public RefactoringStatusEntry[] getEntries() {
107         return (RefactoringStatusEntry[])fEntries.toArray(new RefactoringStatusEntry[fEntries.size()]);
108     }
109     
110     /**
111      * Returns a list of refactoring status entries which are considered equal
112      * to the specified status entry.
113      *
114      * @param comparator the comparator to determine whether two status entries
115      * are considered equal
116      * @param entry the refactoring status entry to compare the entries of this
117      * status with
118      * @return the list of refactoring status entries that are considered equal
119      * to the specified one, in no particular order. Returns an empty
120      * array if no entries are managed or none of them matches.
121      *
122      * @since 3.1
123      */

124     public RefactoringStatusEntry[] getEntries(IRefactoringStatusEntryComparator comparator, RefactoringStatusEntry entry) {
125         final List JavaDoc matches= new ArrayList JavaDoc(fEntries.size());
126         RefactoringStatusEntry current= null;
127         for (Iterator JavaDoc iterator= fEntries.iterator(); iterator.hasNext();) {
128             current= (RefactoringStatusEntry) iterator.next();
129             if (comparator.compare(current, entry) == 0)
130                 matches.add(current);
131         }
132         return (RefactoringStatusEntry[]) matches.toArray(new RefactoringStatusEntry[matches.size()]);
133     }
134
135     /**
136      * Returns whether the status has entries or not.
137      *
138      * @return <code>true</code> if the status as any entries; otherwise
139      * <code>false</code> is returned.
140      */

141     public boolean hasEntries() {
142         return !fEntries.isEmpty();
143     }
144
145     /**
146      * Returns the <code>RefactoringStatusEntry</code> at the specified index.
147      *
148      * @param index the index of the entry to return
149      * @return the entry at the specified index
150      *
151      * @throws IndexOutOfBoundsException if the index is out of range
152      */

153     public RefactoringStatusEntry getEntryAt(int index) {
154         return (RefactoringStatusEntry)fEntries.get(index);
155     }
156
157     /**
158      * Returns the first entry managed by this refactoring status that
159      * matches the given plug-in identifier and code. If more than one
160      * entry exists that matches the criteria the first one in the list
161      * of entries is returned. Returns <code>null</code> if no entry
162      * matches.
163      *
164      * @param pluginId the entry's plug-in identifier
165      * @param code the entry's code
166      * @return the entry that matches the given plug-in identifier and
167      * code; <code>null</code> otherwise
168      */

169     public RefactoringStatusEntry getEntryMatchingCode(String JavaDoc pluginId, int code) {
170         Assert.isTrue(pluginId != null);
171         for (Iterator JavaDoc iter= fEntries.iterator(); iter.hasNext(); ) {
172             RefactoringStatusEntry entry= (RefactoringStatusEntry)iter.next();
173             if (pluginId.equals(entry.getPluginId()) && entry.getCode() == code)
174                 return entry;
175         }
176         return null;
177     }
178
179     /**
180      * Returns the first entry which severity is equal or greater than the
181      * given severity. If more than one entry exists that matches the
182      * criteria the first one is returned. Returns <code>null</code> if no
183      * entry matches.
184      *
185      * @param severity the severity to search for. Must be one of <code>FATAL
186      * </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>
187      * @return the entry that matches the search criteria
188      */

189     public RefactoringStatusEntry getEntryMatchingSeverity(int severity) {
190         Assert.isTrue(severity >= OK && severity <= FATAL);
191         if (severity > fSeverity)
192             return null;
193         Iterator JavaDoc iter= fEntries.iterator();
194         while (iter.hasNext()) {
195             RefactoringStatusEntry entry= (RefactoringStatusEntry)iter.next();
196             if (entry.getSeverity() >= severity)
197                 return entry;
198         }
199         return null;
200     }
201     
202     /**
203      * Returns the entry with the highest severity. If there is more than one
204      * entry that matches the first one found in the list of entries is returned.
205      *
206      * @return the entry with the highest severity or <code>null</code> if no
207      * entries are present
208      *
209      * @since 3.1
210      */

211     public RefactoringStatusEntry getEntryWithHighestSeverity() {
212         if (fEntries == null || fEntries.size() == 0)
213             return null;
214         RefactoringStatusEntry result= (RefactoringStatusEntry)fEntries.get(0);
215         for (int i= 1; i < fEntries.size(); i++) {
216             RefactoringStatusEntry entry= (RefactoringStatusEntry)fEntries.get(i);
217             if (result.getSeverity() < entry.getSeverity())
218                 result= entry;
219         }
220         return result;
221     }
222
223     /**
224      * Returns the first message which severity is equal or greater than the
225      * given severity. If more than one entry exists that matches the criteria
226      * the first one is returned. Returns <code>null</code> if no entry matches.
227      *
228      * @param severity the severity to search for. Must be one of <code>FATAL
229      * </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>
230      * @return the message of the entry that matches the search criteria
231      */

232     public String JavaDoc getMessageMatchingSeverity(int severity) {
233         RefactoringStatusEntry entry= getEntryMatchingSeverity(severity);
234         if (entry == null)
235             return null;
236         return entry.getMessage();
237     }
238
239     /**
240      * Creates a new <code>RefactoringStatus</code> with one entry filled with the given
241      * arguments.
242      *
243      * @param severity the severity
244      * @param msg the message
245      * @param context the context. Can be <code>null</code>
246      * @param pluginId the plug-in identifier. Can be <code>null</code> if argument <code>
247      * code</code> equals <code>NO_CODE</code>
248      * @param code the problem code. Must be either <code>NO_CODE</code> or a positive integer
249      * @param data application specific data
250      *
251      * @return the newly created refactoring status
252      *
253      * @see RefactoringStatusEntry
254      */

255     public static RefactoringStatus createStatus(int severity, String JavaDoc msg, RefactoringStatusContext context, String JavaDoc pluginId, int code, Object JavaDoc data) {
256         RefactoringStatus result= new RefactoringStatus();
257         result.fEntries.add(new RefactoringStatusEntry(severity, msg, context, pluginId, code, data));
258         result.fSeverity= severity;
259         return result;
260     }
261
262     /**
263      * Creates a new <code>RefactoringStatus</code> with one <code>INFO</code> entry
264      * filled with the given message.
265      *
266      * @param msg the message of the info entry
267      * @return the refactoring status
268      *
269      * @see RefactoringStatusEntry
270      */

271     public static RefactoringStatus createInfoStatus(String JavaDoc msg) {
272         return createStatus(INFO, msg, null, null, RefactoringStatusEntry.NO_CODE, null);
273     }
274
275     /**
276      * Creates a new <code>RefactoringStatus</code> with one <code>INFO</code> entry
277      * filled with the given message and context.
278      *
279      * @param msg the message of the info entry
280      * @param context the context of the info entry
281      * @return the refactoring status
282      *
283      * @see RefactoringStatusEntry
284      */

285     public static RefactoringStatus createInfoStatus(String JavaDoc msg, RefactoringStatusContext context) {
286         return createStatus(INFO, msg, context, null, RefactoringStatusEntry.NO_CODE, null);
287     }
288
289     /**
290      * Creates a new <code>RefactoringStatus</code> with one <code>WARNING</code> entry
291      * filled with the given message.
292      *
293      * @param msg the message of the warning entry
294      * @return the refactoring status
295      *
296      * @see RefactoringStatusEntry
297      */

298     public static RefactoringStatus createWarningStatus(String JavaDoc msg) {
299         return createStatus(WARNING, msg, null, null, RefactoringStatusEntry.NO_CODE, null);
300     }
301
302     /**
303      * Creates a <code>RefactoringStatus</code> with one <code>WARNING</code> entry
304      * fill with the given message and context.
305      *
306      * @param msg the message of the warning entry
307      * @param context the context of the warning entry
308      * @return the refactoring status
309      *
310      * @see RefactoringStatusEntry
311      */

312     public static RefactoringStatus createWarningStatus(String JavaDoc msg, RefactoringStatusContext context) {
313         return createStatus(WARNING, msg, context, null, RefactoringStatusEntry.NO_CODE, null);
314     }
315
316     /**
317      * Creates a new <code>RefactoringStatus</code> with one <code>ERROR</code> entry
318      * filled with the given message.
319      *
320      * @param msg the message of the error entry
321      * @return the refactoring status
322      *
323      * @see RefactoringStatusEntry
324      */

325     public static RefactoringStatus createErrorStatus(String JavaDoc msg) {
326         return createStatus(ERROR, msg, null, null, RefactoringStatusEntry.NO_CODE, null);
327     }
328
329     /**
330      * Creates a <code>RefactoringStatus</code> with one <code>ERROR</code> entry
331      * fill with the given message and context.
332      *
333      * @param msg the message of the error entry
334      * @param context the context of the error entry
335      * @return the refactoring status
336      *
337      * @see RefactoringStatusEntry
338      */

339     public static RefactoringStatus createErrorStatus(String JavaDoc msg, RefactoringStatusContext context) {
340         return createStatus(ERROR, msg, context, null, RefactoringStatusEntry.NO_CODE, null);
341     }
342
343     /**
344      * Creates a new <code>RefactoringStatus</code> with one <code>FATAL</code> entry
345      * filled with the given message.
346      *
347      * @param msg the message of the fatal entry
348      * @return the refactoring status
349      *
350      * @see RefactoringStatusEntry
351      */

352     public static RefactoringStatus createFatalErrorStatus(String JavaDoc msg) {
353         return createStatus(FATAL, msg, null, null, RefactoringStatusEntry.NO_CODE, null);
354     }
355
356     /**
357      * Creates a <code>RefactoringStatus</code> with one <code>FATAL</code> entry
358      * fill with the given message and context.
359      *
360      * @param msg the message of the fatal entry
361      * @param context the context of the fatal entry
362      * @return the refactoring status
363      *
364      * @see RefactoringStatusEntry
365      */

366     public static RefactoringStatus createFatalErrorStatus(String JavaDoc msg, RefactoringStatusContext context) {
367         return createStatus(FATAL, msg, context, null, RefactoringStatusEntry.NO_CODE, null);
368     }
369
370     /**
371      * Creates a new <code>RefactoringStatus</code> from the given <code>IStatus</code>. An
372      * OK status is mapped to an OK refactoring status, an information status is mapped
373      * to a warning refactoring status, a warning status is mapped to an error refactoring
374      * status and an error or cancel status is mapped to a fatal refactoring status. An unknown
375      * status is converted into a fatal error status as well. If the status is a <code>MultiStatus
376      * </code> then the first level of children of the status will be added as refactoring status
377      * entries to the created refactoring status.
378      *
379      * @param status the status to create a refactoring status from
380      * @return the refactoring status
381      *
382      * @see IStatus
383      * @since 3.2
384      */

385     public static RefactoringStatus create(IStatus status) {
386         if (status.isOK())
387             return new RefactoringStatus();
388
389         if (!status.isMultiStatus()) {
390             switch (status.getSeverity()) {
391                 case IStatus.OK :
392                     return new RefactoringStatus();
393                 case IStatus.INFO :
394                     return RefactoringStatus.createWarningStatus(status.getMessage());
395                 case IStatus.WARNING :
396                     return RefactoringStatus.createErrorStatus(status.getMessage());
397                 case IStatus.ERROR :
398                     return RefactoringStatus.createFatalErrorStatus(status.getMessage());
399                 case IStatus.CANCEL :
400                     return RefactoringStatus.createFatalErrorStatus(status.getMessage());
401                 default :
402                     return RefactoringStatus.createFatalErrorStatus(status.getMessage());
403             }
404         } else {
405             IStatus[] children= status.getChildren();
406             RefactoringStatus result= new RefactoringStatus();
407             for (int i= 0; i < children.length; i++) {
408                 result.merge(RefactoringStatus.create(children[i]));
409             }
410             return result;
411         }
412     }
413
414     /**
415      * Merges the receiver and the parameter statuses. The resulting list of
416      * entries in the receiver will contain entries from both. The resulting
417      * severity in the receiver will be the more severe of its current severity
418      * and the parameter's severity. Merging with <code>null</code> is
419      * allowed - it has no effect.
420      *
421      * @param other the refactoring status to merge with
422      */

423     public void merge(RefactoringStatus other) {
424         if (other == null)
425             return;
426         fEntries.addAll(other.fEntries);
427         fSeverity= Math.max(fSeverity, other.getSeverity());
428     }
429
430     /**
431      * Adds an <code>INFO</code> entry filled with the given message to this status.
432      * If the current severity is <code>OK</code> it will be changed to <code>INFO
433      * </code>. It will remain unchanged otherwise.
434      *
435      * @param msg the message of the info entry
436      *
437      * @see RefactoringStatusEntry
438      */

439     public void addInfo(String JavaDoc msg) {
440         addInfo(msg, null);
441     }
442
443     /**
444      * Adds an <code>INFO</code> entry filled with the given message and context to
445      * this status. If the current severity is <code>OK</code> it will be changed to
446      * <code>INFO</code>. It will remain unchanged otherwise.
447      *
448      * @param msg the message of the info entry
449      * @param context the context of the info entry
450      *
451      * @see RefactoringStatusEntry
452      */

453     public void addInfo(String JavaDoc msg, RefactoringStatusContext context) {
454         fEntries.add(new RefactoringStatusEntry(RefactoringStatus.INFO, msg, context));
455         fSeverity= Math.max(fSeverity, INFO);
456     }
457
458     /**
459      * Adds a <code>WARNING</code> entry filled with the given message to this status.
460      * If the current severity is <code>OK</code> or <code>INFO</code> it will be
461      * changed to <code>WARNING</code>. It will remain unchanged otherwise.
462      *
463      * @param msg the message of the warning entry
464      *
465      * @see RefactoringStatusEntry
466      */

467     public void addWarning(String JavaDoc msg) {
468         addWarning(msg, null);
469     }
470
471     /**
472      * Adds a <code>WARNING</code> entry filled with the given message and context to
473      * this status. If the current severity is <code>OK</code> or <code>INFO</code> it
474      * will be changed to <code>WARNING</code>. It will remain unchanged otherwise.
475      *
476      * @param msg the message of the warning entry
477      * @param context the context of the warning entry
478      *
479      * @see RefactoringStatusEntry
480      */

481     public void addWarning(String JavaDoc msg, RefactoringStatusContext context) {
482         fEntries.add(new RefactoringStatusEntry(RefactoringStatus.WARNING, msg, context));
483         fSeverity= Math.max(fSeverity, WARNING);
484     }
485
486     /**
487      * Adds an <code>ERROR</code> entry filled with the given message to this status.
488      * If the current severity is <code>OK</code>, <code>INFO</code> or <code>WARNING
489      * </code> it will be changed to <code>ERROR</code>. It will remain unchanged
490      * otherwise.
491      *
492      * @param msg the message of the error entry
493      *
494      * @see RefactoringStatusEntry
495      */

496     public void addError(String JavaDoc msg) {
497         addError(msg, null);
498     }
499
500     /**
501      * Adds an <code>ERROR</code> entry filled with the given message and context to
502      * this status. If the current severity is <code>OK</code>, <code>INFO</code> or
503      * <code>WARNING</code> it will be changed to <code>ERROR</code>. It will remain
504      * unchanged otherwise.
505      *
506      * @param msg the message of the error entry
507      * @param context the context of the error entry
508      *
509      * @see RefactoringStatusEntry
510      */

511     public void addError(String JavaDoc msg, RefactoringStatusContext context) {
512         fEntries.add(new RefactoringStatusEntry(RefactoringStatus.ERROR, msg, context));
513         fSeverity= Math.max(fSeverity, ERROR);
514     }
515
516     /**
517      * Adds a <code>FATAL</code> entry filled with the given message to this status.
518      * The severity of this status will changed to <code>FATAL</code>.
519      *
520      * @param msg the message of the fatal entry
521      *
522      * @see RefactoringStatusEntry
523      */

524     public void addFatalError(String JavaDoc msg) {
525         addFatalError(msg, null);
526     }
527
528     /**
529      * Adds a <code>FATAL</code> entry filled with the given message and status to
530      * this status. The severity of this status will changed to <code>FATAL</code>.
531      *
532      * @param msg the message of the fatal entry
533      * @param context the context of the fatal entry
534      *
535      * @see RefactoringStatusEntry
536      */

537     public void addFatalError(String JavaDoc msg, RefactoringStatusContext context) {
538         fEntries.add(new RefactoringStatusEntry(RefactoringStatus.FATAL, msg, context));
539         fSeverity= Math.max(fSeverity, FATAL);
540     }
541
542     /**
543      * Adds a new entry filled with the given arguments to this status. The severity
544      * of this status is set to the maximum of <code>fSeverity</code> and
545      * <code>severity</code>.
546      *
547      * @param severity the severity of the entry
548      * @param msg the message of the entry
549      * @param context the context of the entry. Can be <code>null</code>
550      * @param pluginId the plug-in identifier of the entry. Can be <code>null</code> if
551      * argument <code>code</code> equals <code>NO_CODE</code>
552      * @param code the problem code of the entry. Must be either <code>NO_CODE</code>
553      * or a positive integer
554      */

555     public void addEntry(int severity, String JavaDoc msg, RefactoringStatusContext context, String JavaDoc pluginId, int code) {
556         fEntries.add(new RefactoringStatusEntry(severity, msg, context, pluginId, code));
557         fSeverity= Math.max(fSeverity, severity);
558     }
559
560     /**
561      * Adds a new entry filled with the given arguments to this status. The severity
562      * of this status is set to the maximum of <code>fSeverity</code> and
563      * <code>severity</code>.
564      *
565      * @param severity the severity of the entry
566      * @param msg the message of the entry
567      * @param context the context of the entry. Can be <code>null</code>
568      * @param pluginId the plug-in identifier of the entry. Can be <code>null</code> if
569      * argument <code>code</code> equals <code>NO_CODE</code>
570      * @param code the problem code of the entry. Must be either <code>NO_CODE</code>
571      * or a positive integer
572      * @param data application specific data of the entry
573      */

574     public void addEntry(int severity, String JavaDoc msg, RefactoringStatusContext context, String JavaDoc pluginId, int code, Object JavaDoc data) {
575         fEntries.add(new RefactoringStatusEntry(severity, msg, context, pluginId, code, data));
576         fSeverity= Math.max(fSeverity, severity);
577     }
578
579     /**
580      * Adds the given <code>RefactoringStatusEntry</code>. The severity of this
581      * status is set to the maximum of <code>fSeverity</code> and the severity of
582      * the entry.
583      *
584      * @param entry the <code>RefactoringStatusEntry</code> to be added
585      */

586     public void addEntry(RefactoringStatusEntry entry) {
587         Assert.isNotNull(entry);
588         fEntries.add(entry);
589         fSeverity= Math.max(fSeverity, entry.getSeverity());
590     }
591
592     /**
593      * Returns whether the status's severity is <code>OK</code> or not.
594      *
595      * @return <code>true</code> if the severity is <code>OK</code>;
596      * otherwise <code>false</code> is returned
597      */

598     public boolean isOK() {
599         return fSeverity == OK;
600     }
601
602     /**
603      * Returns <code>true</code> if the current severity is <code>
604      * FATAL</code>.
605      *
606      * @return <code>true</code> if the current severity is <code>
607      * FATAL</code>; otherwise <code>false</code> is returned
608      */

609     public boolean hasFatalError() {
610         return fSeverity == FATAL;
611     }
612
613     /**
614      * Returns <code>true</code> if the current severity is <code>
615      * FATAL</code> or <code>ERROR</code>.
616      *
617      * @return <code>true</code> if the current severity is <code>
618      * FATAL</code> or <code>ERROR</code>; otherwise <code>false
619      * </code> is returned
620      */

621     public boolean hasError() {
622         return fSeverity == FATAL || fSeverity == ERROR;
623     }
624
625     /**
626      * Returns <code>true</code> if the current severity is <code>
627      * FATAL</code>, <code>ERROR</code> or <code>WARNING</code>.
628      *
629      * @return <code>true</code> if the current severity is <code>
630      * FATAL</code>, <code>ERROR</code> or <code>WARNING</code>;
631      * otherwise <code>false</code> is returned
632      */

633     public boolean hasWarning() {
634         return fSeverity == FATAL || fSeverity == ERROR || fSeverity == WARNING;
635     }
636
637     /**
638      * Returns <code>true</code> if the current severity is <code>
639      * FATAL</code>, <code>ERROR</code>, <code>WARNING</code> or
640      * <code>INFO</code>.
641      *
642      * @return <code>true</code> if the current severity is <code>
643      * FATAL</code>, <code>ERROR</code>, <code>WARNING</code> or
644      * <code>INFO</code>; otherwise <code>false</code> is returned
645      */

646     public boolean hasInfo() {
647         return fSeverity == FATAL || fSeverity == ERROR || fSeverity == WARNING || fSeverity == INFO;
648     }
649
650     /*
651      * (non java-doc)
652      * for debugging only
653      */

654     public String JavaDoc toString() {
655         StringBuffer JavaDoc buff= new StringBuffer JavaDoc();
656         buff.append("<") //$NON-NLS-1$
657
.append(getSeverityString(fSeverity)).append("\n"); //$NON-NLS-1$
658
if (!isOK()) {
659             for (Iterator JavaDoc iter= fEntries.iterator(); iter.hasNext(); ) {
660                 buff.append("\t") //$NON-NLS-1$
661
.append(iter.next()).append("\n"); //$NON-NLS-1$
662
}
663         }
664         buff.append(">"); //$NON-NLS-1$
665
return buff.toString();
666     }
667     
668     /*
669      * non java-doc
670      * for debugging only not for nls
671      */

672     /* package */static String JavaDoc getSeverityString(int severity) {
673         Assert.isTrue(severity >= OK && severity <= FATAL);
674         if (severity == RefactoringStatus.OK)
675             return "OK"; //$NON-NLS-1$
676
if (severity == RefactoringStatus.INFO)
677             return "INFO"; //$NON-NLS-1$
678
if (severity == RefactoringStatus.WARNING)
679             return "WARNING"; //$NON-NLS-1$
680
if (severity == RefactoringStatus.ERROR)
681             return "ERROR"; //$NON-NLS-1$
682
if (severity == RefactoringStatus.FATAL)
683             return "FATALERROR"; //$NON-NLS-1$
684
return null;
685     }
686 }
687
Popular Tags