-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56577b5
commit 1b545e4
Showing
37 changed files
with
1,897 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
23 changes: 23 additions & 0 deletions
23
src/main/java/org/jabref/gui/actions/DisconnectFromSharelatexAction.java
This file contains 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
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(); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/org/jabref/gui/actions/SendChangesToShareLatexAction.java
This file contains 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
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"); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/org/jabref/gui/actions/SynchronizeWithShareLatexAction.java
This file contains 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
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()); | ||
|
||
} | ||
} |
This file contains 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
54 changes: 54 additions & 0 deletions
54
src/main/java/org/jabref/gui/sharelatex/ShareLatexLoginDialogController.java
This file contains 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
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); | ||
|
||
} | ||
|
||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/org/jabref/gui/sharelatex/ShareLatexLoginDialogView.java
This file contains 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
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(); | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/jabref/gui/sharelatex/ShareLatexLoginDialogViewModel.java
This file contains 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
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 | ||
} |
Oops, something went wrong.