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:
+39
-11
@@ -37,9 +37,11 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.patterns.PsiJavaPatterns.psiClass;
|
||||
import static com.intellij.patterns.PsiJavaPatterns.psiElement;
|
||||
@@ -117,26 +119,52 @@ public class JavaClassNameCompletionContributor extends CompletionContributor {
|
||||
|
||||
final boolean pkgContext = JavaCompletionUtil.inSomePackage(insertedElement);
|
||||
AllClassesGetter.processJavaClasses(parameters, matcher, filterByScope, new Consumer<PsiClass>() {
|
||||
@Override
|
||||
public void consume(PsiClass psiClass) {
|
||||
if (filter.isAcceptable(psiClass, insertedElement)) {
|
||||
if (!inJavaContext) {
|
||||
consumer.consume(AllClassesGetter.createLookupItem(psiClass, AllClassesGetter.TRY_SHORTENING));
|
||||
} else {
|
||||
for (JavaPsiClassReferenceElement element : createClassLookupItems(psiClass, afterNew,
|
||||
JavaClassNameInsertHandler.JAVA_CLASS_INSERT_HANDLER, new Condition<PsiClass>() {
|
||||
@Override
|
||||
public void consume(PsiClass psiClass) {
|
||||
processClass(psiClass, ContainerUtil.<PsiClass>newHashSet(), "");
|
||||
}
|
||||
|
||||
private void processClass(PsiClass psiClass, Set<PsiClass> visited, String prefix) {
|
||||
if (!visited.add(psiClass)) return;
|
||||
|
||||
boolean isInnerClass = StringUtil.isNotEmpty(prefix);
|
||||
if (isInnerClass && isProcessedIndependently(psiClass)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (filter.isAcceptable(psiClass, insertedElement)) {
|
||||
if (!inJavaContext) {
|
||||
JavaPsiClassReferenceElement element = AllClassesGetter.createLookupItem(psiClass, AllClassesGetter.TRY_SHORTENING);
|
||||
element.setLookupString(prefix + element.getLookupString());
|
||||
consumer.consume(element);
|
||||
} else {
|
||||
for (JavaPsiClassReferenceElement element : createClassLookupItems(psiClass, afterNew,
|
||||
JavaClassNameInsertHandler.JAVA_CLASS_INSERT_HANDLER, new Condition<PsiClass>() {
|
||||
@Override
|
||||
public boolean value(PsiClass psiClass) {
|
||||
return filter.isAcceptable(psiClass, insertedElement) &&
|
||||
AllClassesGetter.isAcceptableInContext(insertedElement, psiClass, filterByScope, pkgContext);
|
||||
}
|
||||
})) {
|
||||
consumer.consume(element);
|
||||
}
|
||||
element.setLookupString(prefix + element.getLookupString());
|
||||
consumer.consume(element);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String name = psiClass.getName();
|
||||
if (name != null) {
|
||||
for (PsiClass innerClass : psiClass.getInnerClasses()) {
|
||||
processClass(innerClass, visited, prefix + name + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isProcessedIndependently(PsiClass psiClass) {
|
||||
String innerName = psiClass.getName();
|
||||
return innerName != null && matcher.prefixMatches(innerName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static LookupElement highlightIfNeeded(JavaPsiClassReferenceElement element, CompletionParameters parameters) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicatorProvider;
|
||||
import com.intellij.openapi.roots.FileIndexFacade;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
@@ -711,6 +712,10 @@ public class PsiClassImplUtil {
|
||||
|
||||
@Nullable
|
||||
public static PsiClassType correctType(PsiClassType originalType, final GlobalSearchScope resolveScope) {
|
||||
if (!Registry.is("java.correct.class.type.by.place.resolve.scope")) {
|
||||
return originalType;
|
||||
}
|
||||
|
||||
final PsiClassType.ClassResolveResult originalResolveResult = originalType.resolveGenerics();
|
||||
PsiClass superClass = originalResolveResult.getElement();
|
||||
if (superClass == null) {
|
||||
@@ -746,7 +751,7 @@ public class PsiClassImplUtil {
|
||||
}
|
||||
});
|
||||
if (substitute == null) return null;
|
||||
|
||||
|
||||
substitutor = substitutor.put(typeParameters[i], substitute);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
final class MyModule {
|
||||
@Target({FIELD,PARAMETER,METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public static @interface Dependency { }
|
||||
}
|
||||
|
||||
final class SomeService {
|
||||
|
||||
SomeService(@My<caret>) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
final class MyModule {
|
||||
@Target({FIELD,PARAMETER,METHOD})
|
||||
@Retention(RUNTIME)
|
||||
public static @interface Dependency { }
|
||||
}
|
||||
|
||||
final class SomeService {
|
||||
|
||||
SomeService(@MyModule.Dependency<caret>) {
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -25,7 +25,7 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase
|
||||
*/
|
||||
class MultipleModuleHighlightingTest extends JavaCodeInsightFixtureTestCase {
|
||||
|
||||
@Bombed(day = 1, month = Calendar.MARCH)
|
||||
@Bombed(day = 1, month = Calendar.APRIL)
|
||||
public void "test use original place classpath for reference type resolving"() {
|
||||
addTwoModules()
|
||||
|
||||
@@ -60,7 +60,7 @@ class Class3 {
|
||||
myFixture.checkHighlighting()
|
||||
}
|
||||
|
||||
@Bombed(day = 1, month = Calendar.MARCH)
|
||||
@Bombed(day = 1, month = Calendar.APRIL)
|
||||
public void "test use original place classpath for new expression type resolving"() {
|
||||
addTwoModules()
|
||||
|
||||
|
||||
+1
@@ -932,6 +932,7 @@ public class ListUtils {
|
||||
|
||||
public void testTabReplacesMethodNameWithLocalVariableName() throws Throwable { doTest('\t'); }
|
||||
public void testMethodParameterAnnotationClass() throws Throwable { doTest(); }
|
||||
public void testInnerAnnotation() { doTest('\n'); }
|
||||
public void testPrimitiveCastOverwrite() throws Throwable { doTest '\t' }
|
||||
public void testClassReferenceInFor() throws Throwable { doTest ' ' }
|
||||
public void testClassReferenceInFor2() throws Throwable { doTest ' ' }
|
||||
|
||||
@@ -365,6 +365,19 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
|
||||
assertSize(1, findUsages(findModel));
|
||||
}
|
||||
|
||||
public void testNonSourceContent() throws Exception {
|
||||
VirtualFile root = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(createTempDirectory());
|
||||
PsiTestUtil.addContentRoot(myModule, root);
|
||||
|
||||
createFile(myModule, root, "A.txt", "goo doo");
|
||||
|
||||
FindModel findModel = FindManagerTestUtils.configureFindModel("goo");
|
||||
findModel.setProjectScope(false);
|
||||
findModel.setModuleName(myModule.getName());
|
||||
|
||||
assertSize(1, findUsages(findModel));
|
||||
}
|
||||
|
||||
public void testReplaceRegexp() {
|
||||
FindModel findModel = new FindModel();
|
||||
findModel.setStringToFind("bug_(?=here)");
|
||||
@@ -537,6 +550,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
|
||||
findModel.setFromCursor(false);
|
||||
findModel.setGlobal(true);
|
||||
findModel.setMultipleFiles(true);
|
||||
findModel.setCustomScope(true);
|
||||
|
||||
ThrowableRunnable test = new ThrowableRunnable() {
|
||||
@Override
|
||||
@@ -573,6 +587,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
|
||||
VirtualFile file = tempDirFixture.createFile("a.txt", "foo bar foo");
|
||||
FindModel findModel = FindManagerTestUtils.configureFindModel("foo");
|
||||
findModel.setWholeWordsOnly(true);
|
||||
findModel.setCustomScope(true);
|
||||
findModel.setCustomScope(new LocalSearchScope(PsiManager.getInstance(myProject).findFile(file)));
|
||||
assertSize(2, findUsages(findModel));
|
||||
}
|
||||
|
||||
+10
-10
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.codeInsight.daemon;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.util.xmlb.annotations.OptionTag;
|
||||
import com.intellij.util.xmlb.annotations.Transient;
|
||||
|
||||
public class DaemonCodeAnalyzerSettings {
|
||||
@@ -26,9 +26,9 @@ public class DaemonCodeAnalyzerSettings {
|
||||
|
||||
public boolean NEXT_ERROR_ACTION_GOES_TO_ERRORS_FIRST = true;
|
||||
public int AUTOREPARSE_DELAY = 300;
|
||||
public boolean SHOW_ADD_IMPORT_HINTS = true;
|
||||
protected boolean myShowAddImportHints = true;
|
||||
public String NO_AUTO_IMPORT_PATTERN = "[a-z].?";
|
||||
public boolean SUPPRESS_WARNINGS = true;
|
||||
protected boolean mySuppressWarnings = true;
|
||||
public boolean SHOW_METHOD_SEPARATORS = false;
|
||||
public int ERROR_STRIPE_MARK_MIN_HEIGHT = 2;
|
||||
public boolean SHOW_SMALL_ICONS_IN_GUTTER = true;
|
||||
@@ -38,21 +38,21 @@ public class DaemonCodeAnalyzerSettings {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Transient
|
||||
@OptionTag(value = "SHOW_ADD_IMPORT_HINTS")
|
||||
public boolean isImportHintEnabled() {
|
||||
return SHOW_ADD_IMPORT_HINTS;
|
||||
return myShowAddImportHints;
|
||||
}
|
||||
|
||||
public void setImportHintEnabled(boolean isImportHintEnabled) {
|
||||
SHOW_ADD_IMPORT_HINTS = isImportHintEnabled;
|
||||
myShowAddImportHints = isImportHintEnabled;
|
||||
}
|
||||
|
||||
@Transient
|
||||
@OptionTag(value = "SUPPRESS_WARNINGS")
|
||||
public boolean isSuppressWarnings() {
|
||||
return SUPPRESS_WARNINGS;
|
||||
return mySuppressWarnings;
|
||||
}
|
||||
|
||||
public void setSuppressWarnings(boolean suppressWarnings) {
|
||||
SUPPRESS_WARNINGS = suppressWarnings;
|
||||
mySuppressWarnings = suppressWarnings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.ModificationTracker;
|
||||
import com.intellij.openapi.util.NotNullLazyKey;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.util.messages.Topic;
|
||||
@@ -37,9 +38,6 @@ import java.util.List;
|
||||
* A service managing IDEA's 'dumb' mode: when indices are updated in background and the functionality is very much limited.
|
||||
* Only the explicitly allowed functionality is available. Usually it's allowed by implementing {@link DumbAware} interface.
|
||||
*
|
||||
* If you want to register a toolwindow, which will be enabled during the dumb mode, please use {@link com.intellij.openapi.wm.ToolWindowManager}'s
|
||||
* registration methods which have 'canWorkInDumMode' parameter.
|
||||
*
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class DumbService {
|
||||
@@ -50,6 +48,11 @@ public abstract class DumbService {
|
||||
*/
|
||||
public static final Topic<DumbModeListener> DUMB_MODE = new Topic<DumbModeListener>("dumb mode", DumbModeListener.class);
|
||||
|
||||
/**
|
||||
* The tracker is advanced each time we enter/exit from dumb mode.
|
||||
*/
|
||||
public abstract ModificationTracker getModificationTracker();
|
||||
|
||||
/**
|
||||
* @return whether IntelliJ IDEA is in dumb mode, which means that right now indices are updated in background.
|
||||
* IDEA offers only limited functionality at such times, e.g. plain text file editing and version control operations.
|
||||
|
||||
@@ -42,8 +42,31 @@ public class CompareFilesAction extends BaseShowDiffAction {
|
||||
|
||||
VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
|
||||
|
||||
String text = getTemplatePresentation().getText();
|
||||
if (files != null && files.length == 1) text += "...";
|
||||
String text = "Compare Files";
|
||||
if (files != null && files.length == 1) {
|
||||
text = "Compare With...";
|
||||
}
|
||||
else if (files != null && files.length == 2) {
|
||||
Type type1 = getType(files[0]);
|
||||
Type type2 = getType(files[1]);
|
||||
|
||||
if (type1 != type2) {
|
||||
text = "Compare";
|
||||
}
|
||||
else {
|
||||
switch (type1) {
|
||||
case FILE:
|
||||
text = "Compare Files";
|
||||
break;
|
||||
case DIRECTORY:
|
||||
text = "Compare Directories";
|
||||
break;
|
||||
case ARCHIEVE:
|
||||
text = "Compare Archieves";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
e.getPresentation().setText(text);
|
||||
}
|
||||
|
||||
@@ -93,7 +116,9 @@ public class CompareFilesAction extends BaseShowDiffAction {
|
||||
private static VirtualFile getOtherFile(@Nullable Project project, @NotNull VirtualFile file) {
|
||||
FileChooserDescriptor descriptor;
|
||||
String key;
|
||||
if (file.isDirectory() || file.getFileType() instanceof ArchiveFileType) {
|
||||
|
||||
Type type = getType(file);
|
||||
if (type == Type.DIRECTORY || type == Type.ARCHIEVE) {
|
||||
descriptor = new FileChooserDescriptor(false, true, true, false, false, false);
|
||||
key = LAST_USED_FOLDER_KEY;
|
||||
}
|
||||
@@ -121,4 +146,14 @@ public class CompareFilesAction extends BaseShowDiffAction {
|
||||
if (project == null) return;
|
||||
PropertiesComponent.getInstance(project).setValue(key, file.getPath());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Type getType(@Nullable VirtualFile file) {
|
||||
if (file == null) return Type.FILE;
|
||||
if (file.isDirectory()) return Type.DIRECTORY;
|
||||
if (file.getFileType() instanceof ArchiveFileType) return Type.ARCHIEVE;
|
||||
return Type.FILE;
|
||||
}
|
||||
|
||||
private enum Type {FILE, DIRECTORY, ARCHIEVE}
|
||||
}
|
||||
|
||||
@@ -23,17 +23,21 @@ import com.intellij.diff.contents.EmptyContent;
|
||||
import com.intellij.diff.contents.FileContent;
|
||||
import com.intellij.diff.requests.ContentDiffRequest;
|
||||
import com.intellij.diff.requests.DiffRequest;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.diff.DiffElement;
|
||||
import com.intellij.ide.diff.DirDiffSettings;
|
||||
import com.intellij.ide.diff.JarFileDiffElement;
|
||||
import com.intellij.ide.diff.VirtualFileDiffElement;
|
||||
import com.intellij.ide.highlighter.ArchiveFileType;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.diff.impl.dir.DirDiffFrame;
|
||||
import com.intellij.openapi.diff.impl.dir.DirDiffPanel;
|
||||
import com.intellij.openapi.diff.impl.dir.DirDiffTableModel;
|
||||
import com.intellij.openapi.diff.impl.dir.DirDiffWindow;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -46,7 +50,8 @@ class DifDiffViewer implements FrameDiffTool.DiffViewer {
|
||||
@NotNull private final DiffContext myContext;
|
||||
@NotNull private final ContentDiffRequest myRequest;
|
||||
|
||||
@NotNull private final DirDiffPanel myPanel;
|
||||
@NotNull private final DirDiffPanel myDirDiffPanel;
|
||||
@NotNull private final JPanel myPanel;
|
||||
|
||||
public DifDiffViewer(@NotNull DiffContext context, @NotNull ContentDiffRequest request) {
|
||||
myContext = context;
|
||||
@@ -57,7 +62,7 @@ class DifDiffViewer implements FrameDiffTool.DiffViewer {
|
||||
DiffElement element2 = createDiffElement(contents.get(1));
|
||||
DirDiffTableModel model = new DirDiffTableModel(context.getProject(), element1, element2, new DirDiffSettings());
|
||||
|
||||
myPanel = new DirDiffPanel(model, new DirDiffWindow((DirDiffFrame)null) {
|
||||
myDirDiffPanel = new DirDiffPanel(model, new DirDiffWindow((DirDiffFrame)null) {
|
||||
@Override
|
||||
public Window getWindow() {
|
||||
return null;
|
||||
@@ -72,31 +77,43 @@ class DifDiffViewer implements FrameDiffTool.DiffViewer {
|
||||
public void setTitle(String title) {
|
||||
}
|
||||
});
|
||||
|
||||
myPanel = new JPanel(new BorderLayout());
|
||||
myPanel.add(myDirDiffPanel.getPanel(), BorderLayout.CENTER);
|
||||
DataManager.registerDataProvider(myPanel, new DataProvider() {
|
||||
@Override
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (PlatformDataKeys.HELP_ID.is(dataId)) {
|
||||
return "reference.dialogs.diff.folder";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FrameDiffTool.ToolbarComponents init() {
|
||||
myPanel.setupSplitter();
|
||||
myDirDiffPanel.setupSplitter();
|
||||
|
||||
return new FrameDiffTool.ToolbarComponents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
Disposer.dispose(myPanel);
|
||||
Disposer.dispose(myDirDiffPanel);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return myPanel.getPanel();
|
||||
return myPanel;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return myPanel.getTable();
|
||||
return myDirDiffPanel.getTable();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -24,13 +24,13 @@ import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManagerImpl;
|
||||
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
|
||||
import com.intellij.util.xmlb.SkipDefaultsSerializationFilter;
|
||||
import com.intellij.util.xmlb.XmlSerializer;
|
||||
import org.jdom.Element;
|
||||
|
||||
@State(
|
||||
name = "DaemonCodeAnalyzerSettings",
|
||||
storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/editor.codeinsight.xml")}
|
||||
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/editor.codeinsight.xml")
|
||||
)
|
||||
public class DaemonCodeAnalyzerSettingsImpl extends DaemonCodeAnalyzerSettings implements PersistentStateComponent<Element>, Cloneable {
|
||||
@Override
|
||||
@@ -42,7 +42,7 @@ public class DaemonCodeAnalyzerSettingsImpl extends DaemonCodeAnalyzerSettings i
|
||||
public DaemonCodeAnalyzerSettingsImpl clone() {
|
||||
DaemonCodeAnalyzerSettingsImpl settings = new DaemonCodeAnalyzerSettingsImpl();
|
||||
settings.AUTOREPARSE_DELAY = AUTOREPARSE_DELAY;
|
||||
settings.SHOW_ADD_IMPORT_HINTS = SHOW_ADD_IMPORT_HINTS;
|
||||
settings.myShowAddImportHints = myShowAddImportHints;
|
||||
settings.SHOW_METHOD_SEPARATORS = SHOW_METHOD_SEPARATORS;
|
||||
settings.NO_AUTO_IMPORT_PATTERN = NO_AUTO_IMPORT_PATTERN;
|
||||
settings.SHOW_SMALL_ICONS_IN_GUTTER = SHOW_SMALL_ICONS_IN_GUTTER;
|
||||
@@ -51,7 +51,7 @@ public class DaemonCodeAnalyzerSettingsImpl extends DaemonCodeAnalyzerSettings i
|
||||
|
||||
@Override
|
||||
public Element getState() {
|
||||
Element element = XmlSerializer.serialize(this, new SkipDefaultValuesSerializationFilters());
|
||||
Element element = XmlSerializer.serialize(this, new SkipDefaultsSerializationFilter());
|
||||
String profile = InspectionProfileManager.getInstance().getRootProfile().getName();
|
||||
if (!"Default".equals(profile)) {
|
||||
element.setAttribute("profile", profile);
|
||||
|
||||
@@ -356,7 +356,7 @@ public class EnterHandler extends BaseEnterHandler {
|
||||
commentContext.docStart = false;
|
||||
}
|
||||
else {
|
||||
commentContext.docAsterisk = true;
|
||||
commentContext.docAsterisk = CodeStyleSettingsManager.getSettings(getProject()).JD_LEADING_ASTERISKS_ARE_ENABLED;
|
||||
commentContext.docStart = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ class FindInProjectTask {
|
||||
|
||||
@NotNull
|
||||
private Collection<VirtualFile> collectFilesInScope(@NotNull final Set<VirtualFile> alreadySearched, final boolean skipIndexed) {
|
||||
SearchScope customScope = myFindModel.getCustomScope();
|
||||
SearchScope customScope = myFindModel.isCustomScope() ? myFindModel.getCustomScope() : null;
|
||||
final GlobalSearchScope globalCustomScope = toGlobal(customScope);
|
||||
|
||||
final ProjectFileIndex fileIndex = ProjectFileIndex.SERVICE.getInstance(myProject);
|
||||
@@ -432,17 +432,7 @@ class FindInProjectTask {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
SearchScope customScope = myFindModel.getCustomScope();
|
||||
GlobalSearchScope scope = myPsiDirectory != null
|
||||
? GlobalSearchScopesCore.directoryScope(myPsiDirectory, myFindModel.isWithSubdirectories())
|
||||
: myModule != null
|
||||
? myModule.getModuleContentScope()
|
||||
: customScope instanceof GlobalSearchScope
|
||||
? (GlobalSearchScope)customScope
|
||||
: toGlobal(customScope);
|
||||
if (scope == null) {
|
||||
scope = ProjectScope.getContentScope(myProject);
|
||||
}
|
||||
GlobalSearchScope scope = toGlobal(FindInProjectUtil.getScopeFromModel(myProject, myFindModel));
|
||||
|
||||
final Set<VirtualFile> resultFiles = new LinkedHashSet<VirtualFile>();
|
||||
|
||||
|
||||
@@ -49,10 +49,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.vfs.ex.VirtualFileManagerEx;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.GlobalSearchScopesCore;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.search.*;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usageView.UsageViewManager;
|
||||
@@ -443,7 +440,7 @@ public class FindInProjectUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static SearchScope getScopeFromModel(@NotNull Project project, @NotNull FindModel findModel) {
|
||||
static SearchScope getScopeFromModel(@NotNull Project project, @NotNull FindModel findModel) {
|
||||
SearchScope customScope = findModel.getCustomScope();
|
||||
PsiDirectory psiDir = getPsiDirectory(findModel, project);
|
||||
VirtualFile directory = psiDir == null ? null : psiDir.getVirtualFile();
|
||||
@@ -452,8 +449,8 @@ public class FindInProjectUtil {
|
||||
// we don't have to check for myProjectFileIndex.isExcluded(file) here like FindInProjectTask.collectFilesInScope() does
|
||||
// because all found usages are guaranteed to be not in excluded dir
|
||||
directory != null ? GlobalSearchScopesCore.directoryScope(project, directory, findModel.isWithSubdirectories()) :
|
||||
module != null ? GlobalSearchScope.moduleScope(module) :
|
||||
findModel.isProjectScope() ? GlobalSearchScope.projectScope(project) :
|
||||
module != null ? module.getModuleContentScope() :
|
||||
findModel.isProjectScope() ? ProjectScope.getContentScope(project) :
|
||||
GlobalSearchScope.allScope(project);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.HyperlinkListener;
|
||||
|
||||
/**
|
||||
* If you want to register a toolwindow, which will be enabled during the dumb mode, please use {@link ToolWindowManager}'s
|
||||
* registration methods which have 'canWorkInDumMode' parameter.
|
||||
*/
|
||||
public abstract class ToolWindowManager {
|
||||
|
||||
public abstract boolean canShowNotification(@NotNull String toolWindowId);
|
||||
@@ -37,22 +41,22 @@ public abstract class ToolWindowManager {
|
||||
* Register specified tool window into IDE window system.
|
||||
* @param id <code>id</code> of tool window to be registered.
|
||||
* @param component <code>component</code> which represents tool window content.
|
||||
* May be null. Content can be further added via content manager for this tool window (See {@link com.intellij.openapi.wm.ToolWindow#getContentManager()})
|
||||
* May be null. Content can be further added via content manager for this tool window (See {@link ToolWindow#getContentManager()})
|
||||
* @param anchor the default anchor for first registration. It uses only first time the
|
||||
* tool window with the specified <code>id</code> is being registered into the window system.
|
||||
* After the first registration window's anchor is stored in project file
|
||||
* and <code>anchor</code> is ignored.
|
||||
* @exception java.lang.IllegalArgumentException if the same window is already installed or one
|
||||
* @exception IllegalArgumentException if the same window is already installed or one
|
||||
* of the parameters is <code>null</code>.
|
||||
* @return tool window
|
||||
* @deprecated {@link com.intellij.openapi.wm.ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
|
||||
* @deprecated {@link ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
|
||||
*/
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public abstract ToolWindow registerToolWindow(@NotNull String id, @NotNull JComponent component, @NotNull ToolWindowAnchor anchor);
|
||||
|
||||
/**
|
||||
* @deprecated {@link com.intellij.openapi.wm.ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
|
||||
* @deprecated {@link ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
|
||||
*/
|
||||
@Deprecated
|
||||
@NotNull
|
||||
@@ -62,7 +66,7 @@ public abstract class ToolWindowManager {
|
||||
@NotNull Disposable parentDisposable);
|
||||
|
||||
/**
|
||||
* @deprecated {@link com.intellij.openapi.wm.ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
|
||||
* @deprecated {@link ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
|
||||
*/
|
||||
@Deprecated
|
||||
@NotNull
|
||||
@@ -72,7 +76,7 @@ public abstract class ToolWindowManager {
|
||||
Disposable parentDisposable,
|
||||
boolean canWorkInDumbMode);
|
||||
/**
|
||||
* @deprecated {@link com.intellij.openapi.wm.ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
|
||||
* @deprecated {@link ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
|
||||
*/
|
||||
@Deprecated
|
||||
@NotNull
|
||||
|
||||
@@ -215,7 +215,10 @@ public class StartupManagerImpl extends StartupManagerEx {
|
||||
}
|
||||
});
|
||||
|
||||
Registry.get("ide.firstStartup").setValue(false);
|
||||
// otherwise will be stored - we must not create config files in tests
|
||||
if (!app.isUnitTestMode()) {
|
||||
Registry.get("ide.firstStartup").setValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void scheduleInitialVfsRefresh() {
|
||||
|
||||
@@ -49,10 +49,11 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
public class DumbServiceImpl extends DumbService implements Disposable {
|
||||
public class DumbServiceImpl extends DumbService implements Disposable, ModificationTracker {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.project.DumbServiceImpl");
|
||||
private volatile boolean myDumb = false;
|
||||
private final DumbModeListener myPublisher;
|
||||
private long myModificationCount;
|
||||
private final Queue<DumbModeTask> myUpdatesQueue = new Queue<DumbModeTask>(5);
|
||||
|
||||
/**
|
||||
@@ -116,6 +117,11 @@ public class DumbServiceImpl extends DumbService implements Disposable {
|
||||
myAlternativeResolution.set(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModificationTracker getModificationTracker() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDumb() {
|
||||
return myDumb;
|
||||
@@ -209,6 +215,7 @@ public class DumbServiceImpl extends DumbService implements Disposable {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
myDumb = true;
|
||||
myModificationCount++;
|
||||
try {
|
||||
myPublisher.enteredDumbMode();
|
||||
}
|
||||
@@ -236,6 +243,7 @@ public class DumbServiceImpl extends DumbService implements Disposable {
|
||||
|
||||
private void updateFinished() {
|
||||
myDumb = false;
|
||||
myModificationCount++;
|
||||
if (myProject.isDisposed()) return;
|
||||
|
||||
if (ApplicationManager.getApplication().isInternal()) LOG.info("updateFinished");
|
||||
@@ -440,6 +448,11 @@ public class DumbServiceImpl extends DumbService implements Disposable {
|
||||
return result.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getModificationCount() {
|
||||
return myModificationCount;
|
||||
}
|
||||
|
||||
private class AppIconProgress extends ProgressIndicatorBase {
|
||||
private double lastFraction;
|
||||
|
||||
|
||||
@@ -228,8 +228,8 @@ action.NewClass.text=Java Class
|
||||
action.NewFile.text=File
|
||||
action.NewDir.text=Directory/Package
|
||||
action.NewFromTemplate.text=From Template
|
||||
action.CompareTwoFiles.text=Compare Two _Files
|
||||
action.CompareTwoFiles.description=Compare two selected files
|
||||
action.CompareTwoFiles.text=Compare _Files
|
||||
action.CompareTwoFiles.description=Compare two selected files or folders
|
||||
action.CompareFileWithEditor.text=Co_mpare File with Editor
|
||||
action.CompareFileWithEditor.description=Compare selected file with editor
|
||||
action.ShowQuickDocAtPinnedWindowFromTooltip.text=Full documentation in a pinned window
|
||||
|
||||
@@ -7,7 +7,7 @@ com.jetbrains.lang.ejs 131.17 131.12
|
||||
com.jetbrains.twig 133.51 130.1639
|
||||
org.jetbrains.plugins.ruby 7.0.0.20150216 7.0.0.20150204 7.0.0.20141010 7.0.0.20140915 7.0.0.20140901 7.0.0.20140807 6.0.0.20140207 6.5.2.20140512 7.0.0.20140704 7.0.0.20140707 7.0.0.20140724
|
||||
Pythonid 3.1 4.0.25 4.0.26
|
||||
Karma 138.1684 138.1879 138.317 138.21 134.1163 134.1039 134.686 134.31
|
||||
Karma 140.2109 138.1684 138.1879 138.317 138.21 134.1163 134.1039 134.686 134.31
|
||||
org.intellij.scala 1.2.67.3.EAP 1.3.2-14.1 1.3.3-14.1 1.0.93.10.EAP 1.0.93.4.EAP 1.0.93.9.EAP 1.0.58 1.0.16 1.0.14 1.0.13 0.42.28 0.42.23 0.40.20 0.40.18 0.40.16 0.32.593 0.32.562 0.32.558 0.32.550 0.32.520 0.32.512
|
||||
org.jetbrains.kannotator 0.2.420
|
||||
org.jetbrains.kotlin 0.10.555 0.10.4 0.8.1615 0.7.1360 0.7.1376 0.8.7
|
||||
|
||||
@@ -25,6 +25,11 @@ import com.intellij.usages.UsageTarget;
|
||||
import com.intellij.usages.UsageViewManager;
|
||||
|
||||
public class UsageViewManagerTest extends PlatformTestCase {
|
||||
|
||||
static {
|
||||
initPlatformLangPrefix();
|
||||
}
|
||||
|
||||
public void testScopeCreatedForFindInDirectory() {
|
||||
VirtualFile dir = getProject().getBaseDir();
|
||||
FindModel findModel = new FindModel();
|
||||
@@ -36,4 +41,14 @@ public class UsageViewManagerTest extends PlatformTestCase {
|
||||
SearchScope scope = manager.getMaxSearchScopeToWarnOfFallingOutOf(new UsageTarget[]{target});
|
||||
assertEquals(scope, GlobalSearchScopesCore.directoryScope(getProject(), dir, true));
|
||||
}
|
||||
|
||||
public void testScopeCreatedForFindInModuleContent() {
|
||||
FindModel findModel = new FindModel();
|
||||
findModel.setModuleName(getModule().getName());
|
||||
findModel.setProjectScope(false);
|
||||
UsageTarget target = new FindInProjectUtil.StringUsageTarget(getProject(), findModel);
|
||||
UsageViewManagerImpl manager = (UsageViewManagerImpl)UsageViewManager.getInstance(getProject());
|
||||
SearchScope scope = manager.getMaxSearchScopeToWarnOfFallingOutOf(new UsageTarget[]{target});
|
||||
assertEquals(scope, getModule().getModuleContentScope());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,6 +257,9 @@ java.annotations.inference.nullable.method.description=Restart is required; infe
|
||||
java.annotations.inference.nullable.method.transitivity=true
|
||||
java.annotations.inference.nullable.method.transitivity.description=Restart is required; if a method result is a call to a @Nullable method, reports the caller as @Nullable as well
|
||||
|
||||
java.correct.class.type.by.place.resolve.scope=true
|
||||
java.correct.class.type.by.place.resolve.scope.description=When resolving Java references, use the resolve scope of the currently processed source file
|
||||
|
||||
documentation.component.editor.font=false
|
||||
|
||||
ide.completion.show.better.matching.classes=true
|
||||
|
||||
@@ -55,10 +55,10 @@ public class PatchReader {
|
||||
this(patchContent, true);
|
||||
}
|
||||
|
||||
public PatchReader(CharSequence patchContent, boolean parseHunks) {
|
||||
public PatchReader(CharSequence patchContent, boolean saveHunks) {
|
||||
myLines = LineTokenizer.tokenizeIntoList(patchContent, false);
|
||||
myAdditionalInfoParser = new AdditionalInfoParser(!parseHunks);
|
||||
myPatchContentParser = new PatchContentParser(parseHunks);
|
||||
myAdditionalInfoParser = new AdditionalInfoParser(!saveHunks);
|
||||
myPatchContentParser = new PatchContentParser(saveHunks);
|
||||
}
|
||||
|
||||
public List<TextFilePatch> readAllPatches() throws PatchSyntaxException {
|
||||
@@ -254,15 +254,15 @@ public class PatchReader {
|
||||
|
||||
|
||||
private static class PatchContentParser implements Parser {
|
||||
private final boolean myParseHunks;
|
||||
private final boolean mySaveHunks;
|
||||
private DiffFormat myDiffFormat = null;
|
||||
private final List<TextFilePatch> myPatches;
|
||||
|
||||
private boolean myDiffCommandLike;
|
||||
private boolean myIndexLike;
|
||||
|
||||
private PatchContentParser(boolean parseHunks) {
|
||||
myParseHunks = parseHunks;
|
||||
private PatchContentParser(boolean saveHunks) {
|
||||
mySaveHunks = saveHunks;
|
||||
myPatches = new SmartList<TextFilePatch>();
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ public class PatchReader {
|
||||
}
|
||||
|
||||
private TextFilePatch readPatch(String curLine, ListIterator<String> iterator) throws PatchSyntaxException {
|
||||
final TextFilePatch curPatch = new TextFilePatch(null);
|
||||
final TextFilePatch curPatch = mySaveHunks ? new TextFilePatch(null) : new EmptyTextFilePatch();
|
||||
extractFileName(curLine, curPatch, true, myDiffCommandLike && myIndexLike);
|
||||
|
||||
if (! iterator.hasNext()) throw new PatchSyntaxException(iterator.previousIndex(), "Second file name expected");
|
||||
@@ -314,7 +314,7 @@ public class PatchReader {
|
||||
}
|
||||
extractFileName(curLine, curPatch, false, myDiffCommandLike && myIndexLike);
|
||||
|
||||
while (myParseHunks && iterator.hasNext()) {
|
||||
while (iterator.hasNext()) {
|
||||
PatchHunk hunk;
|
||||
if (myDiffFormat == DiffFormat.UNIFIED) {
|
||||
hunk = readNextHunkUnified(iterator);
|
||||
@@ -595,4 +595,37 @@ public class PatchReader {
|
||||
boolean testIsStart(final String start);
|
||||
void parse(final String start, final ListIterator<String> iterator) throws PatchSyntaxException;
|
||||
}
|
||||
|
||||
private static class EmptyTextFilePatch extends TextFilePatch {
|
||||
private int myHunkCount = 0;
|
||||
private boolean myNew;
|
||||
private boolean myDeleted;
|
||||
|
||||
EmptyTextFilePatch() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addHunk(PatchHunk hunk) {
|
||||
if (myHunkCount == 0) {
|
||||
if (hunk.isNewContent()) {
|
||||
myNew = true;
|
||||
}
|
||||
else if (hunk.isDeletedContent()) {
|
||||
myDeleted = true;
|
||||
}
|
||||
}
|
||||
myHunkCount++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNewFile() {
|
||||
return myHunkCount == 1 && myNew;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeletedFile() {
|
||||
return myHunkCount == 1 && myDeleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,23 +399,25 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
|
||||
|
||||
@NotNull
|
||||
public Selection getSelection() {
|
||||
return new Selection();
|
||||
return new Selection(this);
|
||||
}
|
||||
|
||||
public class Selection {
|
||||
public static class Selection {
|
||||
private final TIntHashSet myCommits;
|
||||
private final VcsLogGraphTable myTable;
|
||||
|
||||
public Selection() {
|
||||
myCommits = getCommitsAtRows(myDataPack.getVisibleGraph(), getSelectedRows());
|
||||
public Selection(@NotNull VcsLogGraphTable table) {
|
||||
myTable = table;
|
||||
myCommits = getCommitsAtRows(myTable.myDataPack.getVisibleGraph(), myTable.getSelectedRows());
|
||||
}
|
||||
|
||||
public void restore(@NotNull VisibleGraph<Integer> newVisibleGraph) {
|
||||
TIntHashSet rowsToSelect = findNewRowsToSelect(getGraphTableModel(), newVisibleGraph, myCommits);
|
||||
TIntHashSet rowsToSelect = findNewRowsToSelect(myTable.getGraphTableModel(), newVisibleGraph, myCommits);
|
||||
if (!rowsToSelect.isEmpty()) {
|
||||
rowsToSelect.forEach(new TIntProcedure() {
|
||||
@Override
|
||||
public boolean execute(int row) {
|
||||
addRowSelectionInterval(row, row);
|
||||
myTable.addRowSelectionInterval(row, row);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
+12
-10
@@ -27,25 +27,28 @@ public class StudySmartChecker {
|
||||
private StudySmartChecker() {
|
||||
|
||||
}
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(StudySmartChecker.class);
|
||||
|
||||
public static void smartCheck(@NotNull final AnswerPlaceholder placeholder,
|
||||
@NotNull final Project project,
|
||||
@NotNull final VirtualFile answerFile,
|
||||
@NotNull final TaskFile answerTaskFile,
|
||||
@NotNull final TaskFile usersTaskFile,
|
||||
@NotNull final StudyTestRunner testRunner,
|
||||
@NotNull final VirtualFile virtualFile,
|
||||
@NotNull final Document usersDocument) {
|
||||
@NotNull final Project project,
|
||||
@NotNull final VirtualFile answerFile,
|
||||
@NotNull final TaskFile answerTaskFile,
|
||||
@NotNull final TaskFile usersTaskFile,
|
||||
@NotNull final StudyTestRunner testRunner,
|
||||
@NotNull final VirtualFile virtualFile,
|
||||
@NotNull final Document usersDocument) {
|
||||
|
||||
try {
|
||||
final int index = placeholder.getIndex();
|
||||
String windowCopyName = answerFile.getNameWithoutExtension() + index + EduNames.WINDOW_POSTFIX + answerFile.getExtension();
|
||||
final VirtualFile windowCopy =
|
||||
answerFile.copy(project, answerFile.getParent(), answerFile.getNameWithoutExtension() + index + EduNames.WINDOW_POSTFIX);
|
||||
answerFile.copy(project, answerFile.getParent(), windowCopyName);
|
||||
final FileDocumentManager documentManager = FileDocumentManager.getInstance();
|
||||
final Document windowDocument = documentManager.getDocument(windowCopy);
|
||||
if (windowDocument != null) {
|
||||
final File resourceFile = StudyUtils.copyResourceFile(virtualFile.getName(), windowCopy.getName(), project, usersTaskFile.getTask());
|
||||
final File resourceFile =
|
||||
StudyUtils.copyResourceFile(virtualFile.getName(), windowCopy.getName(), project, usersTaskFile.getTask());
|
||||
final TaskFile windowTaskFile = new TaskFile();
|
||||
TaskFile.copy(answerTaskFile, windowTaskFile);
|
||||
EduDocumentListener listener = new EduDocumentListener(windowTaskFile);
|
||||
@@ -85,5 +88,4 @@ public class StudySmartChecker {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class EduNames {
|
||||
public static final String TEST_TAB_NAME = "test";
|
||||
public static final String USER_TEST_INPUT = "input";
|
||||
public static final String USER_TEST_OUTPUT = "output";
|
||||
public static final String WINDOW_POSTFIX = "_window.py";
|
||||
public static final String WINDOW_POSTFIX = "_window.";
|
||||
public static final String TASK = "task";
|
||||
public static final String USER_TESTS = "userTests";
|
||||
public static final String SANDBOX_DIR = "Sandbox";
|
||||
|
||||
@@ -15,14 +15,18 @@ public class CourseInfo {
|
||||
private String myName;
|
||||
@SerializedName("summary")
|
||||
private String myDescription;
|
||||
@SerializedName("course_format")
|
||||
//course type in format "pycharm <language>"
|
||||
private String myType;
|
||||
|
||||
private String myAuthor;
|
||||
public static CourseInfo INVALID_COURSE = new CourseInfo("", "", "");
|
||||
public static CourseInfo INVALID_COURSE = new CourseInfo("", "", "", "");
|
||||
|
||||
public CourseInfo(String name, String author, String description) {
|
||||
public CourseInfo(String name, String author, String description, String type) {
|
||||
myName = name;
|
||||
myAuthor = author;
|
||||
myDescription = description;
|
||||
myType = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -37,6 +41,10 @@ public class CourseInfo {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return myType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return myName;
|
||||
|
||||
@@ -41,6 +41,8 @@ public class EduStepicConnector {
|
||||
private static final String ourDomain = "stepic.org";
|
||||
private static String ourSessionId = "524iethiwju2tjywaqmf7tbwx0p0jk1b";
|
||||
private static String ourCSRFToken = "LJ9n6OyLVA7hxU94dlYWUu65MF51Nx37";
|
||||
//this prefix indicates that course can be opened by educational plugin
|
||||
public static final String PYCHARM_PREFIX = "pycharm ";
|
||||
|
||||
private EduStepicConnector() {
|
||||
}
|
||||
@@ -84,7 +86,8 @@ public class EduStepicConnector {
|
||||
course.setAuthor(info.getAuthor());
|
||||
course.setDescription(info.getDescription());
|
||||
course.setName(info.getName());
|
||||
course.setLanguage("Python"); // TODO: get from stepic
|
||||
String courseType = info.getType();
|
||||
course.setLanguage(courseType.substring(PYCHARM_PREFIX.length()));
|
||||
course.setUpToDate(true); // TODO: get from stepic
|
||||
try {
|
||||
for (Integer section : info.sections) {
|
||||
|
||||
@@ -49,6 +49,7 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.DumbServiceImpl;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
@@ -64,6 +65,7 @@ import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.xml.XmlAttributeDescriptor;
|
||||
import com.intellij.xml.XmlBundle;
|
||||
import com.intellij.xml.XmlElementDescriptor;
|
||||
import com.intellij.xml.impl.schema.XmlElementDescriptorImpl;
|
||||
import com.intellij.xml.util.*;
|
||||
import gnu.trove.THashSet;
|
||||
@@ -1422,7 +1424,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
Editor[] allEditors = EditorFactory.getInstance().getAllEditors();
|
||||
final Editor schemaEditor = allEditors[0] == myEditor ? allEditors[1]:allEditors[0];
|
||||
final String text = schemaEditor.getDocument().getText();
|
||||
final String newText = text.replaceAll("xsd","xs");
|
||||
final String newText = text.replaceAll("xsd", "xs");
|
||||
WriteCommandAction.runWriteCommandAction(null, new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -1767,7 +1769,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
final String testName = getTestName(false);
|
||||
String[][] urls = {
|
||||
{"urn:jboss:bean-deployer:2.0", testName + ".xsd"},
|
||||
{null, testName + "_2.xsd"}
|
||||
{"", testName + "_2.xsd"}
|
||||
};
|
||||
doTestWithLocations(urls,"xml");
|
||||
}
|
||||
@@ -2082,6 +2084,26 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
assertTrue(resolve instanceof XmlTag);
|
||||
}
|
||||
|
||||
public void testDropAnyAttributeCacheOnExitFromDumbMode() throws Exception {
|
||||
try {
|
||||
DumbServiceImpl.getInstance(myProject).setDumb(true);
|
||||
configureByFiles(null, getVirtualFile(BASE_PATH + "AnyAttributeNavigation/test.xml"),
|
||||
getVirtualFile(BASE_PATH + "AnyAttributeNavigation/test.xsd"),
|
||||
getVirtualFile(BASE_PATH + "AnyAttributeNavigation/library.xsd"));
|
||||
PsiReference at = getFile().findReferenceAt(getEditor().getCaretModel().getOffset());
|
||||
|
||||
XmlTag tag = PsiTreeUtil.getParentOfType(at.getElement(), XmlTag.class);
|
||||
XmlElementDescriptor descriptor = tag.getDescriptor();
|
||||
XmlAttributeDescriptor[] descriptors = descriptor.getAttributesDescriptors(tag);
|
||||
System.out.println(Arrays.asList(descriptors));
|
||||
}
|
||||
finally {
|
||||
DumbServiceImpl.getInstance(myProject).setDumb(false);
|
||||
}
|
||||
|
||||
doDoTest(true, false);
|
||||
}
|
||||
|
||||
public void testQualifiedAttributeReference() throws Exception {
|
||||
configureByFiles(null, BASE_PATH + "qualified.xml", BASE_PATH + "qualified.xsd");
|
||||
doDoTest(true, false);
|
||||
|
||||
@@ -38,7 +38,7 @@ public abstract class ExternalResourceManager extends SimpleModificationTracker
|
||||
public abstract void removeResource(@NotNull String url, @Nullable String version);
|
||||
|
||||
/**
|
||||
* @see #getResourceLocation(String, com.intellij.openapi.project.Project)
|
||||
* @see #getResourceLocation(String, Project)
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract String getResourceLocation(@NotNull @NonNls String url);
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.intellij.xml.impl.schema;
|
||||
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.FieldCache;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.SchemaReferencesProvider;
|
||||
import com.intellij.psi.meta.PsiMetaData;
|
||||
import com.intellij.psi.util.CachedValue;
|
||||
@@ -85,17 +85,21 @@ public class ComplexTypeDescriptor extends TypeDescriptor {
|
||||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
|
||||
private final FactoryMap<String, CachedValue<CanContainAttributeType>> myAnyAttributeCache = new ConcurrentFactoryMap<String, CachedValue<CanContainAttributeType>>() {
|
||||
@Override
|
||||
protected CachedValue<CanContainAttributeType> create(final String key) {
|
||||
return CachedValuesManager.getManager(myTag.getProject()).createCachedValue(new CachedValueProvider<CanContainAttributeType>() {
|
||||
@Override
|
||||
public Result<CanContainAttributeType> compute() {
|
||||
THashSet<PsiFile> dependencies = new THashSet<PsiFile>();
|
||||
THashSet<Object> dependencies = new THashSet<Object>();
|
||||
CanContainAttributeType type = _canContainAttribute(key, myTag, null, new THashSet<String>(), dependencies);
|
||||
if (dependencies.isEmpty()) {
|
||||
dependencies.add(myTag.getContainingFile());
|
||||
}
|
||||
if (DumbService.isDumb(myTag.getProject())) {
|
||||
dependencies.add(DumbService.getInstance(myTag.getProject()).getModificationTracker());
|
||||
}
|
||||
return Result.create(type, ArrayUtil.toObjectArray(dependencies));
|
||||
}
|
||||
}, false);
|
||||
@@ -398,7 +402,7 @@ public class ComplexTypeDescriptor extends TypeDescriptor {
|
||||
XmlTag tag,
|
||||
@Nullable String qName,
|
||||
Set<String> visited,
|
||||
@Nullable Set<PsiFile> dependencies) {
|
||||
@Nullable Set<Object> dependencies) {
|
||||
if (XmlNSDescriptorImpl.equalsToSchemaName(tag, "anyAttribute")) {
|
||||
if (dependencies != null) {
|
||||
dependencies.add(tag.getContainingFile());
|
||||
|
||||
Reference in New Issue
Block a user