word-like integration for texclipse (latex/bibtex export)

Hi all,

I am still working on a pick-your-references-easily kind of integration of zotero and texclipse. My current - working - solution includes installing mozrepl and using the .js below to open the addCitation Dialog and to store the selected reference in a temporary .bib file (where java/texclipse can pick it up and process it further). I am posting it here to get comments on how to change/improve this and also as a reference to anyone doing something similar.

If you use texclipse and zotero, I'd love to hear from you, so I know it is worth to share the full plugin extension.

Markus

--- code, rough first draft ---

// create a dummy io object to communicate with the dialog
var io = new function() { this.wrappedJSObject = this; };

var csl = Zotero.Styles.get(Zotero.Prefs.get("export.lastStyle")).csl;
io.citation = csl.createCitation();

io.previewFunction = function() {
return "DUMMY"; // seems to be important, but no useful for this code
}

// load the dialog
var w = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher).openWindow(null, 'chrome://zotero/content/integration/addCitationDialog.xul', '','chrome,centerscreen,resizable', io);
while(!w.closed) Zotero.mainThread.processNextEvent(true);

// tmp filename, replace with something useful
// code from http://www.curiousjason.com/getBibTeXFromZotero
var filename = "BIBTMPFILE";

var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(filename);

var ids = io.citation.citationItems[0].itemID;
var item = Zotero.Items.get([ids])[0];

// var zotero = Components.classes['@zotero.org/Zotero;1'].getService(Components.interfaces.nsISupports).wrappedJSObject;
var translatorObj = new Zotero.Translate('export');
translatorObj.setLocation(file);
translatorObj.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4');
translatorObj.setItems([item]);
translatorObj.translate();
  • Hi Markus,
    I know it has been quite a while since you posted this, but maybe you are still around.
    I am using TeXClipse and would love to have a nice integration with Zotero. However, since I am more or less new to both software I canĀ“t follow your description...
    I would be glad if you could share your plugin.

    Regards,
    Paul
Sign In or Register to comment.