public class StringResources {
    private HashMap<String, String> strings;

    private static StringResources instance = null;


    private StringResources() {
        this.strings = new HashMap<String, String>();
        strings.put("app_name", _("Περιβάλλον Ανάπτυξης Για Τη ΓΛΩΣΣΑ"));
        strings.put("app_version", "0.0.6");

        strings.put("file", _("_Αρχείο"));
        strings.put("file_new", _("_Δημιουργία"));
        strings.put("tooltip_file_new", _("Δημιουργία νέου αρχείου"));
        strings.put("file_open", _("_Άνοιγμα"));
        strings.put("tooltip_file_open", _("Άνοιγμα αρχείου"));
        strings.put("file_save", _("Α_ποθήκευση"));
        strings.put("tooltip_file_save", _("Αποθήκευση αρχείου"));
        strings.put("file_save_as", _("Απ_οθήκευση Ως..."));
        strings.put("tooltip_file_save_as", _("Αποθήκευση αρχείου ως..."));
        strings.put("export_html", _("Εξα_γωγή ως έγγραφο HTML..."));
        strings.put("tooltip_export_html",_("Εξαγωγή ως έγγραφο HTML..."));
        strings.put("file_print", _("_Εκτύπωση"));
        strings.put("tooltip_file_print", _("Εκτύπωση αρχείου"));
        strings.put("app_exit", _("Έ_ξοδος"));

        strings.put("edit", _("_Επεξεργασία"));
        strings.put("edit_undo", _("_Αναίρεση"));
        strings.put("tooltip_edit_undo", _("Αναίρεση"));
        strings.put("edit_redo", _("Α_κύρωση αναίρεσης"));
        strings.put("tooltip_edit_redo", _("Ακύρωση αναίρεσης"));
        strings.put("edit_cut", _("Α_ποκοπή"));
        strings.put("tooltip_edit_cut", _("Αποκοπή"));
        strings.put("edit_copy", _("Α_ντιγραφή"));
        strings.put("tooltip_edit_copy", _("Αντιγραφή"));
        strings.put("edit_paste", _("Επ_ικόλληση"));
        strings.put("tooltip_edit_paste", _("Επικόλληση"));
        strings.put("edit_delete", _("_Διαγραφή"));
        strings.put("tooltip_edit_delete", _("Διαγραφή"));
        strings.put("edit_select_all", _("Επι_λογή όλων"));
        strings.put("tooltip_edit_select_all", _("Επιλογή όλων"));

        strings.put("help", _("_Βοήθεια"));
        strings.put("show_help_contents", _("_Προβολή περιεχομένων βοήθειας"));
        strings.put("show_about_dialog", _("_Σχετικά με την εφαρμογή"));


        strings.put("program", _("_Πρόγραμμα"));
        strings.put("run", _("_Εκτέλεση"));
        strings.put("tooltip_run", _("Εκτέλεση"));
        strings.put("run_step_by_step", _("Εκτέλεση _βήμα προς βήμα"));
        strings.put("tooltip_run_step_by_step", _("Εκτέλεση βήμα προς βήμα"));
        strings.put("stop", _("_Διακοπή εκτέλεσης"));
        strings.put("tooltip_stop", _("Διακοπή εκτέλεσης"));
        strings.put("tooltip_execution_speed", _("Ταχύτητα εκτέλεσης (%)"));
        strings.put("use_input_file", _("_Χρήση αρχείου εισόδου"));
        strings.put("tooltip_use_input_file", _("Χρήση αρχείου εισόδου"));

        strings.put("untitled", _("Ανώνυμο"));
        strings.put("cursor_col", _("Στήλη"));
        strings.put("cursor_line", _("Γραμμή"));
        strings.put("modified", _("Τροποποιημένο"));

        strings.put("messages", _("Μηνύματα"));
        strings.put("runtime_window", _("Παράθυρο εκτέλεσης"));
        strings.put("input_file", _("Αρχείο εισόδου"));

        strings.put("save_file", _("Αποθήκευση αρχείου"));
        strings.put("open_file", _("Άνοιγμα αρχείου"));
        strings.put("glossa_files", _("Αρχεία κώδικα της ΓΛΩΣΣΑΣ (*.gls)"));
        strings.put("glossa_diermhneyths_files", _("Αρχεία του ΔΙΕΡΜΗΝΕΥΤΗ(*.γλώσσα)"));
        strings.put("all_files", _("Όλα τα αρχεία"));
        strings.put("html_files", _("Αρχεία HTML(*.html)"));
        strings.put("txt_files", _("Αρχεία απλού κειμένου(*.txt)"));
        strings.put("msg_file_modified", _("Το αρχείο '%1$s' έχει αλλάξει! Θέλετε να αποθηκεύσετε τις αλλαγές;"));
        strings.put("msg_input_file_modified", _("Το αρχείο εισόδου έχει αλλάξει! Θέλετε να αποθηκεύσετε τις αλλαγές;"));
        strings.put("msg_file_exists", _("Το αρχείο '%1$s' υπάρχει ήδη! Θέλετε να συνεχίσετε;"));
        strings.put("msg_file_exists_secondary", _("Τα τρέχοντα περιεχόμενα το αρχείου θα χαθούν!"));
        strings.put("msg_interpreter_running", _("Ο διερμηνευτής \"τρέχει\" ακόμη! Θέλετε να τερματίσετε την εκτέλεση;"));

        strings.put("type", _("Τύπος"));
        strings.put("position", _("Θέση"));
        strings.put("message", _("Μήνυμα"));

        strings.put("error", _("Σφάλμα"));
        strings.put("warning", _("Προειδοποίηση"));

        strings.put("submit", _("Υποβολή"));
        strings.put("type_here", _("Πληκτρολογήστε εδώ και πατήστε το Enter"));

        strings.put("preferences", _("Προτιμήσεις"));
        strings.put("font", _("Γραμματοσειρά"));
        strings.put("editor_scheme", _("Χρώματα επεξεργαστή κώδικα"));
        
        strings.put("commands", _("Εντολές"));
        strings.put("commands_list", _("Λίστα εντολών"));
    }

