problem with setSelection() for Graphical view [message #511280] |
Mon, 01 February 2010 04:54 |
|
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)
|
|
|
|
Powered by
FUDForum. Page generated in 0.03128 seconds