Skip to main content



      Home
Home » Newcomers » Newcomers » error launching text editor
error launching text editor [message #145333] Tue, 28 March 2006 09:21 Go to next message
Eclipse UserFriend
Originally posted by: jr_gz.hotmail.com

Hello everybody.

IŽm building a small plug-in with a Samplemenu(contains a SampleAction)
and I wonna open a file(ItŽs out of the workspace) in the text editor when
I execute the SampleAction, but when I execute it I recieve the next
error:

Unhandled event loop exception
Reason:
Workspace is closed.

The code that IŽm using is the next(SampleAction.java):

public void run(IAction action) {
MessageDialog.openInformation(window.getShell(),"Example1HelloWorld
Plug-in",
"Hello, Eclipse world");

IWorkspace ws = ResourcesPlugin.getWorkspace(); //****
IProject project = ws.getRoot().getProject("External Files");

IPath location = new Path("C:\\jr.txt");
IFile file = project.getFile(location.lastSegment());

IEditorInput input=null;
input = new FileEditorInput(file);
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().
openEditor(input, "org.eclipse.ui.DefaultTextEditor");
} catch (PartInitException e) {
e.printStackTrace();
}
}


The error ocurre in the second instruction(****).
I think that I can resolve the error if I DonŽt use "ws" and "project",
but then how can I indicate the IFile?


Can anybody help me?

Thanks a lot.
Jeff please help me [message #145368 is a reply to message #145333] Wed, 29 March 2006 02:19 Go to previous message
Eclipse UserFriend
Originally posted by: jr_gz.hotmail.com

Hello Jeff.

Jeff could you help me please?
Previous Topic:Exlipse Help does not start
Next Topic:Creating plugin for test management and automation of boards
Goto Forum:
  


Current Time: Sun May 11 15:55:23 EDT 2025

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

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

Back to the top