Java Code Examples for org.openide.NotifyDescriptor#setValid()

The following examples show how to use org.openide.NotifyDescriptor#setValid() . 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 File: DashboardTopComponent.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private boolean showCategoryNameDialog(CategoryNamePanel panel, String message) {
    categoryNameDialog = new NotifyDescriptor(
            panel,
            message,
            NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE,
            null,
            NotifyDescriptor.OK_OPTION);
    categoryNameDialog.setValid(false);
    if (categoryNameListener == null) {
        categoryNameListener = new CategoryNameDocumentListener();
    }
    panel.addDocumentListener(categoryNameListener);
    boolean confirm = DialogDisplayer.getDefault().notify(categoryNameDialog) == NotifyDescriptor.OK_OPTION;
    panel.removeDocumentListener(categoryNameListener);
    return confirm;
}
 
Example 2
Source File: DashboardTopComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void addTask(TaskNode... taskNodes) {
    final CategoryPicker picker = new CategoryPicker(taskNodes);
    final NotifyDescriptor nd = new NotifyDescriptor(
            picker,
            NbBundle.getMessage(DashboardTopComponent.class, "LBL_AddTaskToCat"), //NOI18N
            NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE,
            null,
            NotifyDescriptor.OK_OPTION);

    picker.setCategoryListener(new CategoryPicker.CategoryComboListener() {
        @Override
        public void comboItemsChanged(boolean categoryAvailable) {
            nd.setValid(categoryAvailable);
        }
    });
    nd.setValid(false);
    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
        Category category = picker.getChosenCategory();
        dashboard.addTaskToCategory(category, taskNodes);
        
        if(!openedByUserAction && !isOpened()) {
            openedByUserAction = true;
            activate();
        }
    }
}
 
Example 3
Source File: DashboardUtils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void quickSearchTask(RepositoryImpl repositoryImpl) {
    JButton open = new JButton(NbBundle.getMessage(DashboardTopComponent.class, "OPTION_Open"));
    open.setEnabled(false);
    JButton cancel = new JButton(NbBundle.getMessage(DashboardTopComponent.class, "OPTION_Cancel"));

    QuickSearchPanel quickSearchPanel = new QuickSearchPanel(repositoryImpl);
    NotifyDescriptor quickSearchDialog = new NotifyDescriptor(
            quickSearchPanel,
            NbBundle.getMessage(DashboardTopComponent.class, "LBL_QuickTitle", repositoryImpl.getDisplayName()), //NOI18N
            NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE,
            new Object[]{open, cancel},
            open);
    quickSearchDialog.setValid(false);
    QuickSearchListener quickSearchListener = new QuickSearchListener(quickSearchPanel, open);
    quickSearchPanel.addQuickSearchListener(quickSearchListener);
    Object result = DialogDisplayer.getDefault().notify(quickSearchDialog);
    if (result == open) {
        IssueImpl issueImpl = quickSearchPanel.getSelectedTask();
        IssueAction.openIssue(issueImpl.getRepositoryImpl(), issueImpl.getID());
        Category selectedCategory = quickSearchPanel.getSelectedCategory();
        if (selectedCategory != null) {
            DashboardViewer.getInstance().addTaskToCategory(selectedCategory, new TaskNode(issueImpl, null));
        }
    }
    quickSearchPanel.removeQuickSearchListener(quickSearchListener);
}