Java Code Examples for org.openide.windows.WindowManager

The following examples show how to use org.openide.windows.WindowManager. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: constellation   Source File: Startup.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    ConstellationSecurityManager.startSecurityLater(null);

    // application environment
    final String environment = System.getProperty(SYSTEM_ENVIRONMENT);
    final String name = environment != null
            ? String.format("%s %s", BrandingUtilities.APPLICATION_NAME, environment)
            : BrandingUtilities.APPLICATION_NAME;

    // update the main window title with the version number
    WindowManager.getDefault().invokeWhenUIReady(() -> {
        final JFrame frame = (JFrame) WindowManager.getDefault().getMainWindow();
        final String title = String.format("%s - %s", name, VERSION);
        frame.setTitle(title);
    });

    FontUtilities.initialiseFontPreferenceOnFirstUse();
}
 
Example 2
Source Project: constellation   Source File: TutorialStartup.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    final Preferences prefs = NbPreferences.forModule(ApplicationPreferenceKeys.class);
    if (prefs.getBoolean(ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP, ApplicationPreferenceKeys.TUTORIAL_ON_STARTUP_DEFAULT)) {
        SwingUtilities.invokeLater(() -> {
            final TopComponent tutorial = WindowManager.getDefault().findTopComponent(TutorialTopComponent.class.getSimpleName());
            if (tutorial != null) {
                if (!tutorial.isOpened()) {
                    tutorial.open();
                }
                tutorial.setEnabled(true);
                tutorial.requestActive();
            }
        });
    }
}
 
Example 3
Source Project: netbeans   Source File: AnalysisResultTopComponent.java    License: Apache License 2.0 6 votes vote down vote up
public static synchronized AnalysisResultTopComponent findInstance() {
    TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
    if (win instanceof AnalysisResultTopComponent) {
        return (AnalysisResultTopComponent) win;
    }
    if (win == null) {
        Logger.getLogger(AnalysisResultTopComponent.class.getName()).warning(
                "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
    } else {
        Logger.getLogger(AnalysisResultTopComponent.class.getName()).warning(
                "There seem to be multiple components with the '" + PREFERRED_ID +
                "' ID. That is a potential source of errors and unexpected behavior.");
    }
    
    AnalysisResultTopComponent result = new AnalysisResultTopComponent();
    Mode outputMode = WindowManager.getDefault().findMode("output");
    
    if (outputMode != null) {
        outputMode.dockInto(result);
    }
    return result;
}
 
Example 4
public DefaultQualityControlAutoButton() {
    getStylesheets().add(JavafxStyleManager.getMainStyleSheet());
    setStyle(QUERY_RISK_DEFAULT_STYLE + BUTTON_STYLE + String.format("-fx-font-size:%d;", FontUtilities.getOutputFontSize()));

    setOnAction(value -> {
        SwingUtilities.invokeLater(() -> {
            final TopComponent qualityControlView = WindowManager.getDefault().findTopComponent(QualityControlViewTopComponent.class.getSimpleName());
            if (qualityControlView != null) {
                if (!qualityControlView.isOpened()) {
                    qualityControlView.open();
                }
                qualityControlView.requestActive();
            }
        });
    });

    QualityControlAutoVetter.getInstance().addListener(this);
    QualityControlAutoVetter.getInstance().invokeListener(this);
}
 
Example 5
Source Project: netbeans   Source File: MaximizeWindowAction.java    License: Apache License 2.0 6 votes vote down vote up
public MaximizeWindowAction() {
    String label = NbBundle.getMessage(MaximizeWindowAction.class, "CTL_MaximizeWindowAction"); //NOI18N
    putValue(Action.NAME, label);
    propListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String propName = evt.getPropertyName();
            if(WindowManagerImpl.PROP_MAXIMIZED_MODE.equals(propName)
            || WindowManagerImpl.PROP_EDITOR_AREA_STATE.equals(evt.getPropertyName())
            || WindowManager.PROP_MODES.equals(evt.getPropertyName())
            || WindowManagerImpl.PROP_ACTIVE_MODE.equals(evt.getPropertyName())) {
                updateState();
            }
            // #64876: correctly initialize after startup 
            if (TopComponent.Registry.PROP_ACTIVATED.equals(propName)) {
                updateState();
            }
        }
    };
    TopComponent.Registry registry = TopComponent.getRegistry();
    registry.addPropertyChangeListener(WeakListeners.propertyChange(propListener, registry));
    WindowManagerImpl wm = WindowManagerImpl.getInstance();
    wm.addPropertyChangeListener(WeakListeners.propertyChange(propListener, wm));
    
    updateState();
}
 
