本文整理汇总了Java中org.openide.filesystems.FileAlreadyLockedException类的典型用法代码示例。如果您正苦于以下问题:Java FileAlreadyLockedException类的具体用法?Java FileAlreadyLockedException怎么用?Java FileAlreadyLockedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileAlreadyLockedException类属于org.openide.filesystems包,在下文中一共展示了FileAlreadyLockedException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerLock
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
private static LockForFile registerLock(LockForFile result) throws IOException, FileAlreadyLockedException {
File file = result.getFile();
Namesakes namesakes = new Namesakes();
Namesakes oldNamesakes = name2Namesakes.putIfAbsent(file.getName(), namesakes);
if (oldNamesakes != null) {
namesakes = oldNamesakes;
}
if (namesakes.putInstance(file, result) == null) {
FileAlreadyLockedException alreadyLockedException = new FileAlreadyLockedException(file.getAbsolutePath());
LockForFile previousLock = namesakes.getInstance(file);
// #151576 - check for null although it should not happen
if (previousLock != null) {
alreadyLockedException.initCause(previousLock.lockedBy);
}
throw alreadyLockedException;
}
result.valid = true;
return result;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:LockForFile.java
示例2: revertButtonActionPerformed
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
private void revertButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_revertButtonActionPerformed
final Node [] nodes = manager.getSelectedNodes ();
if (nodes != null && confirmRevert(nodes)) {
// Are you sure DLG
rp.post(new Runnable() {
@Override
public void run() {
for (Node node : nodes) {
FileObject fo = node.getLookup().lookup(FileObject.class);
if (fo != null) {
try {
fo.revert();
} catch (FileAlreadyLockedException falex) {
notifyFileLocked(fo);
revertButton.setEnabled(true);
} catch (IOException ex) {
Logger.getLogger(TemplatesPanel.class.getName()).log(Level.WARNING, null, ex);
}
}
}
}
});
revertButton.setEnabled(false);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:TemplatesPanel.java
示例3: test68015
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
public void test68015 () throws Exception {
DES edSupport = support();
edSupport.open();
waitEQ();
edSupport.desEnv().markModified();
assertTrue(edSupport.messageName().indexOf('*') != -1);
assertTrue(edSupport.messageHtmlName().indexOf('*') != -1);
try {
assertLockFree(fileObject);
fail("File shall be locked already");
} catch (FileAlreadyLockedException ex) {
// OK
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:DataEditorSupportTest.java
示例4: lock
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
@Override
public synchronized FileLock lock() throws IOException {
if (lock != null) {
FileLock f = (FileLock) lock.get();
if (f != null) {
// System.out.println ("Already locked: " + this); // NOI18N
throw new FileAlreadyLockedException();
}
}
fs.lock(getPath());
FileLock l = new AfLock();
lock = new WeakReference(l);
// Thread.dumpStack ();
// System.out.println ("Locking file: " + this); // NOI18N
return l;
}
开发者ID:daimor,项目名称:NBStudio,代码行数:20,代码来源:CacheFileObject.java
示例5: saveProperties
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
public void saveProperties() throws FileAlreadyLockedException, IOException {
OutputStream out = null;
FileLock lock = null;
try {
FileObject pFile = file.getPrimaryFile();
FileObject myFile = FileUtil.findBrother(pFile, extension);
if (myFile == null) {
myFile = FileUtil.createData(pFile.getParent(), pFile.getName() + "." + extension);
}
lock = myFile.lock();
out = myFile.getOutputStream(lock);
store(out, "");
} finally {
if (out != null) {
out.close();
}
if (lock != null) {
lock.releaseLock();
}
}
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:22,代码来源:AssetData.java
示例6: lock
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
public FileLock lock() throws IOException {
synchronized (this) {
FileLock current = getLock();
if (current != null) {
throw new FileAlreadyLockedException("File is already locked by [" + current + "]."); // NO18N
}
FileLock l = new FileLock();
lockReference = new WeakReference(l);
return l;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:XmlMultiViewDataObject.java
示例7: getOutputStream
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
private static OutputStream getOutputStream(FileObject fo) throws FileAlreadyLockedException, IOException, InterruptedException {
int retry = 0;
while (true) {
try {
return fo.getOutputStream();
} catch (IOException ioe) {
retry++;
if (retry > 7) {
throw ioe;
}
Thread.sleep(retry * 30);
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:Utils.java
示例8: getOutputStream
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
private static OutputStream getOutputStream(FileObject fo) throws FileAlreadyLockedException, IOException, InterruptedException {
int retry = 0;
while (true) {
try {
return fo.getOutputStream();
} catch (IOException ioe) {
retry++;
if (retry > 7) {
throw ioe;
}
Thread.sleep(retry * 30);
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:RevertDeletedAction.java
示例9: writeMindMap
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
protected static void writeMindMap(final File file, final MindMap map) throws IOException {
final FileObject fileObject = FileUtil.toFileObject(file);
FileLock lock = null;
while (true) {
try {
lock = fileObject.lock();
break;
}
catch (FileAlreadyLockedException ex) {
delay(500L);
}
}
try {
final OutputStream out = fileObject.getOutputStream(lock);
try {
IOUtils.write(map.packToString(), out, "UTF-8"); //NOI18N
}
finally {
IOUtils.closeQuietly(out);
}
}
finally {
if (lock != null) {
lock.releaseLock();
}
}
}
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:28,代码来源:AbstractElement.java
示例10: takeLock
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
protected FileLock takeLock() throws IOException {
FileLock fileLock = null;
try {
fileLock = super.getDataObject().getPrimaryFile().lock();
} catch (FileAlreadyLockedException exception) {
}
return fileLock;
}
开发者ID:dbunibas,项目名称:spicy,代码行数:10,代码来源:TGDEditorSupport.java
示例11: saveProperties
import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
@Deprecated
public void saveProperties() throws FileAlreadyLockedException, IOException {
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:4,代码来源:AssetData.java
注:本文中的org.openide.filesystems.FileAlreadyLockedException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论