Refine search
protected static void saveFile(final FileObject file) { // Save the file try { DataObject dobj = DataObject.find(file); if (dobj != null) { SaveCookie saveCookie = dobj.getCookie(SaveCookie.class); if (saveCookie != null) { saveCookie.save(); } } } catch (DataObjectNotFoundException donfe) { LOGGER.log(Level.SEVERE, donfe.getLocalizedMessage(), donfe); } catch (IOException ioe) { LOGGER.log(Level.SEVERE, ioe.getLocalizedMessage(), ioe); } }
private void ensureSavingFirst() throws IOException { //#65420 it can happen the manifest is currently being edited. save it // and cross fingers because it can be in inconsistent state try { DataObject dobj = DataObject.find(manifestFile); SaveCookie safe = dobj.getLookup().lookup(SaveCookie.class); if (safe != null) { safe.save(); } } catch (DataObjectNotFoundException ex) { Util.err.notify(ErrorManager.WARNING, ex); } } }
DataObject dTemplate = DataObject.find(template); DataObject dobj = dTemplate.createFromTemplate(df, Templates.getTargetName(wiz), wizardProps); if (dobj != null) { if (FileType.TAGLIBRARY.equals(fileType)) { //TLD file org.openide.DialogDisplayer.getDefault().notify(desc); } else { TLDDataObject tldDO = (TLDDataObject) DataObject.find(tldFo); Taglib taglib = null; try { SaveCookie save = (SaveCookie) tldDO.getCookie(SaveCookie.class); if (save != null) { save.save();
destinationsDO = DataObject.find(destinationsFO); } catch (DataObjectNotFoundException donfe) { Exceptions.printStackTrace(donfe); try { EditorCookie editor = (EditorCookie)destinationsDO.getCookie(EditorCookie.class); doc = editor.getDocument(); if (doc == null) { boolean modified = destinationsDO.isModified(); ResourceConfigurationHelper.replaceDocument(doc, newDestinationServiceModel); if (!modified) { SaveCookie cookie = (SaveCookie)destinationsDO.getCookie(SaveCookie.class); try { cookie.save(); } catch (IOException ioe) { String msg = NbBundle.getMessage(MessageDestinationSupport.class,
@Override public void saveAll() { ArrayList<DataObject> bad = new ArrayList<DataObject>(); DataObject[] modifs = DataObject.getRegistry().getModified(); if (modifs.length == 0) { SaveCookie sc = dobj.getLookup().lookup(SaveCookie.class); if (sc != null) { StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage(NbLifecycleManager.class, "CTL_FMT_SavingMessage", dobj.getName())); sc.save();
try { EditorCookie editor = (EditorCookie) dataObject.getCookie(EditorCookie.class); StyledDocument doc = editor.getDocument(); if (doc == null) { "MSG_ConfigurationXmlNotValid", dataObject.getPrimaryFile().getNameExt()), NotifyDescriptor.OK_CANCEL_OPTION); Object result = DialogDisplayer.getDefault().notify(notDesc); boolean modified = dataObject.isModified(); replaceDocument(doc, newConfig); if (!modified) { SaveCookie cookie = (SaveCookie) dataObject.getCookie(SaveCookie.class); if (cookie != null) { cookie.save();
public void save(JSFConfigModel model) { DataObject dObj = (DataObject)model.getModelSource().getLookup().lookup(DataObject.class); if (dObj != null) { SaveCookie saveCookie = (SaveCookie)dObj.getLookup().lookup(SaveCookie.class); if(saveCookie != null) { try { saveCookie.save(); } catch (IOException ioe) { throw new RuntimeException(ioe); } } } }
try { EditorCookie editor = (EditorCookie)deploymentDescriptorDO.getCookie(EditorCookie.class); StyledDocument doc = editor.getDocument(); if (doc == null) { boolean modified = deploymentDescriptorDO.isModified(); ResourceConfigurationHelper.replaceDocument(doc, newJbossClient); if (!modified) { SaveCookie cookie = (SaveCookie)deploymentDescriptorDO.getCookie(SaveCookie.class); if (cookie != null) { cookie.save();
/** * Saves the owning file using project apis */ public void save(){ DataObject dataObject = getDataObject(); if (dataObject != null && state == State.CLEAN) { SaveCookie cookie = (SaveCookie) dataObject.getCookie(SaveCookie.class); if (cookie != null) { try { cookie.save(); } catch (IOException e) { throw new RuntimeException(e); } } } }
/** Performs the work of creating a new template */ private void createNewTemplate(DataObject source, DataFolder targetFolder) { try { SaveCookie cookie = (SaveCookie)source.getCookie (SaveCookie.class); if (cookie != null) { cookie.save (); } DataObject newTemplate = source.copy(targetFolder); newTemplate.setTemplate(true); } catch (IOException ex) { ErrorManager.getDefault().notify(ex); } }
public void save() throws IOException{ SaveCookie cookie = this.getLookup().lookup(SaveCookie.class); if(cookie != null){ cookie.save(); } }
@Override public void run() throws IOException { //#65420 it can happen the manifest is currently being edited. save it // and cross fingers because it can be in inconsistent state try { DataObject dobj = DataObject.find(mfFO); SaveCookie safe = dobj.getLookup().lookup(SaveCookie.class); if (safe != null) { safe.save(); } } catch (DataObjectNotFoundException ex) { Util.err.notify(ErrorManager.WARNING, ex); } EditableManifest em = Util.loadManifest(mfFO); em.addSection(dataLoaderClass); em.setAttribute("OpenIDE-Module-Class", "Loader", dataLoaderClass); // NOI18N if (installBefore != null) { em.setAttribute("Install-Before", installBefore, dataLoaderClass); //NOI18N } Util.storeManifest(mfFO, em); } }
template = templateParent.getFileObject("BodyTagHandler","java"); //NOI18N DataObject dTemplate = DataObject.find( template ); DataObject dobj = dTemplate.createFromTemplate( df, Templates.getTargetName( wiz ) ); JavaSource clazz = JavaSource.forFileObject(dobj.getPrimaryFile()); boolean evaluateBody = !((TagInfoPanel)tagInfoPanel).isEmpty(); TagHandlerGenerator generator = new TagHandlerGenerator(clazz,attrs,isBodyTag, evaluateBody); if (save!=null) save.save(); try { tldDO.write(taglib);
ensureDatasourcesFileExists(); DataObject datasourcesDO = DataObject.find(datasourcesFO); EditorCookie editor = (EditorCookie)datasourcesDO.getCookie(EditorCookie.class); StyledDocument doc = editor.getDocument(); if (doc == null) boolean modified = datasourcesDO.isModified(); ResourceConfigurationHelper.replaceDocument(doc, newDatasources); if (!modified) { SaveCookie cookie = (SaveCookie)datasourcesDO.getCookie(SaveCookie.class); cookie.save();
/** * Save a file. * @param dataObject file to save */ public static void saveFile(DataObject dataObject) { assert dataObject != null; SaveCookie saveCookie = dataObject.getLookup().lookup(SaveCookie.class); if (saveCookie != null) { try { try { saveCookie.save(); } catch (UserQuestionException uqe) { // #216194 NotifyDescriptor.Confirmation desc = new NotifyDescriptor.Confirmation(uqe.getLocalizedMessage(), NotifyDescriptor.Confirmation.OK_CANCEL_OPTION); if (DialogDisplayer.getDefault().notify(desc).equals(NotifyDescriptor.OK_OPTION)) { uqe.confirmed(); saveCookie.save(); } } } catch (IOException ioe) { LOGGER.log(Level.WARNING, ioe.getLocalizedMessage(), ioe); } } }
try { EditorCookie editor = (EditorCookie)deploymentDescriptorDO.getCookie(EditorCookie.class); StyledDocument doc = editor.getDocument(); if (doc == null) { boolean modified = deploymentDescriptorDO.isModified(); ResourceConfigurationHelper.replaceDocument(doc, newJbossWeb); if (!modified) { SaveCookie cookie = (SaveCookie)deploymentDescriptorDO.getCookie(SaveCookie.class); if (cookie != null) { cookie.save();
public static void updateDocument(DataObject dobj, org.w3c.dom.Document doc) throws javax.swing.text.BadLocationException, java.io.IOException { org.openide.cookies.EditorCookie editor = (EditorCookie)dobj.getCookie(EditorCookie.class); javax.swing.text.Document textDoc = editor.getDocument(); if (textDoc == null) { textDoc = editor.openDocument(); } TomcatInstallUtil.updateDocument(textDoc,TomcatInstallUtil.getDocumentText(doc),"<Server"); //NOI18N SaveCookie savec = (SaveCookie) dobj.getCookie(SaveCookie.class); if (savec!=null) savec.save(); }
protected static void saveNode(Node node) { //Save file SaveCookie save = node.getLookup().lookup(SaveCookie.class); if (save != null) { try { save.save(); } catch (IOException ex) { } } }
if (fo != null) { try { DataObject dobj = DataObject.find(fo); EditorCookie ec = dobj.getCookie(EditorCookie.class); if (ec != null) { javax.swing.text.Document doc = ec.openDocument(); "end\n\n"; // NOI18N doc.insertString(offset, insert, null); SaveCookie sc = dobj.getCookie(SaveCookie.class); if (sc != null) { sc.save(); } else { LifecycleManager.getDefault().saveAll();