Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork JabRef? #483

Open
GeorgLink opened this issue Jan 31, 2016 · 9 comments
Open

Fork JabRef? #483

GeorgLink opened this issue Jan 31, 2016 · 9 comments

Comments

@GeorgLink
Copy link
Contributor

In response to #480 (comment).

JabRef moved to GitHub and we could fork the project to maintain our adjustments (separate branch?), create pull-requests for enhanced features to contribute back and regularly pull changes and updates.

Hopefully this would make it easier to import new features and bug fixes from JabRef into Docear.

Thoughts?

@Joeran
Copy link
Contributor

Joeran commented Jan 31, 2016

this would be great and I would be glad if the development of Docear and JabRef in general would align better. However, if you want to start this project, be aware that it will take quite a while to complete. When we originally adjusted JabRef to be integrated into Docear, it took us weeks. Of course, in the long run, it would be great if we could always integrate the latest JabRef version and also push changes to JabRef.

@GeorgLink
Copy link
Contributor Author

Thanks for the hint.

For the most part, changes in JabRef are commented with //DOCEAR (optionally a message explaining changes)
Comparing it to the original JabRef release allows identifying necessary changes to integrate JabRef.

I tried to replicate those changes in JabRef 2.8 in a personal branch: https://github.com/GeorgLink/Desktop/tree/jabref_2.8

It compiles!

  • Update files to JabRef 2.8
  • Import new JabRef 2.8 files
  • Replicate necessary changes for Docear
  • Remove unused JabRef 2.7 files
  • Test

These are notes I took during the process, probably incomplete:

This hopefully helps anyone who upgrads JabRef and it serves as a reminder to myself.

//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\imports\ImportFormatReader.java:374 

// remove 
//  public static BibtexDatabase import_File(String format, String filename)




//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\imports\OpenDatabaseAction.java:324\

//remove
// public static ParserResult loadDataBase(File fileToOpen, String encoding, String source)
//private static String removeMendeleyBackSlash(String path)
//public static String convertHTMLunicode(String s)
//public static String parseSpecialChars(String s)





//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\BasePanel.java:64

import net.sf.jabref.export.DocearSaveDatabaseAction;



//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\EntryEditor.java:1171

                    //FIXME: DOCEAR - stops working see #184
                    //Comment 2016-01-31 @GeorgLink: The reference to #184 does not match  GitHub issue (?)
                    //warnEmptyBibtexkey();


// Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\export\DocearReferenceUpdateController.java
// new file

//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\JabRef.java
// several changes appear to be not labelled by Docear... -- I guessed which ones.


//   Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\export\DocearSaveDatabaseAction.java
// new file



//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\external\DroppedFileHandler.java:186

    //DOCEAR - skip the dialog, because we are adding files only anyway 
    public void linkPdfToEntry(String fileName, BibtexEntry entry) {
        ExternalFileType fileType = Globals.prefs.getExternalFileTypeByExt("pdf");
        NamedCompound edits = new NamedCompound(Globals.lang("Drop %0", fileType.extension));

        doLink(entry, fileType, fileName, true, edits);
        panel.markBaseChanged();

        edits.end();
        panel.undoManager.addEdit(edits);
    }



//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\FieldEditorFocusListener.java:42
// I think this is identical...?

//Docear-version:
((JComponent)event.getSource()).setBackground(GUIGlobals.getActiveBackground()); //DOCEAR
((JComponent)event.getSource()).setBackground(GUIGlobals.getValidFieldBackgroundColor()); //DOCEAR
//JabRef 2.8 version
((JComponent)event.getSource()).setBackground(GUIGlobals.activeBackground);
((JComponent)event.getSource()).setBackground(GUIGlobals.validFieldBackgroundColor);

//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\FieldTextArea.java

//Docear-version
setBackground(GUIGlobals.getValidFieldBackgroundColor());  //DOCEAR
        setForeground(GUIGlobals.getEditorTextColor());  //DOCEAR
//jabref
setBackground(GUIGlobals.validFieldBackgroundColor);
        setForeground(GUIGlobals.editorTextColor);

//docear
    public void setActiveBackgroundColor() {
        setBackground(GUIGlobals.getActiveBackground());  //DOCEAR
    }

    public void setValidBackgroundColor() {
        setBackground(GUIGlobals.getValidFieldBackgroundColor()); //DOCEAR
    }

    public void setInvalidBackgroundColor() {
        setBackground(GUIGlobals.getInvalidFieldBackgroundColor()); //DOCEAR
    }

    public void updateFontColor() {
        setForeground(GUIGlobals.getEditorTextColor());  //DOCEAR
    }
//jabref      
    public void setActiveBackgroundColor() {
        setBackground(GUIGlobals.activeBackground);
    }

    public void setValidBackgroundColor() {
        setBackground(GUIGlobals.validFieldBackgroundColor);
    }

    public void setInvalidBackgroundColor() {
        setBackground(GUIGlobals.invalidFieldBackgroundColor);
    }

    public void updateFontColor() {
        setForeground(GUIGlobals.editorTextColor);
    }

//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\FieldTextField.java
// used docear version



//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\groups\EntryTableTransferHandler.java:393

    //DOCEAR - changed visibility of function (private -> public)

    public void loadOrImportFiles(String[] fileNames, int dropRow) {
    }


//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\GUIGlobals.java:155    

    //DOCEAR - set private
    private static Color

