Skip to content

Open statistics dialog from correct thread#3272

Merged
tobiasdiez merged 1 commit into
JabRef:masterfrom
michaellass:fix-stats-dialog
Oct 7, 2017
Merged

Open statistics dialog from correct thread#3272
tobiasdiez merged 1 commit into
JabRef:masterfrom
michaellass:fix-stats-dialog

Conversation

@michaellass

Copy link
Copy Markdown
Contributor

The dialog to ask for collecting anonymous statistics needs to be created in
the Swing EDT. Do so using SwingUtilities.invokeLater().

This is a follow-up on 7ef2b3a and should finally fix #2955.

No addition to CHANGELOG.md as 7ef2b3a already included a corresponding entry.

  • Change in CHANGELOG.md described
  • Tests created for changes
  • Screenshots added (for bigger UI changes)
  • Manually tested changed features in running JabRef
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)
  • If you changed the localization: Did you run gradle localizationUpdate?

@Override
public void run() {
DefaultTaskExecutor.runInJavaFXThread(JabRefFrame.this::showTrackingNotification);
SwingUtilities.invokeLater(new Runnable() {

@Siedlerchr Siedlerchr Oct 6, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if you could convert this to a lambda expression. (Unfortunately this lamdba styles is not possible with the timer task)
Just:

    SwingUtilities.invokeLater(() -> {
                        DefaultTaskExecutor.runInJavaFXThread(JabRefFrame.this::showTrackingNotification);
                    });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this definitely looks cleaner. Applied and re-tested.

The dialog to ask for collecting anonymous statistics needs to be created in
the Swing EDT. Do so using SwingUtilities.invokeLater().

This is a follow-up on 7ef2b3a and should finally fix JabRef#2955.
@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Oct 6, 2017

@tobiasdiez tobiasdiez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What the heck is this: first you run it in a new thread, then move it to the swing thread and finally invoke it actually in the JavaFX thread. Ok...if it works.

@tobiasdiez tobiasdiez merged commit 85363d0 into JabRef:master Oct 7, 2017
Siedlerchr added a commit that referenced this pull request Oct 7, 2017
* upstream/master: (113 commits)
  Open statistics dialog from correct thread (#3272)
  Fix for issue 2811: bibtexkey generator does not use crossref information (#3248)
  Fix for issue 3143: Import entry from clipboard in different formats (#3243)
  French translation correction (#3262)
  Wait to ask to collect anonymous statistics in JabRefExecutorService to allow jvm to terminate (#3266)
  Directory pattern bracketed expressions (#3238)
  Show development information
  Release v4.0
  add another author to mailmap
  moved changelog entry to the right category
  update new AUTHORS info
  Update log4j from 2.9.0 -> 2.9.1
  fix dblp fetcher
  Add missing Turkish translation
  Add "-console" parameter for Windows launcher (#3242)
  Path check converted to if statement
  Changelog updated
  Fixed renaming files which are not in main directory.
  Only use last name for auto completion in search bar. Fixes JabRef#253
  Implemented issue #3229 (#3233)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jabre-4.x does not exit cleanly

3 participants