Created
October 9, 2012 09:24
-
-
Save dkandalov/3857613 to your computer and use it in GitHub Desktop.
Intellij eval process files from your change list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.intellij.notification.* | |
import com.intellij.openapi.application.ApplicationManager | |
import com.intellij.openapi.vcs.changes.* | |
import javax.swing.SwingUtilities | |
static show(String htmlBody, String title = "", NotificationType notificationType = NotificationType.INFORMATION) { | |
SwingUtilities.invokeLater({ | |
def notification = new Notification("", title, htmlBody, notificationType) | |
ApplicationManager.application.messageBus.syncPublisher(Notifications.TOPIC).notify(notification) | |
} as Runnable) | |
} | |
Collection<Change> changes = ChangeListManager.getInstance(project).getDefaultChangeList().getChanges() | |
def files = changes.collect { it.virtualFile.path } | |
show(files.join(" ")) | |
new Thread({ | |
files.each { file -> | |
try { | |
def builder = new ProcessBuilder("cmd", "/c", "c:/work/cc_checkout.cmd ${file}") | |
def proc = builder.start() | |
def sout = new StringBuffer() | |
def serr = new StringBuffer() | |
proc.consumeProcessOutput(sout, serr) | |
proc.waitForOrKill(5000) | |
if (proc.exitValue() != 0) | |
show(serr != null ? serr.toString() : "null serr") | |
else | |
show(sout != null ? sout.toString(): "null sout") | |
} catch (Exception e) { | |
show(e.toString()) | |
} | |
} | |
}).start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment