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

Fix linux file opening by using Process Builder #8853

Merged
merged 13 commits into from
Jun 5, 2022
Merged

Conversation

Siedlerchr
Copy link
Member

@Siedlerchr Siedlerchr commented May 26, 2022

Fixes #8679
Fixes #8849

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@Siedlerchr
Copy link
Member Author

Terminal opening works, but it doesn't openin the folder, althought directly executing the following command works:
`gnome-terminal --working-directory="/home/xxx/xxxxxr/00 xxxx xxx xx"

`

@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label May 26, 2022
@Siedlerchr Siedlerchr requested a review from btut May 30, 2022 16:21
Copy link
Contributor

@btut btut left a comment

Choose a reason for hiding this comment

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

Is there a particular reason you want to change to ProcessBuilder?

src/main/java/org/jabref/gui/desktop/os/Linux.java Outdated Show resolved Hide resolved
@btut
Copy link
Contributor

btut commented May 31, 2022

Sorry for not giving credit, I somehow screwed up the co-authored-by.

@ThiloteE
Copy link
Member

@btut Ok, I did a short test after you did the split: Linux Mint Cinnamon 20.3 with Nemo filemanager on first glance works perfectly :-)

Process p = runtime.exec("readlink /etc/alternatives/x-terminal-emulator");
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));

String emulatorName = reader.readLine();
Copy link
Contributor

Choose a reason for hiding this comment

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

I get null here. I think /etc/alternatives is a Debian thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe if (Files.exists(/etc/alternatives...) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but what if it does not exist? What terminal emulator do we choose then?

Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out there is no real solution, just checking multiple places https://superuser.com/a/1461079

Copy link
Contributor

Choose a reason for hiding this comment

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

So how do we proceed? Leave it as is? Show an alert message that we cannot determine a TE?
Do you think this is a feature that many people use?

Copy link
Member Author

Choose a reason for hiding this comment

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

Show an alert message. Unable to open terminal. I doubt many use this

@ilippert
Copy link
Contributor

ilippert commented Jun 1, 2022

as per #8849 (comment): the fix works on Fedora's default Gnome, too.

* upstream/main:
  Add an importer for Citavi backup files (#8848)
  Reviewdoc: Comment on PRs (#8878)
  Squashed 'buildres/csl/csl-styles/' changes from 649aac4..e740261
  Use JDK 15 text blocks to improve injected languages readability (#8874)
  Fix fetcher tests (#8877)
  Fix #8390 by allowing multiple group deletion for Remove groups > Kee… (#8875)
  Add restart warning on SSL configuration change (#8871)
  Update to lucene 9.2 (#8868)
  Fix for removing several groups deletes only one of them (#8801)
  Disable Write XMP Button in General tab of Entry-Editor when action is in progress (#8728)
  Bump jsoup from 1.14.3 to 1.15.1 (#8864)
  Bump unirest-java from 3.13.8 to 3.13.10 (#8869)
  Bump unoloader from 7.3.2 to 7.3.3 (#8863)
  Bump pascalgn/automerge-action from 0.15.2 to 0.15.3 (#8860)
  Bump classgraph from 4.8.146 to 4.8.147 (#8861)
  Bump mockito-core from 4.5.1 to 4.6.0 (#8862)
  Lucence dir checkers should only delete lucence dirs (#8854)
  Update README.md (#8858)
  Update adr.md
  Update adr.md
Set directory for terminal
cmd = new String[] {emulatorName, absolutePath};
}

ProcessBuilder builder = new ProcessBuilder(cmd);
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [reviewdog] <com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck> reported by reviewdog 🐶
Use a single space to separate non-whitespace characters.

this.databaseContext = databaseContext;
this.dialogService = dialogService;
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [reviewdog] <com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck> reported by reviewdog 🐶
Use a single space to separate non-whitespace characters.

@@ -51,7 +53,7 @@ private void initialize() {
ActionFactory factory = new ActionFactory(preferences.getKeyBindingRepository());
EasyBind.subscribe(viewModel.selectedFetcherProperty(), fetcher -> {
if ((fetcher != null) && fetcher.getHelpPage().isPresent()) {
Button helpButton = factory.createIconButton(StandardActions.HELP, new HelpAction(fetcher.getHelpPage().get()));
Button helpButton = factory.createIconButton(StandardActions.HELP, new HelpAction(fetcher.getHelpPage().get(),dialogService));
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [reviewdog] <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck> reported by reviewdog 🐶
',' is not followed by whitespace.

@Siedlerchr
Copy link
Member Author

TODO: l10n Could\ not\ detect\ terminal\ automatically.\ Please\ define\ a\ custom\ terminal\ in\ the\ preferences.=Could not detect terminal automatically. Please define a custom terminal in the preferences.

@calixtus
Copy link
Member

calixtus commented Jun 1, 2022

reveal in file explorer works with arch linux, kde and dolphin,
what does not work here is open terminal here with only konsole installed instead of xterm.

@Siedlerchr Siedlerchr merged commit 35cd5d0 into main Jun 5, 2022
@Siedlerchr Siedlerchr deleted the fileManager branch June 5, 2022 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external files os: linux status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers ui
Projects
None yet
5 participants