Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tools-dev] XSDEditor.init is throwing org.eclipse.ui.PartInitException

Hi all,

      I am facing below exception . Please help me in this regard ….

 

XSDEditor.init is throwing org.eclipse.ui.PartInitException

 

Below is the snippets used to open the editor (Import Wizard plugin has been developed to open a predefined XSD on clicking the finish button of the final card):

      private void doFinish(

            String containerName,

            String fileName,

            IProgressMonitor monitor) throws CoreException, IOException

             {

           

            IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();

            IProject myProject = root.getProject("com.idata.example.helloWorld");

            if(myProject.exists()&& !myProject.isOpen())

                  myProject.open(null);

            IFolder iconFolder = myProject.getFolder("icons");

            if(iconFolder.exists()){

                 

                  final IFile newLogo = iconFolder.getFile("DataTypes.xsd");

                 

                  getShell().getDisplay().asyncExec(new Runnable() {

                        public void run() {

                              IWorkbenchPage page =

                                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

                              try {

                                    IDE.openEditor(page, newLogo, true);

                              } catch (PartInitException e) {

                              }

                        }

                  });

            }

 

XSDEditor.init throws the exception at:

  public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException

  {

    if (editorInput instanceof IFileEditorInput)

    {

      setSite(site);

      setInput(editorInput);

      setPartName(((IFileEditorInput)editorInput).getFile().getName());

      site.setSelectionProvider(new MultiPageSelectionProvider(this)); // EATM

      site.getPage().addPartListener(partListener);

    }

    else

    {

      throw new PartInitException("Invalid Input: Must be IFileEditorInput.");

    }

  }

The file we need to open is converted into editorInput which is of type FileEditorInput which implements IFileEditorInput.

If I try to open an XSD directly from eclipse, the same instanceof operator works fine (without throwing any exception). But if I try to open the same XSD from my plugin – exeption is thrown. I have verified that editorInput is of type FileEditorInput ( and hence instanceof IFileEditorInput should pass).

 

I am not able to find the reason for this behaviour.

 

Stack Trace:

org.eclipse.ui.PartInitException: Invalid Input: Must be IFileEditorInput.

      at org.eclipse.xsd.presentation.XSDEditor.init(XSDEditor.java:2111)

      at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:778)

      at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:596)

      at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:384)

      at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552)

      at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:283)

      at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:126)

      at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)

      at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)

      at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:391)

      at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1102)

      at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1051)

      at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1256)

      at org.eclipse.ui.internal.PartStack.add(PartStack.java:442)

      at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:109)

      at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:60)

      at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:212)

      at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:202)

      at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:758)

      at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:665)

      at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:628)

      at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2360)

      at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2295)

      at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage.java:2287)

      at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2273)

      at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)

      at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2268)

      at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2249)

      at org.eclipse.ui.ide.IDE.openEditor(IDE.java:307)

      at com.siebel.nexus.etools.typeXSD.TypeXSDImportWizard$1.run(TypeXSDImportWizard.java:167)

      at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)

      at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)

      at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3057)

      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2716)

      at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)

      at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)

      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)

      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)

      at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)

      at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)

      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)

      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)

      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.core.launcher.Main.invokeFramework(Main.java:334)

      at org.eclipse.core.launcher.Main.basicRun(Main.java:278)

      at org.eclipse.core.launcher.Main.run(Main.java:973)

      at org.eclipse.core.launcher.Main.main(Main.java:948)

 

_______________
Siebel
IT'S ALL ABOUT THE CUSTOMER
Visit www.siebel.com

This e-mail message is for the sole use of the intended recipient(s) and contains confidential and/or privileged information belonging to Siebel Systems, Inc. or its customers or partners. Any unauthorized review, use, copying, disclosure or distribution of this message is strictly prohibited. If you are not an intended recipient of this message, please contact the sender by reply e-mail and destroy all soft and hard copies of the message and any attachments. Thank you for your cooperation.


Back to the top