Example 6
Source Project: netbeans   Source File: TerminalContainerTopComponent.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Obtain the TerminalContainerTopComponent instance. Never call {@link #getDefault} directly!
 */
public static synchronized TerminalContainerTopComponent findInstance() {
    TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
    if (win == null) {
        Logger.getLogger(TerminalContainerTopComponent.class.getName()).warning(
                "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");// NOI18N
        return getDefault();
    }
    if (win instanceof TerminalContainerTopComponent) {
        return (TerminalContainerTopComponent) win;
    }
    Logger.getLogger(TerminalContainerTopComponent.class.getName()).warning(
            "There seem to be multiple components with the '" + PREFERRED_ID // NOI18N
            + "' ID. That is a potential source of errors and unexpected behavior.");// NOI18N
    return getDefault();
}
 
Example 7
Source Project: netbeans   Source File: Installer.java    License: Apache License 2.0 6 votes vote down vote up
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();
            }
        });
    }
}
 
Example 8
protected void performAction(Node[] activatedNodes) {
    Object[] options = {"Yes",
        "No",
        "Cancel"
    };
    int n = JOptionPane.showOptionDialog(WindowManager.getDefault().getMainWindow(),
            "Do you really want to delete " + activatedNodes.length + " filter/s?", "Delete?",
            JOptionPane.YES_NO_CANCEL_OPTION,
            JOptionPane.QUESTION_MESSAGE,
            null,
            options,
            options[2]);

    if (n == JOptionPane.YES_OPTION) {
        for (int i = 0; i < activatedNodes.length; i++) {
            FilterTopComponent.findInstance().removeFilter(activatedNodes[i].getLookup().lookup(Filter.class));
        }
    }
}
 
Example 9
Source Project: netbeans   Source File: CollapseTabGroupAction.java    License: Apache License 2.0 6 votes vote down vote up
public CollapseTabGroupAction() {
    putValue(NAME, NbBundle.getMessage(CloseModeAction.class, "CTL_CollapseTabGroupAction"));
    TopComponent.getRegistry().addPropertyChangeListener(
        WeakListeners.propertyChange(this, TopComponent.getRegistry()));
    WindowManager.getDefault().addPropertyChangeListener(
        WeakListeners.propertyChange(this, WindowManager.getDefault()));
    if (SwingUtilities.isEventDispatchThread()) {
        updateEnabled();
    } else {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                updateEnabled();
            }
        });
    }
}
 
Example 10
Source Project: netbeans   Source File: TaskListTopComponent.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void componentOpened() {
    if( null == model ) {
        toolbarSeparator.setVisible(false);
        statusSeparator.setVisible(false);
        tableScroll.setViewportView( createNoTasksMessage() );
    }

    WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
        @Override
        public void run() {
            TaskManagerImpl.RP.post(new Runnable() {
                @Override
                public void run() {
                    init();
                }
            });
        }
    });
}
 
Example 11
Source Project: NBANDROID-V2   Source File: LogTopComponent.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Obtain the LogTopComponent instance. Never call {@link #getDefault}
 * directly!
 */
public static synchronized LogTopComponent findInstance() {
    TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
    if (win == null) {
        Logger.getLogger(LogTopComponent.class.getName()).warning(
                "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
        return getDefault();
    }
    if (win instanceof LogTopComponent) {
        return (LogTopComponent) win;
    }
    Logger.getLogger(LogTopComponent.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();
}
 
Example 12
Source Project: netbeans   Source File: AntProjectModule.java    License: Apache License 2.0 6 votes vote down vote up
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();
                    }
                });
            }
        }
    });
}
 
Example 13
Source Project: netbeans   Source File: InitializeInAWTTest.java    License: Apache License 2.0 6 votes vote down vote up
public void testInitializeAndBlockInAWT() throws Exception {
    assertTrue("Running in AWT", SwingUtilities.isEventDispatchThread());
    
    class R implements PropertyChangeListener {
        JEditorPane p;
        public void run() {
            p = support.getOpenedPanes()[0];
        }

        public void propertyChange(PropertyChangeEvent evt) {
            if (TopComponent.Registry.PROP_ACTIVATED.equals(evt.getPropertyName())) {
                run();
            }
        }
    }
    R r = new R();
    WindowManager.getDefault().getRegistry().addPropertyChangeListener(r);
    
    final Object LOCK = new JPanel().getTreeLock();
    synchronized (LOCK) {
        support.open();
        assertNotNull(r.p);
    }
    
    assertKit(r.p.getEditorKit());
}
 
Example 14
Source Project: visualvm   Source File: SnapshotsWindowUI.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static boolean isOpen(Snapshot s) {
    File f = FileUtil.toFile(s.getFile());
    if (f == null) return false; // #236480

    if (s.isHeapDump()) {
        Set<TopComponent> tcs = WindowManager.getDefault().getRegistry().getOpened();
        for (TopComponent tc : tcs) {
            if (f.equals(tc.getClientProperty(ProfilerTopComponent.RECENT_FILE_KEY)))
                return true;
        }
    } else {
        LoadedSnapshot ls = ResultsManager.getDefault().findLoadedSnapshot(f);
        if (ls != null) return true;
    }
    return false;
}
 
