DZone Forums
Go Back   DZone Forums > Community > Languages & Frameworks > Java
Reload this Page Eclipse RCP: Updating a view
Notices
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: May 2008
Default Eclipse RCP: Updating a view - 05-05-2008, 04:23 AM

Hello everyone!

I 've got a question about RCP views. There is a view in my application that has a file and a string attribute. The file contains an image which is displayed with the string underneath it. Getters are available for changing the attributes during runtime. All is working fine at first, but how can I force the view to update itself, when the string and/or the file has changed?

Code:
public class TestView extends ViewPart {

  public static final String ID = "TestView";

  private File imageFile;

  private String imageName;

  public TestView() {
	
  }

  public void createPartControl( Composite parent ) {
    final Image image = new Image( Display.getDefault(), imageFile.getAbsolutePath() );
    Canvas imageCanvas = new Canvas( parent, SWT.BORDER );
    imageCanvas.addPaintListener( new PaintListener() {
      public void paintControl( PaintEvent e ) {
        if ( previewImage == null ) {
          e.gc.drawString( "Error: No image", 0, 0 );
        } else {
          e.gc.drawImage( previewImage, 0, 0 );
        }
      }  
    });
    Label imageLabel = new Label( parent, SWT.CENTER );
    imageLabel.setText(imageName);
  }

  public void setFile( File imageFile ) {
    this.imageFile = imageFile;
  }

  public void setName( String imageName ) {
    this.imageName = imageName
  }
This is a short version of my class, I am thankful for any advice.

Greets,
Benedikt
Reply With Quote
Reply

Tags
rcp, view

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remotely Updating a Java app pillie Java 6 01-26-2009 06:09 AM
Programmatically maximize/restore a view in Eclipse and Eclipse WIndow khewuwei Eclipse 0 11-27-2008 08:32 PM
Updating selection dynamically? wortmanb Eclipse 0 06-20-2008 12:44 PM
Focus on view in eclipse.. jayjamba Eclipse 0 05-15-2008 01:57 AM
not updating the content in a view w.r.t the changes in other view prathyusharao Eclipse 0 04-23-2008 02:19 AM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com