Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Updating images in view in background(How to update images in view in background)
Updating images in view in background [message #533475] Fri, 14 May 2010 07:46 Go to next message
vrush Mising nameFriend
Messages: 51
Registered: July 2009
Location: Pune

I'm looking forward to provide a video support within eclipse. Till now managed to have a view with continueosly updating images with endless stream.
Everything works well till this point. But when I change focus to some other view or click anywhere within the eclipse, it hangs. It cannot even come back to video view. There are no listeners in the code. I'm simply changing background images in the loop.

Stuck since long. Please provide any pointers. Badly stuck

Thanks in advance,
Re: Updating images in view in background [message #533476 is a reply to message #533475] Fri, 14 May 2010 07:51 Go to previous message
vrush Mising nameFriend
Messages: 51
Registered: July 2009
Location: Pune
Attaching code for previous thread

public class SampleView_1 extends ViewPart {

public Canvas imageCanvas;
private Action change_image;
private Image sourceImage;
public void createPartControl(Composite parent) {
imageCanvas=new Canvas(parent, SWT.BACKGROUND | SWT.V_SCROLL | SWT.H_SCROLL);
imageCanvas.setBackgroundImage(new Image(parent.getDisplay(), "C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/Blue hills.jpg"));

private void contributeToActionBars() {
IActionBars bars = getViewSite().getActionBars();

private void fillLocalToolBar(IToolBarManager manager) {

private void makeActions() {
change_image = new Action() {
public void run() {
change_image.setText("Change Image");
change_image.setToolTipText("Change Image");
change_image.setImageDescriptor(PlatformUI.getWorkbench().ge tSharedImages().


private void ChangeImage() {
/*String path = "C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/";
String arr[] = new String[]{"/Blue hills.jpg","/Sunset.jpg","/Water lilies.jpg","/Winter.jpg"};

for(int i=0;i<4;i++){
imageCanvas.setBackgroundImage(new Image(imageCanvas.getDisplay(), path + arr[i]));
try {
} catch (InterruptedException e) {
/* IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IViewPart viewPart = window.getActivePage().findView(
Shell shell = viewPart.getSite().getShell();
PaletteData palette[] = new PaletteData[5];
palette[0] = new PaletteData(0, 0, 0);//new PaletteData(0xff, 0xff00, 0xff0000);
palette[1] = new PaletteData(0, 0, 1);//new PaletteData(0xff00, 0xff0000, 0xff);
palette[2] = new PaletteData(0, 1, 0);//new PaletteData(0xff0000, 0xff, 0xff00);
palette[3] = new PaletteData(1, 0, 0);//new PaletteData(0xff, 0xff00, 0xff0000);
palette[4] = new PaletteData(0, 0, 1);//new PaletteData(0xff00, 0xff0000, 0xff);

int i=0;
ImageData hueData = new ImageData(1024, 720, 24, palette[i]);
float hue = 0;
for (int x = 0; x < hueData.width; x++) {
for (int y = 0; y < hueData.height; y++) {
int pixel = palette[i].getPixel(new RGB(hue, 1f, 1f));
hueData.setPixel(x, y, pixel);
hue += 360f / hueData.width;
Image hueImage = new Image(imageCanvas.getDisplay(), hueData);
sourceImage = hueImage;
// shell.setBackgroundImage(sourceImage);
// shell.update();
if(i%4 == 0)
i = 0;

public void setFocus() {



Am i missing anything there?

Previous Topic:Eclipse Running Under Android
Next Topic:How to add validation when enter "New name:" at " 'Package Explorer'-->'Refactor'-
Goto Forum:

Current Time: Thu May 24 19:52:52 GMT 2018

Powered by FUDForum. Page generated in 0.01688 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top