[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-ui-dev] How to open a view programmatically
|
Can any body tell me how to open a view programmatically?
I have already used showView()
written following lines of code to open a view
IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = dw.getActivePage();
try{
page.showView("test.PackageView");
}catch (PartInitException e){
DialogUtil.openError(dw.getShell(), ResourceMessages.getString(
"DataFileResource.errorMessage"),e.getMessage(),e);
}
now in Package View i want to populate a tree the information of tree
Elements is passed in the constructor as shown below
if (page != null){
PackageView pv = new PackageView(htableListFile);
pv.createPartControl(parent);
IViewPart part =(IViewPart) pv.getViewSite() ;
page.activate(part) ;
}
and in createPartControl method of PackageView am populating the Tree View
as
if(table != null){
Enumeration enum= table.keys();
while(enum.hasMoreElements()){
String Key = enum.nextElement().toString();
TreeParent p31 = new TreeParent(Key);
ArrayList tempalist =(ArrayList) table.get(Key);
for(int i = 0;i<tempalist.size();i++){
System.out.println("Key--"+Key+" >> "
+tempalist.get(i).toString());
}
root.addChild(p31);
}
}else{
System.out.println("table is Null");
}
the above Code is adding Childs in tree but its not showing up Childs ,may
be its not updating the view
Help required
Thanks in advance
Rishi Sahni