PageRenderTime 28ms CodeModel.GetById 20ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/eclipse-plugin/plugins/com.google.test.metric.eclipse.ui/src/main/java/com/google/test/metric/eclipse/ui/markers/TestabilityDescriptionMarkerField.java

http://testability-explorer.googlecode.com/
Java | 61 lines | 31 code | 9 blank | 21 comment | 0 complexity | e1e456ce0b69f28c6cccc7eb8f5f720b MD5 | raw file
 1/*
 2 * Copyright 2009 Google Inc.
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 5 * use this file except in compliance with the License. You may obtain a copy of
 6 * the License at
 7 *
 8 * http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16package com.google.test.metric.eclipse.ui.markers;
17
18import com.google.test.metric.eclipse.internal.util.Logger;
19import com.google.test.metric.eclipse.ui.plugin.Activator;
20import com.google.test.metric.eclipse.ui.plugin.ImageNotFoundException;
21
22import org.eclipse.core.resources.IMarker;
23import org.eclipse.jface.viewers.ViewerCell;
24import org.eclipse.swt.widgets.Control;
25import org.eclipse.ui.views.markers.MarkerField;
26import org.eclipse.ui.views.markers.MarkerItem;
27
28/**
29 * Description column in Testability View.
30 * 
31 * @author shyamseshadri@google.com (Shyam Seshadri)
32 */
33public class TestabilityDescriptionMarkerField extends MarkerField {
34
35  private Logger logger = new Logger();
36
37  public TestabilityDescriptionMarkerField() {
38  }
39
40  @Override
41  public int getDefaultColumnWidth(Control control) {
42    return 350;
43  }
44
45  @Override
46  public String getValue(MarkerItem item) {
47    return item.getAttributeValue(IMarker.MESSAGE, "");
48  }
49
50  @Override
51  public void update(ViewerCell cell) {
52    super.update(cell);
53    
54    try {
55      // TODO(shyamseshadri): Check Item Type and assign image accordingly.
56      cell.setImage(Activator.getDefault().getImage("icons/TE.jpg"));
57    } catch (ImageNotFoundException e) {
58      logger.logException(e);
59    }
60  }
61}