    public static StringResources getInstance(){
        if(instance == null){
            instance = new StringResources();
        }
        return instance;
    }

    public String getString(String key){
        return strings.get(key);
    }


} public class CopyAction extends Action{
    private static CopyAction instance = null;

    public static CopyAction getInstance(){
        if(instance == null){
            instance = new CopyAction();
        }
        return instance;
    }

    public CopyAction() {
        super("CopyAction",
                StringResources.getInstance().getString("edit_copy"),
                StringResources.getInstance().getString("tooltip_edit_copy"),
                ActionIcon.EDIT_COPY, new Activate() {

            public void onActivate(Action action) {
                SourceBuffer srcBuf = Editor.getInstance().getBuffer();
                if(srcBuf.getHasSelection()){
                    TextIter start = srcBuf.getSelectionBound().getIter();
                    TextIter end = srcBuf.getInsert().getIter();
                    String text = srcBuf.getText(start, end, true);
                    Clipboard clip = Clipboard.getDefault();
                    clip.setText(text);
                    clip.store();
                }

            }
        });
    }

} public class CutAction extends Action {

    private static CutAction instance = null;

    public static CutAction getInstance() {
        if (instance == null) {
            instance = new CutAction();
        }
        return instance;
    }

    private CutAction() {
        super("CutAction",
                StringResources.getInstance().getString("edit_cut"),
                StringResources.getInstance().getString("tooltip_edit_cut"),
                ActionIcon.EDIT_CUT, new Activate() {

            public void onActivate(Action action) {
                Editor ed = Editor.getInstance();
                if (ed.getEditable()) {
                    SourceBuffer srcBuf = ed.getBuffer();
                    if (srcBuf.getHasSelection()) {
                        srcBuf.beginUserAction();
                        TextIter start = srcBuf.getSelectionBound().getIter();
                        TextIter end = srcBuf.getInsert().getIter();
                        String text = srcBuf.getText(start, end, true);
                        srcBuf.delete(start, end);
                        Clipboard clip = Clipboard.getDefault();
                        clip.setText(text);
                        clip.store();
                        srcBuf.endUserAction();
                    }
                }

            }
        });
    }
} public class NewFileAction extends Action{
    private static NewFileAction instance = null;

    public static NewFileAction getInstance(){
        if(instance == null){
            instance = new NewFileAction();
        }
        return instance;
    }


    private NewFileAction() {
        super("NewFileAction", StringResources.getInstance().getString("file_new"),
                StringResources.getInstance().getString("tooltip_file_new"),
                ActionIcon.DOCUMENT_NEW, new Activate() {

            public void onActivate(Action source) {
                Editor.getInstance().newFile();
            }
        });
        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.N, ModifierType.CONTROL_MASK);
    }

} public class OpenFileAction extends Action{
    private static OpenFileAction instance = null;

    public static OpenFileAction getInstance(){
        if(instance == null){
            instance = new OpenFileAction();
        }
        return instance;
    }


    private OpenFileAction() {
        super("OpenFileAction",  StringResources.getInstance().getString("file_open"),
                StringResources.getInstance().getString("tooltip_file_open"),
                ActionIcon.DOCUMENT_OPEN, new Activate() {

            public void onActivate(Action source) {
                Editor.getInstance().openFile();
            }
        });
        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.O, ModifierType.CONTROL_MASK);
    }

    //TODO: When RecentChooserMenu binding becomes available uncomment this:
    /*@Override
    public ToolItem createToolItem() {
        MenuToolButton openButton = new MenuToolButton(Stock.OPEN);
        openButton.setRelatedAction(this);
        openButton.setMenu(new RecentChooserMenu());
        return openButton;
    }*/



} public class PasteAction extends Action {

    private static PasteAction instance = null;

    public static PasteAction getInstance() {
        if (instance == null) {
            instance = new PasteAction();
        }
        return instance;
    }

    private PasteAction() {
        super("PasteAction",
                StringResources.getInstance().getString("edit_paste"),
                StringResources.getInstance().getString("tooltip_edit_paste"),
                ActionIcon.EDIT_PASTE, new Activate() {

            public void onActivate(Action action) {
                Editor ed = Editor.getInstance();
                if (ed.getEditable()) {
                    SourceBuffer srcBuf = ed.getBuffer();
                    Clipboard clip = Clipboard.getDefault();
                    String text = clip.getText();
                    if (text != null) {
                        srcBuf.beginUserAction();
                        if (srcBuf.getHasSelection()) {
                            TextIter start = srcBuf.getSelectionBound().getIter();
                            TextIter end = srcBuf.getInsert().getIter();
                            srcBuf.delete(start, end);
                        }
                        srcBuf.insertAtCursor(text);
                        srcBuf.endUserAction();
                    }
                }

            }
        });
    }
} public class PrintAction extends Action {

    private static PrintAction instance = null;

    public static PrintAction getInstance() {
        if (instance == null) {
            instance = new PrintAction();
        }
        return instance;
    }

    private PrintAction() {
        super("PrintAction", StringResources.getInstance().getString("file_print"),
                StringResources.getInstance().getString("tooltip_file_print"),
                ActionIcon.DOCUMENT_PRINT, new Activate() {

            public void onActivate(Action source) {
                try {
                    File path = new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParentFile();
                    File tmpFile = File.createTempFile("lingua", ".gls");
                    tmpFile.deleteOnExit();
                    BufferedWriter out = new BufferedWriter(new FileWriter(tmpFile));
                    out.write(Editor.getInstance().getBuffer().getText());
                    out.flush();
                    out.close();
                    Preferences prefs = Preferences.getInstance();
                    String scheme = "glossa";//prefs.getEditorScheme();
                    String[] cmdarr = {
                        "/usr/bin/python",
                        path.getAbsolutePath()+"/source_printer.py",
                        "glossa",
                        scheme,//scheme==null?"glossa":scheme,
                        prefs.getPangoCompatibleFontDescriptionString(),
                        tmpFile.getAbsolutePath()
                    };
                    ProcessBuilder pb = new ProcessBuilder(cmdarr);
                    pb.start();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.P, ModifierType.CONTROL_MASK);

    }
} public class RedoAction extends Action {

    private static RedoAction instance = null;

    public static RedoAction getInstance() {
        if (instance == null) {
            instance = new RedoAction();
        }
        return instance;
    }

    private RedoAction() {
        super("RedoAction",
                StringResources.getInstance().getString("edit_redo"),
                StringResources.getInstance().getString("tooltip_edit_redo"),
                ActionIcon.EDIT_REDO, new Activate() {

            public void onActivate(Action action) {
                Editor ed = Editor.getInstance();
                if (ed.getEditable()) {
                    SourceBuffer srcBuf = ed.getBuffer();
                    if (srcBuf.canRedo()) {
                        srcBuf.redo();
                    }
                }
            }
        });

        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.Z, ModifierType.or(ModifierType.CONTROL_MASK, ModifierType.SHIFT_MASK));
    }
} public class RunAction extends Action{
    private static RunAction instance = null;

    public static RunAction getInstance(){
        if(instance == null){
            instance = new RunAction();
        }
        return instance;
    }


    private RunAction() {
        super("RunAction", StringResources.getInstance().getString("run"), StringResources.getInstance().getString("tooltip_run"), ActionIcon.MEDIA_PLAYBACK_START, new Activate() {

            public void onActivate(Action source) {
                MainWindow.getInstance().run();
            }
        });
        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.F5, ModifierType.NONE);
    }

} public class SaveFileAction extends Action{
    private static SaveFileAction instance = null;

    public static SaveFileAction getInstance(){
        if(instance == null){
            instance = new SaveFileAction();
        }
        return instance;
    }


    private SaveFileAction() {
        super("SaveFileAction",  StringResources.getInstance().getString("file_save"),
                StringResources.getInstance().getString("tooltip_file_save"),
                ActionIcon.DOCUMENT_SAVE, new Activate() {

            public void onActivate(Action source) {
                Editor.getInstance().saveFile(false);
            }
        });
        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.S, ModifierType.CONTROL_MASK);
    }

} public class StopAction extends Action{
    private static StopAction instance = null;

    public static StopAction getInstance(){
        if(instance == null){
            instance = new StopAction();
        }
        return instance;
    }


    private StopAction() {
        super("StopAction", StringResources.getInstance().getString("stop"), StringResources.getInstance().getString("tooltip_stop"), ActionIcon.MEDIA_PLAYBACK_STOP, new Activate() {

            public void onActivate(Action source) {
                MainWindow.getInstance().stop();
            }
        });
        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.F7, ModifierType.NONE);
        setSensitive(false);
    }

} public class ToggleStepByStepAction extends ToggleAction{

    private static ToggleStepByStepAction instance = null;

    public static ToggleStepByStepAction getInstance(){
        if(instance == null){
            instance = new ToggleStepByStepAction();
        }
        return instance;
    }


    private ToggleStepByStepAction() {
        super("ToggleStepByStepAction", StringResources.getInstance().getString("run_step_by_step"), StringResources.getInstance().getString("tooltip_run_step_by_step"), Stock.MEDIA_NEXT, new StepByStepActionToggled());
        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.F8, ModifierType.NONE);
    }

} public class ToggleUseInputFileAction extends ToggleAction{

    private static ToggleUseInputFileAction instance = null;

    public static ToggleUseInputFileAction getInstance(){
        if(instance == null){
            instance = new ToggleUseInputFileAction();
        }
        return instance;
    }


    private ToggleUseInputFileAction() {
        super("ToggleUseInputFileAction", StringResources.getInstance().getString("use_input_file"), StringResources.getInstance().getString("tooltip_use_input_file"), Stock.FILE);
        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.F9, ModifierType.NONE);
    }

} public class UndoAction extends Action {

    private static UndoAction instance = null;

    public static UndoAction getInstance() {
        if (instance == null) {
            instance = new UndoAction();
        }
        return instance;
    }

    private UndoAction() {
        super("UndoAction",
                StringResources.getInstance().getString("edit_undo"),
                StringResources.getInstance().getString("tooltip_edit_undo"),
                ActionIcon.EDIT_UNDO, new Activate() {

            public void onActivate(Action action) {
                Editor ed = Editor.getInstance();
                if (ed.getEditable()) {
                    SourceBuffer srcBuf = ed.getBuffer();
                    if (srcBuf.canUndo()) {
                        srcBuf.undo();
                    }
                }
            }
        });

        setAccelerator(MainWindow.getAcceleratorGroup(), Keyval.Z, ModifierType.CONTROL_MASK);
    }
} public class Editor extends SourceView implements BufferSaver{

    private static Editor instance = null;
    private final Menu popupMenu;
    private PrettyPrinter prettyPrinter;

    public static Editor getInstance() {
        if (instance == null) {
            instance = new Editor();
        }
        return instance;
    }

    private Editor() {
        super(new EditorBuffer());
        popupMenu = new EditorPopupMenu();
        prettyPrinter = new GlossaPrettyPrinter();
        init();
    }

    private void init() {
        EditorBuffer buf = this.getBuffer();
        buf.setEditor(this);
        buf.placeCursor(buf.getIterStart());

        connect(new ButtonPressEvent() {

            public boolean onButtonPressEvent(Widget widget, EventButton eb) {
                if (eb.getButton().equals(MouseButton.RIGHT)) {
                    popupMenu.popup();
                    return true;
                }
                return false;
            }
        });
        
        connect(new KeyReleaseEvent() {

            public boolean onKeyReleaseEvent(Widget widget, EventKey ek) {
                if(ek.getKeyval().equals(Keyval.F) && ek.getState().contains(ModifierType.SHIFT_MASK) && ek.getState().contains(ModifierType.CONTROL_MASK) ){
                    EditorBuffer buf = getBuffer();
                    if(buf!=null){
                        String text = buf.getText();
                        buf.beginUserAction();
                        buf.setText(prettyPrinter.getPrettyText(text));
                        buf.endUserAction();
                    }
                    return true;
                }
                return false;
            }
        });

        connect(new PopupMenu() {

            public boolean onPopupMenu(Widget source) {
                popupMenu.popup();
                return true;
            }
        });
        
        setAutoIndent(true);
        setInsertSpacesInsteadOfTabs(true);
    }

    public void setFont(String fontDescription){
        this.overrideFont(new FontDescription(fontDescription));
    }

    @Override
    public void setEditable(boolean editable) {
        super.setEditable(editable);
        getBuffer().updateControlsSensitivity();
    }



    @Override
    public EditorBuffer getBuffer() {
        return (EditorBuffer) super.getBuffer();
    }

    @Override
    public void setBuffer(TextBuffer buffer) {
        super.setBuffer(buffer);
        buffer.placeCursor(buffer.getIterStart());
        ((EditorBuffer)buffer).setEditor(this);
        MainWindowStatusbar.getInstance().updateMessage();
        MainWindow.getInstance().updateTitle();
        Preferences.getInstance().apply();
    }

    public void newBuffer() {
        EditorBuffer buf = new EditorBuffer();
        buf.setSrc(null);
        buf.setModified(false);
        this.setBuffer(buf);
    }

    public void newBufferFromFile(File src) {
        EditorBuffer buf = new EditorBuffer();
        buf.beginNotUndoableAction();

        try {
            CharsetDetector cd = new CharsetDetector();
            Charset c = cd.detectCharset(src,
                    new String[]{"UTF-8", "windows-1253", "ISO-8859-7"});
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(new FileInputStream(src),
                    c == null ? Charset.defaultCharset() : c));
            String buffer;
            StringBuilder sb = new StringBuilder();
            while ((buffer = reader.readLine()) != null) {
                sb.append(buffer);
                sb.append("\n");
            }
            buf.setText(sb.toString());
            buf.setSrc(src);
            buf.setModified(false);
        } catch (Exception e) {
        }

        buf.endNotUndoableAction();
        this.setBuffer(buf);
    }

    public void newFile() {
        if(MainWindow.getInstance().stopInterpreterAndContinue()){
            EditorBuffer buf = this.getBuffer();
            boolean modified = buf.getModified();


            if (modified) { // buffer has changes
                if (DialogManager.handleModifiedBuffer(false, buf.getDocumentTitle(), this)) { // The user saved or chose not to
                    this.newBuffer();
                }
            } else {
                this.newBuffer();
            }
        }
    }

    public boolean saveFile(boolean saveAs) {
        EditorBuffer buf = this.getBuffer();
        boolean modified = buf.getModified();
        if (modified || saveAs) {
            File target = buf.getSrc();
            String glossaDiermhneythsExtension = new GlossaDiermhneythsFileFilter().getExtension();
            if ((target == null) || saveAs) { // We have a new file
                String filename = DialogManager.showSaveDialog(SaveCodeDialog.getInstance(), buf.getSrc(), buf.getDocumentTitle());
                if (filename != null) {
                    target = new File(filename);
                    Charset c;
                    if(filename.endsWith(glossaDiermhneythsExtension)){
                        c = Charset.forName("windows-1253");
                    }else{
                        c = Charset.forName("UTF-8");
                    }
                    try {
                        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(target), c));
                        out.write(buf.getText());
                        out.flush();
                        out.close();
                        buf.setSrc(target);
                        buf.setModified(false);
                        return true;
                    } catch (IOException e) {
                        return false;
                    }
                } else {
                    return false;
                }
            } else { // We are editing an existing file
                Charset c;
                if(target.getAbsolutePath().endsWith(glossaDiermhneythsExtension)){
                    c = Charset.forName("windows-1253");
                }else{
                    c = Charset.forName("UTF-8");
                }
                try {
                    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(target), c));
                    out.write(buf.getText());
                    out.flush();
                    out.close();
                    buf.setModified(false);
                    return true;
                } catch (Exception e) {
                    return false;
                }
            }
        } else {
            return true;
        }
    }

    public void openFile() {
        if(MainWindow.getInstance().stopInterpreterAndContinue()){
             EditorBuffer buf = this.getBuffer();
            boolean modified = buf.getModified();
            String filename;
            if (modified) { // buffer has changes
                if (DialogManager.handleModifiedBuffer(false, buf.getDocumentTitle(), this)) { // The user saved or chose not to
                    filename = DialogManager.showOpenDialog(OpenCodeDialog.getInstance());
                } else { // The user cancelled the save dialog
                    return;
                }
            } else {
                filename = DialogManager.showOpenDialog(OpenCodeDialog.getInstance());
            }

            if (filename != null) {
                newBufferFromFile(new File(filename));
            }
        }
    }

    public boolean exportHTML() {
        EditorBuffer buf = this.getBuffer();
        String filename = DialogManager.showExportToHTMLDialog(buf.getSrc(), buf.getDocumentTitle());
        if (filename != null) {
            File target = new File(filename);
            try {
                BufferedWriter out = new BufferedWriter(new FileWriter(target));
                out.write(new GlossaHTMLGenerator().getFullHTML(buf.getDocumentTitle(), buf.getText()));
                out.flush();
                out.close();
                MiscUtils.xdgOpenFile(target);
                return true;
            } catch (IOException e) {
                return false;
            }
        } else {
            return false;
        }
    }

}
import lingua.resources.StringResources;
import lingua.ui.gtk.main_window.actions.CopyAction;
import lingua.ui.gtk.main_window.actions.CutAction;
import lingua.ui.gtk.main_window.actions.NewFileAction;
import lingua.ui.gtk.main_window.actions.OpenFileAction;
import lingua.ui.gtk.main_window.actions.PasteAction;
import lingua.ui.gtk.main_window.actions.PrintAction;
import lingua.ui.gtk.main_window.actions.RedoAction;
import lingua.ui.gtk.main_window.actions.RunAction;
import lingua.ui.gtk.main_window.actions.SaveFileAction;
import lingua.ui.gtk.main_window.actions.StopAction;
import lingua.ui.gtk.main_window.actions.ToggleStepByStepAction;
import lingua.ui.gtk.main_window.actions.ToggleUseInputFileAction;
import lingua.ui.gtk.main_window.actions.UndoAction;
import lingua.ui.gtk.main_window.widgets.Editor;
import org.gnome.gtk.Adjustment;
import org.gnome.gtk.Entry;
import org.gnome.gtk.EntryIconPosition;
import org.gnome.gtk.Orientation;
import org.gnome.gtk.PositionType;
import org.gnome.gtk.Scale;
import org.gnome.gtk.SeparatorToolItem;
import org.gnome.gtk.Stock;
import org.gnome.gtk.StyleClass;
import org.gnome.gtk.ToolItem;
import org.gnome.gtk.Toolbar;
/*
 *  The MIT License
 * 
 *  Copyright 2012 Georgios Migdos <cyberpython@gmail.com>.
 * 
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the "Software"), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 * 
 *  The above copyright notice and this permission notice shall be included in
 *  all copies or substantial portions of the Software.
 * 
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 *  THE SOFTWARE.
 */

package lingua.ui.gtk.main_window.toolbars;


/**
 *
 * @author Georgios Migdos <cyberpython@gmail.com>
 */
public class MainToolbar extends Toolbar{

    private final Entry searchBox;
    private final Scale scale;
    private static MainToolbar instance = null;

    public static MainToolbar getInstance(){
        if(instance == null){
            instance = new MainToolbar();
        }
        return instance;
    }

    private MainToolbar() {
        this.getStyleContext().addClass(StyleClass.PRIMARY_TOOLBAR);

        add(NewFileAction.getInstance().createToolItem());