Search in sources :

Example 1 with WindowManager

use of org.openide.windows.WindowManager in project ACS by ACS-Community.

the class SimpleLookup method lookup.

public Object lookup(Class clazz) {
    log.debug("looking up " + clazz.getName());
    //		else
    if (clazz.getName().indexOf("Registry") != -1) {
        WindowManager wm = WindowManager.getDefault();
        if (wm != null && wm instanceof DummyWindowManager) {
            return ((DummyWindowManager) wm).registry();
        } else {
            log.warn("unable to return registry");
        }
    } else if (clazz.getName().indexOf("DialogDisplayer") != -1) {
        if (dialog == null) {
            dialog = new NbDialogDisplayer();
        }
        return dialog;
    } else if (clazz.getName().indexOf("NodeOp") != -1) {
        if (nodeOp == null) {
            nodeOp = new NbNodeOperation();
        }
        return nodeOp;
    }
    // this can be further tuned to better performance
    Lookup.Item item = lookupItem(new Lookup.Template(clazz));
    return item == null ? null : item.getInstance();
}
Also used : NbNodeOperation(org.netbeans.core.NbNodeOperation) DummyWindowManager(org.openide.windows.DummyWindowManager) NbDialogDisplayer(org.netbeans.core.NbTopManager.NbDialogDisplayer) Lookup(org.openide.util.Lookup) WindowManager(org.openide.windows.WindowManager) DummyWindowManager(org.openide.windows.DummyWindowManager)

Aggregations

NbNodeOperation (org.netbeans.core.NbNodeOperation)1 NbDialogDisplayer (org.netbeans.core.NbTopManager.NbDialogDisplayer)1 Lookup (org.openide.util.Lookup)1 DummyWindowManager (org.openide.windows.DummyWindowManager)1 WindowManager (org.openide.windows.WindowManager)1