当前位置: 首页>>代码示例>>Java>>正文


Java WindowManager类代码示例

本文整理汇总了Java中org.openide.windows.WindowManager的典型用法代码示例。如果您正苦于以下问题:Java WindowManager类的具体用法?Java WindowManager怎么用?Java WindowManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WindowManager类属于org.openide.windows包,在下文中一共展示了WindowManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateTitle

import org.openide.windows.WindowManager; //导入依赖的package包/类
/**
 * Updates the title of the enclosing view.
 */
void updateTitle() {
    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            if (active) {
                TopComponent tc = WindowManager.getDefault().findTopComponent("CssStylesTC"); // NOI18N
                if(tc != null) {
                    FileObject fob = getContext();
                    if(fob != null) {
                        ((CssStylesTC)tc).setTitle(fob.getNameExt());
                    }
                }
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:DocumentViewPanel.java

示例2: setWaitCursor

import org.openide.windows.WindowManager; //导入依赖的package包/类
public static void setWaitCursor(final boolean on) {
    Runnable r = new Runnable() {
        @Override
        public void run() {
            JFrame mainWindow = (JFrame) WindowManager.getDefault().getMainWindow();
            mainWindow
                .getGlassPane()
                .setCursor(Cursor.getPredefinedCursor(
                    on ?
                    Cursor.WAIT_CURSOR :
                    Cursor.DEFAULT_CURSOR));
            mainWindow.getGlassPane().setVisible(on);
        }
    };
    if(EventQueue.isDispatchThread()) {
       r.run();
    } else {
        EventQueue.invokeLater(r);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:UIUtils.java

示例3: createDialog

import org.openide.windows.WindowManager; //导入依赖的package包/类
private void createDialog(String title) {
    pHandle = ProgressHandleFactory.createHandle(title);
    JPanel panel = new ProgressPanel(pHandle);
    
    DialogDescriptor descriptor = new DialogDescriptor(
            panel, title
    );
    
    final Object[] OPTIONS = new Object[0];
    descriptor.setOptions(OPTIONS);
    descriptor.setClosingOptions(OPTIONS);
    descriptor.setModal(true);
    descriptor.setOptionsAlign(DialogDescriptor.BOTTOM_ALIGN);
    
    dialog = DialogDisplayer.getDefault().createDialog(descriptor);
    
    Frame mainWindow = WindowManager.getDefault().getMainWindow();
    int windowWidth = mainWindow.getWidth();
    int windowHeight = mainWindow.getHeight();
    int dialogWidth = dialog.getWidth();
    int dialogHeight = dialog.getHeight();
    int dialogX = (int)(windowWidth/2.0) - (int)(dialogWidth/2.0);
    int dialogY = (int)(windowHeight/2.0) - (int)(dialogHeight/2.0);
    
    dialog.setLocation(dialogX, dialogY);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ProgressDialog.java

示例4: DefaultSeparateContainer

import org.openide.windows.WindowManager; //导入依赖的package包/类
/** Creates a DefaultSeparateContainer. */
public DefaultSeparateContainer(final ModeView modeView, WindowDnDManager windowDnDManager, Rectangle bounds, int kind) {
    super(modeView, windowDnDManager, kind);
    // JFrame or JDialog according to the mode kind
    if (kind == Constants.MODE_KIND_EDITOR) {
        modeFrame = new ModeFrame(this, modeView);
        MainWindow.initFrameIcons(modeFrame);
        modeDialog = null;
    } else {
        modeDialog = new ModeDialog(WindowManager.getDefault().getMainWindow(), this, modeView);
        modeFrame = null;
    }
    Window w = getModeUIWindow();
    ((RootPaneContainer) w).getContentPane().add(tabbedHandler.getComponent());
    w.setBounds(bounds);
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DefaultSeparateContainer.java

示例5: showWarning

import org.openide.windows.WindowManager; //导入依赖的package包/类
private void showWarning() {
    NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(AntProjectModule.class, "LBL_Incompatible_Xalan")); // NOI18N
    
    DialogDisplayer.getDefault().notify(nd);
    
    //the IDE cannot be closed here (the window system data are corrupted then), wait until the main window appears
    //and close then:
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            Frame f = WindowManager.getDefault().getMainWindow();
            
            if (f == null || f.isShowing()) {
                LifecycleManager.getDefault().exit();
            } else {
                f.addWindowListener(new WindowAdapter() {
                    public @Override void windowOpened(WindowEvent e) {
                        LifecycleManager.getDefault().exit();
                    }
                });
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:AntProjectModule.java

示例6: addMode

import org.openide.windows.WindowManager; //导入依赖的package包/类
/** Adds mode into model and requests view (if needed). */
    public void addMode(ModeImpl mode, SplitConstraint[] modeConstraints) {
        // PENDING which one to use?
//        if(getModes().contains(mode)) {
//            return;
//        }
        SplitConstraint[] old = getModeConstraints(mode);
        if(modeConstraints == old) {
            return;
        }
        
        model.addMode(mode, modeConstraints);
        
        if(isVisible()) {
            viewRequestor.scheduleRequest(
                new ViewRequest(null, View.CHANGE_MODE_ADDED, null, mode));
        }
        
        WindowManagerImpl.getInstance().doFirePropertyChange(
            WindowManager.PROP_MODES, null, null);
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:Central.java

示例7: view

import org.openide.windows.WindowManager; //导入依赖的package包/类
@Override
public void view(InputGraph graph, boolean clone) {

    if (!clone) {
        WindowManager manager = WindowManager.getDefault();
        for (Mode m : manager.getModes()) {
            for (TopComponent t : manager.getOpenedTopComponents(m)) {
                if (t instanceof EditorTopComponent) {
                    EditorTopComponent etc = (EditorTopComponent) t;
                    if (etc.getModel().getGroup().getGraphs().contains(graph)) {
                        etc.getModel().selectGraph(graph);
                        t.requestActive();
                        return;
                    }
                }
            }
        }
    }

    Diagram diagram = Diagram.createDiagram(graph, Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT));
    EditorTopComponent tc = new EditorTopComponent(diagram);
    tc.open();
    tc.requestActive();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:GraphViewerImplementation.java

示例8: ShowSQLDialog

import org.openide.windows.WindowManager; //导入依赖的package包/类
public ShowSQLDialog() {
    super(WindowManager.getDefault().getMainWindow(), true);
    initComponents();

    jEditorPane1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ShowSQLDialog.class, "showsql.editorpane.accessibleName"));
    jEditorPane1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ShowSQLDialog.class, "ShowSQLDialog.jEditorPane1.AccessibleContext.accessibleDescription"));

    KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
    Action escapeAction = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    };
    getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ShowSQLDialog.class, "ShowSQLDialog.title"));
    getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ShowSQLDialog.class, "ShowSQLDialog.AccessibleContext.accessibleDescription"));

    getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE"); // NOI18N
    getRootPane().getActionMap().put("ESCAPE", escapeAction); // NOI18N  
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:ShowSQLDialog.java

