OpenOffice.org... has its own Plugin Portal!

The OpenOffice.org developers of the NetBeans plugin for OpenOffice.org are in Prague today. I attended an interesting presentation where they demoed their plugin this morning. One of several things I learned about was their very cool Extensions site:

http://extensions.services.openoffice.org/

Unfortunately, however, you cannot see (currently) from inside OpenOffice.org which extensions are available. On the other hand, this is a feature that NetBeans IDE 6.1 Beta does have support for (at least, on my machine, thanks to a plugin I created) because I integrated their various application-specific extension feeds into the IDE's toolbar:

When I get some time, I will try to create an OpenOffice.org Add-On (using the NetBeans/OpenOffice.org plugin) which will attempt to do the same thing from within OpenOffice.org.

Here's the relevant code in the JPanel, which I added to the toolbar via CallableSystemAction.getToolbarPresenter:

public class OOExtensionsPanel extends javax.swing.JPanel {

    DefaultComboBoxModel model = new DefaultComboBoxModel();

    /\*\* Creates new form OOExtensionsPanel \*/
    public OOExtensionsPanel() {
        initComponents();
        //appList is the list of OpenOffice.org applications:
        appList.addActionListener(new AppListListener());
        //extList is the list of OpenOffice.org extensions:
        extList.setModel(model);
    }

    private class AppListListener implements ActionListener {

        public void actionPerformed(ActionEvent ev) {

            model.removeAllElements();

            BufferedReader in = null;
            
            try {

                //InputOutput io = IOProvider.getDefault().getIO("OpenOffice Extensions", true);
                JComboBox box = (JComboBox) ev.getSource();
                String selectedApp = box.getSelectedItem().toString();

                URL url = null;
                if (selectedApp.equals("Writer")) {
                    url = new URL("http://extensions.services.openoffice.org/taxonomy/term/2/0/feed");
                } else if (selectedApp.equals("Calc")) {
                    url = new URL("http://extensions.services.openoffice.org/taxonomy/term/1/0/feed");
                } else if (selectedApp.equals("Draw")) {
                    url = new URL("http://extensions.services.openoffice.org/taxonomy/term/4/0/feed");
                } else if (selectedApp.equals("Impress")) {
                    url = new URL("http://extensions.services.openoffice.org/taxonomy/term/3/0/feed");
                } else if (selectedApp.equals("Chart")) {
                    url = new URL("http://extensions.services.openoffice.org/taxonomy/term/21/0/feed");
                }

                in = new BufferedReader(new InputStreamReader(url.openStream()));
                InputSource source = new InputSource(in);
                org.w3c.dom.Document doc = XMLUtil.parse(source, false, false, null, null);
                org.w3c.dom.NodeList list = doc.getElementsByTagName("\*");
                int length = list.getLength();
                //io.select();

                for (int i = 0; i < length; i++) {
                    org.w3c.dom.Node mainNode = list.item(i);
                    String nodeName = mainNode.getNodeName();
                    String value = mainNode.getTextContent();
                    if (nodeName.equals("title")) {
                        //io.getOut().println("Extension: " + value);
                        model.addElement(value);
                    }
                }
            //io.getOut().close();

            } catch (SAXException ex) {
                Exceptions.printStackTrace(ex);
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
            } finally {
                try {
                    in.close();
                } catch (IOException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
        }
    }
...
...
...

Today on NetBeans Zone. Overview of NetBeans Java API Samples in Plugin Portal.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today