Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Refreshing View
Refreshing View [message #454091] Sat, 16 April 2005 06:46 Go to next message
Eclipse UserFriend
Originally posted by: gunjan_sir.yahoo.com

Hi! All,
I've created a view(named it as Console View)by extending ViewPart.I'm
displaying on the Console View,some strings which are specific to the my
model objects.These strings are displayed when the user clicks on the
model objects on the editor.
So every time the user click on the different objects on the editor, the
Console View is refreshed with new strings,corrosponding to the object.

I've used ListViewer to display the strings in the console.
My contentprovider implements IStructuredContentProvider for which I need
to implement three API's in it:
1)public void inputChanged(Viewer v, Object oldInput, Object newInput) {}
2)public Object[] getElements(Object parent) {
return new String[] { "Error String1","Error String2","Error

String3" };}

3)public void dispose() {}

Plus i will need to call viewer.refresh to refresh the Console View.
Below is the code for content provider:
public class ViewContentProvider implements IStructuredContentProvider{

ListViewer viewer;

public void inputChanged(Viewer v, Object oldInput, Object newInput) {
}

public void dispose() {
}
public Object[] getElements(Object parent) {
return new String[] { "String1","String2","String3" };
}
}
These methods are called by the framework,as per my understanding....
Here i've passed static strings to getElements()
Now my question is:
Ques 1)How do i give a call to getElements(Object parent) to pass the
dynamic strings in it.
Ques 2)What do i need to do/implement in the inputChanged(Viewer v,Object
oldInput,Object newInput) method.
Ques 3)How and where will i give call to viewer.refresh() to actually
refresh the view part.

Thanking in advance for any suggestion.

Many Regards
Ved Gunjan
Re: Refreshing View [message #454109 is a reply to message #454091] Mon, 18 April 2005 02:57 Go to previous message
Eclipse UserFriend
Originally posted by: aaa.domain.invalid

Ans 1
-----

I think you are missing a setInput method.

Ans 2
-----
In your viewer.setContentProvider(..);
You need to pass a object that implements IStructuredContentProvider.
The inputchanged is part of IContentProvider which the
IStructuredContentProvider extends.

Create a simple plugin in eclipse with a view and during the process
select the type of viewer to be table and look at the generated code.
This mimimalistic code will help you understand.

-Chhil
Previous Topic:Is there the way of removing focus border?
Next Topic:how to extend WizardExportResourcesPage
Goto Forum:
  


Current Time: Thu Feb 25 17:15:25 GMT 2021

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

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

Back to the top