Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[pde-dev] Opening a file in a Editor

hi all,

I have created a file in a eclipse project folder and I want to open it in a text editor automatically. I have used the following code. But it says that the file not exists. But the required file is created at the required location.

IProject project=file.getProject();//get the project where file is created
  WSDLFile wsdlFile=new WSDLFile(WSDLFileName);//create the file
  IFile wsdlFileResource=project.getFile(wsdlFile.getFileName());
  
  IWorkbench workbench=PlatformUI.getWorkbench();
  IWorkbenchWindow window=workbench.getActiveWorkbenchWindow();
  IWorkbenchPage page=window.getActivePage();
  
  FileEditorInput wsdlFileEditor=new FileEditorInput(wsdlFileResource);
  try {
    page.openEditor(wsdlFileEditor,"org.eclipse.ui.DefaultTextEditor");
   } catch (PartInitException e) {
    e.printStackTrace();
   }

regards,

sanjaya.


Back to the top