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


Java NotifyDescriptor.InputLine方法代碼示例

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


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

示例1: performAction

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@Override
protected void performAction(Node[] activatedNodes) {
    EmulatorControlSupport emulatorControl = activatedNodes[0].getLookup().lookup(EmulatorControlSupport.class);
    if (emulatorControl != null) {
        NotifyDescriptor.InputLine inputLine = new NotifyDescriptor.InputLine("Phone number:", "Incoming call", NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
        Object notify = DialogDisplayer.getDefault().notify(inputLine);
        if (NotifyDescriptor.OK_OPTION.equals(notify)) {
            String phoneNo = inputLine.getInputText();
            String ok = emulatorControl.getConsole().call(phoneNo);
            if (ok == null) {
                CancelIncomingCallAction.addCalledNumber(emulatorControl.getDevice().getSerialNumber(), phoneNo);
            } else {
                NotifyDescriptor nd = new NotifyDescriptor.Message(ok, NotifyDescriptor.ERROR_MESSAGE);
                DialogDisplayer.getDefault().notifyLater(nd);
            }
        }
    }
}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:19,代碼來源:IncomingCallAction.java

示例2: performAction

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@Override
protected void performAction(Node[] activatedNodes) {
    List<String> connections = getConnections();
    do {
        NotifyDescriptor.InputLine inputLine = new NotifyDescriptor.InputLine("Please enter IP:Port", "Add ADB connection", NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
        Object notify = DialogDisplayer.getDefault().notify(inputLine);
        if (NotifyDescriptor.OK_OPTION.equals(notify)) {
            String inputText = inputLine.getInputText();
            if (DevicesNode.validate(inputText)) {
                connections.add(inputText);
                saveConnections(connections);
                return;
            }
        } else {
            return;
        }
    } while (true);

}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:20,代碼來源:AdbConnectionsNode.java

示例3: perform

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
public void perform (Object[] nodes) {
    ObjectVariable var = (ObjectVariable) nodes[0];
    if (var.getUniqueID() == 0L) return ;
    String title = Bundle.CTL_MarkObject_DLG_Title();
    String label = Bundle.CTL_MarkObject_DLG_Label();
    NotifyDescriptor.InputLine nd = new NotifyDescriptor.InputLine(label, title);
    Object ret = DialogDisplayer.getDefault().notify(nd);
    if (nd.OK_OPTION == ret) {
        label = nd.getInputText().trim();
        if (label.length() == 0) {
            label = null;
        }
        debugger.markObject(var, label);
        fireNodeChange(null); // Refresh all nodes, not just (var);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:LabelVarsFilter.java

示例4: getNewTypes

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
public NewType[] getNewTypes() {
    return new NewType[] { new NewType() {
        public String getName() {
            return bundle.getString("LBL_NewProp");
        }
        public HelpCtx getHelpCtx() {
            return new HelpCtx("org.myorg.systemproperties");
        }
        public void create() throws IOException {
            String title = bundle.getString("LBL_NewProp_dialog");
            String msg = bundle.getString("MSG_NewProp_dialog_key");
            NotifyDescriptor.InputLine desc = new NotifyDescriptor.InputLine(msg, title);
            DialogDisplayer.getDefault().notify(desc);
            String key = desc.getInputText();
            if ("".equals(key)) return;
            msg = bundle.getString("MSG_NewProp_dialog_value");
            desc = new NotifyDescriptor.InputLine(msg, title);
            DialogDisplayer.getDefault().notify(desc);
            String value = desc.getInputText();
            System.setProperty(key, value);
            PropertiesNotifier.changed();
        }
    } };
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:AllPropsNode.java

示例5: askQuestion

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@Override
public String askQuestion (String uri, String prompt) {
    String retval = null;
    if (prompt.toLowerCase().startsWith("password:")) { //NOI18N
        char[] pwd = getPassword(uri, prompt);
        if (pwd != null) {
            retval = new String(pwd);
            Arrays.fill(pwd, (char) 0);
        }
    } else {
        NotifyDescriptor.InputLine desc = new NotifyDescriptor.InputLine(prompt, 
                NbBundle.getMessage(CredentialsCallback.class, "LBL_CredentialsCallback.question.title", uri) //NOI18N
        );
        Object dlgResult = DialogDisplayer.getDefault().notify(desc);
        retval = NotifyDescriptor.OK_OPTION == dlgResult ? desc.getInputText() : null;
    }
    return retval;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:CredentialsCallback.java

示例6: btnAddActionPerformed

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
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,代碼行數:19,代碼來源:ActionMappings.java

示例7: performAction

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@Override
   public void performAction() {
Terminal terminal = getTerminal();

NotifyDescriptor.InputLine inputLine = new NotifyDescriptor.InputLine(getMessage("LBL_Title"), getMessage("LBL_SetTitle")); // NOI18N
String title = terminal.getTitle();
inputLine.setInputText(title);
if (DialogDisplayer.getDefault().notify(inputLine) == NotifyDescriptor.OK_OPTION) {
    String newTitle = inputLine.getInputText().trim();
    if (!newTitle.equals(title)) {
	if (!newTitle.isEmpty()) {
	    terminal.setTitle(newTitle);
	} else {
	    terminal.resetTitle();
	}
    }
}
       terminal.requestFocusInWindow();
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:SetTitleAction.java

示例8: setGroupName

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
private static void setGroupName (Object[] nodes) {
    NotifyDescriptor.InputLine descriptor = new NotifyDescriptor.InputLine (
        NbBundle.getMessage
            (BreakpointsActionsProvider.class, "CTL_BreakpointAction_GroupDialog_NameLabel"),
        NbBundle.getMessage
            (BreakpointsActionsProvider.class, "CTL_BreakpointAction_GroupDialog_Title")
    );
    if (DialogDisplayer.getDefault ().notify (descriptor) == 
        NotifyDescriptor.OK_OPTION
    ) {
       int i, k = nodes.length;
        String newName = descriptor.getInputText ();
        for (i = 0; i < k; i++) {
            if (nodes [i] instanceof BreakpointGroup) {
                BreakpointGroup g = (BreakpointGroup) nodes[i];
                setGroupName(g, newName);
            } else if (nodes [i] instanceof Breakpoint) {
                ((Breakpoint) nodes [i]).setGroupName ( newName );
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:BreakpointsActionsProvider.java

示例9: addURL

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
private void addURL(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addURL
    final NotifyDescriptor.InputLine nd = new NotifyDescriptor.InputLine(
        NbBundle.getMessage(SelectRootsPanel.class,"TXT_RemoteJavadoc"),
        NbBundle.getMessage(SelectRootsPanel.class,"TXT_RemoteJavadoc_Title"),
        NotifyDescriptor.OK_CANCEL_OPTION,
        NotifyDescriptor.PLAIN_MESSAGE);
    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
        final String inputText = nd.getInputText();
        final DefaultListModel<URI> lm = (DefaultListModel<URI>) sources.getModel();
        final Set<URI> contained = new HashSet<>(Collections.list(lm.elements()));
        int index = sources.getSelectedIndex();
        index = index < 0 ? lm.getSize() : index + 1;
        try {
            URI uri = new URI(inputText);
            if (!contained.contains(uri)) {
                lm.add(index, uri);
                select(Collections.<Integer>singleton(index));
                index++;
            }
        } catch (URISyntaxException ex) {
            DialogDisplayer.getDefault().notify(
                new NotifyDescriptor.Message(
                    NbBundle.getMessage(SelectRootsPanel.class, "TXT_InvalidRoot", inputText),
                    NotifyDescriptor.ERROR_MESSAGE));
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:SelectRootsPanel.java

示例10: addFilterSetting

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
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,代碼行數:37,代碼來源:FilterTopComponent.java

示例11: setUserDesignerSize

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
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,代碼行數:29,代碼來源:HandleLayer.java

示例12: performAction

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
protected @Override void performAction(Node[] activatedNodes) {
    NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine(
            NbBundle.getMessage(PickNameAction.class, "PickNameAction_dialog_label"),
            NbBundle.getMessage(PickNameAction.class, "PickNameAction_dialog_title"));
    if (DialogDisplayer.getDefault().notify(d) != NotifyDescriptor.OK_OPTION) {
        return;
    }
    String name = d.getInputText();
    FileObject f = findFile(activatedNodes);
    if (f == null) {
        return;
    }
    NbModuleProvider p = findProject(f);
    if (p == null) {
        return;
    }
    String bundlePath = findBundlePath(p);
    if (bundlePath == null) {
        return;
    }
    try {
        FileObject properties = p.getSourceDirectory().getFileObject(bundlePath);
        EditableProperties ep = Util.loadProperties(properties);
        final String key = LayerUtil.generateBundleKeyForFile(f.getPath());
        ep.setProperty(key, name);
        Util.storeProperties(properties, ep);
        f.setAttribute("displayName", "bundlevalue:"
                + bundlePath.substring(0, bundlePath.length() - ".properties".length())   // NOI18N
                .replace('/', '.')  // NOI18N
                + "#" + key); // NOI18N
    } catch (IOException e) {
        Util.err.notify(ErrorManager.INFORMATIONAL, e);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:35,代碼來源:PickNameAction.java

示例13: getIdentifierFromDialog

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
protected final String getIdentifierFromDialog(String purposeTitle) {
    NotifyDescriptor.InputLine desc = new NotifyDescriptor.InputLine("Please write new identifiew. Name cannot have whitespaces in it.", purposeTitle);
    DialogDisplayer.getDefault().notify(desc);

    if (desc.getValue() != NotifyDescriptor.OK_OPTION) {
        return null;
    }
    if (!Pattern.compile("[a-zA-Z0-9_-]+").matcher(desc.getInputText().trim()).matches()) {
        DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message("Identifier wasn't valid."));
        return null;
    }
    return desc.getInputText().trim();
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:14,代碼來源:AbstractMenuAction.java

示例14: performAction

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
/** Performs action. Overrides superclass method. */
  protected void performAction (Node[] activatedNodes) {
      Node n = activatedNodes[0]; // we supposed that one node is activated
      Node.Cookie cake = n.getCookie(PropertiesLocaleNode.class);
      PropertiesLocaleNode pln = (PropertiesLocaleNode)cake;

      String lang = Util.getLocaleSuffix(pln.getFileEntry());
      if (lang.length() > 0)
          if (lang.charAt(0) == PropertiesDataLoader.PRB_SEPARATOR_CHAR)
              lang = lang.substring(1);

      NotifyDescriptor.InputLine dlg = new NotifyDescriptor.InputLine(
NbBundle.getMessage(LangRenameAction.class,
		    "LBL_RenameLabel"),			//NOI18N
NbBundle.getMessage(LangRenameAction.class,
		    "LBL_RenameTitle"));		//NOI18N
      
      dlg.setInputText(lang);
      if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(dlg))) {
          try {
              pln.setName(Util.assembleName (pln.getFileEntry().getDataObject().getPrimaryFile().getName(), dlg.getInputText()));
          }
          catch (IllegalArgumentException e) {
              // catch & report badly formatted names
              NotifyDescriptor.Message msg = new NotifyDescriptor.Message(
                  MessageFormat.format(
                      NbBundle.getBundle("org.openide.actions.Bundle").getString("MSG_BadFormat"),
                      new Object[] {pln.getName()}),
                  NotifyDescriptor.ERROR_MESSAGE);
                      
              DialogDisplayer.getDefault().notify(msg);
          }
      }
  }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:35,代碼來源:LangRenameAction.java

示例15: getActions

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@Override
public Action[] getActions(boolean context) {
    Action[] oldActs = super.getActions(context);
    Action[] acts = Arrays.copyOf(oldActs, oldActs.length + 7);

    // open map
    acts[oldActs.length + 1] = getPreferredAction();
    // spectating action
    acts[oldActs.length + 2] = new NamedAction("ACT_Spectate", UnrealServerNode.class) {

        @Override
        protected void action(ActionEvent e) throws PogamutException {
            try {
                serverDef.spectate();
            } catch (PogamutException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
    };

    // connect native bot action
    acts[oldActs.length + 4] = new ServerUpAction<IUnrealServer>("ACT_AddNativeBot", UnrealServerNode.class, serverDef) {

        @Override
        protected void action(ActionEvent e) throws PogamutException {
            // show dialog
            NotifyDescriptor.InputLine botTypeDialog = new NotifyDescriptor.InputLine("Bot type (optional): ", "Native bot type");
            DialogDisplayer.getDefault().notify(botTypeDialog);

            if (botTypeDialog.isValid()) {

                String botType = botTypeDialog.getInputText().trim();
                getServer().connectNativeBot(null, botType);
            }
        }
    };

    acts[oldActs.length + 6] = SystemAction.get(PropertiesAction.class);
    return acts;
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:41,代碼來源:UnrealServerNode.java


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