KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Folder field. Designed to display and compare the names of the folders that contain
18  * IMarker objects.
19  */

20 public class FieldFolder extends AbstractField {
21
22     /**
23      * Create a new instance of the receiver.
24      */

25     public FieldFolder() {
26     }
27
28     /*
29      * (non-Javadoc)
30      * @see org.eclipse.ui.views.markers.internal.IField#getDescription()
31      */

32     public String JavaDoc getDescription() {
33         return MarkerMessages.description_folder;
34     }
35
36     /*
37      * (non-Javadoc)
38      * @see org.eclipse.ui.views.markers.internal.IField#getDescriptionImage()
39      */

40     public Image getDescriptionImage() {
41         return null;
42     }
43
44     /*
45      * (non-Javadoc)
46      * @see org.eclipse.ui.views.markers.internal.IField#getColumnHeaderText()
47      */

48     public String JavaDoc getColumnHeaderText() {
49         return MarkerMessages.description_folder;
50     }
51
52     /*
53      * (non-Javadoc)
54      * @see org.eclipse.ui.views.markers.internal.IField#getColumnHeaderImage()
55      */

56     public Image getColumnHeaderImage() {
57         return null;
58     }
59
60     /*
61      * (non-Javadoc)
62      * @see org.eclipse.ui.views.markers.internal.IField#getValue(java.lang.Object)
63      */

64     public String JavaDoc getValue(Object JavaDoc obj) {
65         if (obj == null || !(obj instanceof ConcreteMarker)) {
66             return Util.EMPTY_STRING;
67         }
68         ConcreteMarker marker = (ConcreteMarker) obj;
69         return marker.getFolder();
70     }
71
72     /*
73      * (non-Javadoc)
74      * @see org.eclipse.ui.views.markers.internal.IField#getImage(java.lang.Object)
75      */

76     public Image getImage(Object JavaDoc obj) {
77         return null;
78     }
79
80     /*
81      * (non-Javadoc)
82      * @see org.eclipse.ui.views.markers.internal.IField#compare(java.lang.Object, java.lang.Object)
83      */

84     public int compare(Object JavaDoc obj1, Object JavaDoc obj2) {
85         if (obj1 == null || obj2 == null || !(obj1 instanceof ConcreteMarker)
86                 || !(obj2 instanceof ConcreteMarker)) {
87             return 0;
88         }
89         ConcreteMarker marker1 = (ConcreteMarker) obj1;
90         ConcreteMarker marker2 = (ConcreteMarker) obj2;
91
92         return marker1.getFolder().compareTo(marker2.getFolder());
93     }
94
95     /* (non-Javadoc)
96      * @see org.eclipse.ui.views.markers.internal.IField#getDefaultDirection()
97      */

98     public int getDefaultDirection() {
99         return TableComparator.ASCENDING;
100     }
101     
102     /* (non-Javadoc)
103      * @see org.eclipse.ui.views.markers.internal.IField#getPreferredWidth()
104      */

105     public int getPreferredWidth() {
106         return 150;
107     }
108
109 }
110
Popular Tags