-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[WIP] Sharelatex Integration #2866
Changes from 3 commits
1b545e4
db29578
446d914
867679d
418aaad
74ce5b9
0222168
6e64369
0af05f0
67f08a9
48dc385
c360278
e45e206
a9d1632
fac2c3d
74151de
c91fe49
06685dd
23bf919
dfe262d
ada867a
a8855fa
093140a
855cd54
49b2c41
65f7bb2
b6d2984
4920b9f
10f1bad
3eadbfb
0ae5f11
172a03e
61177b2
99aaa1f
954f3ab
4223da5
61a97a0
23a49da
d473102
961a97d
9e5e176
cd82f04
8f214f1
017f40e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,7 @@ dependencies { | |
compile 'org.controlsfx:controlsfx:8.40.14' | ||
|
||
compile 'org.jsoup:jsoup:1.10.3' | ||
|
||
compile 'com.mashape.unirest:unirest-java:1.4.9' | ||
|
||
compile 'commons-logging:commons-logging:1.2' | ||
|
@@ -129,6 +130,12 @@ dependencies { | |
compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '1.0.9' | ||
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '1.0.9' | ||
|
||
compile "org.glassfish.tyrus.bundles:tyrus-standalone-client:1.13.1" | ||
compile "org.glassfish.tyrus.ext:tyrus-extension-deflate:1.13.1" | ||
|
||
compile "com.google.code.gson:gson:2.8.0" | ||
compile "org.bitbucket.cowwoc:diff-match-patch:1.1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need another diff library? Can't we use the diff library already used in the merge entries dialog? It is OK, if we do. Then, please explain it somehow. Preferrably using MADR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is diff library is the same which is used on the server side of sharelatex |
||
|
||
testCompile 'junit:junit:4.12' | ||
testCompile 'org.mockito:mockito-core:2.10.0' | ||
testCompile 'com.github.tomakehurst:wiremock:2.8.0' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.jabref.gui.actions; | ||
|
||
import java.awt.event.ActionEvent; | ||
|
||
import javax.swing.AbstractAction; | ||
import javax.swing.Action; | ||
|
||
import org.jabref.Globals; | ||
|
||
public class DisconnectFromSharelatexAction extends AbstractAction { | ||
|
||
public DisconnectFromSharelatexAction() { | ||
super(); | ||
putValue(Action.NAME, "Disconnect from ShareLaTeX"); | ||
|
||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
Globals.shareLatexManager.disconnectAndCloseConnection(); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.jabref.gui.actions; | ||
|
||
import java.awt.event.ActionEvent; | ||
|
||
import javax.swing.AbstractAction; | ||
import javax.swing.Action; | ||
|
||
import org.jabref.Globals; | ||
import org.jabref.gui.StateManager; | ||
import org.jabref.logic.sharelatex.ShareLatexManager; | ||
|
||
public class SendChangesToShareLatexAction extends AbstractAction { | ||
|
||
public SendChangesToShareLatexAction() { | ||
super(); | ||
putValue(Action.NAME, "Send changes to ShareLaTeX Server"); | ||
|
||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
|
||
ShareLatexManager manager = Globals.shareLatexManager; | ||
StateManager stateManager = Globals.stateManager; | ||
manager.sendNewDatabaseContent(stateManager.getActiveDatabase().get()); | ||
System.out.println("Send changes"); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.jabref.gui.actions; | ||
|
||
import java.awt.event.ActionEvent; | ||
|
||
import javax.swing.AbstractAction; | ||
import javax.swing.Action; | ||
|
||
import javafx.application.Platform; | ||
|
||
import org.jabref.gui.IconTheme; | ||
import org.jabref.gui.sharelatex.ShareLatexLoginDialogView; | ||
|
||
public class SynchronizeWithShareLatexAction extends AbstractAction { | ||
|
||
public SynchronizeWithShareLatexAction() { | ||
super(); | ||
putValue(Action.NAME, "Synchronize with ShareLaTeX"); | ||
putValue(Action.SMALL_ICON, IconTheme.getImage("sharelatex")); | ||
putValue(Action.SHORT_DESCRIPTION, "Synchronize with ShareLaTeX"); | ||
|
||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
Platform.runLater(() -> new ShareLatexLoginDialogView().show()); | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.jabref.gui.sharelatex; | ||
|
||
import javax.inject.Inject; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Alert.AlertType; | ||
import javafx.scene.control.PasswordField; | ||
import javafx.scene.control.TextField; | ||
|
||
import org.jabref.gui.AbstractController; | ||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.FXDialog; | ||
import org.jabref.gui.FXDialogService; | ||
import org.jabref.logic.sharelatex.ShareLatexManager; | ||
|
||
public class ShareLatexLoginDialogController extends AbstractController<ShareLatexLoginDialogViewModel> { | ||
|
||
@FXML private TextField tbAddress; | ||
@FXML private TextField tbUsername; | ||
@FXML private PasswordField pfPassword; | ||
@Inject private ShareLatexManager manager; | ||
|
||
@FXML | ||
private void initialize() { | ||
viewModel = new ShareLatexLoginDialogViewModel(); | ||
} | ||
|
||
@FXML | ||
private void closeDialog() { | ||
getStage().close(); | ||
} | ||
|
||
@FXML | ||
private void signIn() { | ||
|
||
try { | ||
String result = manager.login(tbAddress.getText(), tbUsername.getText(), pfPassword.getText()); | ||
if (result.contains("incorrect")) { | ||
FXDialog dlg = new FXDialog(AlertType.ERROR); | ||
dlg.setContentText("Your email or password is incorrect. Please try again"); | ||
dlg.showAndWait(); | ||
} else { | ||
ShareLatexProjectDialogView dlgprojects = new ShareLatexProjectDialogView(); | ||
dlgprojects.show(); | ||
closeDialog(); | ||
} | ||
} catch (Exception e) { | ||
DialogService dlg = new FXDialogService(); | ||
dlg.showErrorDialogAndWait(e); | ||
|
||
} | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.jabref.gui.sharelatex; | ||
|
||
import javafx.scene.control.Alert.AlertType; | ||
import javafx.scene.control.DialogPane; | ||
|
||
import org.jabref.gui.AbstractDialogView; | ||
import org.jabref.gui.FXDialog; | ||
|
||
public class ShareLatexLoginDialogView extends AbstractDialogView { | ||
|
||
@Override | ||
public void show() { | ||
FXDialog sharelatexProjectDialog = new FXDialog(AlertType.INFORMATION, "Sharelatex Project Dialog"); | ||
sharelatexProjectDialog.setDialogPane((DialogPane) this.getView()); | ||
sharelatexProjectDialog.setResizable(true); | ||
sharelatexProjectDialog.show(); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.jabref.gui.sharelatex; | ||
|
||
import org.jabref.gui.AbstractViewModel; | ||
|
||
public class ShareLatexLoginDialogViewModel extends AbstractViewModel { | ||
//default construtor used | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have another JSON library in JabRef? Maybe via unirest-java?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have Guava. And gson is a much better json library than the default implementation