AppCode: xcode templates reworked

This commit is contained in:
Anton Makeev
2012-06-04 12:40:03 +02:00
parent aa66aee347
commit 040877b66b
2 changed files with 23 additions and 2 deletions
@@ -80,10 +80,10 @@ public class NativeFileIconProvider implements FileIconProvider {
assert SwingComponentHolder.ourFileChooser != null || !ApplicationManager.getApplication().isReadAccessAllowed();
if (SystemInfo.isMac && virtualFile.isDirectory() && (flags & Iconable.ICON_FLAG_OPEN) == Iconable.ICON_FLAG_OPEN) {
icon = Foundation.isPackageAtPath(f) ? SwingComponentHolder.ourFileChooser.getIcon(f) : DIR_OPEN_ICON;
icon = Foundation.isPackageAtPath(f) ? getNativeIcon(f) : DIR_OPEN_ICON;
}
else {
icon = SwingComponentHolder.ourFileChooser.getIcon(f);
icon = getNativeIcon(f);
}
}
catch (Exception e) { // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4854174
@@ -104,6 +104,11 @@ public class NativeFileIconProvider implements FileIconProvider {
});
}
@Nullable
public static Icon getNativeIcon(@Nullable File file) {
return file == null ? null : SwingComponentHolder.ourFileChooser.getIcon(file);
}
private static Ext getExtension(final VirtualFile file, final int flags) {
if (file.isDirectory()) {
if (file.getExtension() == null) {
@@ -48,10 +48,26 @@ public class FileUtil extends FileUtilRt {
@NonNls public static final String ASYNC_DELETE_EXTENSION = ".__del__";
public static final int REGEX_PATTERN_FLAGS = SystemInfo.isFileSystemCaseSensitive ? 0 : Pattern.CASE_INSENSITIVE;
@SuppressWarnings({"unchecked"})
public static final TObjectHashingStrategy<String> PATH_HASHING_STRATEGY =
SystemInfo.isFileSystemCaseSensitive ? TObjectHashingStrategy.CANONICAL : CaseInsensitiveStringHashingStrategy.INSTANCE;
@SuppressWarnings({"unchecked"})
public static final TObjectHashingStrategy<File> FILE_HASHING_STRATEGY =
SystemInfo.isFileSystemCaseSensitive ? TObjectHashingStrategy.CANONICAL : new TObjectHashingStrategy<File>() {
@Override
public int computeHashCode(File object) {
return fileHashCode(object);
}
@Override
public boolean equals(File o1, File o2) {
return filesEqual(o1, o2);
}
};
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.io.FileUtil");
// do not use channels to copy files larger than 5 Mb because of possible MapFailed error