Java Code Examples for org.openide.NotifyDescriptor#InputLine
The following examples show how to use
org.openide.NotifyDescriptor#InputLine .
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: IncomingCallAction.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
@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); } } } }
Example 2
Source File: BreakpointsActionsProvider.java From netbeans with Apache License 2.0 | 6 votes |
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 ); } } } }
Example 3
Source File: AdbConnectionsNode.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
@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); }
Example 4
Source File: MotionRenameAction.java From opensim-gui with Apache License 2.0 | 6 votes |
@Override public void performAction() { Node[] selected = ExplorerTopComponent.findInstance().getExplorerManager().getSelectedNodes(); OneMotionNode objectNode = (OneMotionNode)selected[0]; NotifyDescriptor.InputLine dlg = new NotifyDescriptor.InputLine("Current Name: ", "Rename Motion"); dlg.setInputText(objectNode.getOpenSimObject().getName()); if(DialogDisplayer.getDefault().notify(dlg)==NotifyDescriptor.OK_OPTION){ String newName = dlg.getInputText(); if (OpenSimDB.getInstance().validateName(newName, true)){ objectNode.getOpenSimObject().setName(newName); objectNode.setName(newName); // Force navigartor window update MotionsDB.getInstance().renameMotion(objectNode.getOpenSimObject(), newName); } else DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message("Provided name "+newName+" is not valid")); } }
Example 5
Source File: LabelVarsFilter.java From netbeans with Apache License 2.0 | 6 votes |
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); } }
Example 6
Source File: AllPropsNode.java From netbeans with Apache License 2.0 | 6 votes |
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(); } } }; }
Example 7
Source File: CoordinateViewerTopComponent.java From opensim-gui with Apache License 2.0 | 6 votes |
private void jSavePoseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jSavePoseButtonActionPerformed // TODO add your handling code here: prefs = ViewDB.getInstance().getModelSavedSettings(aModel).getPrefs(); // Query for name int savedPosesCount=prefs.getNumPoses(); String defaultName= "Pose"+String.valueOf(savedPosesCount+1); NotifyDescriptor.InputLine dlg = new NotifyDescriptor.InputLine("Enter Pose Name", "<Pose Name>"); dlg.setInputText(defaultName); if(DialogDisplayer.getDefault().notify(dlg)==NotifyDescriptor.OK_OPTION){ String newName = dlg.getInputText(); if (!prefs.containsPose(newName)) prefs.addPose(new ModelPose(coords,newName)); else DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( NbBundle.getMessage(CoordinateViewerTopComponent.class, "CTL_DuplicatePoseName"))); }; updateAvailability(); }
Example 8
Source File: EditQueryStringAction.java From netbeans with Apache License 2.0 | 6 votes |
/** Actually performs the SwitchOn action. * @param activatedNodes Currently activated nodes. */ public void performAction (final Node[] activatedNodes) { if (activatedNodes.length == 0) { return; } DataObject dObj = (DataObject)(activatedNodes[0]).getCookie(DataObject.class); QueryStringCookie qsc = (QueryStringCookie)activatedNodes[0].getCookie(QueryStringCookie.class); NotifyDescriptor.InputLine dlg = new NotifyDescriptor.InputLine( NbBundle.getBundle(EditQueryStringAction.class).getString("CTL_QueryStringLabel"), NbBundle.getBundle(EditQueryStringAction.class).getString("CTL_QueryStringTitle")); dlg.setInputText(WebExecSupport.getQueryString(dObj.getPrimaryFile())); if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(dlg))) { try { // WebExecSupport.setQueryString(dObj.getPrimaryFile(), dlg.getInputText()); qsc.setQueryString (dlg.getInputText()); } catch (IOException e) { Exceptions.printStackTrace(e); } } }
Example 9
Source File: RenameGroupAction.java From netbeans with Apache License 2.0 | 6 votes |
@Override protected void performAction(Node[] nodes) { if (nodes != null && nodes.length == 1) { SaasGroup group = nodes[0].getLookup().lookup(SaasGroup.class); if (group == null) { return; } Node n = nodes[0]; NotifyDescriptor.InputLine dlg = new NotifyDescriptor.InputLine( NbBundle.getMessage(RenameAction.class, "CTL_RenameLabel"), // NOI18N NbBundle.getMessage(RenameAction.class, "CTL_RenameTitle")); // NOI18N dlg.setInputText(n.getName()); if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(dlg))) { String name = dlg.getInputText().trim(); if (group.getParent().getChildGroup(name) != null) { String msg = NbBundle.getMessage(RenameGroupAction.class, "MSG_DuplicateGroupName"); // NOI18N DialogDisplayer.getDefault().notify( new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); return; } SaasServicesModel.getInstance().renameGroup(group, name); n.setName(name); } } }
Example 10
Source File: AddGroupAction.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected void performAction(Node[] nodes) { String defaultName = NbBundle.getMessage(AddGroupAction.class, "NEW_GROUP"); // NOI18N NotifyDescriptor.InputLine dlg = new NotifyDescriptor.InputLine( NbBundle.getMessage(AddGroupAction.class, "CTL_GroupLabel"), // NOI18N NbBundle.getMessage(AddGroupAction.class, "CTL_GroupTitle")); // NOI18N dlg.setInputText(defaultName); if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(dlg))) { try { String newName = dlg.getInputText().trim(); if (newName == null || newName.length() == 0) { newName = defaultName; } SaasGroup parent = nodes[0].getLookup().lookup(SaasGroup.class); try { SaasServicesModel.getInstance().createGroup(parent, newName); } catch (Exception ex) { NotifyDescriptor.Message msg = new NotifyDescriptor.Message(ex.getMessage()); DialogDisplayer.getDefault().notify(msg); } } catch (IllegalArgumentException e) { Exceptions.printStackTrace(e); } } }
Example 11
Source File: LangRenameAction.java From netbeans with Apache License 2.0 | 5 votes |
/** 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); } } }
Example 12
Source File: FilterTopComponent.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void addFilterSetting() { NotifyDescriptor.InputLine l = new NotifyDescriptor.InputLine("Enter a name:", "Filter"); 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 \"" + name + "\" already exists, to you want to overwrite?", "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>() { public int compare(FilterSetting o1, FilterSetting o2) { return o1.getName().compareTo(o2.getName()); } }); updateComboBox(); } }
Example 13
Source File: ResourceReferencesTableModel.java From netbeans with Apache License 2.0 | 5 votes |
public int addRow() { String text = Utils.getBundleMessage("LBL_ReferenceName_"); String title = Utils.getBundleMessage("LBL_AddResourceReference"); final NotifyDescriptor.InputLine inputLine = new NotifyDescriptor.InputLine(text, title); DialogDisplayer.getDefault().notify(inputLine); final String name = inputLine.getInputText(); return addRow(name); }
Example 14
Source File: WorkspaceTopComponent.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
@Override public void actionPerformed(ActionEvent e) { NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine("Name:", "Rename Workspace"); d.setInputText(WorkspaceTopComponent.this.getDisplayName()); Object result = DialogDisplayer.getDefault().notify(d); if (NotifyDescriptor.OK_OPTION.equals(result)) { WorkspaceTopComponent.this.setDisplayName(d.getInputText()); } }
Example 15
Source File: FilterTopComponent.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void addFilterSetting() { NotifyDescriptor.InputLine l = new NotifyDescriptor.InputLine("Enter a name:", "Filter"); 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 \"" + name + "\" already exists, to you want to overwrite?", "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>() { public int compare(FilterSetting o1, FilterSetting o2) { return o1.getName().compareTo(o2.getName()); } }); updateComboBox(); } }
Example 16
Source File: FilterTopComponent.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void addFilterSetting() { NotifyDescriptor.InputLine l = new NotifyDescriptor.InputLine("Enter a name:", "Filter"); 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 \"" + name + "\" already exists, to you want to overwrite?", "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>() { public int compare(FilterSetting o1, FilterSetting o2) { return o1.getName().compareTo(o2.getName()); } }); updateComboBox(); } }
Example 17
Source File: ModelRenameAction.java From opensim-gui with Apache License 2.0 | 5 votes |
public void performAction() { Node[] selected = ExplorerTopComponent.findInstance().getExplorerManager().getSelectedNodes(); if (selected.length == 1){ OpenSimObjectNode objectNode = (OpenSimObjectNode) selected[0]; NotifyDescriptor.InputLine dlg = new NotifyDescriptor.InputLine("Model Name: ", "Rename "); dlg.setInputText(objectNode.getOpenSimObject().getName()); if(DialogDisplayer.getDefault().notify(dlg)==NotifyDescriptor.OK_OPTION){ String newName = dlg.getInputText(); if (OpenSimDB.getInstance().validateName(newName, true)){ objectNode.getOpenSimObject().setName(newName); objectNode.setName(newName); // Force navigator window update // Create event to tell everyone else Vector<OpenSimObject> objs = new Vector<OpenSimObject>(1); objs.add(objectNode.getOpenSimObject()); ObjectsRenamedEvent evnt = new ObjectsRenamedEvent(this, null, objs); OpenSimDB.getInstance().setChanged(); OpenSimDB.getInstance().notifyObservers(evnt); // The following is specific to renaming a model since // other windows may display currentModel's name // A more generic scheme using events should be used. if (objectNode instanceof OneModelNode) { Model dModel = ((OneModelNode)objectNode).getModel(); if (dModel==OpenSimDB.getInstance().getCurrentModel()) OpenSimDB.getInstance().setCurrentModel(dModel); // Need to do this so that model dropdown updates // Mark the model as dirty SingleModelGuiElements guiElem = OpenSimDB.getInstance().getModelGuiElements(dModel); guiElem.setUnsavedChangesFlag(true); } objectNode.refreshNode(); } else DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message("Provided name "+newName+" is not valid")); } } else { // Should never happen DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message("Rename of multiple objects is not supported.")); } }
Example 18
Source File: SelectRootsPanel.java From netbeans with Apache License 2.0 | 5 votes |
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)); } } }
Example 19
Source File: FilterTopComponent.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void addFilterSetting() { NotifyDescriptor.InputLine l = new NotifyDescriptor.InputLine("Enter a name:", "Filter"); 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 \"" + name + "\" already exists, to you want to overwrite?", "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>() { public int compare(FilterSetting o1, FilterSetting o2) { return o1.getName().compareTo(o2.getName()); } }); updateComboBox(); } }
Example 20
Source File: RenameAction.java From netbeans with Apache License 2.0 | 4 votes |
protected void performAction(final Node[] activatedNodes) { if (activatedNodes == null || activatedNodes.length == 0) { return; } Node n = activatedNodes[0]; // we supposed that one node is activated // for slow FS perform rename out of EDT if (EventQueue.isDispatchThread() && Boolean.TRUE.equals(n.getValue("slowRename"))) { // NOI18N RP.post(new Runnable() { @Override public void run() { performAction(activatedNodes); } }); return; } NotifyDescriptor.InputLine dlg = new NotifyDescriptor.InputLine( NbBundle.getMessage(RenameAction.class, "CTL_RenameLabel"), NbBundle.getMessage(RenameAction.class, "CTL_RenameTitle") ); dlg.setInputText(n.getName()); if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(dlg))) { String newname = null; try { newname = dlg.getInputText(); if (!newname.equals("")) { n.setName(dlg.getInputText()); // NOI18N } } catch (IllegalArgumentException e) { // determine if "printStackTrace" and "new annotation" of this exception is needed boolean needToAnnotate = Exceptions.findLocalizedMessage(e) == null; // annotate new localized message only if there is no localized message yet if (needToAnnotate) { Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(RenameAction.class, "MSG_BadFormat", n.getName(), newname)); } Exceptions.printStackTrace(e); } } }