Example #1
0
 private void updateTitleImage() {
   if (task != null) {
     AbstractRepositoryConnectorUi connectorUi =
         TasksUiPlugin.getConnectorUi(task.getConnectorKind());
     if (connectorUi != null) {
       ImageDescriptor overlayDescriptor = connectorUi.getTaskKindOverlay(task);
       setTitleImage(
           CommonImages.getCompositeTaskImage(TasksUiImages.TASK, overlayDescriptor, false));
     } else {
       setTitleImage(CommonImages.getImage(TasksUiImages.TASK));
     }
     //		} else if (getEditorInput() instanceof AbstractRepositoryTaskEditorInput) {
     //			setTitleImage(CommonImages.getImage(TasksUiImages.TASK_REMOTE));
   } else {
     setTitleImage(CommonImages.getImage(TasksUiImages.TASK));
   }
 }
  @Override
  public Image getImage(Object element) {
    ImageDescriptor descriptor = null;
    ImageDescriptor bottomLeftDecoration = null;
    ImageDescriptor bottomRightDecoration = null;
    ImageDescriptor topRightDecoration = null;

    // bottom left decoration
    if (element instanceof IBuildElement) {
      bottomLeftDecoration = getBottomLeftDecoration((IBuildElement) element);
    }

    // main image
    if (element instanceof IBuildServer) {
      if (((IBuildServer) element).getLocation().isOffline()) {
        descriptor = BuildImages.SERVER_DISABLED;
      } else {
        descriptor = BuildImages.SERVER;
      }
    } else if (element instanceof IBuildPlan) {
      descriptor = getImageDescriptor(((IBuildPlan) element).getStatus());
      bottomRightDecoration = getBottomRightDecoration(((IBuildPlan) element).getState());
      topRightDecoration = getTopRightDecoration(((IBuildPlan) element).getFlags());
    } else if (element instanceof IBuild) {
      descriptor = BuildLabelProvider.getImageDescriptor(((IBuild) element).getStatus());
      bottomRightDecoration = getBottomRightDecoration(((IBuild) element).getState());
    }

    if (descriptor != null) {
      if (bottomRightDecoration != null
          || bottomLeftDecoration != null
          || topRightDecoration != null) {
        descriptor =
            new DecorationOverlayIcon(
                CommonImages.getImage(descriptor),
                new ImageDescriptor[] {
                  null, topRightDecoration, bottomLeftDecoration, bottomRightDecoration
                });
      }
      return CommonImages.getImage(descriptor);
    }
    return null;
  }
  @Test
  public void imageNotPresentTests() {

    // check that all images are null when they should be
    assertNotNull(myLabelProvider.getColumnImage(myTaskReview1, 0));
    assertNotNull(myLabelProvider.getColumnImage(myTaskReview1, 1));
    assertNotNull(myLabelProvider.getColumnImage(myTaskReview1, 2));
    assertNotNull(myLabelProvider.getColumnImage(myTaskReview1, 3));

    assertEquals(
        CommonImages.getImage(CommonImages.OVERLAY_CLEAR),
        myLabelProvider.getColumnImage(myTaskReview1, 0));
    assertEquals(
        CommonImages.getImage(CommonImages.OVERLAY_CLEAR),
        myLabelProvider.getColumnImage(myTaskReview1, 0));
    assertEquals(
        CommonImages.getImage(CommonImages.OVERLAY_CLEAR),
        myLabelProvider.getColumnImage(myTaskReview1, 0));
    assertEquals(
        CommonImages.getImage(CommonImages.OVERLAY_CLEAR),
        myLabelProvider.getColumnImage(myTaskReview1, 0));
  }
Example #4
0
  private Image getBrandingImage() {
    String connectorKind;
    TaskRepository outgoingNewRepository = TasksUiUtil.getOutgoingNewTaskRepository(task);
    if (outgoingNewRepository != null) {
      connectorKind = outgoingNewRepository.getConnectorKind();
    } else {
      connectorKind = task.getConnectorKind();
    }

    if (LocalRepositoryConnector.CONNECTOR_KIND.equals(connectorKind)) {
      return CommonImages.getImage(TasksUiImages.TASK);
    } else {
      ImageDescriptor overlay;
      if (outgoingNewRepository != null) {
        overlay =
            TasksUiPlugin.getDefault().getBrandManager().getOverlayIcon(outgoingNewRepository);
      } else {
        overlay = TasksUiPlugin.getDefault().getBrandManager().getOverlayIcon(task);
      }
      Image image =
          CommonImages.getImageWithOverlay(TasksUiImages.REPOSITORY, overlay, false, false);
      return image;
    }
  }
 @Override
 protected IFigure createFigure() {
   Label l = (Label) super.createFigure();
   l.setIcon(CommonImages.getImage(BatchImages.END));
   return l;
 }