public void setAttribute(String attrName, Object value) throws IOException { fileObj.setAttribute(attrName, value); }
/** Copies attributes of one FileObject into another. * @param source source folder or file * @param target target folder or file * @exception IOException if it fails */ private static void copyAttrs(FileObject source, FileObject target) { Enumeration<String> en = source.getAttributes(); while (en.hasMoreElements()) { String key = en.nextElement(); Object value = source.getAttribute(key); try { target.setAttribute(key, value); } catch (IOException ie) { } } }
/** * Refreshes all necessary filesystems. Not all instances of <code>FileObject</code> are refreshed * but just those that represent passed <code>files</code> and their children recursively. * @param files * @since 7.6 */ public static void refreshFor(File... files) { FileSystem fs = getDiskFileSystemFor(files); if (fs != null) { try { fs.getRoot().setAttribute("request_for_refreshing_files_be_aware_this_is_not_public_api", files); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } }
dest.setAttribute("methodvalue:" + key, value); // NOI18N } else if (isRawValue.get() && value instanceof Class) { dest.setAttribute("newvalue:" + key, value); // NOI18N } else { dest.setAttribute(key, value);
private boolean setAttributeOnFO(FileObject fo, String attrToSet, Object value, boolean fire) throws IOException { if (fo instanceof AbstractFolder) { ((AbstractFolder) fo).setAttribute(attrToSet, value, false); } else { /** cannot disable firing from underlaying delegate if not AbstractFolder * without API change. So I don`t fire events from this method with one * exception - root. */ fire = fire && fo.isRoot(); fo.setAttribute(attrToSet, value); } return fire; }
newUserDefinedFO.setAttribute(USER_DEFINED_MIME_RESOLVER, Boolean.TRUE); newUserDefinedFO.setAttribute("position", USER_DEFINED_MIME_RESOLVER_POSITION); //NOI18N os = newUserDefinedFO.getOutputStream(); XMLUtil.write(document, os, "UTF-8"); //NOI18N
toBeMoved.setAttribute(ATTR_POSITION, Math.round(findPosition(after) - 100)); } else if (after == null) { toBeMoved.setAttribute(ATTR_POSITION, Math.round(findPosition(before) + 100)); } else { Float beforePos = findPosition(before); int proposed = Math.round(beforePos + afterPos) / 2; if (beforePos < proposed && proposed < afterPos) { toBeMoved.setAttribute(ATTR_POSITION, proposed); } else { f.setAttribute(ATTR_POSITION, pos); pos += 100; for (String attr : NbCollections.iterable(d.getAttributes())) { if (attr.indexOf('/') != -1 && d.getAttribute(attr) instanceof Boolean) { d.setAttribute(attr, null);
obj.setAttribute(attrName, value);
private static void createSeparator ( FileObject folder, String name, int position ) throws IOException { FileObject separator = FileUtil.createData(folder, name + ".instance"); separator.setAttribute ("instanceClass", "javax.swing.JSeparator"); separator.setAttribute("position", position); }
private static boolean setTemplate(FileObject fo, boolean newTempl) throws IOException { boolean oldTempl = false; Object o = fo.getAttribute(DataObject.PROP_TEMPLATE); if ((o instanceof Boolean) && ((Boolean) o).booleanValue()) { oldTempl = true; } if (oldTempl == newTempl) { return false; } fo.setAttribute(DataObject.PROP_TEMPLATE, (newTempl ? Boolean.TRUE : null)); return true; }
/** Method to attach a description to a data object. * It is suggested that the URL use the <code>nbresloc</code> protocol. * @param obj data object to attach description to * @param url the url with description or null if there should be * no description * @exception IOException if I/O fails */ public static void setDescription (DataObject obj, URL url) throws IOException { obj.getPrimaryFile().setAttribute(EA_DESCRIPTION, url); obj.getPrimaryFile().setAttribute(CUSTOM_DESCRIPTION, url); }
protected static boolean setTemplate(FileObject fo, boolean newTempl) throws IOException { boolean oldTempl = false; Object o = fo.getAttribute(DataObject.PROP_TEMPLATE); if ((o instanceof Boolean) && ((Boolean) o).booleanValue()) { oldTempl = true; } if (oldTempl == newTempl) { return false; } fo.setAttribute(DataObject.PROP_TEMPLATE, (newTempl ? Boolean.TRUE : null)); return true; }
/** Set execution arguments for a given entry. * @param entry the entry * @param args array of arguments * @exception IOException if arguments cannot be set */ public static void setArguments(MultiDataObject.Entry entry, String[] args) throws IOException { entry.getFile().setAttribute(EA_ARGUMENTS, args); }
public void run() throws IOException { FileObject pointbaseFolder = ToolsFolder.createFolder("PointbaseMenu"); //NOI18N pointbaseFolder.setAttribute("SystemFileSystem.localizingBundle","org.netbeans.modules.j2ee.sun.ide.j2ee.db.Bundle");//NOI18N pointbaseFolder.createData("org.netbeans.modules.j2ee.sun.ide.j2ee.db.StartAction","instance");//NOI18N pointbaseFolder.createData("org.netbeans.modules.j2ee.sun.ide.j2ee.db.StopAction" ,"instance");//NOI18N ToolsFolder.setAttribute("OpenIDE-Folder-Order","org.netbeans.modules.j2ee.sun.ide.j2ee.db.StartAction.instance/org.netbeans.modules.j2ee.sun.ide.j2ee.db.StopAction.instance");//NOI18N } });
public void setQMakeCommand(String make) { try { getEntry().getFile().setAttribute(PROP_QMAKE_COMMAND, make); } catch (IOException ex) { if (Boolean.getBoolean("netbeans.debug.exceptions")) { // NOI18N ex.printStackTrace(); } } }
public void setRunDirectory(String dir) { FileObject fo = getEntry().getFile(); try { fo.setAttribute(PROP_RUN_DIRECTORY, dir); } catch (IOException ex) { if (Boolean.getBoolean("netbeans.debug.exceptions")) { // NOI18N ex.printStackTrace(); } } }
public void run() { try{ project.getProjectDirectory().setAttribute("NewProject", Boolean.TRUE); // NOI18N template.create(project, pageName); } catch (IOException ioe){ LOGGER.log(Level.WARNING, "Exception during extending an web project", ioe); //NOI18N } } });
private void setNumberOfInvalidShapes(Integer numberOfInvalidShapes) { try { getPrimaryFile().setAttribute(ATT_NUMBER_OF_INVALID_SHAPES, numberOfInvalidShapes); } catch (IOException ex) { LOGGER.log(Level.WARNING, "could not save invalid shapes property for shape data object {0}", getName()); } }
public void rebind(Name name, Object obj) throws NamingException { String attrName = getRelativeName(name); FileObject fo = dobj.getPrimaryFile(); try { fo.setAttribute(attrName, obj); } catch (IOException ex) { NamingException ne = new NamingException(name + " = " + obj); // NOI18N ne.setRootCause(ex); } }
void setQuoteChar(Character ch) { try { Character old = getQuoteChar(); getPrimaryFile().setAttribute(ATT_QUOTE_CHAR, ch); firePropertyChange(PROP_QUOTE_CHAR, old, ch); } catch (IOException ex) { LOGGER.log(Level.WARNING, "could not save quote char property for csv data object {0}", getName()); } }