本文整理了Java中ch.cyberduck.core.Path.getExtension()
方法的一些代码示例,展示了Path.getExtension()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.getExtension()
方法的具体详情如下:
包路径:ch.cyberduck.core.Path
类名称:Path
方法名:getExtension
暂无
代码示例来源:origin: iterate-ch/cyberduck
/**
* Caching last selected extension to build menu.
*
* @return True if menu is built.
*/
@Override
protected boolean isPopulated() {
final Path selected = this.getEditable();
if(selected != null && Objects.equals(extension, selected.getExtension())) {
return true;
}
if(selected != null) {
extension = selected.getExtension();
}
else {
extension = null;
}
return false;
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
protected int compareFirst(final Path p1, final Path p2) {
if(p1.isDirectory() && p2.isDirectory()) {
return 0;
}
if(p1.isFile() && p2.isFile()) {
if(StringUtils.isBlank(p1.getExtension()) && StringUtils.isBlank(p2.getExtension())) {
return 0;
}
if(StringUtils.isBlank(p1.getExtension())) {
return -1;
}
if(StringUtils.isBlank(p2.getExtension())) {
return 1;
}
if(ascending) {
return impl.compare(p1.getExtension(), p2.getExtension());
}
return -impl.compare(p1.getExtension(), p2.getExtension());
}
if(p1.isFile()) {
return ascending ? 1 : -1;
}
return ascending ? -1 : 1;
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public NSView getAccessoryView(final NSAlert alert) {
final NSView view = super.getAccessoryView(alert);
String proposal = MessageFormat.format(PreferencesFactory.get().getProperty("browser.duplicate.format"),
FilenameUtils.getBaseName(selected.getName()),
UserDateFormatterFactory.get().getShortFormat(System.currentTimeMillis(), false).replace(Path.DELIMITER, ':'),
StringUtils.isNotBlank(selected.getExtension()) ? String.format(".%s", selected.getExtension()) : StringUtils.EMPTY);
this.updateField(inputField, proposal);
return view;
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void apply(final Path file, final Local local, final TransferStatus status,
final ProgressListener listener) throws BackgroundException {
if(status.isExists()) {
Local rename;
do {
String proposal = MessageFormat.format(PreferencesFactory.get().getProperty("queue.download.file.rename.format"),
FilenameUtils.getBaseName(file.getName()),
UserDateFormatterFactory.get().getMediumFormat(System.currentTimeMillis(), false).replace(local.getDelimiter(), '-').replace(':', '-'),
StringUtils.isNotBlank(file.getExtension()) ? String.format(".%s", file.getExtension()) : StringUtils.EMPTY);
rename = LocalFactory.get(local.getParent().getAbsolute(), proposal);
}
while(rename.exists());
if(log.isInfoEnabled()) {
log.info(String.format("Rename existing file %s to %s", local, rename));
}
local.rename(rename);
if(log.isDebugEnabled()) {
log.debug(String.format("Clear exist flag for file %s", local));
}
status.setExists(false);
}
super.apply(file, local, status, listener);
}
}
代码示例来源:origin: iterate-ch/cyberduck
/**
* Rename existing file on server if there is a conflict.
*/
@Override
public void apply(final Path file, final Local local, final TransferStatus status,
final ProgressListener listener) throws BackgroundException {
// Rename existing file before putting new file in place
if(status.isExists()) {
Path rename;
do {
final String proposal = MessageFormat.format(PreferencesFactory.get().getProperty("queue.upload.file.rename.format"),
FilenameUtils.getBaseName(file.getName()),
UserDateFormatterFactory.get().getMediumFormat(System.currentTimeMillis(), false).replace(Path.DELIMITER, '-').replace(':', '-'),
StringUtils.isNotBlank(file.getExtension()) ? String.format(".%s", file.getExtension()) : StringUtils.EMPTY);
rename = new Path(file.getParent(), proposal, file.getType());
}
while(find.withCache(cache).find(rename));
if(log.isInfoEnabled()) {
log.info(String.format("Rename existing file %s to %s", file, rename));
}
move.move(file, rename, new TransferStatus().exists(false), new Delete.DisabledCallback(), new DisabledConnectionCallback());
if(log.isDebugEnabled()) {
log.debug(String.format("Clear exist flag for file %s", file));
}
status.setExists(false);
}
super.apply(file, local, status, listener);
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Action
public void renameFileButtonClicked(final ID sender) {
final NSTableView browser = this.getSelectedBrowserView();
browser.editRow(browser.columnWithIdentifier(BrowserColumn.filename.name()),
browser.selectedRow(), true);
final Path selected = this.getSelectedPath();
if(StringUtils.isNotBlank(selected.getExtension())) {
NSText view = browser.currentEditor();
if(null == view) {
return;
}
int index = selected.getName().indexOf(selected.getExtension()) - 1;
if(index > 0) {
view.setSelectedRange(NSRange.NSMakeRange(new NSUInteger(0), new NSUInteger(index)));
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
for(final Path f : selected) {
if(f.isFile()) {
if(StringUtils.isNotBlank(f.getExtension())) {
fileTypes.add(f.getExtension());
代码示例来源:origin: iterate-ch/cyberduck
item.isFile() ? StringUtils.isNotBlank(item.getExtension()) ? item.getExtension() :
LocaleFactory.localizedString("None") : LocaleFactory.localizedString("None"),
TableCellAttributes.browserFontLeftAlignment());
代码示例来源:origin: iterate-ch/cyberduck
return this.folderIcon(size, badge);
return this.documentIcon(StringUtils.lowerCase(file.getExtension()), size, badge);
return this.folderIcon(size, badge);
return this.documentIcon(StringUtils.lowerCase(file.getExtension()), size, badge);
if(StringUtils.isEmpty(file.getExtension())) {
if(file.attributes().getPermission().isExecutable()) {
return this.iconNamed("executable.tiff", size);
return this.documentIcon(StringUtils.lowerCase(file.getExtension()), size);
内容来源于网络,如有侵权,请联系作者删除!