mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -62,7 +62,6 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
|
||||
"remote-servers-api",
|
||||
"remote-servers-java-api",
|
||||
"testFramework-java",
|
||||
"xml-analysis-api",
|
||||
].flatten()
|
||||
|
||||
//noinspection GroovyAssignabilityCheck
|
||||
@@ -78,6 +77,7 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
|
||||
"java-indexing-impl",
|
||||
"java-impl",
|
||||
"java-psi-impl",
|
||||
"js-analysis-impl",
|
||||
"jsp-spi",
|
||||
"manifest",
|
||||
"platform-main",
|
||||
@@ -85,7 +85,6 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
|
||||
"remote-servers-java-impl",
|
||||
"testFramework",
|
||||
"tests_bootstrap",
|
||||
"xml-analysis-impl",
|
||||
].flatten()
|
||||
|
||||
ant.patternset(id: "resources.included") {
|
||||
|
||||
@@ -2359,6 +2359,9 @@ public class CompileDriver {
|
||||
}
|
||||
|
||||
private boolean executeCompileTasks(final CompileContext context, final boolean beforeTasks) {
|
||||
if (myProject.isDisposed()) {
|
||||
return false;
|
||||
}
|
||||
final CompilerManager manager = CompilerManager.getInstance(myProject);
|
||||
final ProgressIndicator progressIndicator = context.getProgressIndicator();
|
||||
progressIndicator.pushState();
|
||||
|
||||
@@ -157,7 +157,9 @@ public class ProblemsViewImpl extends ProblemsView{
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ToolWindowManager.getInstance(myProject).getToolWindow(PROBLEMS_TOOLWINDOW_ID).setIcon(active ? myActiveIcon : myPassiveIcon);
|
||||
final ToolWindowManager twManager = ToolWindowManager.getInstance(myProject);
|
||||
final ToolWindow tw = twManager.getToolWindow(PROBLEMS_TOOLWINDOW_ID);
|
||||
tw.setIcon(active ? myActiveIcon : myPassiveIcon);
|
||||
}
|
||||
}, myProject.getDisposed());
|
||||
}
|
||||
|
||||
+1
-1
@@ -302,7 +302,7 @@ public class RequestManagerImpl extends DebugProcessAdapterImpl implements Reque
|
||||
//there could be no requests after hotswap
|
||||
}
|
||||
else {
|
||||
LOG.error(e);
|
||||
LOG.info(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,9 +98,21 @@ public class VirtualMachineProxyImpl implements JdiTimer, VirtualMachineProxy {
|
||||
public List<ReferenceType> nestedTypes(ReferenceType refType) {
|
||||
List<ReferenceType> nestedTypes = myNestedClassesCache.get(refType);
|
||||
if (nestedTypes == null) {
|
||||
final List<ReferenceType> list = refType.nestedTypes();
|
||||
final int size = list.size();
|
||||
if (size > 0) {
|
||||
List<ReferenceType> list = Collections.emptyList();
|
||||
try {
|
||||
list = refType.nestedTypes();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
// sometimes some strange errors are thrown from JDI. Do not crash debugger because of this.
|
||||
// Example:
|
||||
//java.lang.StringIndexOutOfBoundsException: String index out of range: 487700285
|
||||
// at java.lang.String.checkBounds(String.java:375)
|
||||
// at java.lang.String.<init>(String.java:415)
|
||||
// at com.sun.tools.jdi.PacketStream.readString(PacketStream.java:392)
|
||||
// at com.sun.tools.jdi.JDWP$VirtualMachine$AllClassesWithGeneric$ClassInfo.<init>(JDWP.java:1644)
|
||||
LOG.info(e);
|
||||
}
|
||||
if (!list.isEmpty()) {
|
||||
final Set<ReferenceType> candidates = new HashSet<ReferenceType>();
|
||||
final ClassLoaderReference outerLoader = refType.classLoader();
|
||||
for (ReferenceType nested : list) {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/*
|
||||
|
||||
import com.intellij.lang.findUsages.FindUsagesProvider;
|
||||
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -70,7 +67,7 @@ public class JavaFindUsagesProvider implements FindUsagesProvider {
|
||||
if (ThrowSearchUtil.isSearchable(element)) {
|
||||
return HelpID.FIND_THROW_USAGES;
|
||||
}
|
||||
return HelpID.FIND_OTHER_USAGES;
|
||||
return com.intellij.lang.HelpID.FIND_OTHER_USAGES;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -283,7 +283,7 @@ public class PsiCodeFragmentImpl extends PsiFileImpl implements JavaCodeFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIntentionActionsFilter(final IntentionActionsFilter filter) {
|
||||
public void setIntentionActionsFilter(@NotNull final IntentionActionsFilter filter) {
|
||||
myIntentionActionsFilter = filter;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ public class InplaceIntroduceParameterTest extends AbstractJavaInplaceIntroduceT
|
||||
});
|
||||
}
|
||||
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
|
||||
assertEquals("There is already a parameter <b><code>p</code></b>. It will conflict with an introduced parameter", e.getMessage());
|
||||
assertEquals("There is already a parameter <b><code>p</code></b>. It will conflict with the introduced parameter", e.getMessage());
|
||||
return;
|
||||
}
|
||||
fail("Conflict expected");
|
||||
|
||||
@@ -44,10 +44,12 @@ class OptimizedFileManager extends DefaultFileManager {
|
||||
private boolean myUseZipFileIndex;
|
||||
private final Map<File, Archive> myArchives;
|
||||
private final Map<File, Boolean> myIsFile = new HashMap<File, Boolean>();
|
||||
private final Map<InputFileObject, SoftReference<CharBuffer>> myContentCache = new HashMap<InputFileObject, SoftReference<CharBuffer>>();
|
||||
private final Map<File, File[]> myDirectoryCache = new HashMap<File, File[]>();
|
||||
public static final File[] NULL_FILE_ARRAY = new File[0];
|
||||
|
||||
private static final boolean ourUseContentCache = Boolean.valueOf(System.getProperty("javac.use.content.cache", "false"));
|
||||
private final Map<InputFileObject, SoftReference<CharBuffer>> myContentCache = ourUseContentCache? new HashMap<InputFileObject, SoftReference<CharBuffer>>() : Collections.<InputFileObject, SoftReference<CharBuffer>>emptyMap();
|
||||
|
||||
public OptimizedFileManager() throws Throwable {
|
||||
super(new Context(), true, null);
|
||||
final Field archivesField = DefaultFileManager.class.getDeclaredField("archives");
|
||||
@@ -352,56 +354,36 @@ class OptimizedFileManager extends DefaultFileManager {
|
||||
}
|
||||
|
||||
public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
|
||||
SoftReference<CharBuffer> r = myContentCache.get(this);
|
||||
CharBuffer cb = (r == null ? null : r.get());
|
||||
if (cb == null) {
|
||||
InputStream in = new FileInputStream(f);
|
||||
try {
|
||||
final ByteBuffer bb = makeByteBuffer(in);
|
||||
JavaFileObject prev = log.useSource(this);
|
||||
try {
|
||||
cb = decode(bb, ignoreEncodingErrors);
|
||||
}
|
||||
finally {
|
||||
log.useSource(prev);
|
||||
}
|
||||
myByteBufferCache.put(bb); // save for next time
|
||||
CharBuffer cb;
|
||||
if (ourUseContentCache) {
|
||||
SoftReference<CharBuffer> ref = myContentCache.get(this);
|
||||
cb = (ref != null) ? ref.get() : null;
|
||||
if (cb == null) {
|
||||
cb = loadFileContent(ignoreEncodingErrors);
|
||||
if (!ignoreEncodingErrors) {
|
||||
myContentCache.put(this, new SoftReference<CharBuffer>(cb));
|
||||
}
|
||||
}
|
||||
finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
else {
|
||||
cb = loadFileContent(ignoreEncodingErrors);
|
||||
}
|
||||
return cb;
|
||||
}
|
||||
|
||||
//public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
|
||||
// final String encodingName = getEncodingName();
|
||||
// SoftReference<CharBuffer> r = myContentCache.get(this);
|
||||
// CharBuffer cb = (r == null ? null : r.get());
|
||||
// if (cb == null) {
|
||||
// InputStream in = new FileInputStream(f);
|
||||
// try {
|
||||
// JavaFileObject prev = log.useSource(this);
|
||||
// try {
|
||||
// final char[] chars = FileUtil.loadFileText(f, encodingName);
|
||||
// cb = CharBuffer.wrap(chars);
|
||||
// }
|
||||
// finally {
|
||||
// log.useSource(prev);
|
||||
// }
|
||||
// if (!ignoreEncodingErrors) {
|
||||
// myContentCache.put(this, new SoftReference<CharBuffer>(cb));
|
||||
// }
|
||||
// }
|
||||
// finally {
|
||||
// in.close();
|
||||
// }
|
||||
// }
|
||||
// return cb;
|
||||
//}
|
||||
private CharBuffer loadFileContent(boolean ignoreEncodingErrors) throws IOException {
|
||||
final InputStream in = new FileInputStream(f);
|
||||
final ByteBuffer bb = makeByteBuffer(in);
|
||||
JavaFileObject prev = log.useSource(this);
|
||||
try {
|
||||
return decode(bb, ignoreEncodingErrors);
|
||||
}
|
||||
finally {
|
||||
log.useSource(prev);
|
||||
myByteBufferCache.put(bb); // save for next time
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
@@ -540,7 +522,26 @@ class OptimizedFileManager extends DefaultFileManager {
|
||||
void put(ByteBuffer x) {
|
||||
myCached.set(x);
|
||||
}
|
||||
|
||||
void clear() {
|
||||
myCached.set(null);
|
||||
}
|
||||
}
|
||||
private final ByteBufferCache myByteBufferCache = new ByteBufferCache();
|
||||
|
||||
|
||||
public void close() {
|
||||
try {
|
||||
super.close();
|
||||
}
|
||||
finally {
|
||||
// archives are cleared in super.close()
|
||||
if (ourUseContentCache) {
|
||||
myContentCache.clear();
|
||||
}
|
||||
myDirectoryCache.clear();
|
||||
myByteBufferCache.clear();
|
||||
myIsFile.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ class OptimizedFileManager17 extends com.sun.tools.javac.file.JavacFileManager {
|
||||
private static final boolean isOS2 = _OS_NAME.startsWith("os/2") || _OS_NAME.startsWith("os2");
|
||||
private static final boolean isMac = _OS_NAME.startsWith("mac");
|
||||
private static final boolean isFileSystemCaseSensitive = !isWindows && !isOS2 && !isMac;
|
||||
|
||||
private static final boolean ourUseContentCache = Boolean.valueOf(System.getProperty("javac.use.content.cache", "false"));
|
||||
|
||||
public OptimizedFileManager17() throws Throwable {
|
||||
super(new Context(), true, null);
|
||||
final Field archivesField = com.sun.tools.javac.file.JavacFileManager.class.getDeclaredField("archives");
|
||||
@@ -386,22 +387,24 @@ class OptimizedFileManager17 extends com.sun.tools.javac.file.JavacFileManager {
|
||||
}
|
||||
|
||||
public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
|
||||
CharBuffer cb = fileManager.getCachedContent(this);
|
||||
CharBuffer cb = ourUseContentCache? fileManager.getCachedContent(this) : null;
|
||||
if (cb == null) {
|
||||
InputStream in = new FileInputStream(file);
|
||||
try {
|
||||
ByteBuffer bb = fileManager.makeByteBuffer(in);
|
||||
JavaFileObject prev = fileManager.log.useSource(this);
|
||||
final ByteBuffer bb = fileManager.makeByteBuffer(in);
|
||||
final JavaFileObject prev = fileManager.log.useSource(this);
|
||||
try {
|
||||
cb = fileManager.decode(bb, ignoreEncodingErrors);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
fileManager.log.useSource(prev);
|
||||
}
|
||||
fileManager.recycleByteBuffer(bb);
|
||||
if (!ignoreEncodingErrors) {
|
||||
if (ourUseContentCache && !ignoreEncodingErrors) {
|
||||
fileManager.cache(this, cb);
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
@@ -409,5 +412,14 @@ class OptimizedFileManager17 extends com.sun.tools.javac.file.JavacFileManager {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void close() {
|
||||
try {
|
||||
super.close();
|
||||
}
|
||||
finally {
|
||||
// archives are cleared in super.close()
|
||||
myDirectoryCache.clear();
|
||||
myIsFile.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
+1
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -25,7 +25,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface ChangeLocalityDetector {
|
||||
/**
|
||||
* @param changedElement
|
||||
* @return the psi element (ancestor of the changedElement) which should be re-highlighted, or null if unsure.
|
||||
* Examples:
|
||||
* - in Java, when the statement has changed, re-highlight the enclosing code block only.
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface IntentionFilterOwner {
|
||||
/**
|
||||
@@ -24,7 +25,7 @@ public interface IntentionFilterOwner {
|
||||
*
|
||||
* @param filter the intention actions filter instance.
|
||||
*/
|
||||
void setIntentionActionsFilter(IntentionActionsFilter filter);
|
||||
void setIntentionActionsFilter(@NotNull IntentionActionsFilter filter);
|
||||
|
||||
/**
|
||||
* Sets the intention actions filter which is used to determine which intention actions should be available in an editor.
|
||||
@@ -43,14 +44,14 @@ public interface IntentionFilterOwner {
|
||||
* @param intentionAction the intention action to analyze
|
||||
* @return Returns true if the intention action should be available, false otherwise
|
||||
*/
|
||||
boolean isAvailable(final IntentionAction intentionAction);
|
||||
boolean isAvailable(@NotNull IntentionAction intentionAction);
|
||||
|
||||
/**
|
||||
* This filter reports all intentions are available.
|
||||
*/
|
||||
IntentionActionsFilter EVERYTHING_AVAILABLE = new IntentionActionsFilter() {
|
||||
@Override
|
||||
public boolean isAvailable(final IntentionAction intentionAction) {
|
||||
public boolean isAvailable(@NotNull final IntentionAction intentionAction) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -364,6 +364,11 @@ public class VfsUtilCore {
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String toIdeaUrl(@NotNull String url) {
|
||||
return toIdeaUrl(url, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String toIdeaUrl(@NotNull String url, boolean removeLocalhostPrefix) {
|
||||
int index = url.indexOf(":/");
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.lang;
|
||||
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
public class HelpID {
|
||||
@NonNls public static final String FIND_OTHER_USAGES = "reference.dialogs.findUsages.other";
|
||||
}
|
||||
+3
-4
@@ -625,12 +625,11 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme {
|
||||
@Override
|
||||
public int getConsoleFontSize() {
|
||||
String font = getConsoleFontName();
|
||||
if (!UISettings.getInstance().PRESENTATION_MODE && myConsoleFontPreferences.hasSize(font)) {
|
||||
UISettings uiSettings = UISettings.getInstance();
|
||||
if ((uiSettings == null || !uiSettings.PRESENTATION_MODE) && myConsoleFontPreferences.hasSize(font)) {
|
||||
return myConsoleFontPreferences.getSize(font);
|
||||
}
|
||||
else {
|
||||
return getEditorFontSize();
|
||||
}
|
||||
return getEditorFontSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+15
-29
@@ -15,7 +15,9 @@ import com.intellij.openapi.externalSystem.util.Order;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
@@ -26,6 +28,8 @@ import org.jetbrains.jps.model.java.JavaSourceRootProperties;
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType;
|
||||
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -92,41 +96,34 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat
|
||||
contentEntriesMap.put(contentEntry.getUrl(), contentEntry);
|
||||
}
|
||||
try {
|
||||
for (DataNode<ContentRootData> data : datas) {
|
||||
ContentRootData contentRoot = data.getData();
|
||||
ContentEntry contentEntry = findOrCreateContentRoot(model, contentRoot.getRootPath());
|
||||
for (final DataNode<ContentRootData> data : datas) {
|
||||
final ContentRootData contentRoot = data.getData();
|
||||
final ContentEntry contentEntry = findOrCreateContentRoot(model, contentRoot.getRootPath());
|
||||
contentEntry.clearExcludeFolders();
|
||||
contentEntry.clearSourceFolders();
|
||||
LOG.info(String.format("Importing content root '%s' for module '%s'", contentRoot.getRootPath(), module.getName()));
|
||||
final Set<String> retainedPaths = ContainerUtilRt.newHashSet();
|
||||
for (String path : contentRoot.getPaths(ExternalSystemSourceType.SOURCE)) {
|
||||
createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.SOURCE, false);
|
||||
retainedPaths.add(ExternalSystemApiUtil.toCanonicalPath(path));
|
||||
}
|
||||
for (String path : contentRoot.getPaths(ExternalSystemSourceType.TEST)) {
|
||||
createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.TEST_SOURCE, false);
|
||||
retainedPaths.add(ExternalSystemApiUtil.toCanonicalPath(path));
|
||||
}
|
||||
for (String path : contentRoot.getPaths(ExternalSystemSourceType.RESOURCE)) {
|
||||
createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaResourceRootType.RESOURCE, false);
|
||||
retainedPaths.add(ExternalSystemApiUtil.toCanonicalPath(path));
|
||||
}
|
||||
for (String path : contentRoot.getPaths(ExternalSystemSourceType.TEST_RESOURCE)) {
|
||||
createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaResourceRootType.TEST_RESOURCE, false);
|
||||
retainedPaths.add(ExternalSystemApiUtil.toCanonicalPath(path));
|
||||
}
|
||||
for (String path : contentRoot.getPaths(ExternalSystemSourceType.SOURCE_GENERATED)) {
|
||||
createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.SOURCE, true);
|
||||
retainedPaths.add(ExternalSystemApiUtil.toCanonicalPath(path));
|
||||
}
|
||||
for (String path : contentRoot.getPaths(ExternalSystemSourceType.TEST_GENERATED)) {
|
||||
createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.TEST_SOURCE, true);
|
||||
retainedPaths.add(ExternalSystemApiUtil.toCanonicalPath(path));
|
||||
}
|
||||
for (String path : contentRoot.getPaths(ExternalSystemSourceType.EXCLUDED)) {
|
||||
createExcludedRootIfAbsent(contentEntry, path, module.getName());
|
||||
retainedPaths.add(ExternalSystemApiUtil.toCanonicalPath(path));
|
||||
}
|
||||
contentEntriesMap.remove(contentEntry.getUrl());
|
||||
removeOutdatedContentFolders(contentEntry, retainedPaths);
|
||||
}
|
||||
for(ContentEntry contentEntry : contentEntriesMap.values()) {
|
||||
model.removeContentEntry(contentEntry);
|
||||
@@ -139,23 +136,6 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat
|
||||
});
|
||||
}
|
||||
|
||||
private static void removeOutdatedContentFolders(@NotNull final ContentEntry entry, @NotNull final Set<String> retainedContentFolders) {
|
||||
final List<SourceFolder> sourceFolders = ContainerUtilRt.newArrayList(entry.getSourceFolders());
|
||||
for(final SourceFolder sourceFolder : sourceFolders) {
|
||||
final String path = VirtualFileManager.extractPath(sourceFolder.getUrl());
|
||||
if(!retainedContentFolders.contains(path)) {
|
||||
entry.removeSourceFolder(sourceFolder);
|
||||
}
|
||||
}
|
||||
final List<ExcludeFolder> excludeFolders = ContainerUtilRt.newArrayList(entry.getExcludeFolders());
|
||||
for(final ExcludeFolder excludeFolder : excludeFolders) {
|
||||
final String path = VirtualFileManager.extractPath(excludeFolder.getUrl());
|
||||
if (!retainedContentFolders.contains(path)) {
|
||||
entry.removeExcludeFolder(excludeFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static ContentEntry findOrCreateContentRoot(@NotNull ModifiableRootModel model, @NotNull String path) {
|
||||
ContentEntry[] entries = model.getContentEntries();
|
||||
@@ -193,6 +173,12 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat
|
||||
properties.setForGeneratedSources(true);
|
||||
}
|
||||
}
|
||||
try {
|
||||
VfsUtil.createDirectoryIfMissing(path);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.warn(String.format("Unable to create directory for the path: %s", path), e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createExcludedRootIfAbsent(@NotNull ContentEntry entry, @NotNull String path, @NotNull String moduleName) {
|
||||
|
||||
+3
-3
@@ -38,6 +38,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.packaging.artifacts.ModifiableArtifactModel;
|
||||
import com.intellij.projectImport.ProjectImportBuilder;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -237,9 +238,8 @@ public abstract class AbstractExternalProjectImportBuilder<C extends AbstractImp
|
||||
}
|
||||
|
||||
// Register libraries.
|
||||
Set<DataNode<?>> toImport = ContainerUtilRt.newHashSet();
|
||||
toImport.add(projectWithResolvedLibraries);
|
||||
myProjectDataManager.importData(toImport, project, false);
|
||||
projectWithResolvedLibraries.prepareData(this.getClass().getClassLoader());
|
||||
myProjectDataManager.importData(ContainerUtil.<DataNode<?>>set(projectWithResolvedLibraries), project, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+6
@@ -37,6 +37,7 @@ public abstract class AbstractExternalProjectSettingsControl<S extends ExternalP
|
||||
@NotNull private S myInitialSettings;
|
||||
|
||||
private JBCheckBox myUseAutoImportBox;
|
||||
private boolean myHideUseAutoImportBox;
|
||||
|
||||
protected AbstractExternalProjectSettingsControl(@NotNull S initialSettings) {
|
||||
myInitialSettings = initialSettings;
|
||||
@@ -47,9 +48,14 @@ public abstract class AbstractExternalProjectSettingsControl<S extends ExternalP
|
||||
return myInitialSettings;
|
||||
}
|
||||
|
||||
public void hideUseAutoImportBox() {
|
||||
myHideUseAutoImportBox = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillUi(@NotNull PaintAwarePanel canvas, int indentLevel) {
|
||||
myUseAutoImportBox = new JBCheckBox(ExternalSystemBundle.message("settings.label.use.auto.import"));
|
||||
myUseAutoImportBox.setVisible(!myHideUseAutoImportBox);
|
||||
canvas.add(myUseAutoImportBox, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
|
||||
fillExtraControls(canvas, indentLevel);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -96,7 +96,7 @@ public class CommonRefactoringUtil {
|
||||
|
||||
@NonNls
|
||||
public static String htmlEmphasize(String text) {
|
||||
return "<b><code>" + StringUtil.escapeXml(text) + "</code></b>";
|
||||
return StringUtil.htmlEmphasize(text);
|
||||
}
|
||||
|
||||
public static boolean checkReadOnlyStatus(@NotNull PsiElement element) {
|
||||
|
||||
@@ -60,7 +60,7 @@ public interface DetailView extends UserDataHolder {
|
||||
}
|
||||
|
||||
public static PreviewEditorState create(VirtualFile file, int line, TextAttributes attributes) {
|
||||
return new PreviewEditorState(file, new LogicalPosition(line, 0), attributes);
|
||||
return new PreviewEditorState(file, line < 0 ? null : new LogicalPosition(line, 0), attributes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-3
@@ -23,6 +23,7 @@ import com.intellij.codeInsight.lookup.Lookup;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl;
|
||||
import com.intellij.codeInsight.template.CustomLiveTemplate;
|
||||
import com.intellij.codeInsight.template.CustomLiveTemplateBase;
|
||||
import com.intellij.codeInsight.template.CustomTemplateCallback;
|
||||
import com.intellij.codeInsight.template.impl.*;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
@@ -120,9 +121,12 @@ public abstract class ChooseItemAction extends EditorAction {
|
||||
|
||||
final CustomTemplateCallback callback = new CustomTemplateCallback(editor, file, false);
|
||||
for (CustomLiveTemplate customLiveTemplate : CustomLiveTemplate.EP_NAME.getExtensions()) {
|
||||
final int offset = editor.getCaretModel().getOffset();
|
||||
if (customLiveTemplate.getShortcut() == shortcutChar && customLiveTemplate.hasCompletionItem(file, offset)) {
|
||||
return customLiveTemplate.computeTemplateKey(callback) != null;
|
||||
if (customLiveTemplate instanceof CustomLiveTemplateBase) {
|
||||
final int offset = editor.getCaretModel().getOffset();
|
||||
if (customLiveTemplate.getShortcut() == shortcutChar
|
||||
&& ((CustomLiveTemplateBase)customLiveTemplate).hasCompletionItem(file, offset)) {
|
||||
return customLiveTemplate.computeTemplateKey(callback) != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,10 +41,4 @@ public interface CustomLiveTemplate {
|
||||
String getTitle();
|
||||
|
||||
char getShortcut();
|
||||
|
||||
/**
|
||||
* Implementation should returns {@code true} if it has own lookup item in completion autopopup
|
||||
* and it is supposed that template should be expanded while completion auto-popup is active.
|
||||
*/
|
||||
boolean hasCompletionItem(@NotNull PsiFile file, int offset);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.template;
|
||||
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
abstract public class CustomLiveTemplateBase implements CustomLiveTemplate {
|
||||
/**
|
||||
* Implementation should returns {@code true} if it has own lookup item in completion autopopup
|
||||
* and it is supposed that template should be expanded while completion auto-popup is active.
|
||||
*/
|
||||
public boolean hasCompletionItem(@NotNull PsiFile file, int offset) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class LanguageConsoleViewImpl extends ConsoleViewImpl implements Language
|
||||
}
|
||||
|
||||
public LanguageConsoleViewImpl(@NotNull LanguageConsoleImpl console, boolean usePredefinedMessageFilter) {
|
||||
super(console.getProject(), GlobalSearchScope.allScope(console.getProject()), true, null, usePredefinedMessageFilter);
|
||||
super(console.getProject(), GlobalSearchScope.allScope(console.getProject()), true, usePredefinedMessageFilter);
|
||||
|
||||
myConsole = console;
|
||||
Disposer.register(this, myConsole);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TextConsoleBuilderImpl extends TextConsoleBuilder {
|
||||
}
|
||||
|
||||
protected ConsoleView createConsole() {
|
||||
return new ConsoleViewImpl(myProject, myScope, myViewer, null, myUsePredefinedMessageFilter);
|
||||
return new ConsoleViewImpl(myProject, myScope, myViewer, myUsePredefinedMessageFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,21 +43,16 @@ import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.event.*;
|
||||
import com.intellij.openapi.editor.ex.DocumentEx;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.ex.MarkupModelEx;
|
||||
import com.intellij.openapi.editor.ex.RangeHighlighterEx;
|
||||
import com.intellij.openapi.editor.ex.util.EditorUtil;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.HighlighterClient;
|
||||
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.openapi.editor.impl.DocumentImpl;
|
||||
import com.intellij.openapi.editor.impl.softwrap.SoftWrapAppliancePlaces;
|
||||
import com.intellij.openapi.editor.markup.HighlighterLayer;
|
||||
import com.intellij.openapi.editor.markup.HighlighterTargetArea;
|
||||
import com.intellij.openapi.editor.markup.RangeHighlighter;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.keymap.Keymap;
|
||||
import com.intellij.openapi.keymap.KeymapManager;
|
||||
@@ -67,12 +62,13 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.ui.EditorNotificationPanel;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.EditorPopupHandler;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -249,41 +245,15 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
private final Alarm myFoldingAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, this);
|
||||
private final List<FoldRegion> myPendingFoldRegions = new ArrayList<FoldRegion>();
|
||||
|
||||
private FileType myFileType;
|
||||
|
||||
/**
|
||||
* Use it for custom highlighting for user text.
|
||||
* This will be highlighted as appropriate file to this file type.
|
||||
*
|
||||
* @param fileType according to which use highlighting
|
||||
*/
|
||||
public void setFileType(FileType fileType) {
|
||||
myFileType = fileType;
|
||||
}
|
||||
|
||||
public ConsoleViewImpl(final Project project, boolean viewer) {
|
||||
this(project, viewer, null);
|
||||
}
|
||||
|
||||
public ConsoleViewImpl(@NotNull final Project project, boolean viewer, @Nullable FileType fileType) {
|
||||
this(project, GlobalSearchScope.allScope(project), viewer, fileType);
|
||||
this(project, GlobalSearchScope.allScope(project), viewer, true);
|
||||
}
|
||||
|
||||
public ConsoleViewImpl(@NotNull final Project project,
|
||||
@NotNull GlobalSearchScope searchScope,
|
||||
boolean viewer,
|
||||
@Nullable FileType fileType)
|
||||
{
|
||||
this(project, searchScope, viewer, fileType, true);
|
||||
}
|
||||
|
||||
public ConsoleViewImpl(@NotNull final Project project,
|
||||
@NotNull GlobalSearchScope searchScope,
|
||||
boolean viewer,
|
||||
@Nullable FileType fileType,
|
||||
boolean usePredefinedMessageFilter)
|
||||
{
|
||||
this(project, searchScope, viewer, fileType,
|
||||
boolean usePredefinedMessageFilter) {
|
||||
this(project, searchScope, viewer,
|
||||
new ConsoleState.NotStartedStated() {
|
||||
@Override
|
||||
public ConsoleState attachTo(ConsoleViewImpl console, ProcessHandler processHandler) {
|
||||
@@ -296,7 +266,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
protected ConsoleViewImpl(@NotNull final Project project,
|
||||
@NotNull GlobalSearchScope searchScope,
|
||||
boolean viewer,
|
||||
@Nullable FileType fileType,
|
||||
@NotNull final ConsoleState initialState,
|
||||
boolean usePredefinedMessageFilter)
|
||||
{
|
||||
@@ -305,7 +274,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
myState = initialState;
|
||||
myPsiDisposedCheck = new DisposedPsiManagerCheck(project);
|
||||
myProject = project;
|
||||
myFileType = fileType;
|
||||
|
||||
myCustomFilter = new CompositeFilter(project);
|
||||
myPredefinedMessageFilter = new CompositeFilter(project);
|
||||
@@ -597,13 +565,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* todo python plugin compatibility. Remove on the next update.
|
||||
*/
|
||||
@Deprecated
|
||||
protected void beforeExternalAddContentToDocument(int length, ConsoleViewContentType contentType) {
|
||||
}
|
||||
|
||||
private void addToken(int length, @Nullable HyperlinkInfo info, ConsoleViewContentType contentType) {
|
||||
ConsoleUtil.addToken(length, info, contentType, myTokens);
|
||||
}
|
||||
@@ -928,9 +889,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
LOG.warn("unhandled external change: " + event);
|
||||
}
|
||||
}
|
||||
if (myFileType != null) {
|
||||
highlightUserTokens();
|
||||
}
|
||||
}
|
||||
|
||||
protected EditorEx createRealEditor() {
|
||||
@@ -941,40 +899,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
return new MyHighlighter();
|
||||
}
|
||||
|
||||
private void highlightUserTokens() {
|
||||
if (myTokens.isEmpty()) return;
|
||||
final TokenInfo token = myTokens.get(myTokens.size() - 1);
|
||||
if (token.contentType == ConsoleViewContentType.USER_INPUT) {
|
||||
String text = myEditor.getDocument().getText().substring(token.startOffset, token.endOffset);
|
||||
PsiFile file = PsiFileFactory.getInstance(myProject).
|
||||
createFileFromText("dummy", myFileType, text, LocalTimeCounter.currentTime(), true);
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(file);
|
||||
assert document != null;
|
||||
Editor editor = EditorFactory.getInstance().createEditor(document, myProject, myFileType, false);
|
||||
try {
|
||||
MarkupModelEx markup = (MarkupModelEx)myEditor.getMarkupModel();
|
||||
List<RangeHighlighterEx> list = new ArrayList<RangeHighlighterEx>();
|
||||
markup.processRangeHighlightersOutside(0, token.startOffset-1, new CommonProcessors.CollectProcessor<RangeHighlighterEx>(list));
|
||||
for (RangeHighlighter highlighter : list) {
|
||||
if (highlighter.getStartOffset() >= token.startOffset) {
|
||||
highlighter.dispose();
|
||||
}
|
||||
}
|
||||
HighlighterIterator iterator = ((EditorEx)editor).getHighlighter().createIterator(0);
|
||||
while (!iterator.atEnd()) {
|
||||
markup
|
||||
.addRangeHighlighter(iterator.getStart() + token.startOffset, iterator.getEnd() + token.startOffset, HighlighterLayer.SYNTAX,
|
||||
iterator.getTextAttributes(),
|
||||
HighlighterTargetArea.EXACT_RANGE);
|
||||
iterator.advance();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
EditorFactory.getInstance().releaseEditor(editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerConsoleEditorActions(Editor editor) {
|
||||
new EnterHandler().registerCustomShortcutSet(CommonShortcuts.ENTER, editor.getContentComponent());
|
||||
registerActionHandler(editor, IdeActions.ACTION_EDITOR_PASTE, new PasteHandler());
|
||||
@@ -1212,9 +1136,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
|
||||
@Override
|
||||
public TextAttributes getTextAttributes() {
|
||||
if (myFileType != null && getTokenInfo().contentType == ConsoleViewContentType.USER_INPUT) {
|
||||
return ConsoleViewContentType.NORMAL_OUTPUT.getAttributes();
|
||||
}
|
||||
return getTokenInfo() == null ? null : getTokenInfo().attributes;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -23,10 +23,8 @@ public interface HelpID {
|
||||
@NonNls String FIND_PACKAGE_USAGES = "reference.dialogs.findUsages.package";
|
||||
@NonNls String FIND_CLASS_USAGES = "reference.dialogs.findUsages.class";
|
||||
@NonNls String FIND_METHOD_USAGES = "reference.dialogs.findUsages.method";
|
||||
@NonNls String FIND_OTHER_USAGES = "reference.dialogs.findUsages.other";
|
||||
@NonNls String FIND_THROW_USAGES = "reference.dialogs.findUsages.throwUsages";
|
||||
|
||||
|
||||
@NonNls String FIND_IN_PROJECT = "find.findInProject";
|
||||
@NonNls String REPLACE_IN_PROJECT = "find.findInProject";
|
||||
|
||||
|
||||
@@ -973,7 +973,6 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
updatePopup();
|
||||
}
|
||||
catch (Exception ignore) {
|
||||
ignore.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
myList.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT);
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
|
||||
package com.intellij.util.download.impl;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.util.concurrent.AtomicDouble;
|
||||
import com.intellij.concurrency.JobLauncher;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
@@ -37,7 +38,7 @@ import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.concurrency.BoundedTaskExecutor;
|
||||
import com.intellij.util.containers.hash.LinkedHashMap;
|
||||
import com.intellij.util.download.DownloadableFileDescription;
|
||||
import com.intellij.util.download.FileDownloader;
|
||||
@@ -47,6 +48,7 @@ import com.intellij.util.net.NetUtils;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.ide.PooledThreadExecutor;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.*;
|
||||
@@ -54,12 +56,16 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class FileDownloaderImpl implements FileDownloader {
|
||||
private static final Logger LOG = Logger.getInstance(FileDownloaderImpl.class);
|
||||
private static final int CONNECTION_TIMEOUT = 60*1000;
|
||||
private static final int READ_TIMEOUT = 60*1000;
|
||||
@NonNls private static final String LIB_SCHEMA = "lib://";
|
||||
@@ -156,58 +162,79 @@ public class FileDownloaderImpl implements FileDownloader {
|
||||
public List<Pair<File, DownloadableFileDescription>> download(@NotNull final File targetDir) throws IOException {
|
||||
final List<Pair<File, DownloadableFileDescription>> downloadedFiles = new ArrayList<Pair<File, DownloadableFileDescription>>();
|
||||
final List<Pair<File, DownloadableFileDescription>> existingFiles = new ArrayList<Pair<File, DownloadableFileDescription>>();
|
||||
final ProgressIndicator parentIndicator = getProgressIndicator();
|
||||
ProgressIndicator parentIndicator = ProgressManager.getInstance().getProgressIndicator();
|
||||
if (parentIndicator == null) {
|
||||
parentIndicator = new EmptyProgressIndicator();
|
||||
}
|
||||
|
||||
try {
|
||||
final AtomicReference<IOException> ioException = new AtomicReference<IOException>();
|
||||
final ConcurrentTasksProgressManager progressManager = new ConcurrentTasksProgressManager(parentIndicator, myFileDescriptions.size());
|
||||
parentIndicator.setText(IdeBundle.message("progress.downloading.0.files.text", myFileDescriptions.size()));
|
||||
boolean finished = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(myFileDescriptions, parentIndicator, false, false, new Processor<DownloadableFileDescription>() {
|
||||
@Override
|
||||
public boolean process(DownloadableFileDescription description) {
|
||||
SubTaskProgressIndicator indicator = progressManager.createSubTaskIndicator();
|
||||
indicator.checkCanceled();
|
||||
int maxParallelDownloads = Runtime.getRuntime().availableProcessors();
|
||||
LOG.debug("Downloading " + myFileDescriptions.size() + " files using " + maxParallelDownloads + " threads");
|
||||
long start = System.currentTimeMillis();
|
||||
BoundedTaskExecutor executor = new BoundedTaskExecutor(PooledThreadExecutor.INSTANCE, maxParallelDownloads);
|
||||
List<Future<Void>> results = new ArrayList<Future<Void>>();
|
||||
final AtomicLong totalSize = new AtomicLong();
|
||||
for (final DownloadableFileDescription description : myFileDescriptions) {
|
||||
results.add(executor.submit(new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
SubTaskProgressIndicator indicator = progressManager.createSubTaskIndicator();
|
||||
indicator.checkCanceled();
|
||||
|
||||
final File existing = new File(targetDir, description.getDefaultFileName());
|
||||
final String url = description.getDownloadUrl();
|
||||
if (url.startsWith(LIB_SCHEMA)) {
|
||||
final String path = FileUtil.toSystemDependentName(StringUtil.trimStart(url, LIB_SCHEMA));
|
||||
final File file = PathManager.findFileInLibDirectory(path);
|
||||
existingFiles.add(Pair.create(file, description));
|
||||
}
|
||||
else if (url.startsWith(LocalFileSystem.PROTOCOL_PREFIX)) {
|
||||
String path = FileUtil.toSystemDependentName(StringUtil.trimStart(url, LocalFileSystem.PROTOCOL_PREFIX));
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
final File existing = new File(targetDir, description.getDefaultFileName());
|
||||
final String url = description.getDownloadUrl();
|
||||
if (url.startsWith(LIB_SCHEMA)) {
|
||||
final String path = FileUtil.toSystemDependentName(StringUtil.trimStart(url, LIB_SCHEMA));
|
||||
final File file = PathManager.findFileInLibDirectory(path);
|
||||
existingFiles.add(Pair.create(file, description));
|
||||
}
|
||||
}
|
||||
else {
|
||||
File downloaded;
|
||||
try {
|
||||
downloaded = downloadFile(description, existing, indicator);
|
||||
}
|
||||
catch (IOException e) {
|
||||
ioException.compareAndSet(null, new IOException(IdeBundle.message("error.file.download.failed", description.getDownloadUrl(),
|
||||
e.getMessage()), e));
|
||||
return false;
|
||||
}
|
||||
if (FileUtil.filesEqual(downloaded, existing)) {
|
||||
existingFiles.add(Pair.create(existing, description));
|
||||
else if (url.startsWith(LocalFileSystem.PROTOCOL_PREFIX)) {
|
||||
String path = FileUtil.toSystemDependentName(StringUtil.trimStart(url, LocalFileSystem.PROTOCOL_PREFIX));
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
existingFiles.add(Pair.create(file, description));
|
||||
}
|
||||
}
|
||||
else {
|
||||
downloadedFiles.add(Pair.create(downloaded, description));
|
||||
File downloaded;
|
||||
try {
|
||||
downloaded = downloadFile(description, existing, indicator);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IOException(IdeBundle.message("error.file.download.failed", description.getDownloadUrl(), e.getMessage()), e);
|
||||
}
|
||||
if (FileUtil.filesEqual(downloaded, existing)) {
|
||||
existingFiles.add(Pair.create(existing, description));
|
||||
}
|
||||
else {
|
||||
totalSize.addAndGet(downloaded.length());
|
||||
downloadedFiles.add(Pair.create(downloaded, description));
|
||||
}
|
||||
}
|
||||
indicator.finished();
|
||||
return null;
|
||||
}
|
||||
indicator.finished();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (!finished) {
|
||||
if (ioException.get() != null) {
|
||||
throw ioException.get();
|
||||
}
|
||||
throw new ProcessCanceledException();
|
||||
}));
|
||||
}
|
||||
|
||||
for (Future<Void> result : results) {
|
||||
try {
|
||||
result.get();
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
throw new ProcessCanceledException();
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
Throwables.propagateIfInstanceOf(e.getCause(), IOException.class);
|
||||
Throwables.propagateIfInstanceOf(e.getCause(), ProcessCanceledException.class);
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
long duration = System.currentTimeMillis() - start;
|
||||
LOG.debug("Downloaded " + StringUtil.formatFileSize(totalSize.get()) + " in " + StringUtil.formatDuration(duration) + "(" + duration + "ms)");
|
||||
|
||||
List<Pair<File, DownloadableFileDescription>> localFiles = new ArrayList<Pair<File, DownloadableFileDescription>>();
|
||||
localFiles.addAll(moveToDir(downloadedFiles, targetDir));
|
||||
localFiles.addAll(existingFiles);
|
||||
@@ -223,12 +250,6 @@ public class FileDownloaderImpl implements FileDownloader {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static ProgressIndicator getProgressIndicator() {
|
||||
ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
|
||||
return indicator == null ? new EmptyProgressIndicator() : indicator;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static VirtualFile chooseDirectoryForFiles(Project project, JComponent parentComponent) {
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.ui.mac.MacMessages;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public final class MessageBuilder {
|
||||
private final String myMessage;
|
||||
private final String myTitle;
|
||||
|
||||
private String myYesText;
|
||||
private String myNoText;
|
||||
|
||||
private Project myProject;
|
||||
private Icon myIcon;
|
||||
private DialogWrapper.DoNotAskOption myDoNotAskOption;
|
||||
|
||||
private MessageBuilder(@NotNull String title, @NotNull String message) {
|
||||
myTitle = title;
|
||||
myMessage = message;
|
||||
}
|
||||
|
||||
public static MessageBuilder yesNo(@NotNull String title, @NotNull String message) {
|
||||
return new MessageBuilder(title, message).icon(Messages.getQuestionIcon());
|
||||
}
|
||||
|
||||
public MessageBuilder project(@Nullable Project project) {
|
||||
myProject = project;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link com.intellij.openapi.ui.Messages#getInformationIcon()}
|
||||
* @see {@link com.intellij.openapi.ui.Messages#getWarningIcon()}
|
||||
* @see {@link com.intellij.openapi.ui.Messages#getErrorIcon()}
|
||||
* @see {@link com.intellij.openapi.ui.Messages#getQuestionIcon()}
|
||||
*/
|
||||
public MessageBuilder icon(@Nullable Icon icon) {
|
||||
myIcon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MessageBuilder doNotAsk(@NotNull DialogWrapper.DoNotAskOption doNotAskOption) {
|
||||
myDoNotAskOption = doNotAskOption;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MessageBuilder yesText(@NotNull String yesText) {
|
||||
myYesText = yesText;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MessageBuilder noText(@NotNull String noText) {
|
||||
myNoText = noText;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Messages.YesNoResult
|
||||
public int show() {
|
||||
String yesText = ObjectUtils.chooseNotNull(myYesText, Messages.YES_BUTTON);
|
||||
String noText = ObjectUtils.chooseNotNull(myNoText, Messages.NO_BUTTON);
|
||||
if (Messages.canShowMacSheetPanel()) {
|
||||
return MacMessages.getInstance().showYesNoDialog(myTitle, myMessage, yesText, noText, WindowManager.getInstance().suggestParentWindow(myProject), myDoNotAskOption);
|
||||
}
|
||||
else {
|
||||
//noinspection MagicConstant
|
||||
return Messages.showDialog(myProject, myMessage, myTitle, new String[]{yesText, noText}, 0, myIcon, myDoNotAskOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.ui.mac.MacMessages;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public abstract class MessageDialogBuilder<T extends MessageDialogBuilder> {
|
||||
protected final String myMessage;
|
||||
protected final String myTitle;
|
||||
|
||||
protected String myYesText;
|
||||
protected String myNoText;
|
||||
|
||||
protected Project myProject;
|
||||
protected Icon myIcon;
|
||||
protected DialogWrapper.DoNotAskOption myDoNotAskOption;
|
||||
|
||||
private MessageDialogBuilder(@NotNull String title, @NotNull String message) {
|
||||
myTitle = title;
|
||||
myMessage = message;
|
||||
}
|
||||
|
||||
public static YesNo yesNo(@NotNull String title, @NotNull String message) {
|
||||
return new YesNo(title, message).icon(Messages.getQuestionIcon());
|
||||
}
|
||||
|
||||
public static YesNoCancel yesNoCancel(@NotNull String title, @NotNull String message) {
|
||||
return new YesNoCancel(title, message).icon(Messages.getQuestionIcon());
|
||||
}
|
||||
|
||||
protected abstract T getThis();
|
||||
|
||||
public T project(@Nullable Project project) {
|
||||
myProject = project;
|
||||
return getThis();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link com.intellij.openapi.ui.Messages#getInformationIcon()}
|
||||
* @see {@link com.intellij.openapi.ui.Messages#getWarningIcon()}
|
||||
* @see {@link com.intellij.openapi.ui.Messages#getErrorIcon()}
|
||||
* @see {@link com.intellij.openapi.ui.Messages#getQuestionIcon()}
|
||||
*/
|
||||
public T icon(@Nullable Icon icon) {
|
||||
myIcon = icon;
|
||||
return getThis();
|
||||
}
|
||||
|
||||
public T doNotAsk(@NotNull DialogWrapper.DoNotAskOption doNotAskOption) {
|
||||
myDoNotAskOption = doNotAskOption;
|
||||
return getThis();
|
||||
}
|
||||
|
||||
public T yesText(@NotNull String yesText) {
|
||||
myYesText = yesText;
|
||||
return getThis();
|
||||
}
|
||||
|
||||
public T noText(@NotNull String noText) {
|
||||
myNoText = noText;
|
||||
return getThis();
|
||||
}
|
||||
|
||||
public static final class YesNo extends MessageDialogBuilder<YesNo> {
|
||||
private YesNo(@NotNull String title, @NotNull String message) {
|
||||
super(title, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected YesNo getThis() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Messages.YesNoResult
|
||||
public int show() {
|
||||
String yesText = ObjectUtils.chooseNotNull(myYesText, Messages.YES_BUTTON);
|
||||
String noText = ObjectUtils.chooseNotNull(myNoText, Messages.NO_BUTTON);
|
||||
if (Messages.canShowMacSheetPanel() && !Messages.isApplicationInUnitTestOrHeadless()) {
|
||||
return MacMessages.getInstance().showYesNoDialog(myTitle, myMessage, yesText, noText, WindowManager.getInstance().suggestParentWindow(myProject), myDoNotAskOption);
|
||||
}
|
||||
else {
|
||||
return Messages.showDialog(myProject, myMessage, myTitle, new String[]{yesText, noText}, 0, myIcon, myDoNotAskOption) == 0 ? Messages.YES : Messages.NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final class YesNoCancel extends MessageDialogBuilder<YesNoCancel> {
|
||||
private String myCancelText;
|
||||
|
||||
private YesNoCancel(@NotNull String title, @NotNull String message) {
|
||||
super(title, message);
|
||||
}
|
||||
|
||||
public YesNoCancel cancelText(@NotNull String cancelText) {
|
||||
myCancelText = cancelText;
|
||||
return getThis();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected YesNoCancel getThis() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Messages.YesNoCancelResult
|
||||
public int show() {
|
||||
String yesText = ObjectUtils.chooseNotNull(myYesText, Messages.YES_BUTTON);
|
||||
String noText = ObjectUtils.chooseNotNull(myNoText, Messages.NO_BUTTON);
|
||||
String cancelText = ObjectUtils.chooseNotNull(myCancelText, Messages.CANCEL_BUTTON);
|
||||
if (Messages.canShowMacSheetPanel() && !Messages.isApplicationInUnitTestOrHeadless()) {
|
||||
return MacMessages.getInstance().showYesNoCancelDialog(myTitle, myMessage, yesText, noText, cancelText, WindowManager.getInstance().suggestParentWindow(myProject), myDoNotAskOption);
|
||||
}
|
||||
else {
|
||||
int buttonNumber = Messages.showDialog(myProject, myMessage, myTitle, new String[]{yesText, noText, cancelText}, 0, myIcon, myDoNotAskOption);
|
||||
return buttonNumber == 0 ? Messages.YES : buttonNumber == 1 ? Messages.NO : Messages.CANCEL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public class Messages {
|
||||
return dialog.getExitCode();
|
||||
}
|
||||
|
||||
private static boolean isApplicationInUnitTestOrHeadless(){
|
||||
static boolean isApplicationInUnitTestOrHeadless(){
|
||||
final Application application = ApplicationManager.getApplication();
|
||||
return application != null && (application.isUnitTestMode() || application.isHeadlessEnvironment());
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.execution;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
@@ -23,114 +24,51 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileDeleteEvent;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
|
||||
import com.intellij.problems.WolfTheProblemSolver;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class DelayedDocumentWatcher implements Runnable {
|
||||
public class DelayedDocumentWatcher {
|
||||
private final Project myProject;
|
||||
private final Alarm myAlarm;
|
||||
private final Consumer<VirtualFile[]> myConsumer;
|
||||
private final int myDelay;
|
||||
|
||||
private final int myDelayMillis;
|
||||
private final Consumer<Set<VirtualFile>> myConsumer;
|
||||
private final Condition<VirtualFile> myChangedFileFilter;
|
||||
private final MyDocumentAdapter myListener;
|
||||
private final Runnable myAlarmRunnable;
|
||||
|
||||
private final Set<VirtualFile> myChangedFiles = new THashSet<VirtualFile>();
|
||||
private boolean myWasRequested;
|
||||
|
||||
private final Condition<VirtualFile> myDocumentChangedFilter;
|
||||
|
||||
private MessageBusConnection myMessageBusConnection;
|
||||
|
||||
public DelayedDocumentWatcher(Project project,
|
||||
Alarm alarm,
|
||||
int delay,
|
||||
Consumer<VirtualFile[]> consumer,
|
||||
Condition<VirtualFile> documentChangedFilter) {
|
||||
public DelayedDocumentWatcher(@NotNull Project project,
|
||||
int delayMillis,
|
||||
@NotNull Consumer<Set<VirtualFile>> consumer,
|
||||
@Nullable Condition<VirtualFile> changedFileFilter) {
|
||||
myProject = project;
|
||||
myAlarm = alarm;
|
||||
myDelay = delay;
|
||||
myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, myProject);
|
||||
myDelayMillis = delayMillis;
|
||||
myConsumer = consumer;
|
||||
myDocumentChangedFilter = documentChangedFilter;
|
||||
|
||||
myChangedFileFilter = changedFileFilter;
|
||||
myListener = new MyDocumentAdapter();
|
||||
myAlarmRunnable = new MyRunnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final VirtualFile[] files;
|
||||
synchronized (myChangedFiles) {
|
||||
myWasRequested = false;
|
||||
files = myChangedFiles.toArray(new VirtualFile[myChangedFiles.size()]);
|
||||
myChangedFiles.clear();
|
||||
}
|
||||
|
||||
final WolfTheProblemSolver problemSolver = WolfTheProblemSolver.getInstance(myProject);
|
||||
for (VirtualFile file : files) {
|
||||
if (problemSolver.hasSyntaxErrors(file)) {
|
||||
// threat any other file in queue as dependency of this file — don't flush if some of the queued file is invalid
|
||||
// Vladimir.Krivosheev AutoTestManager behavior behavior is preserved.
|
||||
// LiveEdit version used another strategy (flush all valid files), but now we use AutoTestManager-inspired strategy
|
||||
synchronized (myChangedFiles) {
|
||||
Collections.addAll(myChangedFiles, files);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
myConsumer.consume(files);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
if (myMessageBusConnection != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
myMessageBusConnection = myProject.getMessageBus().connect(myProject);
|
||||
myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
|
||||
@Override
|
||||
public void after(@NotNull List<? extends VFileEvent> events) {
|
||||
for (VFileEvent event : events) {
|
||||
if (event instanceof VFileDeleteEvent) {
|
||||
synchronized (myChangedFiles) {
|
||||
myChangedFiles.remove(event.getFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
EditorFactory.getInstance().getEventMulticaster().addDocumentListener(myListener, myProject);
|
||||
}
|
||||
|
||||
public void deactivate() {
|
||||
if (myMessageBusConnection == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
EditorFactory.getInstance().getEventMulticaster().removeDocumentListener(myListener);
|
||||
}
|
||||
finally {
|
||||
myMessageBusConnection.disconnect();
|
||||
myMessageBusConnection = null;
|
||||
}
|
||||
EditorFactory.getInstance().getEventMulticaster().removeDocumentListener(myListener);
|
||||
}
|
||||
|
||||
private class MyDocumentAdapter extends DocumentAdapter {
|
||||
@@ -138,19 +76,35 @@ public class DelayedDocumentWatcher implements Runnable {
|
||||
public void documentChanged(DocumentEvent event) {
|
||||
final Document document = event.getDocument();
|
||||
final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
|
||||
if (file == null || !myDocumentChangedFilter.value(file)) {
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
if (!myChangedFiles.contains(file)) {
|
||||
// optimization: if possible, avoid possible expensive 'myChangedFileFilter.value(file)' call
|
||||
if (myChangedFileFilter != null && !myChangedFileFilter.value(file)) {
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (myChangedFiles) {
|
||||
// changedFiles contains is not enough, because it can contain not-flushed files from prev request (which are not flushed because some is invalid)
|
||||
if (!myChangedFiles.add(file) && myWasRequested) {
|
||||
myChangedFiles.add(file);
|
||||
}
|
||||
|
||||
myAlarm.cancelRequest(myAlarmRunnable);
|
||||
myAlarm.addRequest(myAlarmRunnable, myDelayMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private class MyRunnable implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
WolfTheProblemSolver problemSolver = WolfTheProblemSolver.getInstance(myProject);
|
||||
for (VirtualFile file : myChangedFiles) {
|
||||
if (problemSolver.hasSyntaxErrors(file)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
myAlarm.cancelRequest(DelayedDocumentWatcher.this);
|
||||
myAlarm.addRequest(DelayedDocumentWatcher.this, myDelay);
|
||||
Set<VirtualFile> copy = ImmutableSet.copyOf(myChangedFiles);
|
||||
myChangedFiles.clear();
|
||||
myConsumer.consume(copy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,25 +15,35 @@
|
||||
*/
|
||||
package com.intellij.execution.impl;
|
||||
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.EditorSettings;
|
||||
import com.intellij.openapi.editor.colors.EditorColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.colors.EditorFontType;
|
||||
import com.intellij.openapi.editor.colors.FontPreferences;
|
||||
import com.intellij.openapi.editor.HighlighterColors;
|
||||
import com.intellij.openapi.editor.colors.*;
|
||||
import com.intellij.openapi.editor.colors.impl.DelegateColorScheme;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.impl.EditorFactoryImpl;
|
||||
import com.intellij.openapi.editor.impl.softwrap.SoftWrapAppliancePlaces;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.containers.FactoryMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.execution.ui.ConsoleViewContentType.registerNewConsoleViewType;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -122,4 +132,48 @@ public class ConsoleViewUtil {
|
||||
public static boolean isConsoleViewEditor(Editor editor) {
|
||||
return editor.getUserData(EDITOR_IS_CONSOLE_VIEW) == Boolean.TRUE;
|
||||
}
|
||||
|
||||
// @noinspection MismatchedQueryAndUpdateOfCollection
|
||||
private static final Map<List<TextAttributesKey>, Key> ourContentTypes = Collections.synchronizedMap(new FactoryMap<List<TextAttributesKey>, Key>() {
|
||||
protected Key create(List<TextAttributesKey> keys) {
|
||||
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
|
||||
TextAttributes result = scheme.getAttributes(HighlighterColors.TEXT);
|
||||
StringBuilder keyName = new StringBuilder("Generated_");
|
||||
for (TextAttributesKey key : keys) {
|
||||
TextAttributes attributes = scheme.getAttributes(key);
|
||||
if (attributes != null) {
|
||||
keyName.append("_").append(key.getExternalName());
|
||||
result = TextAttributes.merge(result, attributes);
|
||||
}
|
||||
}
|
||||
Key newKey = new Key(keyName.toString());
|
||||
ConsoleViewContentType contentType = new ConsoleViewContentType(keyName.toString(), result);
|
||||
registerNewConsoleViewType(newKey, contentType);
|
||||
return newKey;
|
||||
}
|
||||
});
|
||||
|
||||
public static void printWithHighlighting(@NotNull ConsoleView console, @NotNull String text, @NotNull SyntaxHighlighter highlighter) {
|
||||
Lexer lexer = highlighter.getHighlightingLexer();
|
||||
lexer.start(text, 0, text.length(), 0);
|
||||
|
||||
IElementType tokenType;
|
||||
while ((tokenType = lexer.getTokenType()) != null) {
|
||||
TextAttributesKey[] keys = highlighter.getTokenHighlights(tokenType);
|
||||
ConsoleViewContentType type = keys.length == 0 ? ConsoleViewContentType.NORMAL_OUTPUT :
|
||||
ConsoleViewContentType.getConsoleViewType(ourContentTypes.get(Arrays.asList(keys)));
|
||||
console.print(lexer.getTokenText(), type);
|
||||
lexer.advance();
|
||||
}
|
||||
}
|
||||
|
||||
public static void printAsFileType(@NotNull ConsoleView console, @NotNull String text, @NotNull FileType fileType) {
|
||||
SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null);
|
||||
if (highlighter != null) {
|
||||
printWithHighlighting(console, text, highlighter);
|
||||
}
|
||||
else {
|
||||
console.print(text, ConsoleViewContentType.NORMAL_OUTPUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
|
||||
this.installed = installed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
Presentation presentation = e.getPresentation();
|
||||
IdeaPluginDescriptor[] selection = getPluginTable().getSelectedObjects();
|
||||
@@ -80,6 +81,7 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
|
||||
presentation.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
install();
|
||||
}
|
||||
@@ -224,6 +226,7 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
|
||||
message += "updated plugin" + (disabled.size() > 1 ? "s" : "");
|
||||
}
|
||||
else {
|
||||
//noinspection SpellCheckingInspection
|
||||
message += "plugin dependenc" + (disabledDependants.size() > 1 ? "ies" : "y");
|
||||
}
|
||||
message += "?</body></html>";
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ import com.intellij.openapi.project.ex.ProjectEx;
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx;
|
||||
import com.intellij.openapi.project.impl.ProjectManagerImpl;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.MessageBuilder;
|
||||
import com.intellij.openapi.ui.MessageDialogBuilder;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -881,7 +881,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
|
||||
.message(hasUnsafeBgTasks ? "exit.confirm.prompt.tasks" : "exit.confirm.prompt",
|
||||
ApplicationNamesInfo.getInstance().getFullProductName());
|
||||
|
||||
if (MessageBuilder.yesNo(ApplicationBundle.message("exit.confirm.title"), message).yesText(ApplicationBundle.message("command.exit")).noText(CommonBundle.message("button.cancel"))
|
||||
if (MessageDialogBuilder.yesNo(ApplicationBundle.message("exit.confirm.title"), message).yesText(ApplicationBundle.message("command.exit")).noText(CommonBundle.message("button.cancel"))
|
||||
.doNotAsk(option).show() != Messages.YES) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.openapi.vfs.impl.http;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.vfs.VirtualFileSystem;
|
||||
@@ -65,7 +64,7 @@ class VirtualFileImpl extends HttpVirtualFile {
|
||||
}
|
||||
});
|
||||
|
||||
path = StringUtil.trimEnd(UriUtil.trimParameters(path), "/");
|
||||
path = UriUtil.trimLastSlash(UriUtil.trimParameters(path));
|
||||
int lastSlash = path.lastIndexOf('/');
|
||||
if (lastSlash == -1) {
|
||||
myParentPath = null;
|
||||
|
||||
+3
-7
@@ -23,21 +23,18 @@ import com.intellij.openapi.util.LowMemoryWatcher;
|
||||
import com.intellij.openapi.util.ShutDownTracker;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.vfs.newvfs.*;
|
||||
import com.intellij.openapi.vfs.newvfs.events.*;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.FakeVirtualFile;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.containers.ConcurrentIntObjectMap;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.StripedLockIntObjectConcurrentHashMap;
|
||||
import com.intellij.util.io.ReplicatorInputStream;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import gnu.trove.*;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -942,8 +939,7 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone
|
||||
@NotNull
|
||||
private static String normalizeRootUrl(@NotNull String basePath, @NotNull NewVirtualFileSystem fs) {
|
||||
// need to protect against relative path of the form "/x/../y"
|
||||
String url = fs.getProtocol() + "://" + VfsImplUtil.normalize(fs, FileUtil.toCanonicalPath(basePath));
|
||||
return StringUtil.trimEnd(url, "/");
|
||||
return UriUtil.trimLastSlash(fs.getProtocol() + URLUtil.SCHEME_SEPARATOR + VfsImplUtil.normalize(fs, FileUtil.toCanonicalPath(basePath)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ import java.util.List;
|
||||
* User: spLeaner
|
||||
*/
|
||||
public class IdeStatusBarImpl extends JComponent implements StatusBarEx {
|
||||
private static final int MIN_ICON_HEIGHT = 18;
|
||||
private static final int MIN_ICON_HEIGHT = 18 + 1 + 1;
|
||||
private final InfoAndProgressPanel myInfoAndProgressPanel;
|
||||
private IdeFrame myFrame;
|
||||
|
||||
|
||||
+1
-1
@@ -200,7 +200,7 @@ class ToolWindowsWidget extends JLabel implements CustomStatusBarWidget, StatusB
|
||||
PropertiesComponent.getInstance().setValue(key, String.valueOf(true));
|
||||
Disposer.dispose(alarm);
|
||||
}
|
||||
}, 120000);
|
||||
}, 30000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,15 +34,17 @@ import static com.intellij.openapi.util.text.StringUtil.stripQuotesAroundValue;
|
||||
|
||||
public final class UriUtil {
|
||||
public static final CharMatcher PARAM_CHAR_MATCHER = CharMatcher.anyOf("?#;");
|
||||
public static final CharMatcher SLASH_MATCHER = CharMatcher.is('/');
|
||||
|
||||
private static final Pattern DATA_URI_PATTERN = Pattern.compile("data:([^,;]+/[^,;]+)(;charset=[^,;]+)?(;base64)?,(.+)");
|
||||
|
||||
private UriUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* must be synchronized with trimUrlParameters in utils.js
|
||||
*/
|
||||
public static String trimLastSlash(@NotNull String url) {
|
||||
return SLASH_MATCHER.trimTrailingFrom(url);
|
||||
}
|
||||
|
||||
public static String trimParameters(@NotNull String url) {
|
||||
int end = PARAM_CHAR_MATCHER.indexIn(url);
|
||||
return end != -1 ? url.substring(0, end) : url;
|
||||
|
||||
@@ -39,10 +39,10 @@ import java.net.ServerSocket;
|
||||
import java.util.Map;
|
||||
|
||||
public class BuiltInServer implements Disposable {
|
||||
private final ChannelRegistrar channelRegistrar = new ChannelRegistrar();
|
||||
|
||||
static final Logger LOG = Logger.getInstance(BuiltInServer.class);
|
||||
|
||||
private final ChannelRegistrar channelRegistrar = new ChannelRegistrar();
|
||||
|
||||
public boolean isRunning() {
|
||||
return !channelRegistrar.isEmpty();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public final class ChannelExceptionHandler extends ChannelInboundHandlerAdapter
|
||||
public void exceptionCaught(ChannelHandlerContext context, Throwable cause) throws Exception {
|
||||
// don't report about errors while connecting
|
||||
// WEB-7727
|
||||
if (cause instanceof ConnectException || (cause.getMessage() != null && cause.getMessage().startsWith("Connection reset"))) {
|
||||
if (cause instanceof ConnectException) {
|
||||
LOG.debug(cause);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -95,7 +95,8 @@ public final class NettyUtil {
|
||||
|
||||
return (throwable instanceof IOException && message.equals("An existing connection was forcibly closed by the remote host")) ||
|
||||
(throwable instanceof ChannelException && message.startsWith("Failed to bind to: ")) ||
|
||||
throwable instanceof BindException;
|
||||
throwable instanceof BindException ||
|
||||
(message.startsWith("Connection reset") || message.equals("Operation timed out") || message.equals("Connection timed out"));
|
||||
}
|
||||
|
||||
// applicable only in case of ClientBootstrap&OioClientSocketChannelFactory
|
||||
|
||||
@@ -299,7 +299,7 @@ add.parameters.for.fields.to.constructors=Add parameters for &fields to construc
|
||||
0.already.contains.inner.class.named.1={0} already contains inner class named {1}
|
||||
0.uses.1.which.is.pushed.down={0} uses {1}, which is pushed down
|
||||
refactoring.cannot.be.performed=Refactoring cannot be performed
|
||||
there.is.already.a.0.it.will.conflict.with.an.introduced.parameter=There is already a {0}. It will conflict with an introduced parameter
|
||||
there.is.already.a.0.it.will.conflict.with.an.introduced.parameter=There is already a {0}. It will conflict with the introduced parameter
|
||||
introduce.parameter.command=Extracting parameter to {0}
|
||||
parameter.initializer.contains.0.but.not.all.calls.to.method.are.in.its.class=Parameter initializer contains {0}, but not all calls to method are in its class
|
||||
0.is.not.accessible.from.1.value.for.introduced.parameter.in.that.method.call.will.be.incorrect={0} is not accessible from {1}. Value for introduced parameter in that method call will be incorrect.
|
||||
|
||||
@@ -355,6 +355,8 @@
|
||||
|
||||
<group id="NavBarToolBar">
|
||||
<reference ref="ToolbarRunGroup"/>
|
||||
<separator/>
|
||||
<reference ref="MainToolBarSettings"/>
|
||||
</group>
|
||||
|
||||
<group id="Bookmarks">
|
||||
|
||||
+8
-7
@@ -12,11 +12,11 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.containers.WeakList;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -37,14 +37,14 @@ public class AutoTestManager {
|
||||
|
||||
public AutoTestManager(Project project) {
|
||||
myProject = project;
|
||||
myDocumentWatcher = createWatcher();
|
||||
myDelay = PropertiesComponent.getInstance(myProject).getOrInitInt(AUTO_TEST_MANAGER_DELAY, 3000);
|
||||
myDocumentWatcher = createWatcher();
|
||||
}
|
||||
|
||||
private DelayedDocumentWatcher createWatcher() {
|
||||
return new DelayedDocumentWatcher(myProject, new Alarm(Alarm.ThreadToUse.SWING_THREAD, myProject), myDelay, new Consumer<VirtualFile[]>() {
|
||||
return new DelayedDocumentWatcher(myProject, myDelay, new Consumer<Set<VirtualFile>>() {
|
||||
@Override
|
||||
public void consume(VirtualFile[] files) {
|
||||
public void consume(Set<VirtualFile> files) {
|
||||
for (Content content : myEnabledDescriptors) {
|
||||
runAutoTest(content);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class AutoTestManager {
|
||||
@Override
|
||||
public boolean value(VirtualFile file) {
|
||||
// Vladimir.Krivosheev — I don't know, why AutoTestManager checks it, but old behavior is preserved
|
||||
return FileEditorManager.getInstance(myDocumentWatcher.getProject()).isFileOpen(file);
|
||||
return FileEditorManager.getInstance(myProject).isFileOpen(file);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -61,6 +61,7 @@ public class AutoTestManager {
|
||||
public void setAutoTestEnabled(RunContentDescriptor descriptor, boolean enabled) {
|
||||
Content content = descriptor.getAttachedContent();
|
||||
if (enabled) {
|
||||
// TODO Why not just 'myEnabledDescriptors.add(content)'?
|
||||
if (!myEnabledDescriptors.contains(content)) {
|
||||
myEnabledDescriptors.add(content);
|
||||
}
|
||||
@@ -105,6 +106,6 @@ public class AutoTestManager {
|
||||
if (!myEnabledDescriptors.isEmpty()) {
|
||||
myDocumentWatcher.activate();
|
||||
}
|
||||
PropertiesComponent.getInstance(myProject).getOrInitInt(AUTO_TEST_MANAGER_DELAY, myDelay);
|
||||
PropertiesComponent.getInstance(myProject).setValue(AUTO_TEST_MANAGER_DELAY, String.valueOf(myDelay));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,6 +35,6 @@ public class TestsConsoleBuilderImpl extends TextConsoleBuilderImpl {
|
||||
|
||||
@Override
|
||||
protected ConsoleView createConsole() {
|
||||
return new TestsConsoleViewImpl(getProject(), getScope(), isViewer(), null, isUsePredefinedMessageFilter());
|
||||
return new TestsConsoleViewImpl(getProject(), getScope(), isViewer(), isUsePredefinedMessageFilter());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -19,7 +19,6 @@ import com.intellij.execution.impl.ConsoleState;
|
||||
import com.intellij.execution.impl.ConsoleViewImpl;
|
||||
import com.intellij.execution.impl.ConsoleViewRunningState;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
|
||||
@@ -31,9 +30,8 @@ public class TestsConsoleViewImpl extends ConsoleViewImpl {
|
||||
public TestsConsoleViewImpl(final Project project,
|
||||
final GlobalSearchScope searchScope,
|
||||
final boolean viewer,
|
||||
final FileType fileType,
|
||||
boolean usePredefinedMessageFilter) {
|
||||
super(project, searchScope, viewer, fileType,
|
||||
super(project, searchScope, viewer,
|
||||
new ConsoleState.NotStartedStated() {
|
||||
@Override
|
||||
public ConsoleState attachTo(ConsoleViewImpl console, ProcessHandler processHandler) {
|
||||
|
||||
@@ -1780,6 +1780,12 @@ public class StringUtil extends StringUtilRt {
|
||||
return replace(text, REPLACES_DISP, REPLACES_REFS);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String htmlEmphasize(String text) {
|
||||
return "<b><code>" + escapeXml(text) + "</code></b>";
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public static String escapeToRegexp(@NotNull String text) {
|
||||
final StringBuilder result = new StringBuilder(text.length());
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.diff.impl.dir.actions.popup.WarnOnDeletion;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.MessageBuilder;
|
||||
import com.intellij.openapi.ui.MessageDialogBuilder;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.popup.Balloon;
|
||||
@@ -804,7 +804,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
}
|
||||
|
||||
private boolean confirmDeletion(int count) {
|
||||
return MessageBuilder.yesNo("Confirm Delete", "Delete " + count + " items?").project(myProject).yesText("Delete").noText(CommonBundle.message("button.cancel")).doNotAsk(
|
||||
return MessageDialogBuilder.yesNo("Confirm Delete", "Delete " + count + " items?").project(myProject).yesText("Delete").noText(CommonBundle.message("button.cancel")).doNotAsk(
|
||||
new DialogWrapper.DoNotAskOption() {
|
||||
@Override
|
||||
public boolean isToBeShown() {
|
||||
|
||||
+2
-1
@@ -34,6 +34,7 @@ import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.ui.components.labels.LinkLabel;
|
||||
import com.intellij.ui.components.labels.LinkListener;
|
||||
import com.intellij.ui.table.TableView;
|
||||
import com.intellij.util.UriUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.*;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
@@ -106,7 +107,7 @@ public class VcsDirectoryConfigurationPanel extends JPanel implements Configurab
|
||||
String directory = mapping.getDirectory();
|
||||
VirtualFile baseDir = myProject.getBaseDir();
|
||||
if (baseDir != null) {
|
||||
final File directoryFile = new File(StringUtil.trimEnd(StringUtil.trimEnd(directory, "/"), "\\") + "/");
|
||||
final File directoryFile = new File(StringUtil.trimEnd(UriUtil.trimLastSlash(directory), "\\") + "/");
|
||||
File ioBase = new File(baseDir.getPath());
|
||||
if (directoryFile.isAbsolute() && !FileUtil.isAncestor(ioBase, directoryFile, false)) {
|
||||
append(new File(directory).getPath());
|
||||
|
||||
@@ -25,6 +25,6 @@ public interface TimedVcsCommit extends VcsCommit {
|
||||
/**
|
||||
* Returns the timestamp indicating the date & time when this commit was made.
|
||||
*/
|
||||
long getAuthorTime();
|
||||
long getTime();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ public interface VcsFullCommitDetails extends VcsShortCommitDetails {
|
||||
@NotNull
|
||||
VcsUser getCommitter();
|
||||
|
||||
long getCommitTime();
|
||||
long getAuthorTime();
|
||||
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ public interface VcsLogObjectsFactory {
|
||||
VirtualFile root, @NotNull String subject, @NotNull String authorName, String authorEmail);
|
||||
|
||||
@NotNull
|
||||
VcsFullCommitDetails createFullDetails(@NotNull Hash hash, @NotNull List<Hash> parents, long authorTime, VirtualFile root,
|
||||
VcsFullCommitDetails createFullDetails(@NotNull Hash hash, @NotNull List<Hash> parents, long time, VirtualFile root,
|
||||
@NotNull String subject,
|
||||
@NotNull String authorName, @NotNull String authorEmail, @NotNull String message,
|
||||
@NotNull String committerName,
|
||||
@NotNull String committerEmail, long commitTime, @NotNull List<Change> changes,
|
||||
@NotNull String committerEmail, long authorTime, @NotNull List<Change> changes,
|
||||
@NotNull ContentRevisionFactory contentRevisionFactory);
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -28,7 +28,7 @@ public interface VcsShortCommitDetails {
|
||||
@NotNull
|
||||
List<Hash> getParents();
|
||||
|
||||
long getAuthorTime();
|
||||
long getTime();
|
||||
|
||||
@NotNull
|
||||
String getSubject();
|
||||
|
||||
@@ -589,7 +589,7 @@ public class VcsLogDataHolder implements Disposable {
|
||||
return ContainerUtil.map(firstBlockDetails, new Function<VcsFullCommitDetails, TimedVcsCommit>() {
|
||||
@Override
|
||||
public TimedVcsCommit fun(VcsFullCommitDetails details) {
|
||||
return new CompactCommit(details.getHash(), details.getParents(), details.getAuthorTime());
|
||||
return new CompactCommit(details.getHash(), details.getParents(), details.getTime());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -790,15 +790,15 @@ public class VcsLogDataHolder implements Disposable {
|
||||
private final int myHashIndex;
|
||||
private final int myParent; // there is almost always one parent
|
||||
private final int[] myOtherParents;
|
||||
private final long myAuthorTime;
|
||||
private final long myTime;
|
||||
|
||||
public CompactCommit(TimedVcsCommit commit) {
|
||||
this(commit.getHash(), commit.getParents(), commit.getAuthorTime());
|
||||
this(commit.getHash(), commit.getParents(), commit.getTime());
|
||||
}
|
||||
|
||||
public CompactCommit(Hash hash, List<Hash> parents, long time) {
|
||||
myHashIndex = putHash(hash);
|
||||
myAuthorTime = time;
|
||||
myTime = time;
|
||||
|
||||
if (!parents.isEmpty()) {
|
||||
myParent = putHash(parents.get(0));
|
||||
@@ -819,8 +819,8 @@ public class VcsLogDataHolder implements Disposable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAuthorTime() {
|
||||
return myAuthorTime;
|
||||
public long getTime() {
|
||||
return myTime;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -33,7 +33,7 @@ public class VcsLogDateFilter implements VcsLogDetailsFilter {
|
||||
|
||||
@Override
|
||||
public boolean matches(@NotNull VcsFullCommitDetails details) {
|
||||
Date date = new Date(details.getCommitTime()); // behave like Git does: it filters by commit time, not author time
|
||||
Date date = new Date(details.getTime()); // Git itself also filters by commit time, not author time
|
||||
boolean matches = true;
|
||||
if (myAfter != null) {
|
||||
matches &= date.after(myAfter);
|
||||
|
||||
@@ -220,7 +220,7 @@ public class VcsLogJoiner {
|
||||
Collections.sort(newSortedCommits, new Comparator<TimedVcsCommit>() {
|
||||
@Override
|
||||
public int compare(@NotNull TimedVcsCommit o1, @NotNull TimedVcsCommit o2) {
|
||||
return new Long(o1.getAuthorTime()).compareTo(o2.getAuthorTime());
|
||||
return new Long(o1.getTime()).compareTo(o2.getTime());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ class VcsLogMultiRepoJoiner {
|
||||
long maxTimeStamp = 0;
|
||||
TimedVcsCommit lastCommit = null;
|
||||
for (TimedVcsCommit commit : commits) {
|
||||
if (commit.getAuthorTime() > maxTimeStamp) {
|
||||
maxTimeStamp = commit.getAuthorTime();
|
||||
if (commit.getTime() > maxTimeStamp) {
|
||||
maxTimeStamp = commit.getTime();
|
||||
lastCommit = commit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class TimedVcsCommitImpl extends VcsCommitImpl implements TimedVcsCommit
|
||||
}
|
||||
|
||||
@Override
|
||||
public final long getAuthorTime() {
|
||||
public final long getTime() {
|
||||
return myTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,17 +23,17 @@ public class VcsFullCommitDetailsImpl extends VcsShortCommitDetailsImpl implemen
|
||||
@NotNull private final String myFullMessage;
|
||||
|
||||
@NotNull private final VcsUser myCommitter;
|
||||
private final long myCommitTime;
|
||||
private final long myAuthorTime;
|
||||
|
||||
@NotNull private final Collection<LightChange> myChanges;
|
||||
|
||||
public VcsFullCommitDetailsImpl(@NotNull Hash hash, @NotNull List<Hash> parents, long authorTime, @NotNull VirtualFile root,
|
||||
public VcsFullCommitDetailsImpl(@NotNull Hash hash, @NotNull List<Hash> parents, long time, @NotNull VirtualFile root,
|
||||
@NotNull String subject, @NotNull VcsUser author, @NotNull String message,
|
||||
@NotNull VcsUser committer, long commitTime,
|
||||
@NotNull VcsUser committer, long authorTime,
|
||||
@NotNull List<Change> changes, @NotNull final ContentRevisionFactory contentRevisionFactory) {
|
||||
super(hash, parents, authorTime, root, subject, author);
|
||||
super(hash, parents, time, root, subject, author);
|
||||
myCommitter = committer;
|
||||
myCommitTime = commitTime;
|
||||
myAuthorTime = authorTime;
|
||||
myFullMessage = message;
|
||||
myChanges = ContainerUtil.map(changes, new Function<Change, LightChange>() {
|
||||
@Override
|
||||
@@ -67,8 +67,8 @@ public class VcsFullCommitDetailsImpl extends VcsShortCommitDetailsImpl implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCommitTime() {
|
||||
return myCommitTime;
|
||||
public long getAuthorTime() {
|
||||
return myAuthorTime;
|
||||
}
|
||||
|
||||
private static class LightChange {
|
||||
|
||||
@@ -49,14 +49,14 @@ public class VcsLogObjectsFactoryImpl implements VcsLogObjectsFactory {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public VcsFullCommitDetails createFullDetails(@NotNull Hash hash, @NotNull List<Hash> parents, long authorTime, @NotNull VirtualFile root,
|
||||
public VcsFullCommitDetails createFullDetails(@NotNull Hash hash, @NotNull List<Hash> parents, long time, @NotNull VirtualFile root,
|
||||
@NotNull String subject, @NotNull String authorName, @NotNull String authorEmail,
|
||||
@NotNull String message, @NotNull String committerName,
|
||||
@NotNull String committerEmail, long commitTime, @NotNull List<Change> changes,
|
||||
@NotNull String committerEmail, long authorTime, @NotNull List<Change> changes,
|
||||
@NotNull ContentRevisionFactory contentRevisionFactory) {
|
||||
VcsUser author = createUser(authorName, authorEmail);
|
||||
VcsUser committer = createUser(committerName, committerEmail);
|
||||
return new VcsFullCommitDetailsImpl(hash, parents, authorTime, root, subject, author, message, committer, commitTime,
|
||||
return new VcsFullCommitDetailsImpl(hash, parents, time, root, subject, author, message, committer, authorTime,
|
||||
changes, contentRevisionFactory);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ public class VcsShortCommitDetailsImpl implements VcsShortCommitDetails {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAuthorTime() {
|
||||
return myTimeCommitParents.getAuthorTime();
|
||||
public long getTime() {
|
||||
return myTimeCommitParents.getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -151,16 +151,16 @@ class DetailsPanel extends JPanel implements ListSelectionListener {
|
||||
String authorText = commit.getAuthor().getName() + " at " + DateFormatUtil.formatDateTime(commit.getAuthorTime());
|
||||
if (!commit.getAuthor().equals(commit.getCommitter())) {
|
||||
String commitTime;
|
||||
if (commit.getCommitTime() != commit.getAuthorTime()) {
|
||||
commitTime = " at " + DateFormatUtil.formatDateTime(commit.getCommitTime());
|
||||
if (commit.getAuthorTime() != commit.getTime()) {
|
||||
commitTime = " at " + DateFormatUtil.formatDateTime(commit.getTime());
|
||||
}
|
||||
else {
|
||||
commitTime = "";
|
||||
}
|
||||
authorText += " (committed by " + commit.getCommitter().getName() + commitTime + ")";
|
||||
}
|
||||
else if (commit.getCommitTime() != commit.getAuthorTime()) {
|
||||
authorText += " (committed at " + DateFormatUtil.formatDateTime(commit.getCommitTime()) + ")";
|
||||
else if (commit.getAuthorTime() != commit.getTime()) {
|
||||
authorText += " (committed at " + DateFormatUtil.formatDateTime(commit.getTime()) + ")";
|
||||
}
|
||||
return authorText;
|
||||
}
|
||||
|
||||
+2
-2
@@ -60,11 +60,11 @@ public abstract class AbstractVcsLogTableModel<T> extends AbstractTableModel {
|
||||
return data.getAuthor().getName();
|
||||
}
|
||||
case DATE_COLUMN:
|
||||
if (data == null || data.getAuthorTime() < 0) {
|
||||
if (data == null || data.getTime() < 0) {
|
||||
return "";
|
||||
}
|
||||
else {
|
||||
return DateFormatUtil.formatDateTime(data.getAuthorTime());
|
||||
return DateFormatUtil.formatDateTime(data.getTime());
|
||||
}
|
||||
default:
|
||||
throw new IllegalArgumentException("columnIndex is " + columnIndex + " > " + (COLUMN_COUNT - 1));
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SimpleTimedVcsCommit implements TimedVcsCommit {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAuthorTime() {
|
||||
public long getTime() {
|
||||
return myTime;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -394,7 +394,8 @@ parameter.hides.member.variable.ignore.constructors.option=Ignore for constructo
|
||||
parameter.hides.member.variable.ignore.abstract.methods.option=Ignore for abstract methods
|
||||
parameter.hides.member.variable.ignore.static.parameters.option=Ignore for static method parameters hiding instance fields
|
||||
type.parameter.hides.visible.type.display.name=Type parameter hides visible type
|
||||
type.parameter.hides.visible.type.problem.descriptor=Type parameter <code>#ref</code> hides a visible type ''{0}'' #loc
|
||||
type.parameter.hides.visible.type.problem.descriptor=Type parameter <code>#ref</code> hides visible type ''{0}'' #loc
|
||||
type.parameter.hides.type.parameter.problem.descriptor=Type parameter <code>#ref</code> hides type parameter ''{0}'' #loc
|
||||
anonymous.class.variable.hides.containing.method.variable.display.name=Anonymous class variable hides variable in containing method
|
||||
anonymous.class.parameter.hides.containing.method.variable.problem.descriptor=Anonymous class parameter <code>#ref</code> hides variable in containing method #loc
|
||||
anonymous.class.field.hides.containing.method.variable.problem.descriptor=Anonymous class field <code>#ref</code> hides variable in containing method #loc
|
||||
@@ -1437,7 +1438,7 @@ confusing.octal.escape.sequence.problem.descriptor=Octal escape sequence <code>#
|
||||
field.accessed.synchronized.and.unsynchronized.option=Simple getters and setters are considered field accesses too
|
||||
method.overrides.package.local.method.display.name=Method overrides package-local method of superclass located in other package
|
||||
method.overrides.package.local.method.problem.descriptor=Method <code>#ref()</code> overrides a package-local method of a superclass located in another package #loc
|
||||
suspicious.to.array.call.display.name=Suspicious 'Collections.toArray()' call
|
||||
suspicious.to.array.call.display.name=Suspicious 'Collection.toArray()' call
|
||||
suspicious.to.array.call.problem.descriptor=Array of type ''{0}[]'' expected #loc
|
||||
suspicious.system.arraycopy.display.name=Suspicious 'System.arraycopy()' call
|
||||
suspicious.system.arraycopy.problem.descriptor1=Parameter 'srcPos' may not be negative #loc
|
||||
|
||||
+27
-20
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2007 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2003-2013 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.siyeh.ig.visibility;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -26,8 +27,7 @@ public class TypeParameterHidesVisibleTypeInspectionBase extends BaseInspection
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message(
|
||||
"type.parameter.hides.visible.type.display.name");
|
||||
return InspectionGadgetsBundle.message("type.parameter.hides.visible.type.display.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,9 +39,16 @@ public class TypeParameterHidesVisibleTypeInspectionBase extends BaseInspection
|
||||
@NotNull
|
||||
public String buildErrorString(Object... infos) {
|
||||
final PsiClass aClass = (PsiClass)infos[0];
|
||||
return InspectionGadgetsBundle.message(
|
||||
"type.parameter.hides.visible.type.problem.descriptor",
|
||||
aClass.getQualifiedName());
|
||||
if (aClass instanceof PsiTypeParameter) {
|
||||
return InspectionGadgetsBundle.message("type.parameter.hides.type.parameter.problem.descriptor", aClass.getName());
|
||||
}
|
||||
else {
|
||||
String name = aClass.getQualifiedName();
|
||||
if (name == null) {
|
||||
name = aClass.getName();
|
||||
}
|
||||
return InspectionGadgetsBundle.message("type.parameter.hides.visible.type.problem.descriptor", name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,28 +56,28 @@ public class TypeParameterHidesVisibleTypeInspectionBase extends BaseInspection
|
||||
return new TypeParameterHidesVisibleTypeVisitor();
|
||||
}
|
||||
|
||||
private static class TypeParameterHidesVisibleTypeVisitor
|
||||
extends BaseInspectionVisitor {
|
||||
private static class TypeParameterHidesVisibleTypeVisitor extends BaseInspectionVisitor {
|
||||
|
||||
@Override
|
||||
public void visitTypeParameter(PsiTypeParameter parameter) {
|
||||
super.visitTypeParameter(parameter);
|
||||
final String unqualifiedClassName = parameter.getName();
|
||||
|
||||
final JavaPsiFacade manager = JavaPsiFacade.getInstance(parameter.getProject());
|
||||
final PsiFile containingFile = parameter.getContainingFile();
|
||||
final PsiResolveHelper resolveHelper = manager.getResolveHelper();
|
||||
final PsiClass aClass =
|
||||
resolveHelper.resolveReferencedClass(unqualifiedClassName,
|
||||
containingFile);
|
||||
if (aClass == null) {
|
||||
PsiElement context = parameter.getOwner();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
final PsiIdentifier identifier = parameter.getNameIdentifier();
|
||||
if (identifier == null) {
|
||||
return;
|
||||
final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(parameter.getProject()).getResolveHelper();
|
||||
while (true) {
|
||||
context = PsiTreeUtil.getParentOfType(context, PsiMember.class);
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
final PsiClass aClass = resolveHelper.resolveReferencedClass(unqualifiedClassName, context);
|
||||
if (aClass != null) {
|
||||
registerClassError(parameter, aClass);
|
||||
return;
|
||||
}
|
||||
}
|
||||
registerError(identifier, aClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,5 @@ language level of 5.0 or higher.
|
||||
<p>
|
||||
Use the checkbox below to only report truly superfluous boxing, where a boxed value will immediately be implicitly or explicitly unboxed.
|
||||
In this case the entire boxing-unboxing step can be removed. Simple explicit boxing will not be reported.
|
||||
again.
|
||||
</body>
|
||||
</html>
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.siyeh.igtest.visibility;
|
||||
import java.util.*;
|
||||
|
||||
public abstract class TypeParameterHidesVisibleTypeInspection<List> {
|
||||
private Map map = new HashMap();
|
||||
|
||||
public abstract List foo();
|
||||
|
||||
public abstract <Set> Set bar();
|
||||
public abstract <TypeParameterHidesVisibleTypeInspection> TypeParameterHidesVisibleTypeInspection baz();
|
||||
public abstract <InputStream> InputStream baz3();
|
||||
public abstract <A> A baz2();
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.siyeh.ig.visibility;
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.siyeh.ig.LightInspectionTestCase;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class TypeParameterHidesVisibleTypeInspectionTest extends LightInspectionTestCase {
|
||||
|
||||
public void testSimple() {
|
||||
doTest("import java.util.*;\n" +
|
||||
"public abstract class TypeParameterHidesVisibleTypeInspection<List> {\n" +
|
||||
" private Map map = new HashMap();\n" +
|
||||
" public abstract List foo();\n" +
|
||||
" public abstract </*Type parameter 'Set' hides visible type 'java.util.Set'*/Set/**/> Set bar();\n" +
|
||||
" public abstract </*Type parameter 'TypeParameterHidesVisibleTypeInspection' hides visible type 'TypeParameterHidesVisibleTypeInspection'*/TypeParameterHidesVisibleTypeInspection/**/> TypeParameterHidesVisibleTypeInspection baz();\n" +
|
||||
" public abstract <InputStream> InputStream baz3();\n" +
|
||||
" public abstract <A> A baz2();\n" +
|
||||
"}\n");
|
||||
}
|
||||
|
||||
public void testHiddenTypeParameter() {
|
||||
doTest("import java.util.*;\n" +
|
||||
"public abstract class MyList<T> extends AbstractList<T> {\n" +
|
||||
" private List<T> elements;\n" +
|
||||
" public </*Type parameter 'T' hides type parameter 'T'*/T/**/> T[] toArray( T[] array ) {\n" +
|
||||
" return elements.toArray( array );\n" +
|
||||
" }\n" +
|
||||
"}\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new TypeParameterHidesVisibleTypeInspection();
|
||||
}
|
||||
}
|
||||
@@ -33,10 +33,10 @@ import java.util.List;
|
||||
*/
|
||||
public final class GitCommit extends VcsFullCommitDetailsImpl {
|
||||
|
||||
public GitCommit(final Project project, @NotNull Hash hash, @NotNull List<Hash> parents, long authorTime, @NotNull VirtualFile root,
|
||||
public GitCommit(final Project project, @NotNull Hash hash, @NotNull List<Hash> parents, long time, @NotNull VirtualFile root,
|
||||
@NotNull String subject, @NotNull VcsUser author, @NotNull String message, @NotNull VcsUser committer,
|
||||
long commitTime, @NotNull List<Change> changes) {
|
||||
super(hash, parents, authorTime, root, subject, author, message, committer, commitTime, changes,
|
||||
long authorTime, @NotNull List<Change> changes) {
|
||||
super(hash, parents, time, root, subject, author, message, committer, authorTime, changes,
|
||||
GitContentRevisionFactory.getInstance(project));
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package git4idea.branch;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.MessageBuilder;
|
||||
import com.intellij.openapi.ui.MessageDialogBuilder;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -239,7 +239,7 @@ class GitDeleteRemoteBranchOperation extends GitBranchOperation {
|
||||
}
|
||||
|
||||
final AtomicBoolean deleteChoice = new AtomicBoolean();
|
||||
delete = MessageBuilder.yesNo(title, message).project(myProject).yesText("Delete").noText("Cancel").doNotAsk(new DialogWrapper.DoNotAskOption() {
|
||||
delete = MessageDialogBuilder.yesNo(title, message).project(myProject).yesText("Delete").noText("Cancel").doNotAsk(new DialogWrapper.DoNotAskOption() {
|
||||
@Override
|
||||
public boolean isToBeShown() {
|
||||
return true;
|
||||
|
||||
@@ -823,7 +823,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
|
||||
VcsFullCommitDetails commit = (VcsFullCommitDetails)data;
|
||||
String author = String.format("%s <%s>", commit.getAuthor().getName(), commit.getAuthor().getEmail());
|
||||
myAuthor.getEditor().setItem(author);
|
||||
myAuthorDate = new Date(commit.getAuthorTime());
|
||||
myAuthorDate = new Date(commit.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ public class GitHistoryUtils {
|
||||
public static List<? extends VcsShortCommitDetails> readMiniDetails(final Project project, final VirtualFile root, List<String> hashes) throws VcsException {
|
||||
GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.LOG);
|
||||
GitLogParser parser = new GitLogParser(project, GitLogParser.NameStatus.NONE, HASH, PARENTS, AUTHOR_NAME,
|
||||
AUTHOR_EMAIL, AUTHOR_TIME, SUBJECT);
|
||||
AUTHOR_EMAIL, COMMIT_TIME, SUBJECT);
|
||||
h.setStdoutSuppressed(true);
|
||||
// git show can show either -p, or --name-status, or --name-only, but we need nothing, just details => using git log --no-walk
|
||||
h.addParameters("--no-walk");
|
||||
@@ -527,7 +527,7 @@ public class GitHistoryUtils {
|
||||
for (String parent : record.getParentsHashes()) {
|
||||
parents.add(HashImpl.build(parent));
|
||||
}
|
||||
return vcsObjectsFactory(project).createShortDetails(HashImpl.build(record.getHash()), parents, record.getAuthorTimeStamp(), root,
|
||||
return vcsObjectsFactory(project).createShortDetails(HashImpl.build(record.getHash()), parents, record.getCommitTime(), root,
|
||||
record.getSubject(), record.getAuthorName(), record.getAuthorEmail());
|
||||
}
|
||||
});
|
||||
@@ -540,7 +540,7 @@ public class GitHistoryUtils {
|
||||
final int COMMIT_BUFFER = 1000;
|
||||
|
||||
GitLineHandler h = new GitLineHandler(project, root, GitCommand.LOG);
|
||||
final GitLogParser parser = new GitLogParser(project, GitLogParser.NameStatus.NONE, HASH, PARENTS, AUTHOR_TIME,
|
||||
final GitLogParser parser = new GitLogParser(project, GitLogParser.NameStatus.NONE, HASH, PARENTS, COMMIT_TIME,
|
||||
AUTHOR_NAME, AUTHOR_EMAIL);
|
||||
h.setStdoutSuppressed(true);
|
||||
h.addParameters(parser.getPretty(), "--encoding=UTF-8");
|
||||
@@ -630,7 +630,7 @@ public class GitHistoryUtils {
|
||||
return HashImpl.build(s);
|
||||
}
|
||||
});
|
||||
return factory.createTimedCommit(HashImpl.build(rec.getHash()), parents, rec.getAuthorTimeStamp());
|
||||
return factory.createTimedCommit(HashImpl.build(rec.getHash()), parents, rec.getCommitTime());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -789,9 +789,9 @@ public class GitHistoryUtils {
|
||||
}
|
||||
});
|
||||
VcsLogObjectsFactory factory = vcsObjectsFactory(project);
|
||||
return new GitCommit(project, HashImpl.build(record.getHash()), parents, record.getAuthorTimeStamp(), root, record.getSubject(),
|
||||
return new GitCommit(project, HashImpl.build(record.getHash()), parents, record.getCommitTime(), root, record.getSubject(),
|
||||
factory.createUser(record.getAuthorName(), record.getAuthorEmail()), record.getFullMessage(),
|
||||
factory.createUser(record.getCommitterName(), record.getCommitterEmail()), record.getLongTimeStamp(),
|
||||
factory.createUser(record.getCommitterName(), record.getCommitterEmail()), record.getAuthorTimeStamp(),
|
||||
record.parseChanges(project, root));
|
||||
}
|
||||
|
||||
@@ -1126,7 +1126,7 @@ public class GitHistoryUtils {
|
||||
}
|
||||
GitLogRecord record = parser.parseOneRecord(line);
|
||||
consumer.consume(new CommitHashPlusParents(record.getHash(),
|
||||
record.getParentsHashes(), record.getLongTimeStamp(),
|
||||
record.getParentsHashes(), record.getCommitTime(),
|
||||
record.getAuthorName()));
|
||||
}
|
||||
} catch (ProcessCanceledException e) {
|
||||
|
||||
@@ -101,7 +101,7 @@ class GitLogRecord {
|
||||
return GitUtil.parseTimestampWithNFEReport(myOptions.get(COMMIT_TIME), myHandler, myOptions.toString());
|
||||
}
|
||||
|
||||
long getLongTimeStamp() {
|
||||
long getCommitTime() {
|
||||
return Long.parseLong(myOptions.get(COMMIT_TIME).trim()) * 1000;
|
||||
}
|
||||
|
||||
|
||||
@@ -336,7 +336,7 @@ class GitPushLog extends JPanel implements TypeSafeDataProvider {
|
||||
|
||||
@NotNull
|
||||
private static String getDateString(@NotNull GitCommit commit) {
|
||||
return DateFormatUtil.formatPrettyDateTime(commit.getAuthorTime()) + " ";
|
||||
return DateFormatUtil.formatPrettyDateTime(commit.getTime()) + " ";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -206,7 +206,7 @@ public class GitCommitListPanel extends JPanel implements TypeSafeDataProvider {
|
||||
}
|
||||
|
||||
private static String getTime(GitCommit commit) {
|
||||
return DateFormatUtil.formatPrettyDateTime(commit.getAuthorTime());
|
||||
return DateFormatUtil.formatPrettyDateTime(commit.getTime());
|
||||
}
|
||||
|
||||
private abstract static class GitCommitColumnInfo extends ColumnInfo<GitCommit, String> {
|
||||
|
||||
@@ -94,10 +94,10 @@ public class RefParserTest {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public VcsFullCommitDetails createFullDetails(@NotNull Hash hash, @NotNull List<Hash> parents, long authorTime, VirtualFile root,
|
||||
public VcsFullCommitDetails createFullDetails(@NotNull Hash hash, @NotNull List<Hash> parents, long time, VirtualFile root,
|
||||
@NotNull String subject, @NotNull String authorName, @NotNull String authorEmail,
|
||||
@NotNull String message, @NotNull String committerName, @NotNull String committerEmail,
|
||||
long commitTime, @NotNull List<Change> changes,
|
||||
long authorTime, @NotNull List<Change> changes,
|
||||
@NotNull ContentRevisionFactory contentRevisionFactory) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
<root url="jar://$MODULE_DIR$/lib/gradle-plugins-1.9-rc-3.jar!/" />
|
||||
<root url="jar://$MODULE_DIR$/lib/gradle-build-init-1.9-rc-3.jar!/" />
|
||||
<root url="jar://$MODULE_DIR$/lib/gradle-native-1.9-rc-3.jar!/" />
|
||||
<root url="jar://$MODULE_DIR$/lib/gradle-ide-1.9-rc-3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
|
||||
Binary file not shown.
@@ -36,6 +36,7 @@
|
||||
<resolve.contributor implementation="org.jetbrains.plugins.gradle.service.resolve.GradleTaskContributor"/>
|
||||
<resolve.contributor implementation="org.jetbrains.plugins.gradle.service.resolve.GradleConfigurationsContributor"/>
|
||||
<resolve.contributor implementation="org.jetbrains.plugins.gradle.service.resolve.GradleBuildScriptContributor"/>
|
||||
<resolve.contributor implementation="org.jetbrains.plugins.gradle.service.resolve.GradleIdeaPluginScriptContributor"/>
|
||||
<resolve.contributor implementation="org.jetbrains.plugins.gradle.service.resolve.GradleRepositoriesContributor"/>
|
||||
<resolve.contributor implementation="org.jetbrains.plugins.gradle.service.resolve.GradleMavenArtifactRepositoryContributor"/>
|
||||
<resolve.contributor implementation="org.jetbrains.plugins.gradle.service.resolve.GradleMavenDeployerContributor"/>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.model;
|
||||
|
||||
import org.gradle.tooling.model.DomainObjectSet;
|
||||
import org.gradle.tooling.model.idea.IdeaContentRoot;
|
||||
import org.gradle.tooling.model.idea.IdeaSourceDirectory;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/15/13
|
||||
*/
|
||||
public interface ExtIdeaContentRoot extends IdeaContentRoot, Serializable {
|
||||
|
||||
DomainObjectSet<? extends IdeaSourceDirectory> getResourceDirectories();
|
||||
}
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.model;
|
||||
|
||||
import org.gradle.tooling.model.DomainObjectSet;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
@@ -51,4 +53,11 @@ public interface ModuleExtendedModel extends Serializable {
|
||||
* @return
|
||||
*/
|
||||
List<File> getArtifacts();
|
||||
|
||||
/**
|
||||
* All IDEA content roots.
|
||||
*
|
||||
* @return content roots
|
||||
*/
|
||||
DomainObjectSet<? extends ExtIdeaContentRoot> getContentRoots();
|
||||
}
|
||||
|
||||
+100
-2
@@ -17,14 +17,22 @@ package org.jetbrains.plugins.gradle.model.impl;
|
||||
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Task;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.SourceSetContainer;
|
||||
import org.gradle.api.tasks.bundling.Jar;
|
||||
import org.gradle.api.tasks.testing.Test;
|
||||
import org.gradle.plugins.ide.idea.IdeaPlugin;
|
||||
import org.gradle.plugins.ide.idea.model.IdeaModel;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.gradle.model.ExtIdeaContentRoot;
|
||||
import org.jetbrains.plugins.gradle.model.ModelBuilderService;
|
||||
import org.jetbrains.plugins.gradle.model.ModuleExtendedModel;
|
||||
import org.jetbrains.plugins.gradle.model.internal.IdeaContentRootImpl;
|
||||
import org.jetbrains.plugins.gradle.model.internal.IdeaSourceDirectoryImpl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
@@ -32,6 +40,9 @@ import java.util.List;
|
||||
*/
|
||||
public class ModuleExtendedModelBuilderImpl implements ModelBuilderService {
|
||||
|
||||
private static final String SOURCE_SETS_PROPERTY = "sourceSets";
|
||||
private static final String TEST_SRC_DIRS_PROPERTY = "testSrcDirs";
|
||||
|
||||
@Override
|
||||
public boolean canBuild(String modelName) {
|
||||
return ModuleExtendedModel.class.getName().equals(modelName);
|
||||
@@ -56,6 +67,93 @@ public class ModuleExtendedModelBuilderImpl implements ModelBuilderService {
|
||||
}
|
||||
|
||||
moduleVersionModel.setArtifacts(artifacts);
|
||||
|
||||
Set<String> testDirectories = new HashSet<String>();
|
||||
for (Task task : project.getTasks()) {
|
||||
if (task instanceof Test) {
|
||||
Test test = (Test)task;
|
||||
if (test.hasProperty(TEST_SRC_DIRS_PROPERTY)) {
|
||||
Object testSrcDirs = test.property(TEST_SRC_DIRS_PROPERTY);
|
||||
if (testSrcDirs instanceof Iterable) {
|
||||
for (Object dir : Iterable.class.cast(testSrcDirs)) {
|
||||
addFilePath(testDirectories, dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> javaDirectories = new HashSet<String>();
|
||||
Set<String> resourceDirectories = new HashSet<String>();
|
||||
|
||||
if (project.hasProperty(SOURCE_SETS_PROPERTY)) {
|
||||
Object sourceSets = project.property(SOURCE_SETS_PROPERTY);
|
||||
if (sourceSets instanceof SourceSetContainer) {
|
||||
SourceSetContainer sourceSetContainer = (SourceSetContainer)sourceSets;
|
||||
for (SourceSet sourceSet : sourceSetContainer) {
|
||||
for (File javaSrcDir : sourceSet.getAllJava().getSrcDirs()) {
|
||||
addFilePath(javaDirectories, javaSrcDir);
|
||||
}
|
||||
for (File resourcesSrcDir : sourceSet.getResources().getSrcDirs()) {
|
||||
addFilePath(resourceDirectories, resourcesSrcDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File projectDir = project.getProjectDir();
|
||||
IdeaContentRootImpl contentRoot = new IdeaContentRootImpl(projectDir);
|
||||
|
||||
enrichDataFromIdeaPlugin(project, contentRoot, javaDirectories, testDirectories);
|
||||
|
||||
javaDirectories.removeAll(testDirectories);
|
||||
javaDirectories.removeAll(resourceDirectories);
|
||||
testDirectories.removeAll(resourceDirectories);
|
||||
|
||||
for (String javaDir : javaDirectories) {
|
||||
contentRoot.addSourceDirectory(new IdeaSourceDirectoryImpl(new File(javaDir)));
|
||||
}
|
||||
for (String testDir : testDirectories) {
|
||||
contentRoot.addTestDirectory(new IdeaSourceDirectoryImpl(new File(testDir)));
|
||||
}
|
||||
for (String resourceDir : resourceDirectories) {
|
||||
contentRoot.addResourceDirectory(new IdeaSourceDirectoryImpl(new File(resourceDir)));
|
||||
}
|
||||
|
||||
moduleVersionModel.setContentRoots(Collections.<ExtIdeaContentRoot>singleton(contentRoot));
|
||||
return moduleVersionModel;
|
||||
}
|
||||
|
||||
private static void addFilePath(Set<String> filePathSet, Object file) {
|
||||
if (file instanceof File) {
|
||||
try {
|
||||
filePathSet.add(((File)file).getCanonicalPath());
|
||||
}
|
||||
catch (IOException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void enrichDataFromIdeaPlugin(Project project,
|
||||
IdeaContentRootImpl contentRoot,
|
||||
Set<String> javaDirectories,
|
||||
Set<String> testDirectories) {
|
||||
|
||||
IdeaPlugin ideaPlugin = project.getPlugins().getPlugin(IdeaPlugin.class);
|
||||
if (ideaPlugin == null) return;
|
||||
|
||||
IdeaModel ideaModel = ideaPlugin.getModel();
|
||||
if (ideaModel == null || ideaModel.getModule() == null) return;
|
||||
|
||||
for (File excludeDir : ideaModel.getModule().getExcludeDirs()) {
|
||||
contentRoot.addExcludeDirectory(excludeDir);
|
||||
}
|
||||
for (File file : ideaModel.getModule().getSourceDirs()) {
|
||||
javaDirectories.add(file.getPath());
|
||||
}
|
||||
for (File file : ideaModel.getModule().getTestSourceDirs()) {
|
||||
testDirectories.add(file.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
-10
@@ -15,42 +15,48 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.model.impl;
|
||||
|
||||
import org.gradle.tooling.model.DomainObjectSet;
|
||||
import org.gradle.tooling.model.internal.ImmutableDomainObjectSet;
|
||||
import org.jetbrains.plugins.gradle.model.ExtIdeaContentRoot;
|
||||
import org.jetbrains.plugins.gradle.model.ModuleExtendedModel;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/8/13
|
||||
*/
|
||||
public class ModuleExtendedModelImpl implements ModuleExtendedModel {
|
||||
private final String name;
|
||||
private final String group;
|
||||
private final String version;
|
||||
private final String myName;
|
||||
private final String myGroup;
|
||||
private final String myVersion;
|
||||
private List<File> myArtifacts;
|
||||
private Set<ExtIdeaContentRoot> myContentRoots;
|
||||
|
||||
public ModuleExtendedModelImpl(String name, String group, String version) {
|
||||
this.name = name;
|
||||
this.group = group;
|
||||
this.version = version;
|
||||
this.myArtifacts = Collections.emptyList();
|
||||
myName = name;
|
||||
myGroup = group;
|
||||
myVersion = version;
|
||||
myArtifacts = Collections.emptyList();
|
||||
myContentRoots = Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
return myName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return group;
|
||||
return myGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return version;
|
||||
return myVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,4 +67,13 @@ public class ModuleExtendedModelImpl implements ModuleExtendedModel {
|
||||
public void setArtifacts(List<File> artifacts) {
|
||||
this.myArtifacts = artifacts == null ? Collections.<File>emptyList() : artifacts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainObjectSet<? extends ExtIdeaContentRoot> getContentRoots() {
|
||||
return ImmutableDomainObjectSet.of(myContentRoots);
|
||||
}
|
||||
|
||||
public void setContentRoots(Set<ExtIdeaContentRoot> contentRoots) {
|
||||
myContentRoots = contentRoots == null ? Collections.<ExtIdeaContentRoot>emptySet() : contentRoots;
|
||||
}
|
||||
}
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.model.internal;
|
||||
|
||||
import org.gradle.tooling.model.DomainObjectSet;
|
||||
import org.gradle.tooling.model.idea.IdeaSourceDirectory;
|
||||
import org.gradle.tooling.model.internal.ImmutableDomainObjectSet;
|
||||
import org.jetbrains.plugins.gradle.model.ExtIdeaContentRoot;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/13/13
|
||||
*/
|
||||
public class IdeaContentRootImpl implements ExtIdeaContentRoot {
|
||||
|
||||
private final File myRootDirectory;
|
||||
private final List<IdeaSourceDirectory> mySourceDirectories;
|
||||
private final List<IdeaSourceDirectory> myTestDirectories;
|
||||
private final List<IdeaSourceDirectory> myResourceDirectories;
|
||||
private final Set<File> myExcludeDirectories;
|
||||
|
||||
public IdeaContentRootImpl(File rootDirectory) {
|
||||
myRootDirectory = rootDirectory;
|
||||
mySourceDirectories = new ArrayList<IdeaSourceDirectory>();
|
||||
myTestDirectories = new ArrayList<IdeaSourceDirectory>();
|
||||
myResourceDirectories = new ArrayList<IdeaSourceDirectory>();
|
||||
myExcludeDirectories = new HashSet<File>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getRootDirectory() {
|
||||
return myRootDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainObjectSet<? extends IdeaSourceDirectory> getSourceDirectories() {
|
||||
return ImmutableDomainObjectSet.of(mySourceDirectories);
|
||||
}
|
||||
|
||||
public void addSourceDirectory(IdeaSourceDirectory sourceDirectory) {
|
||||
mySourceDirectories.add(sourceDirectory);
|
||||
}
|
||||
|
||||
public void addTestDirectory(IdeaSourceDirectory testDirectory) {
|
||||
myTestDirectories.add(testDirectory);
|
||||
}
|
||||
|
||||
public void addResourceDirectory(IdeaSourceDirectory resourceDirectory) {
|
||||
myResourceDirectories.add(resourceDirectory);
|
||||
}
|
||||
|
||||
public void addExcludeDirectory(File excludeDirectory) {
|
||||
myExcludeDirectories.add(excludeDirectory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainObjectSet<? extends IdeaSourceDirectory> getTestDirectories() {
|
||||
return ImmutableDomainObjectSet.of(myTestDirectories);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainObjectSet<? extends IdeaSourceDirectory> getResourceDirectories() {
|
||||
return ImmutableDomainObjectSet.of(myResourceDirectories);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<File> getExcludeDirectories() {
|
||||
return myExcludeDirectories;
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.model.internal;
|
||||
|
||||
import org.gradle.tooling.model.idea.IdeaSourceDirectory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/15/13
|
||||
*/
|
||||
public class IdeaSourceDirectoryImpl implements IdeaSourceDirectory, Serializable {
|
||||
|
||||
private final File myDirectory;
|
||||
|
||||
public IdeaSourceDirectoryImpl(File directory) {
|
||||
myDirectory = directory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getDirectory() {
|
||||
return myDirectory;
|
||||
}
|
||||
}
|
||||
+21
-2
@@ -50,6 +50,7 @@ import org.gradle.tooling.model.idea.*;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.gradle.model.ExtIdeaContentRoot;
|
||||
import org.jetbrains.plugins.gradle.model.ModuleExtendedModel;
|
||||
import org.jetbrains.plugins.gradle.model.ProjectDependenciesModel;
|
||||
import org.jetbrains.plugins.gradle.model.impl.GradleDependency;
|
||||
@@ -61,6 +62,7 @@ import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -150,7 +152,15 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver
|
||||
@Override
|
||||
public void populateModuleContentRoots(@NotNull IdeaModule gradleModule,
|
||||
@NotNull DataNode<ModuleData> ideModule) {
|
||||
DomainObjectSet<? extends IdeaContentRoot> contentRoots = gradleModule.getContentRoots();
|
||||
DomainObjectSet<? extends IdeaContentRoot> contentRoots;
|
||||
ModuleExtendedModel moduleExtendedModel = resolverCtx.getExtraProject(gradleModule, ModuleExtendedModel.class);
|
||||
if (moduleExtendedModel != null) {
|
||||
contentRoots = moduleExtendedModel.getContentRoots();
|
||||
}
|
||||
else {
|
||||
contentRoots = gradleModule.getContentRoots();
|
||||
}
|
||||
|
||||
if (contentRoots == null) {
|
||||
return;
|
||||
}
|
||||
@@ -164,6 +174,12 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver
|
||||
ideModule.getData().setModuleFileDirectoryPath(ideContentRoot.getRootPath());
|
||||
populateContentRoot(ideContentRoot, ExternalSystemSourceType.SOURCE, gradleContentRoot.getSourceDirectories());
|
||||
populateContentRoot(ideContentRoot, ExternalSystemSourceType.TEST, gradleContentRoot.getTestDirectories());
|
||||
|
||||
if (gradleContentRoot instanceof ExtIdeaContentRoot) {
|
||||
populateContentRoot(ideContentRoot, ExternalSystemSourceType.RESOURCE,
|
||||
ExtIdeaContentRoot.class.cast(gradleContentRoot).getResourceDirectories());
|
||||
}
|
||||
|
||||
Set<File> excluded = gradleContentRoot.getExcludeDirectories();
|
||||
if (excluded != null) {
|
||||
for (File file : excluded) {
|
||||
@@ -278,7 +294,10 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver
|
||||
@NotNull
|
||||
@Override
|
||||
public List<KeyValue<String, String>> getExtraJvmArgs() {
|
||||
return HttpConfigurable.getJvmPropertiesList(false, null);
|
||||
if (ExternalSystemApiUtil.isInProcessMode(GradleConstants.SYSTEM_ID)) {
|
||||
return HttpConfigurable.getJvmPropertiesList(false, null);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+12
-1
@@ -24,6 +24,8 @@ import org.gradle.tooling.UnsupportedVersionException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.net.ConnectException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
@@ -129,6 +131,15 @@ public class BaseProjectImportErrorHandler extends AbstractProjectImportErrorHan
|
||||
}
|
||||
}
|
||||
|
||||
return createUserFriendlyError(rootCause.getMessage(), location);
|
||||
final String errMessage;
|
||||
if (rootCause.getMessage() == null) {
|
||||
StringWriter writer = new StringWriter();
|
||||
rootCause.printStackTrace(new PrintWriter(writer));
|
||||
errMessage = writer.toString();
|
||||
}
|
||||
else {
|
||||
errMessage = rootCause.getMessage();
|
||||
}
|
||||
return createUserFriendlyError(errMessage, location);
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.service.resolve;
|
||||
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 11/18/13
|
||||
*/
|
||||
public class GradleIdeaPluginScriptContributor extends GradleSimpleContributor {
|
||||
public GradleIdeaPluginScriptContributor() {
|
||||
super("idea", "org.gradle.plugins.ide.idea.model.IdeaModel");
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -51,7 +51,9 @@ public class ImportFromGradleControl
|
||||
@NotNull
|
||||
@Override
|
||||
protected ExternalSystemSettingsControl<GradleProjectSettings> createProjectSettingsControl(@NotNull GradleProjectSettings settings) {
|
||||
return new GradleProjectSettingsControl(settings);
|
||||
GradleProjectSettingsControl settingsControl = new GradleProjectSettingsControl(settings);
|
||||
settingsControl.hideUseAutoImportBox();
|
||||
return settingsControl;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ public class GroovyCodeFragment extends GroovyFileImpl implements JavaCodeFragme
|
||||
return myExceptionChecker;
|
||||
}
|
||||
|
||||
public void setIntentionActionsFilter(IntentionActionsFilter filter) {
|
||||
public void setIntentionActionsFilter(@NotNull IntentionActionsFilter filter) {
|
||||
myFilter = filter;
|
||||
}
|
||||
|
||||
|
||||
+1
-11
@@ -16,10 +16,8 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi.impl.synthetic;
|
||||
|
||||
import com.intellij.codeInsight.completion.originInfo.OriginInfoAwareElement;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
@@ -41,15 +39,7 @@ public class GrMethodWrapper extends GrLightMethodBuilder {
|
||||
|
||||
getModifierList().copyModifiers(method);
|
||||
|
||||
for (PsiParameter parameter : method.getParameterList().getParameters()) {
|
||||
GrLightParameter p = new GrLightParameter(StringUtil.notNullize(parameter.getName()), parameter.getType(), this);
|
||||
|
||||
if (parameter instanceof GrParameter) {
|
||||
p.setOptional(((GrParameter)parameter).isOptional());
|
||||
}
|
||||
|
||||
addParameter(p);
|
||||
}
|
||||
getParameterList().copyParameters(method);
|
||||
|
||||
if (method instanceof OriginInfoAwareElement) {
|
||||
setOriginInfo(((OriginInfoAwareElement)method).getOriginInfo());
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public interface MavenServerEmbedder extends Remote {
|
||||
@NotNull Collection<String> activeProfiles) throws RemoteException,
|
||||
MavenServerProcessCanceledException;
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
String evaluateEffectivePom(@NotNull File file, @NotNull List<String> activeProfiles) throws RemoteException,
|
||||
MavenServerProcessCanceledException;
|
||||
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ public class Maven2ServerEmbedderImpl extends MavenRemoteObject implements Maven
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
public String evaluateEffectivePom(@NotNull File file, @NotNull List<String> activeProfiles) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
+1
-1
@@ -287,7 +287,7 @@ public class Maven3ServerEmbedderImpl extends MavenRemoteObject implements Maven
|
||||
return createExecutionResult(file, result, listener.getRootNode());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
@Override
|
||||
public String evaluateEffectivePom(@NotNull File file, @NotNull List<String> activeProfiles)
|
||||
throws RemoteException, MavenServerProcessCanceledException {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user