Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 385061

Summary: SWTBotTreeItem foregroundColor and backgroundColor methods don't work
Product: [Technology] SWTBot Reporter: David North <dtn-eclipsebugs>
Component: SWTBotAssignee: Project Inbox <swtbot-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mistria
Version: unspecified   
Target Milestone: 2.2.0   
Hardware: All   
OS: All   
Whiteboard:

Description David North CLA 2012-07-13 10:27:52 EDT
Build Identifier: M20120208-0800

The foregroundColor and backgroundColor methods on SWTBotTreeItem always return null.

This is because they are implemented on AbstractSWTBot and require the widget to be an instance of Control (TreeItems are only Widgets, not Controls).

Adding the following overrides to SWTBotTreeItem implements the methods correctly:

@Override
public Color foregroundColor() {
  return syncExec(new Result<Color>() {
    public Color run() {
      return widget.getForeground();
    }
  });
}

@Override
public Color backgroundColor() {
  return syncExec(new Result<Color>() {
    public Color run() {
      return widget.getBackground();
    }
  });
}

Reproducible: Always
Comment 1 Mickael Istria CLA 2013-10-08 11:38:50 EDT
Can you please propose this change as a Gerrit patch? http://wiki.eclipse.org/SWTBot/Contributing
Comment 2 David North CLA 2013-10-09 06:55:57 EDT
I've tried to do as you ask, but I can't push my proposal:

$ git push ssh://dnorth@git.eclipse.org:29418/swtbot/org.eclipse.swtbot.git HEAD:refs/for/master

...

remote: Reviewing commit: commit f0f5ff11667dcd20db52102dc567d8a0fd8b08d6 1381315903 ----sp
remote: Authored by: David North <dtn-eclipsebugs@corefiling.co.uk>
remote: 
remote: The author is not a committer on the project.
remote: The author has a current Contributor License Agreement (CLA) on file.
remote: error: The author has not "signed-off" on the contribution.
remote: Please see http://wiki.eclipse.org/CLA
Comment 3 Mickael Istria CLA 2013-10-09 07:01:23 EDT
Commits have to be signed-off.
You can use "git commit --amend --signoff" to add the signoff footer to the existing commit.
In general with Git at Eclipse.org, always use "git commit --signoff".
Comment 4 David North CLA 2013-10-09 07:05:22 EDT
Thank you.

https://git.eclipse.org/r/17203
Comment 5 Mickael Istria CLA 2013-10-09 10:52:04 EDT
Thanks David for this contribution!