Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.ViewerRow


  private ViewerCell newCell(int columnIndex, Object element) throws Exception {
    final String[] text = new String[1];
    final Color[] background = new Color[1];
    final Color[] foreground = new Color[1];

    ViewerRow row = mock(ViewerRow.class);
    given(row.getBackground(columnIndex)).willAnswer(new Answer<Color>() {
      @Override
      public Color answer(InvocationOnMock invocation) throws Throwable {
        return background[0];
      }
    });
    given(row.getForeground(columnIndex)).willAnswer(new Answer<Color>() {
      @Override
      public Color answer(InvocationOnMock invocation) throws Throwable {
        return foreground[0];
      }
    });
    given(row.getText(columnIndex)).willAnswer(new Answer<String>() {
      @Override
      public String answer(InvocationOnMock invocation) throws Throwable {
        return text[0];
      }
    });
    given(row.getTreePath()).willReturn(new TreePath(new Object[]{element}));

    doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        background[0] = (Color) invocation.getArguments()[1];
View Full Code Here


  private ViewerCell newCell(int columnIndex, Object element) throws Exception {
    final String[] text = new String[1];
    final Color[] background = new Color[1];
    final Color[] foreground = new Color[1];

    ViewerRow row = mock(ViewerRow.class);
    given(row.getBackground(columnIndex)).willAnswer(new Answer<Color>() {
      @Override
      public Color answer(InvocationOnMock invocation) throws Throwable {
        return background[0];
      }
    });
    given(row.getForeground(columnIndex)).willAnswer(new Answer<Color>() {
      @Override
      public Color answer(InvocationOnMock invocation) throws Throwable {
        return foreground[0];
      }
    });
    given(row.getText(columnIndex)).willAnswer(new Answer<String>() {
      @Override
      public String answer(InvocationOnMock invocation) throws Throwable {
        return text[0];
      }
    });
    given(row.getTreePath()).willReturn(new TreePath(new Object[]{element}));

    doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        background[0] = (Color) invocation.getArguments()[1];
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.ViewerRow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.