chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1845324 - /chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java
Date Wed, 31 Oct 2018 11:37:30 GMT
Author: fmui
Date: Wed Oct 31 11:37:30 2018
New Revision: 1845324

URL: http://svn.apache.org/viewvc?rev=1845324&view=rev
Log:
Workbench: removed workaround for a Java 9/Groovy issue -> fixed in Groovy

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java?rev=1845324&r1=1845323&r2=1845324&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ConsoleHelper.java
Wed Oct 31 11:37:30 2018
@@ -116,106 +116,98 @@ public class ConsoleHelper {
             // add menu
             JMenuBar consoleMenuBar = console.getFrame().getRootPane().getJMenuBar();
 
-            if (consoleMenuBar != null) { // workaround for a Java 9/Groovy
-                                          // issue (-> no menu bar)
-                                          // should be removed when the issue is
-                                          // fixed
-
-                JMenu cmisMenu = new JMenu("CMIS");
-                cmisMenu.setMnemonic(KeyEvent.VK_M);
-                consoleMenuBar.add(cmisMenu);
-
-                addConsoleMenu(cmisMenu, "CMIS 1.0 Specification",
-                        new URI("https://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html"));
-                addConsoleMenu(cmisMenu, "CMIS 1.1 Specification",
-                        new URI("https://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.html"));
-                cmisMenu.addSeparator();
-                addConsoleMenu(cmisMenu, "OpenCMIS Documentation",
-                        new URI("https://chemistry.apache.org/java/opencmis.html"));
-                addConsoleMenu(cmisMenu, "OpenCMIS Code Samples",
-                        new URI("https://chemistry.apache.org/docs/cmis-samples/"));
-                addConsoleMenu(cmisMenu, "OpenCMIS Client API JavaDoc",
-                        new URI("https://chemistry.apache.org/java/javadoc/"));
-                cmisMenu.addSeparator();
-                JMenuItem menuItem = new JMenuItem("CMIS Session Details");
-                menuItem.addActionListener(new ActionListener() {
-                    @Override
-                    public void actionPerformed(ActionEvent e) {
-                        AttributeSet style = console.getOutputStyle();
-                        console.clearOutput();
-                        console.appendOutputNl("Session ID:      " + groovySession.getBinding().getSessionId(),
style);
-                        console.appendOutputNl("Repository ID:   " + groovySession.getRepositoryInfo().getId(),
style);
-                        console.appendOutputNl("Repository name: " + groovySession.getRepositoryInfo().getName(),
-                                style);
-                        console.appendOutputNl("Binding:         " + groovySession.getBinding().getBindingType(),
-                                style);
-                        console.appendOutputNl("User:            " + user, style);
-                    }
-                });
-                cmisMenu.add(menuItem);
-
-                JMenu snippetsMenu = new JMenu("Snippets");
-                snippetsMenu.setMnemonic(KeyEvent.VK_N);
-                consoleMenuBar.add(snippetsMenu);
-
-                for (FileEntry entry : readSnippetLibrary()) {
-                    String snippet = ClientHelper.readFileAndRemoveHeader(entry.getFile());
-
-                    JMenuItem snippetItem = new JMenuItem(entry.getName());
-                    snippetItem.addActionListener(new ConsoleInsertActionListener(console,
snippet));
-                    snippetsMenu.add(snippetItem);
+            JMenu cmisMenu = new JMenu("CMIS");
+            cmisMenu.setMnemonic(KeyEvent.VK_M);
+            consoleMenuBar.add(cmisMenu);
+
+            addConsoleMenu(cmisMenu, "CMIS 1.0 Specification",
+                    new URI("https://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html"));
+            addConsoleMenu(cmisMenu, "CMIS 1.1 Specification",
+                    new URI("https://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.html"));
+            cmisMenu.addSeparator();
+            addConsoleMenu(cmisMenu, "OpenCMIS Documentation",
+                    new URI("https://chemistry.apache.org/java/opencmis.html"));
+            addConsoleMenu(cmisMenu, "OpenCMIS Code Samples",
+                    new URI("https://chemistry.apache.org/docs/cmis-samples/"));
+            addConsoleMenu(cmisMenu, "OpenCMIS Client API JavaDoc",
+                    new URI("https://chemistry.apache.org/java/javadoc/"));
+            cmisMenu.addSeparator();
+            JMenuItem menuItem = new JMenuItem("CMIS Session Details");
+            menuItem.addActionListener(new ActionListener() {
+                @Override
+                public void actionPerformed(ActionEvent e) {
+                    AttributeSet style = console.getOutputStyle();
+                    console.clearOutput();
+                    console.appendOutputNl("Session ID:      " + groovySession.getBinding().getSessionId(),
style);
+                    console.appendOutputNl("Repository ID:   " + groovySession.getRepositoryInfo().getId(),
style);
+                    console.appendOutputNl("Repository name: " + groovySession.getRepositoryInfo().getName(),
style);
+                    console.appendOutputNl("Binding:         " + groovySession.getBinding().getBindingType(),
style);
+                    console.appendOutputNl("User:            " + user, style);
                 }
+            });
+            cmisMenu.add(menuItem);
 
-                // add popup menu
+            JMenu snippetsMenu = new JMenu("Snippets");
+            snippetsMenu.setMnemonic(KeyEvent.VK_N);
+            consoleMenuBar.add(snippetsMenu);
+
+            for (FileEntry entry : readSnippetLibrary()) {
+                String snippet = ClientHelper.readFileAndRemoveHeader(entry.getFile());
+
+                JMenuItem snippetItem = new JMenuItem(entry.getName());
+                snippetItem.addActionListener(new ConsoleInsertActionListener(console, snippet));
+                snippetsMenu.add(snippetItem);
+            }
 
-                final JPopupMenu popup = new JPopupMenu();
+            // add popup menu
 
-                final JMenuItem cutItem = new JMenuItem(new DefaultEditorKit.CutAction());
-                cutItem.setText("Cut");
-                popup.add(cutItem);
+            final JPopupMenu popup = new JPopupMenu();
 
-                final JMenuItem copyItem = new JMenuItem(new DefaultEditorKit.CopyAction());
-                copyItem.setText("Copy");
-                popup.add(copyItem);
+            final JMenuItem cutItem = new JMenuItem(new DefaultEditorKit.CutAction());
+            cutItem.setText("Cut");
+            popup.add(cutItem);
 
-                final JMenuItem pasteItem = new JMenuItem(new DefaultEditorKit.PasteAction());
-                pasteItem.setText("Paste");
-                popup.add(pasteItem);
+            final JMenuItem copyItem = new JMenuItem(new DefaultEditorKit.CopyAction());
+            copyItem.setText("Copy");
+            popup.add(copyItem);
 
-                console.getInputArea().addMouseListener(new MouseAdapter() {
-                    @Override
-                    public void mouseClicked(MouseEvent e) {
-                    }
+            final JMenuItem pasteItem = new JMenuItem(new DefaultEditorKit.PasteAction());
+            pasteItem.setText("Paste");
+            popup.add(pasteItem);
 
-                    @Override
-                    public void mousePressed(MouseEvent e) {
-                        maybeShowPopup(e);
-                    }
-
-                    @Override
-                    public void mouseReleased(MouseEvent e) {
-                        maybeShowPopup(e);
-                    }
+            console.getInputArea().addMouseListener(new MouseAdapter() {
+                @Override
+                public void mouseClicked(MouseEvent e) {
+                }
 
-                    private void maybeShowPopup(MouseEvent e) {
-                        if (e.isPopupTrigger()) {
-                            if (console.getInputArea().getSelectedText() != null) {
-                                cutItem.setEnabled(true);
-                                copyItem.setEnabled(true);
-
-                            } else {
-                                cutItem.setEnabled(false);
-                                copyItem.setEnabled(false);
-                            }
+                @Override
+                public void mousePressed(MouseEvent e) {
+                    maybeShowPopup(e);
+                }
 
-                            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
-                            pasteItem.setEnabled(clipboard.isDataFlavorAvailable(DataFlavor.stringFlavor));
+                @Override
+                public void mouseReleased(MouseEvent e) {
+                    maybeShowPopup(e);
+                }
 
-                            popup.show(e.getComponent(), e.getX(), e.getY());
+                private void maybeShowPopup(MouseEvent e) {
+                    if (e.isPopupTrigger()) {
+                        if (console.getInputArea().getSelectedText() != null) {
+                            cutItem.setEnabled(true);
+                            copyItem.setEnabled(true);
+
+                        } else {
+                            cutItem.setEnabled(false);
+                            copyItem.setEnabled(false);
                         }
+
+                        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+                        pasteItem.setEnabled(clipboard.isDataFlavorAvailable(DataFlavor.stringFlavor));
+
+                        popup.show(e.getComponent(), e.getX(), e.getY());
                     }
-                });
-            }
+                }
+            });
 
             // read source code
             if (file != null) {



Mime
View raw message