diff --git a/src/com/gpl/rpg/atcontentstudio/ui/Editor.java b/src/com/gpl/rpg/atcontentstudio/ui/Editor.java
index cd462a2..4175412 100644
--- a/src/com/gpl/rpg/atcontentstudio/ui/Editor.java
+++ b/src/com/gpl/rpg/atcontentstudio/ui/Editor.java
@@ -1,1120 +1,1108 @@
-package com.gpl.rpg.atcontentstudio.ui;
-
-import com.gpl.rpg.atcontentstudio.ATContentStudio;
-import com.gpl.rpg.atcontentstudio.Notification;
-import com.gpl.rpg.atcontentstudio.model.GameDataElement;
-import com.gpl.rpg.atcontentstudio.model.Project;
-import com.gpl.rpg.atcontentstudio.model.ProjectElementListener;
-import com.gpl.rpg.atcontentstudio.model.Workspace;
-import com.gpl.rpg.atcontentstudio.model.gamedata.*;
-import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
-import com.gpl.rpg.atcontentstudio.utils.WeblateIntegration;
-import com.jidesoft.swing.ComboBoxSearchable;
-import com.jidesoft.swing.JideBoxLayout;
-
-import javax.swing.*;
-import javax.swing.JSpinner.NumberEditor;
-import javax.swing.event.*;
-import javax.swing.text.DefaultFormatter;
-import javax.swing.text.JTextComponent;
-import java.awt.*;
-import java.awt.event.*;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-import java.util.*;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.regex.Matcher;
-
-public abstract class Editor extends JPanel implements ProjectElementListener {
-
- private static final long serialVersionUID = 241750514033596878L;
- private static final FieldUpdateListener nullListener = new FieldUpdateListener() {
- @Override
- public void valueChanged(JComponent source, Object value) {
- }
- };
-
- public static final String SAVE = "Save";
- public static final String DELETE = "Delete";
- public static final String REVERT = "Revert to original";
- public static final String ALTER = "Alter";
- public static final String GO_TO_ALTERED = "Go to altered";
-
-
- public static final String READ_ONLY_MESSAGE =
- "" +
- "This element is not modifiable.
" +
- "Click on the \"Alter\" button to create a writable copy." +
- "";
-
- public static final String ALTERED_EXISTS_MESSAGE =
- "" +
- "This element is not modifiable.
" +
- "A writable copy exists in this project. Click on \"Go to altered\" to open it." +
- "";
-
- public static final String ALTERED_MESSAGE =
- "" +
- "This element is a writable copy of an element of the referenced game source.
" +
- "Take care not to break existing content when modifying it." +
- "";
-
- public static final String CREATED_MESSAGE =
- "" +
- "This element is a creation of yours.
" +
- "Do as you please." +
- "";
-
-
- public String name = "Editor";
- public Icon icon = null;
- public GameDataElement target = null;
-
- public JLabel message = null;
-
-
- public static JTextField addLabelField(JPanel pane, String label, String value) {
- return addTextField(pane, label, value, false, nullListener);
- }
-
- public static void addTranslationPane(JPanel pane, final JTextComponent tfComponent, final String initialValue) {
- if (Workspace.activeWorkspace.settings.translatorLanguage.getCurrentValue() != null) {
- JPanel labelPane = new JPanel();
- labelPane.setLayout(new JideBoxLayout(labelPane, JideBoxLayout.LINE_AXIS, 6));
- final JLabel translateLinkLabel = new JLabel(getWeblateLabelLink(initialValue));
- labelPane.add(translateLinkLabel, JideBoxLayout.FIX);
- labelPane.add(new JLabel(" "), JideBoxLayout.FIX);
- final JLabel translationStatus = new JLabel("Retrieving...");
- translationStatus.setIcon(new ImageIcon(DefaultIcons.getStatusUnknownIcon()));
- translationStatus.setToolTipText("Connecting to weblate...");
- labelPane.add(translationStatus, JideBoxLayout.VARY);
- new Thread() {
- public void run() {
- WeblateIntegration.WeblateTranslationUnit unit = WeblateIntegration.getTranslationUnit(initialValue);
- switch (unit.status) {
- case absent:
- translationStatus.setIcon(new ImageIcon(DefaultIcons.getStatusRedIcon()));
- translationStatus.setToolTipText("This string isn't managed by weblate (yet).");
- break;
- case done:
- translationStatus.setIcon(new ImageIcon(DefaultIcons.getStatusGreenIcon()));
- translationStatus.setToolTipText("This string is translated on weblate.");
- break;
- case fuzzy:
- translationStatus.setIcon(new ImageIcon(DefaultIcons.getStatusOrangeIcon()));
- translationStatus.setToolTipText("This string is translated on weblate, but needs a review.");
- break;
- case notTranslated:
- translationStatus.setIcon(new ImageIcon(DefaultIcons.getStatusRedIcon()));
- translationStatus.setToolTipText("This string isn't translated in your language on weblate yet.");
- break;
- case warning:
- translationStatus.setIcon(new ImageIcon(DefaultIcons.getStatusOrangeIcon()));
- translationStatus.setToolTipText("This string is translated on weblate, but triggered some weblate checks.");
- break;
- case error:
- translationStatus.setIcon(new ImageIcon(DefaultIcons.getStatusRedIcon()));
- translationStatus.setToolTipText("Cannot connect to weblate. Check internet connection and firewall settings.");
- break;
- case notAllowed:
- translationStatus.setIcon(new ImageIcon(DefaultIcons.getStatusBlueIcon()));
- translationStatus.setToolTipText("You have not allowed ATCS to access to internet. You can change this in the workspace settings.");
- break;
- }
- translationStatus.setText(unit.translatedText);
- }
-
- }.start();
- pane.add(labelPane, JideBoxLayout.FIX);
- tfComponent.getDocument().addDocumentListener(new DocumentListener() {
- @Override
- public void removeUpdate(DocumentEvent e) {
- translateLinkLabel.setText(getWeblateLabelLink(tfComponent.getText().replaceAll("\n", Matcher.quoteReplacement("\n"))));
- translateLinkLabel.revalidate();
- translateLinkLabel.repaint();
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- translateLinkLabel.setText(getWeblateLabelLink(tfComponent.getText().replaceAll("\n", Matcher.quoteReplacement("\n"))));
- translateLinkLabel.revalidate();
- translateLinkLabel.repaint();
- }
-
- @Override
- public void changedUpdate(DocumentEvent e) {
- translateLinkLabel.setText(getWeblateLabelLink(tfComponent.getText().replaceAll("\n", Matcher.quoteReplacement("\n"))));
- translateLinkLabel.revalidate();
- translateLinkLabel.repaint();
- }
- });
- translateLinkLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
- translateLinkLabel.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1) {
- try {
- Desktop.getDesktop().browse(new URI(WeblateIntegration.getWeblateLabelURI(tfComponent.getText().replaceAll("\n", Matcher.quoteReplacement("\n")))));
- } catch (IOException e1) {
- e1.printStackTrace();
- } catch (URISyntaxException e1) {
- e1.printStackTrace();
- }
- }
- }
- });
- }
- }
-
- public static JTextField addTranslatableTextField(JPanel pane, String label, String initialValue, boolean editable, final FieldUpdateListener listener) {
- final JTextField tfField = addTextField(pane, label, initialValue, editable, listener);
- addTranslationPane(pane, tfField, initialValue);
- return tfField;
- }
-
- public static String getWeblateLabelLink(String text) {
- return "Translate on weblate";
- }
-
- public static JTextField addTextField(JPanel pane, String label, String initialValue, boolean editable, final FieldUpdateListener listener) {
- final JTextField tfField = new JTextField(initialValue);
- addTextComponent(pane, label, editable, listener, tfField, false, false);
- tfField.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- listener.valueChanged(tfField, tfField.getText());
- }
- });
- return tfField;
- }
- public static T addTextComponent(JPanel pane, String label, boolean editable, final FieldUpdateListener listener, T tfField, boolean specialNewLinesHandling, boolean scrollable) {
- JPanel tfPane = new JPanel();
- tfPane.setLayout(new JideBoxLayout(tfPane, JideBoxLayout.LINE_AXIS, 6));
- JLabel tfLabel = new JLabel(label);
- tfPane.add(tfLabel, JideBoxLayout.FIX);
- tfField.setEditable(editable);
- JComponent component;
- if (scrollable){
- component = new JScrollPane(tfField);
- }else{
- component = tfField;
- }
- tfPane.add(component, JideBoxLayout.VARY);
- JButton nullify = new JButton(new ImageIcon(DefaultIcons.getNullifyIcon()));
- tfPane.add(nullify, JideBoxLayout.FIX);
- nullify.setEnabled(editable);
- pane.add(tfPane, JideBoxLayout.FIX);
-
- nullify.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- tfField.setText("");
- listener.valueChanged(tfField, null);
- }
- });
- tfField.getDocument().addDocumentListener(new DocumentListener() {
- @Override
- public void removeUpdate(DocumentEvent e) {
- String text = tfField.getText();
- if(specialNewLinesHandling) text = text.replaceAll("\n", Matcher.quoteReplacement("\n"));
- listener.valueChanged(tfField, text);
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- String text = tfField.getText();
- if(specialNewLinesHandling) text = text.replaceAll("\n", Matcher.quoteReplacement("\n"));
- listener.valueChanged(tfField, text);
- }
-
- @Override
- public void changedUpdate(DocumentEvent e) {
- String text = tfField.getText();
- if(specialNewLinesHandling) text = text.replaceAll("\n", Matcher.quoteReplacement("\n"));
- listener.valueChanged(tfField, text);
- }
- });
- return tfField;
- }
-
-
- public static JTextArea addTranslatableTextArea(JPanel pane, String label, String initialValue, boolean editable, final FieldUpdateListener listener) {
- final JTextArea tfArea = addTextArea(pane, label, initialValue, editable, listener);
- addTranslationPane(pane, tfArea, initialValue);
- return tfArea;
- }
-
- public static JTextArea addTextArea(JPanel pane, String label, String initialValue, boolean editable, final FieldUpdateListener listener) {
- String text = initialValue == null ? "" : initialValue.replaceAll("\\n", "\n");
- final JTextArea tfArea = new JTextArea(text);
- tfArea.setRows(2);
- tfArea.setLineWrap(true);
- tfArea.setWrapStyleWord(true);
-
- addTextComponent(pane, label, editable, listener, tfArea, true, true);
- return tfArea;
- }
-
-// public static JSpinner addIntegerField(JPanel pane, String label, Integer initialValue, boolean allowNegatives, boolean editable) {
-// return addIntegerField(pane, label, initialValue, allowNegatives, editable, nullListener);
-// }
-
- public static JSpinner addIntegerField(JPanel pane, String label, Integer initialValue, boolean allowNegatives, boolean editable, final FieldUpdateListener listener) {
- return addIntegerField(pane, label, initialValue, 0, allowNegatives, editable, listener);
- }
-
- public static > JSpinner addNumberField(JPanel pane, String label, boolean editable, final FieldUpdateListener listener, T minimum, T maximum, Number stepSize, Number value, Number defaultValue) {
- JPanel tfPane = new JPanel();
- tfPane.setLayout(new JideBoxLayout(tfPane, JideBoxLayout.LINE_AXIS, 6));
- JLabel tfLabel = new JLabel(label);
- tfPane.add(tfLabel, JideBoxLayout.FIX);
- if (!(((minimum == null) || (((Comparable