Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » problem with setSelection() for Graphical view
icon4.gif  problem with setSelection() for Graphical view [message #510907] Fri, 29 January 2010 06:16
raj is currently offline rajFriend
Messages: 19
Registered: January 2010
Location: hyderabad
Junior Member

For Saving and restore, we tried with the database. For Saving option, we have stored all the data in to the database. And for the retrieval we are getting the data back from the database and displaying it correctly in all the views (data and Selections) except the graphical View. In the graphical View I am able to display the data but I am unable to do setSelection() for the graphical View.

Problem is : Unable to do setSelection() for Graphical view

In a Wizard class, I have to programmatically set the selection for Graphical View.

Following is the code

public class LoadDBImportWizard extends Wizard implements IImportWizard {


// Graphical View...

GraphicalView gView = (GraphicalView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView(GraphicalView.class.getName());


// Database operations....

rsTargetGeno = stmtTargetGeno.executeQuery("select distinct acc.accession_name from target_genotype tg inner join accessions acc on tg.accession_id=acc.accession_id where generation_id='"+generationId+"'");

while(rsTargetGeno.next()){

obj = targetHashMap.get(rsTargetGeno.getString("accession_name"));

targetGenoList.add(obj);

}


//Here I am setting the selection for Graphical View...

gView.getSite().getSelectionProvider().setSelection(new StructuredSelection(targetGenoList));


}

**
How can I cast a String variable or an ArrayList() to org.eclipse.gef.EditPart in a Wizard class.


And the following is the error.


java.lang.ClassCastException: java.util.ArrayList cannot be cast to org.eclipse.gef.EditPart
at org.eclipse.gef.SelectionManager.setSelection(SelectionManag er.java:221)
at org.eclipse.gef.ui.parts.AbstractEditPartViewer.setSelection (AbstractEditPartViewer.java:729)
at org.icrisat.ismab.ui.wizards.LoadDBImportWizard.performFinis h(LoadDBImportWizard.java:433)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDi alog.java:742)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDi alog.java:373)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.jav a:618)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:227)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820 )
at org.eclipse.jface.window.Window.open(Window.java:796)
at org.eclipse.ui.actions.ImportResourcesAction.run(ImportResou rcesAction.java:159)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEv ent(BaseSelectionListenerAction.java:168)
at org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:546)
at org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:490)
at org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench5-(Wo rkbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.icrisat.ismab.rcp.Application.start(Application.java:20)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)


[Updated on: Fri, 29 January 2010 06:18]

Report message to a moderator

Previous Topic:Problem loading plugin class from endorsed code
Next Topic:dynamically changing menu and toolbar icons
Goto Forum:
  


Current Time: Tue Dec 23 02:20:47 GMT 2014

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

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