inline rename with shift f6
This commit is contained in:
parent
54889fb4c1
commit
1a71db41d7
@ -94,6 +94,38 @@ public class AppConfig {
|
||||
properties.setProperty("window.maximized", String.valueOf(maximized));
|
||||
}
|
||||
|
||||
public int getFileEditorX() {
|
||||
return Integer.parseInt(properties.getProperty("fileeditor.x", "150"));
|
||||
}
|
||||
|
||||
public void setFileEditorX(int x) {
|
||||
properties.setProperty("fileeditor.x", String.valueOf(x));
|
||||
}
|
||||
|
||||
public int getFileEditorY() {
|
||||
return Integer.parseInt(properties.getProperty("fileeditor.y", "150"));
|
||||
}
|
||||
|
||||
public void setFileEditorY(int y) {
|
||||
properties.setProperty("fileeditor.y", String.valueOf(y));
|
||||
}
|
||||
|
||||
public int getFileEditorWidth() {
|
||||
return Integer.parseInt(properties.getProperty("fileeditor.width", "800"));
|
||||
}
|
||||
|
||||
public void setFileEditorWidth(int width) {
|
||||
properties.setProperty("fileeditor.width", String.valueOf(width));
|
||||
}
|
||||
|
||||
public int getFileEditorHeight() {
|
||||
return Integer.parseInt(properties.getProperty("fileeditor.height", "600"));
|
||||
}
|
||||
|
||||
public void setFileEditorHeight(int height) {
|
||||
properties.setProperty("fileeditor.height", String.valueOf(height));
|
||||
}
|
||||
|
||||
public String getActivePanel() {
|
||||
return properties.getProperty("active.panel", "left");
|
||||
}
|
||||
|
||||
@ -65,8 +65,12 @@ public class FileEditor extends JDialog {
|
||||
|
||||
// Final window positioning and visibility - only set default size if NOT an image
|
||||
if (!isImageFile(file)) {
|
||||
setSize(800, 600);
|
||||
setSize(config.getFileEditorWidth(), config.getFileEditorHeight());
|
||||
if (config.getFileEditorX() == 150 && config.getFileEditorY() == 150) {
|
||||
setLocationRelativeTo(parent);
|
||||
} else {
|
||||
setLocation(config.getFileEditorX(), config.getFileEditorY());
|
||||
}
|
||||
}
|
||||
|
||||
// Intercept window close (X) so we run the same save-confirm flow as other close actions
|
||||
@ -1036,7 +1040,18 @@ public class FileEditor extends JDialog {
|
||||
}
|
||||
}
|
||||
|
||||
private void saveWindowState() {
|
||||
if (!isImageFile(file)) {
|
||||
config.setFileEditorX(this.getX());
|
||||
config.setFileEditorY(this.getY());
|
||||
config.setFileEditorWidth(this.getWidth());
|
||||
config.setFileEditorHeight(this.getHeight());
|
||||
config.saveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
private void closeEditor() {
|
||||
saveWindowState();
|
||||
if (!readOnly && modified) {
|
||||
int result = showSaveConfirmDialog("Soubor byl změněn. Uložit změny?", "Neuložené změny");
|
||||
|
||||
|
||||
@ -76,6 +76,23 @@ public class FilePanelTab extends JPanel {
|
||||
|
||||
/** Start inline rename for currently selected item (if single selection). */
|
||||
public void startInlineRename() {
|
||||
// If already editing, special logic: select filename without extension
|
||||
if (fileTable.isEditing()) {
|
||||
Component ed = fileTable.getEditorComponent();
|
||||
if (ed instanceof JTextField) {
|
||||
JTextField tf = (JTextField) ed;
|
||||
String text = tf.getText();
|
||||
int lastDot = text.lastIndexOf('.');
|
||||
if (lastDot > 0) { // Found a dot, and it's not the first character
|
||||
tf.setSelectionStart(0);
|
||||
tf.setSelectionEnd(lastDot);
|
||||
} else {
|
||||
tf.selectAll();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine selected row/column according to view mode
|
||||
int selRow = fileTable.getSelectedRow();
|
||||
if (selRow < 0) return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user