Skip to content

Instantly share code, notes, and snippets.

@dkandalov
Created November 15, 2012 18:33
Show Gist options
  • Save dkandalov/4080326 to your computer and use it in GitHub Desktop.
Save dkandalov/4080326 to your computer and use it in GitHub Desktop.
"open files from current change list" action for intellij-eval
import com.intellij.notification.*
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.vcs.changes.Change
import com.intellij.openapi.vcs.changes.ChangeListManager
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)
}
def fileEditorManager = FileEditorManager.getInstance(event.project)
//fileEditorManager.openFiles.each { fileEditorManager.closeFile(it) }
Collection<Change> changes = ChangeListManager.getInstance(project).getDefaultChangeList().getChanges()
changes.collect { it.virtualFile }.findAll { it != null }.each {
fileEditorManager.openFile(it, false)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment