rename to legacy component
This commit is contained in:
parent
1e1624541d
commit
568db9fc94
@ -8,7 +8,7 @@ import com.intellij.ui.components.JBScrollPane;
|
|||||||
import com.intellij.ui.components.JBTextField;
|
import com.intellij.ui.components.JBTextField;
|
||||||
|
|
||||||
import de.marhali.easyi18n.service.LegacyDataStore;
|
import de.marhali.easyi18n.service.LegacyDataStore;
|
||||||
import de.marhali.easyi18n.model.KeyedTranslation;
|
import de.marhali.easyi18n.model.LegacyKeyedTranslation;
|
||||||
import de.marhali.easyi18n.model.TranslationCreate;
|
import de.marhali.easyi18n.model.TranslationCreate;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@ -56,7 +56,7 @@ public class AddDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
TranslationCreate creation = new TranslationCreate(new KeyedTranslation(keyTextField.getText(), messages));
|
TranslationCreate creation = new TranslationCreate(new LegacyKeyedTranslation(keyTextField.getText(), messages));
|
||||||
LegacyDataStore.getInstance(project).processUpdate(creation);
|
LegacyDataStore.getInstance(project).processUpdate(creation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import com.intellij.ui.components.JBLabel;
|
|||||||
import com.intellij.ui.components.JBScrollPane;
|
import com.intellij.ui.components.JBScrollPane;
|
||||||
import com.intellij.ui.components.JBTextField;
|
import com.intellij.ui.components.JBTextField;
|
||||||
import de.marhali.easyi18n.service.LegacyDataStore;
|
import de.marhali.easyi18n.service.LegacyDataStore;
|
||||||
import de.marhali.easyi18n.model.KeyedTranslation;
|
import de.marhali.easyi18n.model.LegacyKeyedTranslation;
|
||||||
import de.marhali.easyi18n.model.TranslationDelete;
|
import de.marhali.easyi18n.model.TranslationDelete;
|
||||||
import de.marhali.easyi18n.model.TranslationUpdate;
|
import de.marhali.easyi18n.model.TranslationUpdate;
|
||||||
import de.marhali.easyi18n.dialog.descriptor.DeleteActionDescriptor;
|
import de.marhali.easyi18n.dialog.descriptor.DeleteActionDescriptor;
|
||||||
@ -26,12 +26,12 @@ import java.util.ResourceBundle;
|
|||||||
public class EditDialog {
|
public class EditDialog {
|
||||||
|
|
||||||
private final Project project;
|
private final Project project;
|
||||||
private final KeyedTranslation origin;
|
private final LegacyKeyedTranslation origin;
|
||||||
|
|
||||||
private JBTextField keyTextField;
|
private JBTextField keyTextField;
|
||||||
private Map<String, JBTextField> valueTextFields;
|
private Map<String, JBTextField> valueTextFields;
|
||||||
|
|
||||||
public EditDialog(Project project, KeyedTranslation origin) {
|
public EditDialog(Project project, LegacyKeyedTranslation origin) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ public class EditDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyedTranslation getChanges() {
|
private LegacyKeyedTranslation getChanges() {
|
||||||
Map<String, String> messages = new HashMap<>();
|
Map<String, String> messages = new HashMap<>();
|
||||||
|
|
||||||
valueTextFields.forEach((k, v) -> {
|
valueTextFields.forEach((k, v) -> {
|
||||||
@ -56,7 +56,7 @@ public class EditDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return new KeyedTranslation(keyTextField.getText(), messages);
|
return new LegacyKeyedTranslation(keyTextField.getText(), messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DialogBuilder prepare() {
|
private DialogBuilder prepare() {
|
||||||
|
@ -6,7 +6,7 @@ import com.intellij.psi.impl.FakePsiElement;
|
|||||||
|
|
||||||
import de.marhali.easyi18n.dialog.AddDialog;
|
import de.marhali.easyi18n.dialog.AddDialog;
|
||||||
import de.marhali.easyi18n.dialog.EditDialog;
|
import de.marhali.easyi18n.dialog.EditDialog;
|
||||||
import de.marhali.easyi18n.model.KeyedTranslation;
|
import de.marhali.easyi18n.model.LegacyKeyedTranslation;
|
||||||
import de.marhali.easyi18n.model.LocalizedNode;
|
import de.marhali.easyi18n.model.LocalizedNode;
|
||||||
import de.marhali.easyi18n.service.LegacyDataStore;
|
import de.marhali.easyi18n.service.LegacyDataStore;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ public class KeyReference extends PsiReferenceBase<PsiElement> {
|
|||||||
LocalizedNode node = LegacyDataStore.getInstance(getProject()).getTranslations().getNode(getKey());
|
LocalizedNode node = LegacyDataStore.getInstance(getProject()).getTranslations().getNode(getKey());
|
||||||
|
|
||||||
if(node != null) {
|
if(node != null) {
|
||||||
new EditDialog(getProject(), new KeyedTranslation(getKey(), node.getValue())).showAndHandle();
|
new EditDialog(getProject(), new LegacyKeyedTranslation(getKey(), node.getValue())).showAndHandle();
|
||||||
} else {
|
} else {
|
||||||
new AddDialog(getProject(), getKey()).showAndHandle();
|
new AddDialog(getProject(), getKey()).showAndHandle();
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,12 @@ import java.util.Map;
|
|||||||
* @author marhali
|
* @author marhali
|
||||||
*/
|
*/
|
||||||
@Deprecated // Might be deprecated
|
@Deprecated // Might be deprecated
|
||||||
public class KeyedTranslation {
|
public class LegacyKeyedTranslation {
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
private Map<String, String> translations;
|
private Map<String, String> translations;
|
||||||
|
|
||||||
public KeyedTranslation(String key, Map<String, String> translations) {
|
public LegacyKeyedTranslation(String key, Map<String, String> translations) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.translations = translations;
|
this.translations = translations;
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
* @author marhali
|
* @author marhali
|
||||||
*/
|
*/
|
||||||
public class TranslationCreate extends TranslationUpdate {
|
public class TranslationCreate extends TranslationUpdate {
|
||||||
public TranslationCreate(@NotNull KeyedTranslation translation) {
|
public TranslationCreate(@NotNull LegacyKeyedTranslation translation) {
|
||||||
super(null, translation);
|
super(null, translation);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
* @author marhali
|
* @author marhali
|
||||||
*/
|
*/
|
||||||
public class TranslationDelete extends TranslationUpdate {
|
public class TranslationDelete extends TranslationUpdate {
|
||||||
public TranslationDelete(@NotNull KeyedTranslation translation) {
|
public TranslationDelete(@NotNull LegacyKeyedTranslation translation) {
|
||||||
super(translation, null);
|
super(translation, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,19 +8,19 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class TranslationUpdate {
|
public class TranslationUpdate {
|
||||||
|
|
||||||
private final @Nullable KeyedTranslation origin;
|
private final @Nullable LegacyKeyedTranslation origin;
|
||||||
private final @Nullable KeyedTranslation change;
|
private final @Nullable LegacyKeyedTranslation change;
|
||||||
|
|
||||||
public TranslationUpdate(@Nullable KeyedTranslation origin, @Nullable KeyedTranslation change) {
|
public TranslationUpdate(@Nullable LegacyKeyedTranslation origin, @Nullable LegacyKeyedTranslation change) {
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
this.change = change;
|
this.change = change;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyedTranslation getOrigin() {
|
public LegacyKeyedTranslation getOrigin() {
|
||||||
return origin;
|
return origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyedTranslation getChange() {
|
public LegacyKeyedTranslation getChange() {
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package de.marhali.easyi18n.model.table;
|
package de.marhali.easyi18n.model.table;
|
||||||
|
|
||||||
import de.marhali.easyi18n.model.LocalizedNode;
|
import de.marhali.easyi18n.model.LocalizedNode;
|
||||||
import de.marhali.easyi18n.model.KeyedTranslation;
|
import de.marhali.easyi18n.model.LegacyKeyedTranslation;
|
||||||
import de.marhali.easyi18n.model.TranslationUpdate;
|
import de.marhali.easyi18n.model.TranslationUpdate;
|
||||||
import de.marhali.easyi18n.model.Translations;
|
import de.marhali.easyi18n.model.Translations;
|
||||||
|
|
||||||
@ -108,8 +108,8 @@ public class TableModelTranslator implements TableModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUpdate update = new TranslationUpdate(new KeyedTranslation(key, messages),
|
TranslationUpdate update = new TranslationUpdate(new LegacyKeyedTranslation(key, messages),
|
||||||
new KeyedTranslation(newKey, messages));
|
new LegacyKeyedTranslation(newKey, messages));
|
||||||
|
|
||||||
updater.accept(update);
|
updater.accept(update);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import de.marhali.easyi18n.model.LocalizedNode;
|
|||||||
import de.marhali.easyi18n.model.Translations;
|
import de.marhali.easyi18n.model.Translations;
|
||||||
import de.marhali.easyi18n.io.TranslatorIO;
|
import de.marhali.easyi18n.io.TranslatorIO;
|
||||||
import de.marhali.easyi18n.model.DataSynchronizer;
|
import de.marhali.easyi18n.model.DataSynchronizer;
|
||||||
import de.marhali.easyi18n.model.KeyedTranslation;
|
import de.marhali.easyi18n.model.LegacyKeyedTranslation;
|
||||||
import de.marhali.easyi18n.model.TranslationDelete;
|
import de.marhali.easyi18n.model.TranslationDelete;
|
||||||
import de.marhali.easyi18n.model.TranslationUpdate;
|
import de.marhali.easyi18n.model.TranslationUpdate;
|
||||||
import de.marhali.easyi18n.util.IOUtil;
|
import de.marhali.easyi18n.util.IOUtil;
|
||||||
@ -135,7 +135,7 @@ public class LegacyDataStore {
|
|||||||
|
|
||||||
// Parent is empty now, we need to remove it as well (except root)
|
// Parent is empty now, we need to remove it as well (except root)
|
||||||
if(node.getChildren().isEmpty() && !node.getKey().equals(LocalizedNode.ROOT_KEY)) {
|
if(node.getChildren().isEmpty() && !node.getKey().equals(LocalizedNode.ROOT_KEY)) {
|
||||||
processUpdate(new TranslationDelete(new KeyedTranslation(
|
processUpdate(new TranslationDelete(new LegacyKeyedTranslation(
|
||||||
TranslationsUtil.sectionsToFullPath(sections), null)));
|
TranslationsUtil.sectionsToFullPath(sections), null)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import de.marhali.easyi18n.service.LegacyDataStore;
|
|||||||
import de.marhali.easyi18n.model.LocalizedNode;
|
import de.marhali.easyi18n.model.LocalizedNode;
|
||||||
import de.marhali.easyi18n.model.DataSynchronizer;
|
import de.marhali.easyi18n.model.DataSynchronizer;
|
||||||
import de.marhali.easyi18n.model.Translations;
|
import de.marhali.easyi18n.model.Translations;
|
||||||
import de.marhali.easyi18n.model.KeyedTranslation;
|
import de.marhali.easyi18n.model.LegacyKeyedTranslation;
|
||||||
import de.marhali.easyi18n.model.TranslationDelete;
|
import de.marhali.easyi18n.model.TranslationDelete;
|
||||||
import de.marhali.easyi18n.model.table.TableModelTranslator;
|
import de.marhali.easyi18n.model.table.TableModelTranslator;
|
||||||
import de.marhali.easyi18n.dialog.EditDialog;
|
import de.marhali.easyi18n.dialog.EditDialog;
|
||||||
@ -57,7 +57,7 @@ public class TableView implements DataSynchronizer {
|
|||||||
LocalizedNode node = LegacyDataStore.getInstance(project).getTranslations().getNode(fullPath);
|
LocalizedNode node = LegacyDataStore.getInstance(project).getTranslations().getNode(fullPath);
|
||||||
|
|
||||||
if(node != null) {
|
if(node != null) {
|
||||||
new EditDialog(project, new KeyedTranslation(fullPath, node.getValue())).showAndHandle();
|
new EditDialog(project, new LegacyKeyedTranslation(fullPath, node.getValue())).showAndHandle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ public class TableView implements DataSynchronizer {
|
|||||||
String fullPath = String.valueOf(table.getValueAt(selectedRow, 0));
|
String fullPath = String.valueOf(table.getValueAt(selectedRow, 0));
|
||||||
|
|
||||||
LegacyDataStore.getInstance(project).processUpdate(
|
LegacyDataStore.getInstance(project).processUpdate(
|
||||||
new TranslationDelete(new KeyedTranslation(fullPath, null)));
|
new TranslationDelete(new LegacyKeyedTranslation(fullPath, null)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import de.marhali.easyi18n.service.LegacyDataStore;
|
|||||||
import de.marhali.easyi18n.model.LocalizedNode;
|
import de.marhali.easyi18n.model.LocalizedNode;
|
||||||
import de.marhali.easyi18n.model.DataSynchronizer;
|
import de.marhali.easyi18n.model.DataSynchronizer;
|
||||||
import de.marhali.easyi18n.model.Translations;
|
import de.marhali.easyi18n.model.Translations;
|
||||||
import de.marhali.easyi18n.model.KeyedTranslation;
|
import de.marhali.easyi18n.model.LegacyKeyedTranslation;
|
||||||
import de.marhali.easyi18n.model.TranslationDelete;
|
import de.marhali.easyi18n.model.TranslationDelete;
|
||||||
import de.marhali.easyi18n.model.tree.TreeModelTranslator;
|
import de.marhali.easyi18n.model.tree.TreeModelTranslator;
|
||||||
import de.marhali.easyi18n.action.treeview.CollapseTreeViewAction;
|
import de.marhali.easyi18n.action.treeview.CollapseTreeViewAction;
|
||||||
@ -103,7 +103,7 @@ public class TreeView implements DataSynchronizer {
|
|||||||
LocalizedNode localizedNode = LegacyDataStore.getInstance(project).getTranslations().getNode(fullPath);
|
LocalizedNode localizedNode = LegacyDataStore.getInstance(project).getTranslations().getNode(fullPath);
|
||||||
|
|
||||||
if(localizedNode != null) {
|
if(localizedNode != null) {
|
||||||
new EditDialog(project,new KeyedTranslation(fullPath, localizedNode.getValue())).showAndHandle();
|
new EditDialog(project,new LegacyKeyedTranslation(fullPath, localizedNode.getValue())).showAndHandle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ public class TreeView implements DataSynchronizer {
|
|||||||
String fullPath = TreeUtil.getFullPath(path);
|
String fullPath = TreeUtil.getFullPath(path);
|
||||||
|
|
||||||
LegacyDataStore.getInstance(project).processUpdate(
|
LegacyDataStore.getInstance(project).processUpdate(
|
||||||
new TranslationDelete(new KeyedTranslation(fullPath, null)));
|
new TranslationDelete(new LegacyKeyedTranslation(fullPath, null)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user