[Texeclipse-cvs] net.sourceforge.texeclipse/src/net/sourceforge/texeclipse TexProjectNature.java,1.1
Status: Planning
Brought to you by:
sba
From: <sb...@us...> - 2003-09-19 19:53:50
|
Update of /cvsroot/texeclipse/net.sourceforge.texeclipse/src/net/sourceforge/texeclipse In directory sc8-pr-cvs1:/tmp/cvs-serv19998/src/net/sourceforge/texeclipse Modified Files: TexProjectNature.java TexeclipsePlugin.java Log Message: Added a dummy Tex Builder class. Added tex and latex files to be known as ascii text as a team extension Index: TexProjectNature.java =================================================================== RCS file: /cvsroot/texeclipse/net.sourceforge.texeclipse/src/net/sourceforge/texeclipse/TexProjectNature.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TexProjectNature.java 14 Sep 2003 22:49:52 -0000 1.1 +++ TexProjectNature.java 19 Sep 2003 11:49:40 -0000 1.2 @@ -1,7 +1,9 @@ package net.sourceforge.texeclipse; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectNature; /** @@ -13,27 +15,52 @@ IProject project; /** - * TODO: Implement the "TexProjectNature" constructor. */ public TexProjectNature() { } /** - * TODO: Implement "configure". * @see IProjectNature#configure */ - public void configure() throws CoreException { + public void configure() throws CoreException + { + // get project description and then the associated build commands + IProjectDescription desc = project.getDescription(); + ICommand[] commands = desc.getBuildSpec(); + + // determine if builder already associated + boolean found = false; + for (int i = 0; i < commands.length; ++i) { + if (commands[i].getBuilderName().equals(TexeclipsePlugin.TEX_BUILDER_ID)) + { + found = true; + break; + } + } + + // add builder if not already in project + if (!found) { + ICommand command = desc.newCommand(); + command.setBuilderName(TexeclipsePlugin.TEX_BUILDER_ID); + ICommand[] newCommands = new ICommand[commands.length + 1]; + + // Add it before other builders. + System.arraycopy(commands, 0, newCommands, 1, commands.length); + newCommands[0] = command; + desc.setBuildSpec(newCommands); + project.setDescription(desc, null); + } } /** - * TODO: Implement "deconfigure". * @see IProjectNature#deconfigure */ - public void deconfigure() throws CoreException { + public void deconfigure() throws CoreException + { + } /** - * TODO: Implement "getProject". * @see IProjectNature#getProject */ public IProject getProject() @@ -42,7 +69,6 @@ } /** - * TODO: Implement "setProject". * @see IProjectNature#setProject */ public void setProject(IProject project) Index: TexeclipsePlugin.java =================================================================== RCS file: /cvsroot/texeclipse/net.sourceforge.texeclipse/src/net/sourceforge/texeclipse/TexeclipsePlugin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TexeclipsePlugin.java 14 Sep 2003 22:49:52 -0000 1.1 +++ TexeclipsePlugin.java 19 Sep 2003 11:49:40 -0000 1.2 @@ -13,6 +13,8 @@ // Constants public static final String PLUGIN_ID = "net.sourceforge.texeclipse"; public static final String TEX_NATURE_ID = PLUGIN_ID + ".texNature"; + public static final String TEX_BUILDER_ID = PLUGIN_ID + ".texbuilder"; + //The shared instance. private static TexeclipsePlugin plugin; |