Search in sources :

Example 1 with PreferencesWindowController

use of org.omegat.gui.preferences.PreferencesWindowController in project omegat by omegat-org.

the class MatchesTextArea method populatePaneMenu.

@Override
public void populatePaneMenu(JPopupMenu menu) {
    populateContextMenu(menu, activeMatch);
    menu.addSeparator();
    final JMenuItem notify = new JCheckBoxMenuItem(OStrings.getString("GUI_MATCHWINDOW_SETTINGS_NOTIFICATIONS"));
    notify.setSelected(Preferences.isPreference(Preferences.NOTIFY_FUZZY_MATCHES));
    notify.addActionListener(e -> Preferences.setPreference(Preferences.NOTIFY_FUZZY_MATCHES, notify.isSelected()));
    menu.add(notify);
    menu.addSeparator();
    final JMenuItem prefs = new JMenuItem(OStrings.getString("MATCHES_OPEN_PREFERENCES"));
    prefs.addActionListener(e -> new PreferencesWindowController().show(Core.getMainWindow().getApplicationFrame(), TMMatchesPreferencesController.class));
    menu.add(prefs);
}
Also used : PreferencesWindowController(org.omegat.gui.preferences.PreferencesWindowController) TMMatchesPreferencesController(org.omegat.gui.preferences.view.TMMatchesPreferencesController) JMenuItem(javax.swing.JMenuItem) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem)

Example 2 with PreferencesWindowController

use of org.omegat.gui.preferences.PreferencesWindowController in project omegat by omegat-org.

the class MachineTranslateTextArea method populatePaneMenu.

@Override
public void populatePaneMenu(JPopupMenu menu) {
    final JMenuItem prefs = new JMenuItem(OStrings.getString("GUI_MACHINETRANSLATESWINDOW_OPEN_PREFS"));
    prefs.addActionListener(e -> new PreferencesWindowController().show(Core.getMainWindow().getApplicationFrame(), MachineTranslationPreferencesController.class));
    menu.add(prefs);
}
Also used : MachineTranslationPreferencesController(org.omegat.gui.preferences.view.MachineTranslationPreferencesController) PreferencesWindowController(org.omegat.gui.preferences.PreferencesWindowController) JMenuItem(javax.swing.JMenuItem)

Example 3 with PreferencesWindowController

use of org.omegat.gui.preferences.PreferencesWindowController in project omegat by omegat-org.

the class TaaSPlugin method loadPlugins.

/**
 * Register plugin into OmegaT.
 */
public static void loadPlugins() {
    TaaSGlossary glossary;
    TaaSClient client = getClient();
    try {
        client.init();
        if (client.isAllowed()) {
            glossary = new TaaSGlossary();
            try (InputStream in = TaaSGlossary.class.getResourceAsStream("filter.xslt")) {
                if (in == null) {
                    throw new Exception("filter.xslt is unaccessible");
                }
                TransformerFactory factory = TransformerFactory.newInstance();
                Source xslt = new StreamSource(in);
                filterTransformer = factory.newTransformer(xslt);
            }
        } else {
            glossary = null;
        }
    } catch (Exception ex) {
        Log.log(ex);
        return;
    }
    CoreEvents.registerApplicationEventListener(new IApplicationEventListener() {

        public void onApplicationStartup() {
            JMenuItem lookup = new JCheckBoxMenuItem();
            lookup.setSelected(Preferences.isPreferenceDefault(Preferences.TAAS_LOOKUP, false));
            Mnemonics.setLocalizedText(lookup, OStrings.getString("TAAS_MENU_LOOKUP"));
            lookup.addActionListener(e -> {
                if (client.isAllowed()) {
                    Preferences.setPreference(Preferences.TAAS_LOOKUP, lookup.isSelected());
                    Preferences.save();
                } else {
                    lookup.setSelected(false);
                    new PreferencesWindowController().show(Core.getMainWindow().getApplicationFrame(), TaaSPreferencesController.class);
                }
            });
            Core.getMainWindow().getMainMenu().getGlossaryMenu().add(lookup);
            PreferencesControllers.addSupplier(TaaSPreferencesController::new);
            Preferences.addPropertyChangeListener(Preferences.TAAS_LOOKUP, e -> lookup.setSelected((Boolean) e.getNewValue()));
            if (client.isAllowed()) {
                Core.getGlossaryManager().addGlossaryProvider(glossary);
            }
        }

        public void onApplicationShutdown() {
        }
    });
}
Also used : OutputStream(java.io.OutputStream) Transformer(javax.xml.transform.Transformer) StringWriter(java.io.StringWriter) StreamResult(javax.xml.transform.stream.StreamResult) StreamSource(javax.xml.transform.stream.StreamSource) PreferencesWindowController(org.omegat.gui.preferences.PreferencesWindowController) Log(org.omegat.util.Log) Mnemonics(org.openide.awt.Mnemonics) IApplicationEventListener(org.omegat.core.events.IApplicationEventListener) Source(javax.xml.transform.Source) CoreEvents(org.omegat.core.CoreEvents) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) PreferencesControllers(org.omegat.gui.preferences.PreferencesControllers) StringReader(java.io.StringReader) JMenuItem(javax.swing.JMenuItem) Core(org.omegat.core.Core) OStrings(org.omegat.util.OStrings) TransformerFactory(javax.xml.transform.TransformerFactory) Preferences(org.omegat.util.Preferences) InputStream(java.io.InputStream) TransformerFactory(javax.xml.transform.TransformerFactory) IApplicationEventListener(org.omegat.core.events.IApplicationEventListener) InputStream(java.io.InputStream) StreamSource(javax.xml.transform.stream.StreamSource) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) PreferencesWindowController(org.omegat.gui.preferences.PreferencesWindowController) JMenuItem(javax.swing.JMenuItem)

Example 4 with PreferencesWindowController

use of org.omegat.gui.preferences.PreferencesWindowController in project omegat by omegat-org.

the class MainWindowMenuHandler method optionsPreferencesMenuItemActionPerformed.

public void optionsPreferencesMenuItemActionPerformed() {
    PreferencesWindowController pwc = new PreferencesWindowController();
    pwc.show(Core.getMainWindow().getApplicationFrame());
}
Also used : PreferencesWindowController(org.omegat.gui.preferences.PreferencesWindowController)

Aggregations

PreferencesWindowController (org.omegat.gui.preferences.PreferencesWindowController)4 JMenuItem (javax.swing.JMenuItem)3 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)2 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 Source (javax.xml.transform.Source)1 Transformer (javax.xml.transform.Transformer)1 TransformerFactory (javax.xml.transform.TransformerFactory)1 StreamResult (javax.xml.transform.stream.StreamResult)1 StreamSource (javax.xml.transform.stream.StreamSource)1 Core (org.omegat.core.Core)1 CoreEvents (org.omegat.core.CoreEvents)1 IApplicationEventListener (org.omegat.core.events.IApplicationEventListener)1 PreferencesControllers (org.omegat.gui.preferences.PreferencesControllers)1 MachineTranslationPreferencesController (org.omegat.gui.preferences.view.MachineTranslationPreferencesController)1 TMMatchesPreferencesController (org.omegat.gui.preferences.view.TMMatchesPreferencesController)1 Log (org.omegat.util.Log)1 OStrings (org.omegat.util.OStrings)1