當前位置: 首頁>>代碼示例>>Java>>正文


Java NotifyDescriptor.OK_OPTION屬性代碼示例

本文整理匯總了Java中org.openide.NotifyDescriptor.OK_OPTION屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.OK_OPTION屬性的具體用法?Java NotifyDescriptor.OK_OPTION怎麽用?Java NotifyDescriptor.OK_OPTION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.openide.NotifyDescriptor的用法示例。


在下文中一共展示了NotifyDescriptor.OK_OPTION屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: promptToDelete

private boolean promptToDelete(Preferences prefs) {
    Object result = DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation(
            NbBundle.getMessage(FallbackProvider.class, "FallbackProvider.msg_clear_keys"),
            NbBundle.getMessage(FallbackProvider.class, "FallbackProvider.title_clear_keys"),
            NotifyDescriptor.OK_CANCEL_OPTION));
    if (result == NotifyDescriptor.OK_OPTION) {
        try {
            LOG.log(Level.FINE, "agreed to delete stored passwords: {0}", Arrays.asList(prefs.keys()));
            prefs.clear();
            return testSampleKey(prefs);
        } catch (BackingStoreException x) {
            LOG.log(Level.INFO, null, x);
        }
    } else {
        LOG.fine("refused to delete stored passwords");
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:FallbackProvider.java

示例2: open

/**
 * Opens dialog for adding entities.
 * @return fully qualified names of the selected entities' classes.
 */
public static List<String> open(EntityClassScope entityClassScope, Set<String> ignoreClassNames){
    AddEntityPanel panel = AddEntityPanel.create(entityClassScope, ignoreClassNames);
    
    final DialogDescriptor nd = new DialogDescriptor(
            panel,
            NbBundle.getMessage(AddEntityDialog.class, "LBL_AddEntity"),
            true,
            DialogDescriptor.OK_CANCEL_OPTION,
            DialogDescriptor.OK_OPTION,
            DialogDescriptor.DEFAULT_ALIGN,
            new HelpCtx(AddEntityPanel.class),
            null
            );
    
    Object button = DialogDisplayer.getDefault().notify(nd);
    if (button != NotifyDescriptor.OK_OPTION) {
        return Collections.emptyList();
    }
    
    return Collections.unmodifiableList(panel.getSelectedEntityClasses());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:AddEntityDialog.java

示例3: handleInput

public void handleInput(InputRequest request) throws BuildException {
    interestingOutputCallback.run();

    // #30196 - for one Ant script containing several <input> tasks there will be created
    // just one instance of the NbInputHandler. So it is necessary to cleanup the instance
    // used by the previous <input> task first.
    combo = null;
    input = null;

    JPanel panel = createPanel(request);
    DialogDescriptor dlg = new DialogDescriptor(panel,
    NbBundle.getMessage(NbInputHandler.class, "TITLE_input_handler")); //NOI18N
    do {
        DialogDisplayer.getDefault().createDialog(dlg).setVisible(true);
        if (dlg.getValue() != NotifyDescriptor.OK_OPTION) {
            throw new BuildException(NbBundle.getMessage(NbInputHandler.class, "MSG_input_aborted")); //NOI18N
        }
        String value;
        if (combo != null) {
            value = (String) combo.getSelectedItem();
        } else {
            value = input.getText();
        }
        request.setInput(value);
    } while (!request.isInputValid());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:NbInputHandler.java

示例4: addKeyToBranding

private boolean addKeyToBranding (String bundlepath, String codenamebase, String key) {
    BrandingSupport.BundleKey bundleKey = getBranding().getGeneralBundleKeyForModification(codenamebase, bundlepath, key);
    KeyInput inputLine = new KeyInput(key + ":", bundlepath); // NOI18N
    String oldValue = bundleKey.getValue();
    inputLine.setInputText(oldValue);
    if (DialogDisplayer.getDefault().notify(inputLine)==NotifyDescriptor.OK_OPTION) {
        String newValue = inputLine.getInputText();
        if (newValue.compareTo(oldValue)!=0) {
            bundleKey.setValue(newValue);
            getBranding().addModifiedGeneralBundleKey(bundleKey);
            setModified();
            return true;
        }
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:ResourceBundleBrandingPanel.java

示例5: btnAddActionPerformed

private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-HEADEREND:event_btnAddActionPerformed
    NotifyDescriptor.InputLine nd = new NonEmptyInputLine(org.openide.util.NbBundle.getMessage(ActionMappings.class, "TIT_Add_action"), org.openide.util.NbBundle.getMessage(ActionMappings.class, "LBL_AddAction"));
    Object ret = DialogDisplayer.getDefault().notify(nd);
    if (ret == NotifyDescriptor.OK_OPTION) {
        NetbeansActionMapping nam = new NetbeansActionMapping();
        nam.setDisplayName(nd.getInputText());
        nam.setActionName(CUSTOM_ACTION_PREFIX + nd.getInputText()); 
        getActionMappings().addAction(nam);
        if (handle != null) {
            handle.markAsModified(getActionMappings());
        }
        MappingWrapper wr = new MappingWrapper(nam);
        wr.setUserDefined(true);
        ((DefaultListModel)lstMappings.getModel()).addElement(wr);
        lstMappings.setSelectedIndex(lstMappings.getModel().getSize() - 1);
        lstMappings.ensureIndexIsVisible(lstMappings.getModel().getSize() - 1);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ActionMappings.java

示例6: removeRemote

public void removeRemote (File repository, final String remoteName) {
    if (DialogDisplayer.getDefault().notify(new NotifyDescriptor(NbBundle.getMessage(RemoveRemoteConfig.class, "MSG_RemoveRemoteConfig.confirmation", remoteName), //NOI18N
            NbBundle.getMessage(RemoveRemoteConfig.class, "LBL_RemoveRemoteConfig.confirmation"), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE, //NOI18N
            new Object[] { NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION }, NotifyDescriptor.OK_OPTION)) == NotifyDescriptor.OK_OPTION) {
        GitProgressSupport supp = new GitProgressSupport() {
            @Override
            protected void perform () {
                try {
                    GitClient client = getClient();
                    client.removeRemote(remoteName, getProgressMonitor());
                } catch (GitException ex) {
                    GitClientExceptionHandler.notifyException(ex, true);
                }
            }
        };
        supp.start(Git.getInstance().getRequestProcessor(repository), repository, NbBundle.getMessage(RemoveRemoteConfig.class, "LBL_RemoveRemoteConfig.progressName")); //NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:RemoveRemoteConfig.java

示例7: showCategoryNameDialog

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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:DashboardTopComponent.java

示例8: addFilterSetting

public void addFilterSetting() {
    NotifyDescriptor.InputLine l = new NotifyDescriptor.InputLine("Name of the new profile:", "Filter Profile");
    if (DialogDisplayer.getDefault().notify(l) == NotifyDescriptor.OK_OPTION) {
        String name = l.getInputText();

        FilterSetting toRemove = null;
        for (FilterSetting s : filterSettings) {
            if (s.getName().equals(name)) {
                NotifyDescriptor.Confirmation conf = new NotifyDescriptor.Confirmation("Filter profile \"" + name + "\" already exists, do you want to replace it?", "Filter");
                if (DialogDisplayer.getDefault().notify(conf) == NotifyDescriptor.YES_OPTION) {
                    toRemove = s;
                    break;
                } else {
                    return;
                }
            }
        }

        if (toRemove != null) {
            filterSettings.remove(toRemove);
        }
        FilterSetting setting = createFilterSetting(name);
        filterSettings.add(setting);

        // Sort alphabetically
        Collections.sort(filterSettings, new Comparator<FilterSetting>() {

            @Override
            public int compare(FilterSetting o1, FilterSetting o2) {
                return o1.getName().compareTo(o2.getName());
            }
        });

        updateComboBox();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:36,代碼來源:FilterTopComponent.java

示例9: ignore

@Messages({
    "# {0} - job name",
    "# {1} - server name",
    "ProblemNotification.ignore.question=Do you wish to cease to receive notifications of failures in {0}? If you change your mind, use Services > Hudson Builders > {1} > {0} > Properties > Watched.",
    "# {0} - job name",
    "ProblemNotification.ignore.title=Ignore Failures in {0}"
})
void ignore() { // #161601
    if (DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation(
            Bundle.ProblemNotification_ignore_question(job.getDisplayName(), job.getInstance().getName()),
            Bundle.ProblemNotification_ignore_title(job.getDisplayName()),
            NotifyDescriptor.OK_CANCEL_OPTION)) == NotifyDescriptor.OK_OPTION) {
        job.setSalient(false);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ProblemNotification.java

示例10: actionPerformed

@Messages({
    "ProjectAssociationAction.open_some_projects=Open some projects to choose from.",
    "ProjectAssociationAction.title_select_project=Select Project",
    "ProjectAssociationAction.could_not_associate=Failed to record a Hudson job association.",
    "ProjectAssociationAction.could_not_dissociate=Failed to find the Hudson job association to be removed."
})
@Override public void actionPerformed(ActionEvent e) {
    if (alreadyAssociatedProject == null) {
        SortedSet<Project> projects = new TreeSet<Project>(ProjectRenderer.comparator());
        projects.addAll(Arrays.asList(OpenProjects.getDefault().getOpenProjects()));
        if (projects.isEmpty()) {
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ProjectAssociationAction_open_some_projects(), NotifyDescriptor.INFORMATION_MESSAGE));
            return;
        }
        JComboBox box = new JComboBox(new DefaultComboBoxModel(projects.toArray(new Project[projects.size()])));
        box.setRenderer(new ProjectRenderer());
        if (DialogDisplayer.getDefault().notify(new NotifyDescriptor(box, Bundle.ProjectAssociationAction_title_select_project(), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE, null, null)) != NotifyDescriptor.OK_OPTION) {
            return;
        }
        if (!ProjectHudsonProvider.getDefault().recordAssociation((Project) box.getSelectedItem(), assoc)) {
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ProjectAssociationAction_could_not_associate(), NotifyDescriptor.WARNING_MESSAGE));
        }
    } else {
        if (!ProjectHudsonProvider.getDefault().recordAssociation(alreadyAssociatedProject, null)) {
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ProjectAssociationAction_could_not_dissociate(), NotifyDescriptor.WARNING_MESSAGE));
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:ProjectAssociationAction.java

示例11: bConnectionPropertiesActionPerformed

private void bConnectionPropertiesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bConnectionPropertiesActionPerformed
    PropertyEditorPanel pep = new PropertyEditorPanel(connectionProperties, true);
    DialogDescriptor dd = new DialogDescriptor(
            pep,
            NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionPanel.dlgConnectionProperties"),
            true,
            null);
    Object result = DialogDisplayer.getDefault().notify(dd);
    if(result == NotifyDescriptor.OK_OPTION) {
        connectionProperties = pep.getValue();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:NewConnectionPanel.java

示例12: setUserDesignerSize

private void setUserDesignerSize() {
    NotifyDescriptor.InputLine input = new NotifyDescriptor.InputLine(
        FormUtils.getBundleString("CTL_SetDesignerSize_Label"), // NOI18N
        FormUtils.getBundleString("CTL_SetDesignerSize_Title")); // NOI18N
    Dimension size = formDesigner.getComponentLayer().getDesignerSize();
    input.setInputText(Integer.toString(size.width) + ", " // NOI18N
                       + Integer.toString(size.height));

    if (DialogDisplayer.getDefault().notify(input) == NotifyDescriptor.OK_OPTION) {
        String txt = input.getInputText();
        int i = txt.indexOf(',');
        if (i > 0) {
            int n = txt.length();
            try {
                int w = Integer.parseInt(txt.substring(0, i));
                while (++i < n && txt.charAt(i) == ' ');
                int h = Integer.parseInt(txt.substring(i, n));
                if (w >= 0 && h >= 0) {
                    size = new Dimension(w ,h);
                    formDesigner.setDesignerSize(size, null);
                    setToolTipText(null);
                    setCursor(Cursor.getDefaultCursor());
                }
            }
            catch (NumberFormatException ex) {} // silently ignore, do nothing
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:HandleLayer.java

示例13: create

public void create() throws IOException {
    String title = "Create New " + getName();
    NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine("New name:", title);
    if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.OK_OPTION) {
        String name = d.getInputText();
        if (dir) {
            ph.createContainerPhadhail(name);
        } else {
            ph.createLeafPhadhail(name);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:PhadhailNewType.java

示例14: actionPerformed

@Override
public void actionPerformed(ActionEvent e) {
    String title = dialogTitle;
    String text = "Parameters:";

    NotifyDescriptor.InputLine input = new NotifyDescriptor.InputLine(text, title);
    FormalParameters params = dataNode.getParameters();
    input.setInputText("vars(" + params.toString() + ")");

    Object result = DialogDisplayer.getDefault().notify(input);

    if (result != NotifyDescriptor.OK_OPTION) {
        return;
    }

    String userInput = input.getInputText().trim();
    try {
        FormalParameters newParams;
        if (userInput.isEmpty() || userInput.matches("^vars *\\( *\\)$")) {
            newParams = new FormalParameters();
        } else {
            PoshParser parser = new PoshParser(new StringReader(userInput));
            newParams = parser.parameters();
        }
        dataNode.setParameters(newParams);
    } catch (ParseException ex) {
        String msg = MessageFormat.format("Unable to parse parameters from:\n{0}\nError message: ", userInput, ex.getMessage());
        errorDialog(msg);
    }
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:30,代碼來源:ShedMenuActionFactory.java

示例15: notifyImportImpossible

private void notifyImportImpossible(String msg) {
    NotifyDescriptor nd =
        new NotifyDescriptor(
            msg,
            NbBundle.getMessage(CreateAction.class, "MSG_ImportNotAllowed"), // NOI18N
            NotifyDescriptor.DEFAULT_OPTION,
            NotifyDescriptor.WARNING_MESSAGE,
            new Object[] {NotifyDescriptor.OK_OPTION},
            NotifyDescriptor.OK_OPTION);
    DialogDisplayer.getDefault().notify(nd);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:CreateAction.java


注:本文中的org.openide.NotifyDescriptor.OK_OPTION屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。