/** * Read the command line arguments for the program from the preferences. The input filename is * marked with a "%input" and the output file name is marked with a "%output". * * @return the command line arguments for the program */ public String getProgramArguments() { String args = TexlipsePlugin.getPreference(getArgumentsPreferenceName()); if (args == null || args.length() == 0) { return TexlipsePlugin.getPreference(getArgumentsPreferenceNameByClass()); } else { return args; } }
/** @return the program path and filename from the preferences */ public String getProgramPath() { String path = TexlipsePlugin.getPreference(getCommandPreferenceName()); if (path == null || path.length() == 0) { // Fall back to class-based config return TexlipsePlugin.getPreference(getCommandPreferenceNameByClass()); } else { return path; } }
/** * Does the same as super.createDocument(Object), except this also adds latex nature to the * project containing the given document. */ public IDocument getDocument(Object element) { IDocument doc = super.getDocument(element); // add latex nature to project holding this latex file // this way we also get latex builder to any project that has latex files if (element instanceof FileEditorInput) { IFile file = (IFile) ((FileEditorInput) element).getAdapter(IFile.class); if (file != null) { IProject project = file.getProject(); try { if (!project.hasNature(TexlipseNature.NATURE_ID)) { return doc; // TexlipseProjectCreationOperation.addProjectNature(project, new // NullProgressMonitor()); } else if (TexlipseProperties.getProjectProperty( project, TexlipseProperties.OUTPUT_FORMAT) == null) { // this is needed for imported projects TexlipseNature n = new TexlipseNature(); // the nature is not added, just configured n.setProject(project); // this will cause the builder to be added, if not already there n.configure(); } } catch (CoreException e) { return doc; } // output format might not yet be set String format = TexlipseProperties.getProjectProperty(project, TexlipseProperties.OUTPUT_FORMAT); if (format == null || format.length() == 0) { TexlipseProperties.setProjectProperty( project, TexlipseProperties.OUTPUT_FORMAT, TexlipsePlugin.getPreference(TexlipseProperties.OUTPUT_FORMAT)); TexlipseProperties.setProjectProperty( project, TexlipseProperties.BUILDER_NUMBER, TexlipsePlugin.getPreference(TexlipseProperties.BUILDER_NUMBER)); TexlipseProperties.setProjectProperty( project, TexlipseProperties.MARK_TEMP_DERIVED_PROPERTY, "true"); TexlipseProperties.setProjectProperty( project, TexlipseProperties.MARK_OUTPUT_DERIVED_PROPERTY, "true"); String name = file.getName(); TexlipseProperties.setProjectProperty( project, TexlipseProperties.MAINFILE_PROPERTY, name); String output = name.substring(0, name.lastIndexOf('.') + 1) + TexlipsePlugin.getPreference(TexlipseProperties.OUTPUT_FORMAT); TexlipseProperties.setProjectProperty( project, TexlipseProperties.OUTPUTFILE_PROPERTY, output); IPath path = file.getFullPath(); String dir = path.removeFirstSegments(1).removeLastSegments(1).toString(); if (dir.length() > 0) { TexlipseProperties.setProjectProperty( project, TexlipseProperties.SOURCE_DIR_PROPERTY, dir); TexlipseProperties.setProjectProperty( project, TexlipseProperties.OUTPUT_DIR_PROPERTY, dir); TexlipseProperties.setProjectProperty( project, TexlipseProperties.TEMP_DIR_PROPERTY, dir); } } } } return doc; }