//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\GUIGlobals.java:236

        // Set up entry editor colors, first time:
        //DOCEAR - causes recursive contructor call on JabRefPreferences
        //updateEntryEditorColors();

//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\GUIGlobals.java:246
    //DOCEAR
    public static Color getInvalidFieldBackgroundColor() {
        if(invalidFieldBackgroundColor == null) {
            updateEntryEditorColors();
        }
        return invalidFieldBackgroundColor;
    }

    //DOCEAR
    public static Color getActiveBackground() {
        if(activeBackground == null) {
            updateEntryEditorColors();
        }
        return activeBackground;
    }

    //DOCEAR
    public static Color getValidFieldBackgroundColor() {
        if(validFieldBackgroundColor == null) {
            updateEntryEditorColors();
        }
        return validFieldBackgroundColor;
    }

    //DOCEAR
    public static Color getEditorTextColor() {
        if(editorTextColor == null) {
            updateEntryEditorColors();
        }
        return editorTextColor;
    }




//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\JabRefPreferences.java
    //:124
    //DOCEAR: added argument to supply various packages to save the prefs
    public static JabRefPreferences getInstance(Class<?> c) {
        if (singleton == null)
            singleton = new JabRefPreferences(c);
        return singleton;
    }
    //DOCEAR: adapter
    private JabRefPreferences() {
        this(JabRef.class);
    }

    // The constructor is made private to enforce this as a singleton class:
    //DOCEAR: added argument to supply various packages to save the prefs
    private JabRefPreferences(Class<?> c) {


    //:838
        //DOCEAR: allow to set the LabelPattern save path with a different package
        private Class<?> labelPatternSaveClass = net.sf.jabref.labelPattern.LabelPattern.class;
        public void setLabelPatternSavePackage(Class<?> c) {
            this.labelPatternSaveClass = c;
        }

        //DOCEAR: allow to set the LabelPattern save path with a different package
        private Preferences getLabelPatternPreferences() {
            return Preferences.userNodeForPackage(this.labelPatternSaveClass);
        }    



//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\net\sf\jabref\plugin\PluginCore.java:190

            //DOCEAR changed from severe to warning 
            log
                .warning(Globals
                    .lang("Error in starting plug-in system. Starting without, but some functionality may be missing.") +
                    "\n" + e.getLocalizedMessage());


//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\spl\gui\ImportDialog.java
// lots of changes, don't know which belong to Docear ...



//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\spl\gui\MetaDataListDialog.java:155

                //FIXME: DOCEAR: use other classloader
                final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();                
                Thread.currentThread().setContextClassLoader(getClass().getClassLoader());              
                //...
                //FIXME: DOCEAR: reset classloader
                Thread.currentThread().setContextClassLoader(contextClassLoader);

//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\spl\PdfImporter.java
// lots of changes, don't know which belong to Docear ...

//Docear\Desktop\Jabref_Beta_2_7_Docear\src\java\spl\SplWebClient.java
// don't know what Docear changed...

@Joeran
Copy link
Contributor

Joeran commented Feb 5, 2016

Comparing it to the original JabRef release allows identifying necessary changes to integrate JabRef.

right :-)

It compiles!

wow, amazing :-)

Update files to JabRef 2.8

wouldn't it make more sense to use JabRef 3.2 ? https://github.com/JabRef/jabref/releases/tag/v3.2

@GeorgLink
Copy link
Contributor Author

Yes, 3.2 makes sense. But between 2.7 (Docear) and 3.2 are more changes
than were necessary for Docear. 2.8 was close enough (oldest version on
GitHub) to find Docear changes and get an idea for how to change JabRef to
make it work within Docear. With this knowledge 3.2 is next.
On Feb 5, 2016 5:03 AM, "Joeran" [email protected] wrote:

Comparing it to the original JabRef release allows identifying necessary
changes to integrate JabRef.
right :-)

It compiles!
wow, amazing :-)

Update files to JabRef 2.8
wouldn't it make more sense to use JabRef 3.2 ?
https://github.com/JabRef/jabref/releases/tag/v3.2


Reply to this email directly or view it on GitHub
#483 (comment).

@i2000s
Copy link

i2000s commented Oct 29, 2017

@GeorgLink Any hint on making JabRef 4.0 work for Docear? I feel you may be able to use submodule method to bring the fork of JabRef to Docear in a better way. But I have no experience with Docear development neither I can find a proper document to start with. Your branch link has been deleted on Github. Can you take a trial and I will follow up if I figure out what I can do for this direction. Thanks!

@GeorgLink
Copy link
Contributor Author

Hi @i2000s ,

Sorry, I cannot help.
I've not been involved with Docear in a while and don't have the time on hand to get back into.

@i2000s
Copy link

i2000s commented Nov 15, 2017

@GeorgLink No worry. My trial didn't work for now, but I'll wait for the Docear team to update JabRef when they have enough people. Thanks.

@koppor
Copy link

koppor commented Apr 9, 2020

@GeorgLink What a pity that your fork is not available any more. Think, the work is lost? If not, it would be helpful if you pushed your work to a branch here.

Meanwhile, I quickly sketched a data model how to store a (simple) mindmap inside JabRef (see koppor/jabref#433). Maybe, someone can step in here and work on it?

@GeorgLink
Copy link
Contributor Author

GeorgLink commented Apr 9, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants