Texlipse 和 Miktex 2.9 的 NullPointerException

发布于 2024-10-19 13:03:37 字数 165 浏览 11 评论 0原文

在我的 Windows 机器上将 Texlipse 与 Miktex 2.9 一起使用时,每次编译文档时系统都会抛出 NullPointerExcpetion。

在我使用更新管理器更新 Miktex 2.9 发行版后,问题消失了。希望这可以帮助其他有同样问题的人。

问候, 普恩德里安

When using Texlipse together with Miktex 2.9 on my Windows machine, the system throws a NullPointerExcpetion each time the document is compiled.

The problem disappeared after I have updated the Miktex 2.9 distribution using the Update manager. Hope this helps others who have the same problem.

Regards,
Pwndrian

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青衫负雪 2024-10-26 13:03:37

对我来说,这也发生了。

这是我所做的解决方法,但我认为这并不是最佳解决方案。
我看到打开了一个错误 http:// sourceforge.net/tracker/?func=detail&aid=3306779&group_id=133306&atid=726818

有类net.sourceforge.texlipse.builder.TExlipseBuilder,我做了以下更改来克服这个问题(请注意两个函数的差异)。问题在于,在 TExlipsePlugin 中的 getCurrentProject 函数中,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();
}

To me it happens too.

This is a workaround I did, however I think that it is not quite optimal solution.
I saw that there is a bug opened http://sourceforge.net/tracker/?func=detail&aid=3306779&group_id=133306&atid=726818.

There is the class net.sourceforge.texlipse.builder.TExlipseBuilder, I made the following changes to overcome this problem(Please note the differences in both functions). The problem is that in TExlipsePlugin in the function getCurrentProject the actEditor is null since there is no active editor when importing projects or when pressing on clean while no editor is open.

@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();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文