public void save() throws IOException{ SaveCookie cookie = this.getLookup().lookup(SaveCookie.class); if(cookie != null){ cookie.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) { } } }
private void saveAll(Node[] activatedNodes) { for(Node node : activatedNodes) { SaveCookie saveCookie = node.getLookup().lookup(SaveCookie.class); if (saveCookie != null) { try { saveCookie.save(); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } } } }
public void save() throws IOException { // pc.getConfigDataObject().getEditorSupport().saveDocument(); getCookie(SaveCookie.class).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); } } } }
private void handleDeleteSettings() throws IOException { SaveCookie s = (SaveCookie) getCookie(SaveCookie.class); try { if (s != null) s.save(); } catch (IOException ex) { // ignore } super.handleDelete(); }
/** * 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); } } } }
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); } } }
/** * 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); } } }
StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage(NbLifecycleManager.class, "CTL_FMT_SavingMessage", dobj.getName())); sc.save();
/** 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); } }
private void save(boolean wholeChain) { if (!changes.isEmpty()) { for (String bundleName : getBundleNames()) { DataObject dobj = ResourceUtils.getPropertiesDataObject(sourceFile, bundleName, false); if (dobj != null) { SaveCookie save = dobj.getCookie(SaveCookie.class); if (save != null) { try { save.save(); } catch (IOException ex) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); } } } } changes.clear(); } if (wholeChain) { DesignResourceMap parent = getDesignParent(); if (parent != null) parent.save(wholeChain); } }
protected void performAction (final Node[] activatedNodes) { SaveCookie sc = (SaveCookie)activatedNodes[0].getCookie (SaveCookie.class); // workaround the issue 44501, SaveAction can be invoked repeatedly if (sc == null) return ; try { sc.save(); StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage( SaveAction.class, "MSG_saved", getSaveMessage(activatedNodes[0]) ) ); } catch (IOException e) { ErrorManager err = ErrorManager.getDefault (); err.annotate (e, NbBundle.getMessage ( SaveAction.class, "EXC_notsaved", getSaveMessage (activatedNodes[0]) )); err.notify (e); } }
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 void performAction (final Node[] activatedNodes) { SaveCookie sc = (SaveCookie)activatedNodes[0].getCookie (SaveCookie.class); // workaround the issue 44501, SaveAction can be invoked repeatedly if (sc == null) return ; try { sc.save(); StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage( SaveAction.class, "MSG_saved", getSaveMessage(activatedNodes[0]) ) ); } catch (IOException e) { ErrorManager err = ErrorManager.getDefault (); err.annotate (e, NbBundle.getMessage ( SaveAction.class, "EXC_notsaved", getSaveMessage (activatedNodes[0]) )); err.notify (e); } }
SaveCookie sc = dobj.getCookie(SaveCookie.class); if (sc != null) { sc.save(); } else { LifecycleManager.getDefault().saveAll();
@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); } }
saveCookie.save(); } catch (IOException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
protected void dispose() { if (getPrimaryFile().hasExt(SER_EXT)) { savingCanceled = true; if (ser != null) { RequestProcessor.Task task = ser.getSaveTask(); if (task.getDelay() > 0 || ser.isSaving() && !task.isFinished()) { task.waitFinished(); } } relaseFileLock(); } else if (getPrimaryFile().hasExt(XML_EXT)) { SaveCookie s = (SaveCookie) getCookie(SaveCookie.class); try { if (s != null) s.save(); } catch (IOException ex) { //ignore } } super.dispose(); }