在我的Windows机上使用Texlipse和Miktex 2.9时,每次编译文档时系统都会抛出一个NullPointerExcpetion。
在我使用更新管理器更新了Miktex 2.9发行版之后,这个问题就消失了。希望这对其他有同样问题的人有所帮助。
致敬,Pwndrian
发布于 2011-07-12 16:35:38
对我来说也是如此。
这是我做的一个变通方法,但是我认为它不是最优的解决方案。我看到有一个打开了http://sourceforge.net/tracker/?func=detail&aid=3306779&group_id=133306&atid=726818的bug。
有一个类是net.sourceforge.texlipse.builder.TExlipseBuilder,我做了以下修改来解决这个问题(请注意两个函数的区别)。问题是,在函数getCurrentProject的TExlipsePlugin中,actEditor是空的,因为在导入项目时或在没有打开编辑器的情况下按下clean时,没有活动的编辑器。
@Override
protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
throws CoreException {
BuilderRegistry.clearConsole();
IWorkbenchPage page = TexlipsePlugin.getCurrentWorkbenchPage();
IEditorPart actEditor = null;
if (page.isEditorAreaVisible()
&& page.getActiveEditor() != null) {
actEditor = page.getActiveEditor();
}
if ( actEditor == null )
return null;
if (isUpToDate(getProject()))
return null;
Object s = TexlipseProperties.getProjectProperty(getProject(), TexlipseProperties.PARTIAL_BUILD_PROPERTY);
if (s != null) {
partialBuild(monitor);
} else {
buildFile(null, monitor);
}
return null;
}
/**
* Clean the temporary files.
*
* @see IncrementalProjectBuilder.clean
*/
@Override
protected void clean(IProgressMonitor monitor) throws CoreException {
IProject project = getProject();
BuilderRegistry.clearConsole();
IWorkbenchPage page = TexlipsePlugin.getCurrentWorkbenchPage();
IEditorPart actEditor = null;
if (page.isEditorAreaVisible()
&& page.getActiveEditor() != null) {
actEditor = page.getActiveEditor();
}
if ( actEditor == null )
return;
// reset session variables
TexlipseProperties.setSessionProperty(project, TexlipseProperties.SESSION_LATEX_RERUN, null);
TexlipseProperties.setSessionProperty(project, TexlipseProperties.SESSION_BIBTEX_RERUN, null);
TexlipseProperties.setSessionProperty(project, TexlipseProperties.BIBFILES_CHANGED, null);
// check main file
String mainFile = TexlipseProperties.getProjectProperty(project, TexlipseProperties.MAINFILE_PROPERTY);
if (mainFile == null || mainFile.length() == 0) {
// main tex file not set -> nothing builded -> nothing to clean
return;
}
cleanTempDir(monitor, project);
cleanOutput(monitor, project);
monitor.subTask(TexlipsePlugin.getResourceString("builderSubTaskCleanMarkers"));
this.deleteMarkers(project);
project.refreshLocal(IProject.DEPTH_INFINITE, monitor);
monitor.done();
}https://stackoverflow.com/questions/5103210
复制相似问题