Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ekaterina Tuzova
2014-01-13 12:37:40 +04:00
4 changed files with 21 additions and 15 deletions
@@ -6,6 +6,9 @@ import org.jetbrains.annotations.Nullable;
public final class LocalFileUrl implements Url {
private final String path;
/**
* Use {@link Urls#newLocalFileUrl(String)} instead
*/
public LocalFileUrl(@NotNull String path) {
this.path = path;
}
@@ -43,6 +43,16 @@ public final class Urls {
return new UrlImpl(scheme, null, path);
}
@NotNull
public static Url newLocalFileUrl(@NotNull String path) {
return new LocalFileUrl(path);
}
@NotNull
public static Url newLocalFileUrl(@NotNull VirtualFile file) {
return newLocalFileUrl(file.getPath());
}
@NotNull
public static Url newFromEncoded(@NotNull String url) {
Url result = parseEncoded(url);
@@ -78,7 +88,7 @@ public final class Urls {
// java.net.URI.create cannot parse "file:///Test Stuff" - but you don't need to worry about it - this method is aware
@Nullable
public static Url parseFromIdea(@NotNull String url) {
return URLUtil.containsScheme(url) ? parseUrl(url) : new LocalFileUrl(url);
return URLUtil.containsScheme(url) ? parseUrl(url) : newLocalFileUrl(url);
}
@Nullable
@@ -89,7 +99,7 @@ public final class Urls {
if (asLocalIfNoScheme && !URLUtil.containsScheme(url)) {
// nodejs debug — files only in local filesystem
return new LocalFileUrl(url);
return newLocalFileUrl(url);
}
return parseUrl(VfsUtilCore.toIdeaUrl(url));
}
@@ -199,23 +199,16 @@ public class TableUtil {
table.setRowSelectionInterval(0, 0);
}
/**
* @return column width
*/
public static int setupCheckboxColumn(@NotNull JTable table, int columnIndex) {
return setupCheckboxColumn(table.getColumnModel().getColumn(columnIndex));
public static void setupCheckboxColumn(@NotNull JTable table, int columnIndex) {
setupCheckboxColumn(table.getColumnModel().getColumn(columnIndex));
}
/**
* @return column width
*/
public static int setupCheckboxColumn(@NotNull TableColumn column) {
public static void setupCheckboxColumn(@NotNull TableColumn column) {
int checkboxWidth = new JCheckBox().getPreferredSize().width;
column.setResizable(false);
column.setPreferredWidth(checkboxWidth);
column.setMaxWidth(checkboxWidth);
column.setMinWidth(checkboxWidth);
return checkboxWidth;
}
public static void updateScroller(@NotNull JTable table, boolean temporaryHideVerticalScrollBar) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -264,7 +264,7 @@ public class HtmlUtil {
return descriptors;
}
public static XmlElementDescriptor[] getCustomTagDescriptors(XmlElement context) {
public static XmlElementDescriptor[] getCustomTagDescriptors(@Nullable PsiElement context) {
String entitiesString = getEntitiesString(context, XmlEntitiesInspection.TAG_SHORT_NAME);
if (entitiesString == null) return XmlElementDescriptor.EMPTY_ARRAY;
@@ -298,7 +298,7 @@ public class HtmlUtil {
}
@Nullable
public static String getEntitiesString(XmlElement context, String inspectionName) {
public static String getEntitiesString(@Nullable PsiElement context, @NotNull String inspectionName) {
if (context == null) return null;
PsiFile containingFile = context.getContainingFile().getOriginalFile();