KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > views > markers > internal > FieldId


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
12 package org.eclipse.ui.views.markers.internal;
13
14 import org.eclipse.swt.graphics.Image;
15
16 /**
17  * FieldId is the field for marker id.
18  *
19  */

20 public class FieldId implements IField {
21
22     private String JavaDoc description;
23
24     private Image image;
25
26     /**
27      * Create a new instance of the receiver.
28      */

29     public FieldId() {
30         description = MarkerMessages.description_markerId;
31     }
32
33     /*
34      * (non-Javadoc)
35      * @see org.eclipse.ui.views.markers.internal.IField#getDescription()
36      */

37     public String JavaDoc getDescription() {
38         return description;
39     }
40
41     /*
42      * (non-Javadoc)
43      * @see org.eclipse.ui.views.markers.internal.IField#getDescriptionImage()
44      */

45     public Image getDescriptionImage() {
46         return image;
47     }
48
49     /*
50      * (non-Javadoc)
51      * @see org.eclipse.ui.views.markers.internal.IField#getColumnHeaderText()
52      */

53     public String JavaDoc getColumnHeaderText() {
54         return description;
55     }
56
57     /*
58      * (non-Javadoc)
59      * @see org.eclipse.ui.views.markers.internal.IField#getColumnHeaderImage()
60      */

61     public Image getColumnHeaderImage() {
62         return image;
63     }
64
65     /*
66      * (non-Javadoc)
67      * @see org.eclipse.ui.views.markers.internal.IField#getValue(java.lang.Object)
68      */

69     public String JavaDoc getValue(Object JavaDoc obj) {
70         if (obj == null || !(obj instanceof ConcreteMarker)) {
71             return ""; //$NON-NLS-1$
72
}
73         ConcreteMarker marker = (ConcreteMarker) obj;
74         return "" + marker.getId(); //$NON-NLS-1$
75
}
76
77     /*
78      * (non-Javadoc)
79      * @see org.eclipse.ui.views.markers.internal.IField#getImage(java.lang.Object)
80      */

81     public Image getImage(Object JavaDoc obj) {
82         return null;
83     }
84
85     /*
86      * (non-Javadoc)
87      * @see org.eclipse.ui.views.markers.internal.IField#compare(java.lang.Object, java.lang.Object)
88      */

89     public int compare(Object JavaDoc obj1, Object JavaDoc obj2) {
90         if (obj1 == null || obj2 == null || !(obj1 instanceof ConcreteMarker)
91                 || !(obj2 instanceof ConcreteMarker)) {
92             return 0;
93         }
94
95         ConcreteMarker marker1 = (ConcreteMarker) obj1;
96         ConcreteMarker marker2 = (ConcreteMarker) obj2;
97         return (int)(marker1.getId() - marker2.getId());
98     }
99
100     /* (non-Javadoc)
101      * @see org.eclipse.ui.views.markers.internal.IField#getDefaultDirection()
102      */

103     public int getDefaultDirection() {
104         return TableComparator.ASCENDING;
105     }
106
107     /* (non-Javadoc)
108      * @see org.eclipse.ui.views.markers.internal.IField#getPreferredWidth()
109      */

110     public int getPreferredWidth() {
111         return 0;
112     }
113     
114     /* (non-Javadoc)
115      * @see org.eclipse.ui.views.markers.internal.IField#isShowing()
116      */

117     public boolean isShowing() {
118         // Never show id
119
return false;
120     }
121     
122     /* (non-Javadoc)
123      * @see org.eclipse.ui.views.markers.internal.IField#setShowing(boolean)
124      */

125     public void setShowing(boolean showing) {
126         // Ignore
127

128     }
129 }
130
Popular Tags