Created
February 13, 2013 22:16
-
-
Save xhanin/4948868 to your computer and use it in GitHub Desktop.
Insert MongoDB ObjectId IntellijEval plugin
This file contains hidden or 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.openapi.actionSystem.AnActionEvent | |
import static intellijeval.PluginUtil.* | |
import org.bson.types.*; | |
// add-to-classpath $HOME/.m2/repository/org/mongodb/mongo-java-driver/2.10.1/mongo-java-driver-2.10.1.jar | |
registerAction("InsertMongoObjectId", "alt shift O") { AnActionEvent event -> | |
runDocumentWriteAction(event.project) { | |
currentEditorIn(event.project).with { | |
def offset = caretModel.offset | |
document.insertString(offset, new ObjectId().toString()) | |
} | |
} | |
} | |
show("Registered ObjectId plugin. Use alt shift O to insert a new ObjectId") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment