KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > DetailFormatter


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.jdt.internal.debug.ui;
12
13
14 /**
15  * Information about a detail formatter.
16  */

17 public class DetailFormatter implements Comparable JavaDoc {
18     
19     private boolean fEnabled;
20     
21     private String JavaDoc fTypeName;
22     
23     private String JavaDoc fSnippet;
24     
25     public DetailFormatter(String JavaDoc typeName, String JavaDoc snippet, boolean enabled) {
26         fTypeName= typeName;
27         fSnippet= snippet;
28         fEnabled= enabled;
29     }
30     
31     /**
32      * Indicate if this pretty should be used or not.
33      * @return boolean
34      */

35     public boolean isEnabled() {
36         return fEnabled;
37     }
38
39     /**
40      * Returns the code snippet.
41      * @return String
42      */

43     public String JavaDoc getSnippet() {
44         return fSnippet;
45     }
46
47     /**
48      * Returns the type name.
49      * @return String
50      */

51     public String JavaDoc getTypeName() {
52         return fTypeName;
53     }
54
55     /**
56      * Sets the enabled flag.
57      * @param enabled the new value of the flag
58      */

59     public void setEnabled(boolean enabled) {
60         fEnabled= enabled;
61     }
62
63     /**
64      * Sets the code snippet.
65      * @param snippet the snippet to set
66      */

67     public void setSnippet(String JavaDoc snippet) {
68         fSnippet= snippet;
69     }
70
71     /**
72      * Sets the type name.
73      * @param typeName the type name to set
74      */

75     public void setTypeName(String JavaDoc typeName) {
76         fTypeName= typeName;
77     }
78
79     /**
80      * @see java.lang.Comparable#compareTo(java.lang.Object)
81      */

82     public int compareTo(Object JavaDoc another) {
83         DetailFormatter detailFormatter= (DetailFormatter)another;
84         if (fTypeName == null) {
85             if (detailFormatter.fTypeName == null) {
86                 return 0;
87             }
88             return detailFormatter.fTypeName.compareTo(fTypeName);
89         }
90         return fTypeName.compareTo(detailFormatter.fTypeName);
91     }
92
93 }
94
Popular Tags