/** Support for new types that can be created in this node. * @return array of new type operations that are allowed */ @Override public NewType[] getNewTypes() { if (isReadOnly()) return RADComponent.NO_NEW_TYPES; Class[] classes = supportedMenus.get(Integer.valueOf(getMenuItemType())); if (classes == null) return RADComponent.NO_NEW_TYPES; NewType[] types = new NewType[classes.length]; for (int i = 0; i < types.length; i++) types[i] = new NewMenuType(classes[i]); return types; }
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(); } } }; }
/** Performs action on given type */ private static void performAction(Node[] activatedNodes, NewType type) { PasteAction.NodeSelector sel = null; try { ExplorerManager em = PasteAction.findExplorerManager(); if (em != null) { sel = new PasteAction.NodeSelector(em, activatedNodes); } type.create(); } catch (java.io.IOException e) { Exceptions.printStackTrace(e); } finally { if (sel != null) { sel.select(); } } }
private NewType[] newTypes() { if (lookup != null) { java.util.Collection c = lookup.lookupResult(Node.class).allItems(); if (c.size() == 1) { java.util.Iterator it = c.iterator(); while (it.hasNext()) { Lookup.Item item = (Lookup.Item) it.next(); Node n = (Node) item.getInstance(); if (n != null) { if (n == prevNode && prevTypes != null) { return prevTypes; } prevNode = n; prevTypes = n.getNewTypes(); return prevTypes; } } } } return getNewTypes(); }
public void performActionAt(int index) { NewType[] nt = newTypes(); // bugfix #41587, AIOBE if array is empty if (nt.length <= index) { return; } Node[] arr; if (lookup != null) { arr = (Node[]) lookup.lookupAll(Node.class).toArray(new Node[0]); } else { arr = WindowManager.getDefault().getRegistry().getCurrentNodes(); } performAction(arr, nt[index]); }
public NewType[] getNewTypes() { NewType nt = new NewType() { public void create() { if (array != null) { Object []newArray = (Object[])Array.newInstance(getConvertedType(), array.length+1); System.arraycopy(array, 0, newArray, 0, array.length); // throw away the old array! array = newArray; array[array.length-1] = defaultValue(); } else { // throw away the old array! array = (Object[])Array.newInstance(getConvertedType(), 1); array[0] = defaultValue(); } IndexedPropertyEditor.this.firePropertyChange(); DisplayIndexedNode din = new DisplayIndexedNode(array.length-1); getChildren().add(new Node[] { din }); Index i = (Index)getCookie(Index.class); i.addChangeListener(WeakListener.change(din, i)); } }; return new NewType[] { nt }; }
/** Performs action on given type */ private static void performAction (Node[] activatedNodes, NewType type) { PasteAction.NodeSelector sel = null; try { ExplorerManager em = PasteAction.findExplorerManager(); if (em != null) { sel = new PasteAction.NodeSelector (em, activatedNodes); } type.create(); } catch (java.io.IOException e) { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(e.getMessage(), NotifyDescriptor.ERROR_MESSAGE)); } finally { if (sel != null) { sel.select (); } } }
private NewType[] newTypes () { if (lookup != null) { java.util.Collection c = lookup.lookup ( new Lookup.Template (Node.class) ).allItems (); if (c.size () == 1) { java.util.Iterator it = c.iterator(); while (it.hasNext()) { Lookup.Item item = (Lookup.Item)it.next (); Node n = (Node)item.getInstance(); if (n != null) { return n.getNewTypes(); } } } } return getNewTypes (); }
public NewType[] getNewTypes() { NewType nt = new NewType() { public void create() { if (array != null) { Object[] newArray = (Object[]) Array.newInstance(getConvertedType(), array.length + 1); System.arraycopy(array, 0, newArray, 0, array.length); // throw away the old array! array = newArray; array[array.length - 1] = defaultValue(); } else { // throw away the old array! array = (Object[]) Array.newInstance(getConvertedType(), 1); array[0] = defaultValue(); } IndexedPropertyEditor.this.firePropertyChange(); DisplayIndexedNode din = new DisplayIndexedNode(array.length - 1); getChildren().add(new Node[] { din }); Index i = getCookie(Index.class); i.addChangeListener(org.openide.util.WeakListeners.change(din, i)); } }; return new NewType[] { nt }; }
@Override public NewType[] getNewTypes() { NewType[] res = super.getNewTypes(); if( null == res || res.length == 0 ) { DataFolder paletteFolder = (DataFolder)getCookie( DataFolder.class ); if( null != paletteFolder ) res = new NewType[] { new NewCategory() }; } return res; }
public void actionPerformed(ActionEvent event) { NewType[] newTypes = paletteNode.getNewTypes(); try { if( null != newTypes && newTypes.length > 0 ) { newTypes[0].create(); } } catch( IOException ioE ) { ERR.log( Level.INFO, ioE.getLocalizedMessage(), ioE ); } }
public NewType[] getNewTypes(Phadhail ph, Lookup e) { if (ph.hasChildren()) { return new NewType[] { new PhadhailNewType(ph, false), new PhadhailNewType(ph, true), }; } else { return new NewType[0]; } }
public NewType[] getNewTypes() { if (ph.hasChildren()) { return new NewType[] { new PhadhailNewType(ph, false), new PhadhailNewType(ph, true), }; } else { return new NewType[0]; } }
/** Gets new types that can be created in this node. * @return array with <code>NewLocaleType</code> */ @Override public NewType[] getNewTypes() { PropertiesDataObject propDO = (PropertiesDataObject) getDataObject(); if (propDO.isMultiLocale()) { return new NewType[] {new NewLocaleType()}; } else { PropertiesFileEntry pfEntry = (PropertiesFileEntry) propDO.getPrimaryEntry(); return new NewType[] { new NewLocaleType(), new PropertiesLocaleNode.NewPropertyType(pfEntry) }; } }
/** Performs action on index and nodes. */ private static void performAction(Node[] activatedNodes, int indx) { NewType[] types = getNewTypes(activatedNodes); if (types.length <= indx) { return; } performAction(activatedNodes, types[indx]); }
/** Getter for array of activated new types. */ private static NewType[] getNewTypes(Node[] activatedNodes) { if ((activatedNodes == null) || (activatedNodes.length != 1)) { return new NewType[0]; } else { return activatedNodes[0].getNewTypes(); } }
/** Utility method, creates name for action depending on specified new types. */ private static String createName(NewType[] newTypes) { if ((newTypes != null) && (newTypes.length == 1)) { return NbBundle.getMessage(NewAction.class, "NewArg", newTypes[0].getName()); } else { return NbBundle.getMessage(NewAction.class, "New"); } }
public String getLabel(int index) { NewType[] newTypes = newTypes(); if (newTypes.length <= index) { return null; } else { return newTypes[index].getName(); } }
public HelpCtx getHelpCtx(int index) { NewType[] newTypes = newTypes(); if (newTypes.length <= index) { return null; } else { return newTypes[index].getHelpCtx(); } }
/** * We can create a new Parameter here... */ @Override public NewType[] getNewTypes() { // TODO: add the ability to create a new group... if (getType() == CrosstabGroupNode.ROW_GROUP) { return NewTypesUtils.getNewType(this, NewTypesUtils.CROSSTAB_ROW_GROUP); } else { return NewTypesUtils.getNewType(this, NewTypesUtils.CROSSTAB_COLUMN_GROUP); } }
@Override public NewType[] getNewTypes() { if (getParentNode() instanceof TemplateNode) { return ((TemplateNode)getParentNode()).getNewTypes(); } return super.getNewTypes(); }
/** Performs action on index and nodes. */ private static void performAction (Node[] activatedNodes, int indx) { NewType[] types = getNewTypes (activatedNodes); if (types.length <= indx) { return; } performAction (activatedNodes, types[indx]); }
/** Getter for array of activated new types. */ private static NewType[] getNewTypes (Node[] activatedNodes) { if (activatedNodes == null || activatedNodes.length != 1) { return new NewType[0]; } else { return activatedNodes[0].getNewTypes (); } }
protected boolean enable (Node[] activatedNodes) { NewType[] types = getNewTypes (); // notify listeners Object[] listeners = model.getListenerList(); if (listeners.length > 0) { ChangeEvent ev = new ChangeEvent (model); for (int i = listeners.length-1; i>=0; i-=2) { ((ChangeListener)listeners[i]).stateChanged (ev); } } return (types.length > 0); }
public String getLabel(int index) { NewType[] newTypes = newTypes(); if (newTypes.length <= index) return null; else return newTypes[index].getName(); }
public HelpCtx getHelpCtx (int index) { NewType[] newTypes = newTypes(); if (newTypes.length <= index) return null; else return newTypes[index].getHelpCtx(); }
public void performActionAt(int index) { NewType[] nt = newTypes (); if (nt.length < index) { return; } Node[] arr; if (lookup != null) { arr = (Node[])lookup.lookup (new Lookup.Template (Node.class)).allInstances ().toArray (new Node[0]); } else { arr = WindowManager.getDefault().getRegistry ().getCurrentNodes (); } performAction (arr, nt[index]); }
@Override public NewType[] getNewTypes() { return component.getNewTypes(); }
/** Support for new types that can be created in this node. * @return array of new type operations that are allowed */ public NewType[] getNewTypes() { return NO_NEW_TYPES; }
@Override public boolean isEnabled() { NewType[] newTypes = paletteNode.getNewTypes(); return null != newTypes && newTypes.length > 0; }
/** List new types that can be created in this node. Overrides superclass method. * @return new types */ @Override public NewType[] getNewTypes () { return new NewType[] { new NewPropertyType((PropertiesFileEntry)getFileEntry()) }; }
/** Support for new types that can be created in this node. * @return array of new type operations that are allowed */ public NewType[] getNewTypes () { return new NewType[0]; }
public NewType[] getNewTypes() { return original.getNewTypes(); }
/** Getter for array of activated new types. */ private static NewType[] getNewTypes() { return getNewTypes(WindowManager.getDefault().getRegistry().getCurrentNodes()); }
protected boolean enable(Node[] activatedNodes) { NewType[] types = getNewTypes(); model.cs.fireChange(); return (types.length > 0); }
public NewType[] getNewTypes() { return null; }