当前位置: 首页>>代码示例>>Java>>正文


Java DataObject.isModified方法代码示例

本文整理汇总了Java中org.openide.loaders.DataObject.isModified方法的典型用法代码示例。如果您正苦于以下问题:Java DataObject.isModified方法的具体用法?Java DataObject.isModified怎么用?Java DataObject.isModified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.loaders.DataObject的用法示例。


在下文中一共展示了DataObject.isModified方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFileStreamFromDocument

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private Reader getFileStreamFromDocument(File resultFile) {
    FileObject fo = FileUtil.toFileObject(FileUtil.normalizeFile(resultFile));
    if(fo != null){
        DataObject dobj = null;
        try {
            dobj = DataObject.find(fo);
        } catch (DataObjectNotFoundException ex) {
            return null;
        }
        if(dobj.isValid() && dobj.isModified()){
            // DataObjectAdapters does not implement getByteStream
            // so calling this here will effectively return null
            return DataObjectAdapters.inputSource(dobj).getCharacterStream();
        } else{
            //return null so that the validator will use normal file path to access doc
            return null;
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CatalogModelImpl.java

示例2: closeDocuments

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private static void closeDocuments(Set<DataObject> toCloseDocuments) {
    for (DataObject dobj : toCloseDocuments) {
        if (!dobj.isModified()) {
            //the modified files would force user to decide about saving..
            CloseCookie cook = dobj.getLookup().lookup(CloseCookie.class);
            if (cook != null) {
                cook.close();
            }
        }
    }   
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:Group.java

示例3: getModifiedFiles

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private static Set<DataObject> getModifiedFiles (Set<DataObject> openedFiles) {
       Set<DataObject> set = new HashSet<DataObject> (openedFiles.size ());
for (DataObject obj: openedFiles) {
           if (obj.isModified ()) {
               set.add (obj);
           }
       }
       return set;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ExitDialog.java

示例4: canClose

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/** 
 * Overrides superclass method.
 * Should test whether all data is saved, and if not, prompt the user
 * to save. Called by my topcomponent when it wants to close its last topcomponent, but the table editor may still be open
 * @return <code>true</code> if everything can be closed
 */
@Override
protected boolean canClose () {
    // if the table is open, can close without worries, don't remove the save cookie
    if (hasOpenedTableComponent()){
        return true;
    }else{
        DataObject propDO = myEntry.getDataObject();
        if ((propDO == null) || !propDO.isModified()) {
            return true;
        }
        return super.canClose();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PropertiesEditorSupport.java

示例5: canCloseElement

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
@Messages({
     "MSG_SaveModified=File {0} is modified. Save?"
 })
 @Override
 public CloseOperationState canCloseElement() {
     if (sqlEditorSupport().isConsole()) {
         return CloseOperationState.STATE_OK;
     } else {
         DataObject sqlDO = sqlEditorSupport().getDataObject();
         FileObject sqlFO = sqlEditorSupport().getDataObject().getPrimaryFile();
         if (sqlDO.isModified()) {
             if (sqlFO.canWrite()) {
                 Savable sav = sqlDO.getLookup().lookup(Savable.class);
                 if (sav != null) {
                     AbstractAction save = new AbstractAction() {
                         @Override
                         public void actionPerformed(ActionEvent e) {
                             try {
                                 sqlEditorSupport().saveDocument();
                             } catch (IOException ex) {
                                 Exceptions.printStackTrace(ex);
                             }
                         }
                     };
                     save.putValue(Action.LONG_DESCRIPTION, Bundle.MSG_SaveModified(sqlFO.getNameExt()));
                     return MultiViewFactory.createUnsafeCloseState("editor", save, null);
                 }
             }
         }
     }
     return CloseOperationState.STATE_OK;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:SQLCloneableEditor.java

示例6: setCoverage

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
public void setCoverage(FileCoverageDetails details) {
    if (details != null) {
        FileCoverageSummary summary = details.getSummary();
        float coverage = summary.getCoveragePercentage();

        if (coverage >= 0.0) {
            coverageBar.setCoveragePercentage(coverage);
        }
        //coverageBar.setStats(summary.getLineCount(), summary.getExecutedLineCount(),
        //        summary.getInferredCount(), summary.getPartialCount());

        long dataModified = details.lastUpdated();
        FileObject fo = details.getFile();
        boolean tooOld = false;
        if (fo != null && dataModified > 0 && dataModified < fo.lastModified().getTime()) {
            tooOld = true;
        } else if (fo != null && fo.isValid()) {
            try {
                DataObject dobj = DataObject.find(fo);
                tooOld = dobj.isModified();
            } catch (DataObjectNotFoundException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
        if (tooOld) {
            warningsLabel.setText(NbBundle.getMessage(CoverageSideBar.class, "DataTooOld"));
        } else {
            warningsLabel.setText("");
        }
    } else {
        coverageBar.setCoveragePercentage(0.0f);
        warningsLabel.setText("");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:CoverageSideBar.java

示例7: getFileObject

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/**
 * Get file object that have user selected
 * @throws IOException if cancelled or invalid data entered
 */
public FileObject getFileObject () throws IOException {
    FileObject newFO = null;

    while ( newFO == null ) {
        DialogDisplayer.getDefault().notify(selectDD);
        if (selectDD.getValue() != NotifyDescriptor.OK_OPTION) {
            throw new UserCancelException();
        }
        final String newName = selectDD.getInputText();

        newFO = folder.getFileObject (newName, ext);
    
        if ( ( newFO == null ) ||
             ( newFO.isVirtual() == true ) ) {

            FileSystem fs = folder.getFileSystem();
            final FileObject tempFile = newFO;
            
            fs.runAtomicAction (new FileSystem.AtomicAction () {
                    public void run () throws IOException {

                        if ( ( tempFile != null ) &&
                             tempFile.isVirtual() ) {
                            tempFile.delete();
                        }

                        try {
                            folder.createData (newName, ext);                                
                        } catch (IOException exc) {
                            NotifyDescriptor desc = new NotifyDescriptor.Message
                                (NbBundle.getMessage(SelectFileDialog.class, "MSG_cannot_create_data", newName + "." + ext), NotifyDescriptor.WARNING_MESSAGE);
                            DialogDisplayer.getDefault().notify (desc);

                            //if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug (exc);
                        }
                    }
                });
            
            newFO = folder.getFileObject (newName, ext);

        } else if (newFO != null) {
            DataObject data = DataObject.find(newFO);
            if (data.isModified() || data.isValid() == false) {
                NotifyDescriptor message = new NotifyDescriptor.Message(NbBundle.getMessage(SelectFileDialog.class, "BK0001"), NotifyDescriptor.WARNING_MESSAGE);
                DialogDisplayer.getDefault().notify(message);
                throw new UserCancelException();
            } else if (! GuiUtil.confirmAction (NbBundle.getMessage(SelectFileDialog.class, "PROP_replaceMsg",
                                                            newName, ext ) )) {
                throw new UserCancelException();
            }
        }
    } // while

    return newFO;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:60,代码来源:SelectFileDialog.java


注:本文中的org.openide.loaders.DataObject.isModified方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。