/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. */
  16. package com.google.test.metric.eclipse.ui.markers;
  17. import com.google.test.metric.eclipse.internal.util.Logger;
  18. import com.google.test.metric.eclipse.ui.plugin.Activator;
  19. import com.google.test.metric.eclipse.ui.plugin.ImageNotFoundException;
  20. import org.eclipse.core.resources.IMarker;
  21. import org.eclipse.jface.viewers.ViewerCell;
  22. import org.eclipse.swt.widgets.Control;
  23. import org.eclipse.ui.views.markers.MarkerField;
  24. import org.eclipse.ui.views.markers.MarkerItem;
  25. /**
  26. * Description column in Testability View.
  27. *
  28. * @author shyamseshadri@google.com (Shyam Seshadri)
  29. */
  30. public class TestabilityDescriptionMarkerField extends MarkerField {
  31. private Logger logger = new Logger();
  32. public TestabilityDescriptionMarkerField() {
  33. }
  34. @Override
  35. public int getDefaultColumnWidth(Control control) {
  36. return 350;
  37. }
  38. @Override
  39. public String getValue(MarkerItem item) {
  40. return item.getAttributeValue(IMarker.MESSAGE, "");
  41. }
  42. @Override
  43. public void update(ViewerCell cell) {
  44. super.update(cell);
  45. try {
  46. // TODO(shyamseshadri): Check Item Type and assign image accordingly.
  47. cell.setImage(Activator.getDefault().getImage("icons/TE.jpg"));
  48. } catch (ImageNotFoundException e) {
  49. logger.logException(e);
  50. }
  51. }
  52. }