本文整理汇总了Java中com.trollworks.toolkit.utility.FileProxy类的典型用法代码示例。如果您正苦于以下问题:Java FileProxy类的具体用法?Java FileProxy怎么用?Java FileProxy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileProxy类属于com.trollworks.toolkit.utility包,在下文中一共展示了FileProxy类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDockableFor
import com.trollworks.toolkit.utility.FileProxy; //导入依赖的package包/类
public Dockable getDockableFor(Path path) {
for (Dockable dockable : getDockContainer().getDock().getDockables()) {
if (dockable instanceof FileProxy) {
File file = ((FileProxy) dockable).getBackingFile();
if (file != null) {
try {
if (Files.isSameFile(path, file.toPath())) {
return dockable;
}
} catch (IOException ioe) {
Log.error(ioe);
}
}
}
}
return null;
}
示例2: openLibrary
import com.trollworks.toolkit.utility.FileProxy; //导入依赖的package包/类
private FileProxy openLibrary(Path path) throws IOException {
FileProxy proxy = null;
LibraryFile library = new LibraryFile(path.toFile());
SpellList spells = library.getSpellList();
if (!spells.isEmpty()) {
spells.setModified(true);
proxy = dockLibrary(new SpellsDockable(spells));
}
SkillList skills = library.getSkillList();
if (!skills.isEmpty()) {
skills.setModified(true);
proxy = dockLibrary(new SkillsDockable(skills));
}
EquipmentList equipment = library.getEquipmentList();
if (!equipment.isEmpty()) {
equipment.setModified(true);
proxy = dockLibrary(new EquipmentDockable(equipment));
}
AdvantageList adq = library.getAdvantageList();
if (!adq.isEmpty()) {
adq.setModified(true);
proxy = dockLibrary(new AdvantagesDockable(adq));
}
return proxy;
}
示例3: create
import com.trollworks.toolkit.utility.FileProxy; //导入依赖的package包/类
@Override
public FileProxy create(File file) throws IOException {
LibraryExplorerDockable library = LibraryExplorerDockable.get();
if (library != null) {
FileProxy proxy = library.open(file.toPath());
proxy.toFrontAndFocus();
return proxy;
}
return null;
}
示例4: run
import com.trollworks.toolkit.utility.FileProxy; //导入依赖的package包/类
@Override
public void run() {
FileProxy proxy = AppWindow.findFileProxy(mFile);
if (proxy != null) {
PrintCommand.print(proxy.getPrintProxy());
} else if (System.currentTimeMillis() - mStart < TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES)) {
EventQueue.invokeLater(this);
}
}
示例5: open
import com.trollworks.toolkit.utility.FileProxy; //导入依赖的package包/类
/** @param file The file to open. */
public static void open(File file) {
if (file != null) {
try {
String name = file.getName();
FileProxy proxy = AppWindow.findFileProxy(file);
if (proxy == null) {
for (FileType type : FileType.getOpenable()) {
if (name.matches(StdFileDialog.createExtensionMatcher(type.getExtension()))) {
proxy = type.getFileProxyCreator().create(file);
break;
}
}
} else {
proxy.toFrontAndFocus();
}
if (proxy != null) {
RecentFilesMenu.addRecent(file);
} else {
throw new IOException("Unknown file extension"); //$NON-NLS-1$
}
} catch (Exception exception) {
Log.error(exception);
StdFileDialog.showCannotOpenMsg(getFocusOwner(), file.getName(), exception);
}
}
}
示例6: open
import com.trollworks.toolkit.utility.FileProxy; //导入依赖的package包/类
public FileProxy open(Path path) {
// See if it is already open
FileProxy proxy = (FileProxy) getDockableFor(path);
if (proxy == null) {
// If it wasn't, load it and put it into the dock
try {
switch (PathUtils.getExtension(path)) {
case AdvantageList.EXTENSION:
proxy = openAdvantageList(path);
break;
case EquipmentList.EXTENSION:
proxy = openEquipmentList(path);
break;
case SkillList.EXTENSION:
proxy = openSkillList(path);
break;
case SpellList.EXTENSION:
proxy = openSpellList(path);
break;
case LibraryFile.EXTENSION:
proxy = openLibrary(path);
break;
case GURPSCharacter.EXTENSION:
proxy = dockSheet(new SheetDockable(new GURPSCharacter(path.toFile())));
break;
case Template.EXTENSION:
proxy = dockTemplate(new TemplateDockable(new Template(path.toFile())));
break;
case FileType.PDF_EXTENSION:
proxy = dockPdf(new PdfDockable(new PdfRef(null, path.toFile(), 0), 1, null));
break;
default:
break;
}
} catch (Throwable throwable) {
StdFileDialog.showCannotOpenMsg(this, PathUtils.getLeafName(path, true), throwable);
proxy = null;
}
} else {
Dockable dockable = (Dockable) proxy;
dockable.getDockContainer().setCurrentDockable(dockable);
}
if (proxy != null) {
File file = proxy.getBackingFile();
if (file != null) {
RecentFilesMenu.addRecent(file);
}
}
return proxy;
}
示例7: openAdvantageList
import com.trollworks.toolkit.utility.FileProxy; //导入依赖的package包/类
private FileProxy openAdvantageList(Path path) throws IOException {
AdvantageList list = new AdvantageList();
list.load(path.toFile());
list.getModel().setLocked(true);
return dockLibrary(new AdvantagesDockable(list));
}
示例8: openEquipmentList
import com.trollworks.toolkit.utility.FileProxy; //导入依赖的package包/类
private FileProxy openEquipmentList(Path path) throws IOException {
EquipmentList list = new EquipmentList();
list.load(path.toFile());
list.getModel().setLocked(true);
return dockLibrary(new EquipmentDockable(list));
}
示例9: openSkillList
import com.trollworks.toolkit.utility.FileProxy; //导入依赖的package包/类
private FileProxy openSkillList(Path path) throws IOException {
SkillList list = new SkillList();
list.load(path.toFile());
list.getModel().setLocked(true);
return dockLibrary(new SkillsDockable(list));
}
示例10: openSpellList
import com.trollworks.toolkit.utility.FileProxy; //导入依赖的package包/类
private FileProxy openSpellList(Path path) throws IOException {
SpellList list = new SpellList();
list.load(path.toFile());
list.getModel().setLocked(true);
return dockLibrary(new SpellsDockable(list));
}