-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add option for direct attached file renaming #4887
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
Conversation
| .load() | ||
| .setAsContent(this.getDialogPane()); | ||
|
|
||
| this.getDialogPane().getButtonTypes().addAll(ButtonType.APPLY, ButtonType.CANCEL); |
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.
you can put these directly in the fxml, see some other fxml files. But don't forget the ButtonType import declaration in the fxml
|
Thanks for the contribution, for the dialog I think it would make more sense to actually only change the filename and not the whole path. This would be confusing And I would rename the link label to "New Filename" |
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.
Thanks for your contribution.
| } | ||
|
|
||
| public void renameFile() { | ||
| LinkedFileRenameDialogView dialog = new LinkedFileRenameDialogView(this.linkedFile); |
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.
I'm really sorry for your work, but in my opinion a simple TextInputDialog should be sufficient (instead of a custom dialog):
| public Optional<String> showInputDialogAndWait(String title, String content) { |
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.
@tobiasdiez A TextInputDialog does not have a browse button....
| Path subPath = Paths.get(oldFile).subpath(0, nameCount - 1); | ||
| Optional<LinkedFile> editedFile = dialog.showAndWait(); | ||
| editedFile.ifPresent(file -> { | ||
| String newFile = System.getProperty("file.separator") + subPath.toString() + System.getProperty("file.separator") + file.getLink(); |
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.
You can use the Path.resolveSibling method to construct the new path more easily.
Add RENAME action on Standard Actions and add an item for it on the right click menu of the Base Panel. Signed-off-by: kaiquekk <[email protected]>
Signed-off-by: yurickyh <[email protected]>
Signed-off-by: kaiquekk <[email protected]>
Remove the Rename button from the main table and add it on the linked files editor table. Signed-off-by: kaiquekk <[email protected]>
Signed-off-by: yurickyh <[email protected]>
Signed-off-by: yurickyh <[email protected]>
Signed-off-by: yurickyh <[email protected]>
Signed-off-by: yurickyh <[email protected]>
Signed-off-by: yurickyh <[email protected]>
Signed-off-by: kaiquekk <[email protected]>
Signed-off-by: kaiquekk <[email protected]>
Change the attached file rename dialog to only alter the filename and not the whole file path. Signed-off-by: kaiquekk <[email protected]>
Signed-off-by: kaiquekk <[email protected]>
…ecreased. Signed-off-by: yurickyh <[email protected]>
…re converted to ButtonType. Signed-off-by: yurickyh <[email protected]>
Signed-off-by: kaiquekk <[email protected]>
Signed-off-by: kaiquekk <[email protected]>
3748c65 to
169af5c
Compare
Signed-off-by: kaiquekk <[email protected]>
|
As the intention is to only rename the file and not change the link, we thought that it makes sense to only have the textfield on the dialog. So, we changed it to a simple TextInputDialog like @tobiasdiez requested. |
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.
Thanks for the follow-up!
But now I have another request ;-) Could you please add the old file name as the default text in the TextInputDialog?
As this option is currently not available in our DialogService I would suggest to add another method Optional<String> showInputDialogWithDefaultAndWait(String title, String content, String defaultValue);
As this is directly support by Java FX's TextInputDialog the implementation of the method is super easy.
Another aspect: looking at the screenshots I think we should consider relabeling also the old "Rename file" option - because for me this is not really self-explanatory. What about "Rename file to defined pattern"? Or "Rename to pattern" to have it shorter?
@tobiasdiez, @Siedlerchr WDYT?
Best regards,
Matthias
|
@kaiquekk Thanks for the follow-up! |
Signed-off-by: yurickyh <[email protected]>
…extfield the old filename. Signed-off-by: yurickyh <[email protected]>
Signed-off-by: yurickyh <[email protected]>
…ndWait. Signed-off-by: yurickyh <[email protected]>
Signed-off-by: yurickyh <[email protected]>
|
@tobiasdiez @matthiasgeiger : Thanks for your reply. We implemented what you suggested, so the text field has the old filename as its default value. Also, the 'Rename file' option was changed to 'Rename file to defined pattern' as asked. |
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.
Perfect! Thank you very much!
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.
Thanks again



Add option on the Linked File Editor context menu to directly rename an entry's attached file. The option opens a dialog with a textfield that allows to change the name or the path of the attached file.
This PR fixes #4844