[jbosstools-commits] JBoss Tools SVN: r31713 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue May 31 20:40:09 EDT 2011


Author: scabanovich
Date: 2011-05-31 20:40:09 -0400 (Tue, 31 May 2011)
New Revision: 31713

Modified:
   trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/WebModelPlugin.java
Log:
JBIDE-9028
https://issues.jboss.org/browse/JBIDE-9028

Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/WebModelPlugin.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/WebModelPlugin.java	2011-06-01 00:39:38 UTC (rev 31712)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/WebModelPlugin.java	2011-06-01 00:40:09 UTC (rev 31713)
@@ -18,6 +18,7 @@
 import org.eclipse.core.resources.IProjectDescription;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunchConfiguration;
@@ -230,4 +231,29 @@
 	    System.arraycopy(commands, 0, cmds, 0, commands.length);
 	    return cmds;
     }
+
+    public static boolean makeBuilderLast(IProject project, String builderId) throws CoreException {
+		IProjectDescription d = project.getDescription();
+		ICommand[] bs = d.getBuildSpec();
+		ICommand v = null;
+		boolean updated = false;
+		for (int i = 0; i < bs.length; i++) {
+			if(builderId.equals(bs[i].getBuilderName())) {
+				v = bs[i];
+			}
+			if(v != null) {
+				if(i + 1 < bs.length) {
+					bs[i] = bs[i + 1];
+					updated = true;
+				} else if(updated) {
+					bs[i] = v;
+				}
+			}
+		}
+		if(updated) {
+			d.setBuildSpec(bs);
+			project.setDescription(d, IProject.FORCE, new NullProgressMonitor());
+		}
+		return updated;
+    }
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list