mylyn-suite/module1/src/org/apidesign/listbundles/ListBndsl.java
author Jaroslav Tulach <jtulach@netbeans.org>
Fri Feb 05 18:38:28 2010 +0100
changeset 38 f368d0cf0ca8
parent 5 034c4d52efe2
child 29 adfe0ad2c687
permissions -rw-r--r--
By default build and test the sample
jtulach@5
     1
/*
jtulach@5
     2
 *  Copyright (C) 2009 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jtulach@5
     3
 *
jtulach@5
     4
 *  This program is free software; you can redistribute it and/or
jtulach@5
     5
 *  modify it under the terms of the GNU General Public License
jtulach@5
     6
 *  as published by the Free Software Foundation; version 2
jtulach@5
     7
 *  of the License.
jtulach@5
     8
 *
jtulach@5
     9
 *  This program is distributed in the hope that it will be useful,
jtulach@5
    10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
jtulach@5
    11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jtulach@5
    12
 *  GNU General Public License for more details.
jtulach@5
    13
 *
jtulach@5
    14
 *  You should have received a copy of the GNU General Public License
jtulach@5
    15
 *  along with this program; if not, write to the Free Software
jtulach@5
    16
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
jtulach@5
    17
 */
jtulach@5
    18
package org.apidesign.listbundles;
jtulach@5
    19
jtulach@5
    20
import java.awt.event.ActionEvent;
jtulach@5
    21
import java.awt.event.ActionListener;
jtulach@5
    22
import org.openide.DialogDisplayer;
jtulach@5
    23
import org.openide.NotifyDescriptor;
jtulach@5
    24
import org.osgi.framework.Bundle;
jtulach@10
    25
// BEGIN: netbinox.mylyn.listbundles
jtulach@5
    26
public final class ListBndsl implements ActionListener {
jtulach@5
    27
    public void actionPerformed(ActionEvent e) {
jtulach@5
    28
        StringBuilder sb = new StringBuilder();
jtulach@5
    29
        for (Bundle b : Installer.bc.getBundles()) {
jtulach@5
    30
            if (b.getState() != Bundle.ACTIVE) {
jtulach@5
    31
                continue;
jtulach@5
    32
            }
jtulach@5
    33
            sb.append(b.getSymbolicName());
jtulach@5
    34
            sb.append("\n");
jtulach@5
    35
        }
jtulach@10
    36
        DialogDisplayer.getDefault().notify(
jtulach@10
    37
            new NotifyDescriptor.Message(sb)
jtulach@10
    38
        );
jtulach@5
    39
    }
jtulach@5
    40
}
jtulach@10
    41
// END: netbinox.mylyn.listbundles