Example 15
Source Project: netbeans   Source File: Central.java    License: Apache License 2.0 6 votes vote down vote up
/** 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);
    }
 
Example 16
/**
 * Obtain the AssetPackBrowserTopComponent instance. Never call {@link #getDefault} directly!
 */
public static synchronized AssetPackBrowserTopComponent findInstance() {
    TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
    if (win == null) {
        Logger.getLogger(AssetPackBrowserTopComponent.class.getName()).warning(
                "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
        return getDefault();
    }
    if (win instanceof AssetPackBrowserTopComponent) {
        return (AssetPackBrowserTopComponent) win;
    }
    Logger.getLogger(AssetPackBrowserTopComponent.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();
}
 
Example 17
Source Project: netbeans   Source File: ProgressDialog.java    License: Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 18
@Override
public void actionPerformed(ActionEvent e) {
    String defaultName = WindowUtilities.getUniqueTitle(Bundle.VAL_NewWorkspaceActionValue(),
                                                        WorkspaceTopComponent.class);
    NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine(Bundle.LBL_NewWorkspaceActionName(),
                                                                  Bundle.CTL_NewWorkspaceActionName());
    d.setInputText(defaultName);
    Object result = DialogDisplayer.getDefault().notify(d);
    if (NotifyDescriptor.OK_OPTION.equals(result)) {
        WorkspaceTopComponent workspaceTopComponent = new WorkspaceTopComponent(d.getInputText());
        Mode editor = WindowManager.getDefault().findMode("editor");
        Assert.notNull(editor, "editor");
        editor.dockInto(workspaceTopComponent);
        workspaceTopComponent.open();
        workspaceTopComponent.requestActive();
    }
}
 
Example 19
Source Project: netbeans   Source File: GetRightEditorAction.java    License: Apache License 2.0 6 votes vote down vote up
/** Perform the action. Sets/unsets maximzed mode. */
 public void actionPerformed(java.awt.event.ActionEvent ev) {
     WindowManager wm = WindowManager.getDefault();
     MultiViewHandler handler = MultiViews.findMultiViewHandler(wm.getRegistry().getActivated());
     if (handler != null) {
         MultiViewPerspective pers = handler.getSelectedPerspective();
         MultiViewPerspective[] all = handler.getPerspectives();
         for (int i = 0; i < all.length; i++) {
             if (pers.equals(all[i])) {
                 int newIndex = i != all.length  - 1 ? i + 1 : 0;
   MultiViewDescription selectedDescr = Accessor.DEFAULT.extractDescription(pers);
   if (selectedDescr instanceof ContextAwareDescription) {
if (((ContextAwareDescription) selectedDescr).isSplitDescription()) {
    newIndex = i != all.length  - 1 ? i + 2 : 1;
} else {
    newIndex = i != all.length  - 2 ? i + 2 : 0;
}
   }
                 handler.requestActive(all[newIndex]);
   break;
             }
         }
     } else {
         Utilities.disabledActionBeep();
     }
 }
 
Example 20
/**
 * Obtain the BytecodeViewTopComponent instance. Never call {@link #getDefault} directly!
 */
public static synchronized BytecodeViewTopComponent findInstance() {
    TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
    if (win == null) {
        ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find BytecodeView component. It will not be located properly in the window system.");
        return getDefault();
    }
    if (win instanceof BytecodeViewTopComponent) {
        return (BytecodeViewTopComponent) win;
    }
    ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior.");
    return getDefault();
}
 
Example 21
Source Project: netbeans   Source File: RunOffEDTImplTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testShowProgressDialogAndRun_3args_2() throws InterruptedException {
    final WM wm = Lookup.getDefault().lookup(WM.class);
    //make sure main window is on screen before proceeding
    wm.await();
    final JFrame jf = (JFrame) WindowManager.getDefault().getMainWindow();
    final CountDownLatch countDown = new CountDownLatch(1);
    final AtomicBoolean glassPaneFound = new AtomicBoolean(false);
    final boolean testGlassPane = canTestGlassPane();
    class R implements Runnable {
        volatile boolean hasRun;
        @Override
        public void run() {
            try {
                wm.waitForGlassPane();
                if (testGlassPane) {
                    glassPaneFound.set(jf.getGlassPane() instanceof RunOffEDTImpl.TranslucentMask);
                }
                hasRun = true;
            } finally {
                countDown.countDown();
            }
        }
    }
    R r = new R();
    ProgressUtils.showProgressDialogAndRun(r, "Something");
    countDown.await();
    assertTrue (r.hasRun);
    assertTrue ("Glass pane not set", !testGlassPane || glassPaneFound.get());
}
 
Example 22
/** Creates new form EditFilterDialog */
public EditFilterDialog(CustomFilter customFilter) {
    super(WindowManager.getDefault().getMainWindow(), true);
    this.customFilter = customFilter;
    initComponents();

    sourceTextArea.setText(customFilter.getCode());
    nameTextField.setText(customFilter.getName());
}
 
Example 23
Source Project: netbeans   Source File: UtilTestCase.java    License: Apache License 2.0 5 votes vote down vote up
public void testCreateNewQuery() {
    Repository repo = getRepo();
    APITestRepository apiRepo = getApiRepo();
    
    assertNull(apiRepo.newQuery);
    Util.createNewQuery(repo);
    
    long t = System.currentTimeMillis();
    TopComponent openedTC = null;
    while(openedTC == null) {
        Set<TopComponent> openedTCs = WindowManager.getDefault().getRegistry().getOpened();
        for (TopComponent tc : openedTCs) {
            if(tc instanceof QueryTopComponent) {
                QueryTopComponent itc = (QueryTopComponent)tc;
                QueryImpl queryImpl = itc.getQuery();
                if(queryImpl != null && queryImpl.isData(apiRepo.newQuery)) {
                    openedTC = tc;
                    break;
                }
            }
        }
        if(System.currentTimeMillis() - t > 50000) {
            break;
        }
    }
    
    assertNotNull(apiRepo.newQuery);
    if(openedTC == null) {
        fail("TopComponent with new query wasn't opened");
    }
    openedTC.close();
}
 
Example 24
Source Project: constellation   Source File: AbstractTopComponent.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void componentHidden() {
    super.componentHidden();
    if (WindowManager.getDefault().isTopComponentFloating(this)) {
        ConstellationLogger.getDefault().viewInfo(this, "Hidden / Floating");
    } else if (WindowManager.getDefault().isTopComponentMinimized(this)) {
        ConstellationLogger.getDefault().viewInfo(this, "Hidden / Minimised");
    } else {
        ConstellationLogger.getDefault().viewInfo(this, "Hidden / Docked");
    }
}
 
Example 25
Source Project: netbeans   Source File: PopupUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static void hidePopup() {
        if (popupWindow != null) {
//            popupWindow.getContentPane().removeAll();
            Toolkit.getDefaultToolkit().removeAWTEventListener(hideListener);
            
            popupWindow.setVisible( false );
            popupWindow.dispose();
        }
        WindowManager.getDefault().getMainWindow().removeWindowStateListener(hideListener);
        WindowManager.getDefault().getMainWindow().removeComponentListener(hideListener);
        popupWindow = null;
    }
 
Example 26
/**
 * Obtain the OutlineTopComponent instance. Never call {@link #getDefault} directly!
 */
public static synchronized OutlineTopComponent findInstance() {
    TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
    if (win == null) {
        ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find Outline component. It will not be located properly in the window system.");
        return getDefault();
    }
    if (win instanceof OutlineTopComponent) {
        return (OutlineTopComponent) win;
    }
    ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior.");
    return getDefault();
}
 
Example 27
public static WorkspaceTopComponent findShowingInstance() {
    TopComponent activated = WindowManager.getDefault().getRegistry().getActivated();
    if (activated instanceof WorkspaceTopComponent) {
        return (WorkspaceTopComponent) activated;
    }
    List<WorkspaceTopComponent> showingWorkspaces = findShowingInstances();
    if (!showingWorkspaces.isEmpty()) {
        return showingWorkspaces.get(0);
    }
    return null;
}
 
Example 28
/**
 * Obtain the OutlineTopComponent instance. Never call {@link #getDefault} directly!
 */
public static synchronized OutlineTopComponent findInstance() {
    TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
    if (win == null) {
        ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find Outline component. It will not be located properly in the window system.");
        return getDefault();
    }
    if (win instanceof OutlineTopComponent) {
        return (OutlineTopComponent) win;
    }
    ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior.");
    return getDefault();
}
 
Example 29
Source Project: Open-LaTeX-Studio   Source File: Undo.java    License: MIT License 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    TopComponent tc = WindowManager.getDefault().findTopComponent("EditorTopComponent");
    EditorTopComponent etc = (EditorTopComponent) tc;
    
    etc.undoAction();
    etc.getEditorState().setDirty(true);
}
 
Example 30
Source Project: jdk8u60   Source File: EditorTopComponent.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static EditorTopComponent getActive() {
    Set<? extends Mode> modes = WindowManager.getDefault().getModes();
    for (Mode m : modes) {
        TopComponent tc = m.getSelectedTopComponent();
        if (tc instanceof EditorTopComponent) {
            return (EditorTopComponent) tc;
        }
    }
    return null;
}