Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Opening a Java File in Java Editor
Opening a Java File in Java Editor [message #95162] Fri, 12 September 2003 07:11 Go to next message
Eclipse UserFriend
Originally posted by: anil.reddy.patni.com

Hi,

I want to open a Java file in the Java Editor after I have completed the
wizard entries for describing the contents I want to write to it.
However I am not sure how the Editor can be invoked after the click on the
'Finish' button on the wizard page. (Similiar to the functionality
provided by Eclipse with a slight modification.)

Please help me in this.
If anyone has a sample code in this regard, would it possible for them to
upload it or provide a link.

regards,
Anil
Re: Opening a Java File in Java Editor [message #95267 is a reply to message #95162] Fri, 12 September 2003 11:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: felix.mayer.cingular.com

Here is an example of what I do:

String fileName = ...
Path path = new Path( fileName );
IContainer container = workspaceRoot.getContainerForLocation( path );
IPath projectPath = container.getProjectRelativePath();
IFile file = container.getProject().getFile( projectPath );
ICompilationUnit compilationUnit = JavaCore.createCompilationUnitFrom(
file );
if( compilationUnit.exists() && ! compilationUnit.isOpen() ) {
compilationUnit.open( null );
}//if
Types[] types = compilationUnit.getAllTypes();
JavaUI.openInEditor( types[0] );

Anil Reddy wrote:

> Hi,

> I want to open a Java file in the Java Editor after I have completed the
> wizard entries for describing the contents I want to write to it.
> However I am not sure how the Editor can be invoked after the click on the
> 'Finish' button on the wizard page. (Similiar to the functionality
> provided by Eclipse with a slight modification.)

> Please help me in this.
> If anyone has a sample code in this regard, would it possible for them to
> upload it or provide a link.

> regards,
> Anil
Re: Opening a Java File in Java Editor [message #95639 is a reply to message #95267] Mon, 15 September 2003 05:09 Go to previous message
Eclipse UserFriend
Originally posted by: anil.reddy.patni.com

thanks for the reply..

Felix Mayer wrote:

> Here is an example of what I do:

> String fileName = ...
> Path path = new Path( fileName );
> IContainer container = workspaceRoot.getContainerForLocation( path );
> IPath projectPath = container.getProjectRelativePath();
> IFile file = container.getProject().getFile( projectPath );
> ICompilationUnit compilationUnit = JavaCore.createCompilationUnitFrom(
> file );
> if( compilationUnit.exists() && ! compilationUnit.isOpen() ) {
> compilationUnit.open( null );
> }//if
> Types[] types = compilationUnit.getAllTypes();
> JavaUI.openInEditor( types[0] );

> Anil Reddy wrote:

> > Hi,

> > I want to open a Java file in the Java Editor after I have completed the
> > wizard entries for describing the contents I want to write to it.
> > However I am not sure how the Editor can be invoked after the click on the
> > 'Finish' button on the wizard page. (Similiar to the functionality
> > provided by Eclipse with a slight modification.)

> > Please help me in this.
> > If anyone has a sample code in this regard, would it possible for them to
> > upload it or provide a link.

> > regards,
> > Anil
Previous Topic:Navigator View
Next Topic:org.eclipse.vcm
Goto Forum:
  


Current Time: Fri May 30 20:51:30 EDT 2025

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

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

Back to the top