示例9: signOn

import org.openide.windows.WindowManager; //导入依赖的package包/类
public static void signOn () {
    // temprorary to investigate #203326
    NotificationDisplayer.getDefault();
    // end of investigation #203326
    
    AutoupdateSettings.generateIdentity ();
    
    if (timeToCheck ()) {
        // schedule refresh providers
        // install update checker when UI is ready (main window shown)
        WindowManager.getDefault().invokeWhenUIReady(new Runnable () {
            @Override
            public void run () {
                Installer.RP.post (doCheck, 5000);
            }
        });
    } else {
        // install update checker when UI is ready (main window shown)
        WindowManager.getDefault().invokeWhenUIReady(new Runnable () {
            @Override
            public void run () {
                Installer.RP.post (doCheckLazyUpdates, 11000);
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:AutoupdateCheckScheduler.java

示例10: findInstance

import org.openide.windows.WindowManager; //导入依赖的package包/类
/**
 * Obtain the AnalyzerTopComponent instance. Never call {@link #getDefault} directly!
 */
public static synchronized AnalyzerTopComponent findInstance() {
    TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
    if (win == null) {
        Logger.getLogger(AnalyzerTopComponent.class.getName()).warning(
                "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
        return getDefault();
    }
    if (win instanceof AnalyzerTopComponent) {
        return (AnalyzerTopComponent) win;
    }
    Logger.getLogger(AnalyzerTopComponent.class.getName()).warning(
            "There seem to be multiple components with the '" + PREFERRED_ID +
            "' ID. That is a potential source of errors and unexpected behavior.");
    return getDefault();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AnalyzerTopComponent.java

示例11: willCloseNotify

import org.openide.windows.WindowManager; //导入依赖的package包/类
@Override
public void willCloseNotify(List<ComponentInfo> components) {
    for (ComponentInfo ci : components) {
        Component c = ci.getComponent();
        if (c instanceof TopComponent) {
            TopComponent tc = (TopComponent) c;
            boolean isOpened = tc.isOpened();
            String tcId = WindowManager.getDefault().findTopComponentID(tc);
            Properties.getDefault().getProperties(PROPERTY_BASE_NAME).
                    getProperties(PROPERTY_CLOSED_TC).setBoolean(tcId, !isOpened);
            boolean isMinimized = WindowManager.getDefault().isTopComponentMinimized(tc);
            Properties.getDefault().getProperties(PROPERTY_BASE_NAME).
                    getProperties(PROPERTY_MINIMIZED_TC).setBoolean(tcId, isMinimized);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:JPDAEngineComponentsProvider.java

示例12: usageStatisticsReminder

import org.openide.windows.WindowManager; //导入依赖的package包/类
private void usageStatisticsReminder () {
    //Increment number of IDE starts, stop at 4 because we are interested at second start
    long nbOfIdeStarts = corePref.getLong(USAGE_STATISTICS_NB_OF_IDE_STARTS, 0);
    nbOfIdeStarts++;
    if (nbOfIdeStarts < 4) {
        corePref.putLong(USAGE_STATISTICS_NB_OF_IDE_STARTS, nbOfIdeStarts);
    }
    boolean setByIde = corePref.getBoolean(USAGE_STATISTICS_SET_BY_IDE, false);
    boolean usageEnabled = corePref.getBoolean(USAGE_STATISTICS_ENABLED, false);

    //If "usageStatisticsEnabled" was set by IDE do not ask again.
    if (setByIde) {
        return;
    }
    //If "usageStatisticsEnabled" was not set by IDE, it is false and it is second start ask again
    if (!setByIde && !usageEnabled && (nbOfIdeStarts == 2)) {
        WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
            @Override
            public void run() {
                showDialog();
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:Installer.java

示例13: closing

import org.openide.windows.WindowManager; //导入依赖的package包/类
static void closing(List<ComponentInfo> components) {
    for (ComponentInfo ci : components) {
        Component c = ci.getComponent();
        if (c instanceof TopComponent) {
            TopComponent tc = (TopComponent) c;
            /* To check which components we're closing:
            try {
                Method pid = TopComponent.class.getDeclaredMethod("preferredID");
                pid.setAccessible(true);
                System.err.println("ComponentInfoFromBeanContext.closing("+pid.invoke(tc)+")");
            } catch (Exception ex) {
                ex.printStackTrace();
            }*/
            boolean isOpened = tc.isOpened();
            Properties.getDefault().getProperties(DebuggerManagerListener.class.getName()).
                    getProperties(PROPERTY_CLOSED_TC).setBoolean(tc.getName(), !isOpened);
            boolean isMinimized = WindowManager.getDefault().isTopComponentMinimized(tc);
            Properties.getDefault().getProperties(DebuggerManagerListener.class.getName()).
                    getProperties(PROPERTY_MINIMIZED_TC).setBoolean(tc.getName(), isMinimized);
        }
    }
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ComponentInfoFromBeanContext.java

示例14: CssStylesTCController

import org.openide.windows.WindowManager; //导入依赖的package包/类
public CssStylesTCController() {
    //register a weak property change listener to the window manager registry
    //XXX is the weak listener really necessary? Is the registry ever GCed?
    Registry reg = WindowManager.getDefault().getRegistry();
    reg.addPropertyChangeListener(
            WeakListeners.propertyChange(this, reg));

    Lookup.Result<PageInspector> lookupResult = Lookup.getDefault().lookupResult(PageInspector.class);
    lookupResult.addLookupListener(this);
    resultChanged(new LookupEvent(lookupResult));

    //called from CssCaretAwareSourceTask constructor when the caret is set to a css source code
    //for the first time, which means if we initialize the window listener now, we won't get the component
    //activated event since it happened just before the caret was set.

    //fire an artificial even so the rule editor possibly opens
    //the active TC should be the editor which triggered the css caret event
    propertyChange(new PropertyChangeEvent(this, TopComponent.Registry.PROP_ACTIVATED, null,
            TopComponent.getRegistry().getActivated()));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CssStylesTCController.java

示例15: findDefault

import org.openide.windows.WindowManager; //导入依赖的package包/类
/** Finds default instance. Use in client code instead of {@link #getDefault()}. */
@ActionID(id = "org.netbeans.modules.favorites.View", category = "Window")
@OpenActionRegistration(displayName="#ACT_View")
@ActionReference(position = 400, path = "Menu/Window")
public static synchronized Tab findDefault() {
    if(DEFAULT == null) {
        TopComponent tc = WindowManager.getDefault().findTopComponent("favorites"); // NOI18N
        if(DEFAULT == null) {
            Logger.getLogger(Tab.class.getName()).log(Level.WARNING, null,
                              new IllegalStateException("Can not find project component for its ID. Returned " +
                                                        tc)); // NOI18N
            DEFAULT = new Tab();
            // XXX Look into getDefault method.
            DEFAULT.scheduleValidation();
        }
    }

    return DEFAULT;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Tab.java


注:本文中的org.openide.windows.WindowManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。