在自己的RCP中使用RCP的TCL编辑器视图

import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.runtime.Path;

IFileStore fileStore=  EFS.getLocalFileSystem().getStore(new Path("d:/new_Project/a.tcl"));
IDE.openEditorOnFileStore(page, fileStore);

这样是在非workspace中打开编辑器,后台会报异常说:
java.lang.NullPointerException
	at org.eclipse.dltk.tcl.internal.core.parser.processors.tcl.TclNamespaceProcessor.process(TclNamespaceProcessor.java:71)



还有就是使用新建workspace来建立
try{
			IWorkspace workspace = ResourcesPlugin.getWorkspace();

			IWorkspaceRoot root = workspace.getRoot();

			IProject newProjectHandle = root.getProject("new_Project");

			// Get a project descriptor.

			IPath targetPath = new Path("d:/"	+ newProjectHandle.getName());

			final IProjectDescription description =
//
			workspace.newProjectDescription(newProjectHandle.getName());
//
			description.setLocation(targetPath);
//
			try {

			newProjectHandle.create(description, null);

			newProjectHandle.open(null);

			} catch (CoreException e) {

			// Deal with exception.

			}
			Path ph = new Path("d:/new_Project/a.tcl");
			IWorkbenchPage page = window.getActivePage();
			
			IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(ph);
IDE.openEditor(page, file, true);
} catch(Exception ex) {
			ex.printStackTrace();
		}

一样也会有异常出现:
java.lang.NullPointerException
	at org.eclipse.dltk.tcl.internal.core.parser.processors.tcl.TclNamespaceProcessor.process(TclNamespaceProcessor.java:71)

这些异常暂时都还没有找到办法来解决。

你可能感兴趣的:(java,eclipse,ide,Tcl)