Package org.openide.windows

Examples of org.openide.windows.TopComponent


        super(NbBundle.getMessage(scratch_padAction.class, "CTL_scratch_padAction"));
        //putValue(SMALL_ICON, new ImageIcon(Utilities.loadImage(scratch_padTopComponent.ICON_PATH, true)));
    }

    public void actionPerformed(ActionEvent evt) {
        TopComponent win = scratch_padTopComponent.findInstance();
        win.open();
        win.requestActive();
    }
View Full Code Here


        showTreeLabel.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {
                TopComponent tc = WindowManager.getDefault().findTopComponent("HierarchyTopComponent");
                if (tc != null) {
                    tc.open();
                    tc.requestActive();
                    HierarchyTopComponent hierarchyTopComponent = (HierarchyTopComponent) tc;
                    hierarchyTopComponent.refresh();
                }
            }
        });
View Full Code Here

    /**
     * Obtain the TutorialTopComponent instance. Never call {@link #getDefault} directly!
     */
    public static synchronized TutorialTopComponent findInstance() {
        TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
        if (win == null) {
            Logger.getLogger(TutorialTopComponent.class.getName()).warning(
                    "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
            return getDefault();
        }
View Full Code Here

        if(jp != null)
        {
         name = jp.getName();
        TopComponent.Registry registry = TopComponent.getRegistry();
        if(registry != null) {
             TopComponent activated = registry.getActivated();
             if(activated != null) {
                 tcName = activated.getName();
             } else {
                 Set<TopComponent> opened = registry.getOpened();
                 if(opened.size() == 1) {
                     Iterator<TopComponent> iterator = opened.iterator();
                     if(iterator.hasNext()) {
                         TopComponent next = iterator.next();
                         if(next != null) {
                             tcName = next.getName();
                         }
                     }
                 }
             }
        }
View Full Code Here

    /**
     * Obtain the SodbeansOutputTopComponent instance. Never call {@link #getDefault} directly!
     */
    public static synchronized SodbeansOutputTopComponent findInstance() {
        TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
        if (win == null) {
            Logger.getLogger(SodbeansOutputTopComponent.class.getName()).warning(
                    "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
            return getDefault();
        }
View Full Code Here

            tc.requestActive();
        }
    }

    public static void closeTopComponent() {
        final TopComponent etc = WindowManager.getDefault().findTopComponent("ImageAnalyzerTopComponent");
        if (etc != null) {
            try {
                etc.close();
            } catch (Exception e) {
                LOGGER.log(Level.SEVERE, "failed to close ImageAnalyzerTopComponent", e);
            }
        }
    }
View Full Code Here

                menuItems.add(AddDrawableTagAction.getInstance().getPopupMenu());

                final MenuItem extractMenuItem = new MenuItem("Extract File(s)");
                extractMenuItem.setOnAction((ActionEvent t) -> {
                    SwingUtilities.invokeLater(() -> {
                        TopComponent etc = WindowManager.getDefault().findTopComponent(ImageAnalyzerTopComponent.PREFERRED_ID);
                        ExtractAction.getInstance().actionPerformed(new java.awt.event.ActionEvent(etc, 0, null));
                    });
                });
                menuItems.add(extractMenuItem);
View Full Code Here

        // TODO: there has to be a better way to do this.

        // find the data explorer top components
        Collection<? extends DataExplorer> dataExplorers = Lookup.getDefault().lookupAll(DataExplorer.class);
        for (DataExplorer de : dataExplorers) {
            TopComponent explorerWin = de.getTopComponent();
            Mode m = WindowManager.getDefault().findMode("explorer"); //NON-NLS
            if (m != null) {
                m.dockInto(explorerWin); // redock into the explorer mode
            } else {
                logger.log(Level.WARNING, "Could not find explorer mode and dock explorer window"); //NON-NLS
            }
            explorerWin.open(); // open that top component
        }

        // find the data content top component
        TopComponent contentWin = DataContentTopComponent.findInstance();
        Mode m = WindowManager.getDefault().findMode("output"); //NON-NLS
        if (m != null) {
            m.dockInto(contentWin); // redock into the output mode
        } else {
            logger.log(Level.WARNING, "Could not find output mode and dock content window"); //NON-NLS
        }

        contentWin.open(); // open that top component
    }
View Full Code Here

        WindowManager wm = WindowManager.getDefault();
        Set<? extends Mode> modes = wm.getModes();
        Iterator<? extends Mode> iter = wm.getModes().iterator();


        TopComponent directoryTree = null;
        TopComponent favorites = null;
        String tcName = "";
        while (iter.hasNext()) {
            Mode mode = iter.next();
            for (TopComponent tc : mode.getTopComponents()) {
                tcName = tc.getName();
                if (tcName == null) {
                    logger.log(Level.INFO, "tcName was null"); //NON-NLS
                    tcName = "";
                }
                // switch requires constant strings, so converted to if/else.
                if (DIRECTORY_TREE.equals(tcName)) {
                    directoryTree = tc;
                } else if (FAVORITES.equals(tcName)) {
                    favorites = tc;
                } else {
                    tc.close();
                }
            }
        }
       
        if (directoryTree != null) {
            directoryTree.close();
        }
        if (favorites != null) {
            favorites.close();
        }
    }
View Full Code Here

            } else {
                rootNode = Node.EMPTY;
            }

            final String pathText = NbBundle.getMessage(this.getClass(), "HashDbSearchManager.MD5HashSearch");
            TopComponent searchResultWin = DataResultTopComponent.createInstance(
                    NbBundle.getMessage(this.getClass(), "HashDbSearchManager.MD5HashSearch"),
                    pathText,
                    rootNode,
                    kvCollection.size());

            searchResultWin.requestActive();
        } else {
            JOptionPane.showMessageDialog(null,
                                          NbBundle.getMessage(this.getClass(), "HashDbSearchManager.noResultsFoundMsg"));
        }
    }
View Full Code Here

TOP

Related Classes of org.openide.windows.TopComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.