mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
+1
-1
@@ -105,7 +105,7 @@ public class DefaultLibraryRootsComponentDescriptor extends LibraryRootsComponen
|
||||
}
|
||||
}
|
||||
|
||||
private class AttachSourcesDescriptor extends ChooserBasedAttachRootButtonDescriptor {
|
||||
private static class AttachSourcesDescriptor extends ChooserBasedAttachRootButtonDescriptor {
|
||||
private AttachSourcesDescriptor() {
|
||||
super(OrderRootType.SOURCES, ProjectBundle.message("module.libraries.attach.sources.button"));
|
||||
}
|
||||
|
||||
@@ -618,17 +618,20 @@ public class JavaCompletionUtil {
|
||||
if (qualifier != null) {
|
||||
final Project project = qualifier.getProject();
|
||||
final PairFunction<PsiExpression, CompletionParameters, PsiType> evaluator = refExpr.getContainingFile().getCopyableUserData(DYNAMIC_TYPE_EVALUATOR);
|
||||
PsiReferenceExpression context = refExpr;
|
||||
PsiType type = null;
|
||||
if (evaluator != null) {
|
||||
type = evaluator.fun(qualifier, parameters);
|
||||
context = null;
|
||||
}
|
||||
if (type == null) {
|
||||
type = GuessManager.getInstance(project).getControlFlowExpressionType(qualifier);
|
||||
context = refExpr;
|
||||
}
|
||||
if (type != null) {
|
||||
processor.clear();
|
||||
|
||||
return addQualifierCastingVariants(processor, refExpr, type, set);
|
||||
return addQualifierCastingVariants(processor, refExpr, type, set, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -637,13 +640,13 @@ public class JavaCompletionUtil {
|
||||
|
||||
private static PsiType addQualifierCastingVariants(JavaCompletionProcessor processor, PsiReferenceExpression refExpr,
|
||||
PsiType castTo,
|
||||
THashSet<LookupElement> set) {
|
||||
THashSet<LookupElement> set, final PsiReferenceExpression context) {
|
||||
Project project = refExpr.getProject();
|
||||
|
||||
PsiExpression qualifier = refExpr.getQualifierExpression();
|
||||
assert qualifier != null;
|
||||
final String newText = "((" + castTo.getCanonicalText() + ") " + qualifier.getText() + ")." + refExpr.getReferenceName();
|
||||
final PsiExpression newRef = JavaPsiFacade.getElementFactory(project).createExpressionFromText(newText, refExpr);
|
||||
final PsiExpression newRef = JavaPsiFacade.getElementFactory(project).createExpressionFromText(newText, context);
|
||||
((PsiReferenceExpression)newRef).processVariants(processor);
|
||||
|
||||
final LookupElement castItem = PsiTypeLookupItem.createLookupItem(castTo, refExpr);
|
||||
@@ -785,6 +788,9 @@ public class JavaCompletionUtil {
|
||||
public static boolean containsMethodCalls(@Nullable final PsiElement qualifier) {
|
||||
if (qualifier == null) return false;
|
||||
if (qualifier instanceof PsiMethodCallExpression) return true;
|
||||
if (qualifier instanceof PsiArrayAccessExpression) {
|
||||
return containsMethodCalls(((PsiArrayAccessExpression)qualifier).getArrayExpression());
|
||||
}
|
||||
return containsMethodCalls(getQualifier(qualifier));
|
||||
}
|
||||
|
||||
|
||||
@@ -349,7 +349,13 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
|
||||
if (element instanceof PomTarget) {
|
||||
addAliasingUsages((PomTarget)element, processor, options);
|
||||
}
|
||||
if (!ThrowSearchUtil.isSearchable(element) && options.isSearchForTextOccurrences && options.searchScope instanceof GlobalSearchScope) {
|
||||
final Boolean isSearchable = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
return ThrowSearchUtil.isSearchable(element);
|
||||
}
|
||||
});
|
||||
if (!isSearchable && options.isSearchForTextOccurrences && options.searchScope instanceof GlobalSearchScope) {
|
||||
// todo add to fastTrack
|
||||
processUsagesInText(element, processor, (GlobalSearchScope)options.searchScope);
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ public class TreeJavaClassChooserDialog extends AbstractTreeClassChooserDialog<P
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected BaseClassInheritorsProvider<PsiClass> getInheritorsProvider() {
|
||||
return new JavaInheritorsProvider(getProject(), getBaseClass(), getScope());
|
||||
protected BaseClassInheritorsProvider<PsiClass> getInheritorsProvider(@NotNull PsiClass baseClass) {
|
||||
return new JavaInheritorsProvider(getProject(), baseClass, getScope());
|
||||
}
|
||||
|
||||
private static class JavaInheritorsProvider extends BaseClassInheritorsProvider<PsiClass> {
|
||||
|
||||
+63
-7
@@ -28,8 +28,11 @@ import com.intellij.codeInsight.completion.JavaCompletionUtil;
|
||||
import com.intellij.codeInsight.highlighting.HighlightManager;
|
||||
import com.intellij.codeInsight.intention.impl.TypeExpression;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.codeInsight.template.*;
|
||||
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
|
||||
import com.intellij.codeInsight.template.impl.TextExpression;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.lang.LanguageRefactoringSupport;
|
||||
@@ -49,6 +52,8 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.*;
|
||||
import com.intellij.psi.impl.PsiVariableEx;
|
||||
import com.intellij.psi.impl.java.stubs.PsiModifierListStub;
|
||||
import com.intellij.psi.impl.source.tree.java.ReplaceExpressionUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
@@ -459,7 +464,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
|
||||
final Pass<OccurrencesChooser.ReplaceChoice> callback = new Pass<OccurrencesChooser.ReplaceChoice>() {
|
||||
@Override
|
||||
public void pass(OccurrencesChooser.ReplaceChoice choice) {
|
||||
public void pass(final OccurrencesChooser.ReplaceChoice choice) {
|
||||
final Ref<SmartPsiElementPointer<PsiVariable>> variable = new Ref<SmartPsiElementPointer<PsiVariable>>();
|
||||
final IntroduceVariableSettings settings =
|
||||
getSettings(project, editor, expr, occurrences, typeSelectorManager, inFinalContext, hasWriteAccess, validator, choice);
|
||||
@@ -487,35 +492,46 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
editor.putUserData(ReassignVariableUtil.DECLARATION_KEY, declarationStatement);
|
||||
editor.putUserData(ReassignVariableUtil.OCCURRENCES_KEY,
|
||||
occurrenceMarkers.toArray(new RangeMarker[occurrenceMarkers.size()]));
|
||||
final boolean cantChangeFinalModifier = hasWriteAccess || (inFinalContext && choice == OccurrencesChooser.ReplaceChoice.ALL);
|
||||
final VariableInplaceRenamer renamer = new VariableInplaceRenamer(elementToRename, editor){
|
||||
@Override
|
||||
protected void addAdditionalVariables(TemplateBuilderImpl builder) {
|
||||
final PsiTypeElement typeElement = elementToRename.getTypeElement();
|
||||
builder.replaceElement(typeElement, "Variable_Type",
|
||||
ReassignVariableUtil.createExpression(expression, typeElement.getText()), false, true);
|
||||
ReassignVariableUtil.createExpression(expression, typeElement.getText(), !cantChangeFinalModifier), false, true);
|
||||
if (!cantChangeFinalModifier) {
|
||||
builder.replaceElement(elementToRename.getModifierList(), "_FINAL_", new FinalExpression(project), false, true);
|
||||
}
|
||||
}
|
||||
};
|
||||
renamer.setAdvertisementText(
|
||||
ReassignVariableUtil.getAdvertisementText(editor, declarationStatement, elementToRename.getType(), typeSelectorManager.getTypesForAll()));
|
||||
ReassignVariableUtil.getAdvertisementText(editor, declarationStatement, elementToRename.getType(), typeSelectorManager.getTypesForAll(), !cantChangeFinalModifier));
|
||||
renamer.performInplaceRename(false, new LinkedHashSet<String>(Arrays.asList(suggestedName.names)), new Consumer<Boolean>() {
|
||||
@Override
|
||||
public void consume(Boolean apply) {
|
||||
if (apply) {
|
||||
final Document document = editor.getDocument();
|
||||
final PsiVariable psiVariable =
|
||||
PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PsiVariable.class);
|
||||
if (psiVariable != null) {
|
||||
JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_FINALS = psiVariable.hasModifierProperty(PsiModifier.FINAL);
|
||||
FinalExpression.adjustLine(psiVariable, document);
|
||||
}
|
||||
int startOffset = exprMarker.getStartOffset();
|
||||
final PsiReference referenceAt = file.findReferenceAt(startOffset);
|
||||
if (referenceAt != null && referenceAt.resolve() instanceof PsiLocalVariable) {
|
||||
startOffset = referenceAt.getElement().getTextRange().getEndOffset();
|
||||
} else {
|
||||
startOffset = editor.getDocument().getLineEndOffset(editor.getDocument().getLineNumber(startOffset));
|
||||
startOffset = document.getLineEndOffset(document.getLineNumber(startOffset));
|
||||
}
|
||||
editor.getCaretModel().moveToOffset(startOffset);
|
||||
typeSelectorManager.typeSelected(ReassignVariableUtil.getVariableType(declarationStatement));
|
||||
}
|
||||
editor.putUserData(ReassignVariableUtil.DECLARATION_KEY, null);
|
||||
for (RangeMarker occurrenceMarker : occurrenceMarkers) {
|
||||
occurrenceMarker.dispose();
|
||||
}
|
||||
editor.putUserData(ReassignVariableUtil.OCCURRENCES_KEY, null);
|
||||
typeSelectorManager.typeSelected(ReassignVariableUtil.getVariableType(declarationStatement));
|
||||
exprMarker.dispose();
|
||||
}
|
||||
});
|
||||
@@ -803,8 +819,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
replaceChoice == OccurrencesChooser.ReplaceChoice.ALL || replaceChoice == OccurrencesChooser.ReplaceChoice.NO_WRITE;
|
||||
final boolean declareFinal =
|
||||
!anyAssignmentLHS && (replaceAll &&
|
||||
declareFinalIfAll ||
|
||||
CodeStyleSettingsManager.getSettings(project).GENERATE_FINAL_LOCALS);
|
||||
declareFinalIfAll || createFinals(project));
|
||||
final boolean replaceWrite = anyAssignmentLHS && replaceChoice == OccurrencesChooser.ReplaceChoice.ALL;
|
||||
return new IntroduceVariableSettings() {
|
||||
@Override
|
||||
@@ -840,6 +855,11 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
};
|
||||
}
|
||||
|
||||
private static boolean createFinals(Project project) {
|
||||
final Boolean createFinals = JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_FINALS;
|
||||
return createFinals == null ? CodeStyleSettingsManager.getSettings(project).GENERATE_FINAL_LOCALS : createFinals.booleanValue();
|
||||
}
|
||||
|
||||
public interface Validator {
|
||||
boolean isOK(IntroduceVariableSettings dialog);
|
||||
}
|
||||
@@ -863,4 +883,40 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
conflicts.putValue(occurence, RefactoringBundle.message("introducing.variable.may.break.code.logic"));
|
||||
}
|
||||
}
|
||||
|
||||
private static class FinalExpression extends Expression {
|
||||
private final Project myProject;
|
||||
|
||||
public FinalExpression(Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result calculateResult(ExpressionContext context) {
|
||||
return new TextResult(createFinals(myProject) ? PsiKeyword.FINAL : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result calculateQuickResult(ExpressionContext context) {
|
||||
return calculateResult(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LookupElement[] calculateLookupItems(ExpressionContext context) {
|
||||
LookupElement[] lookupElements = new LookupElement[2];
|
||||
lookupElements[0] = LookupElementBuilder.create("");
|
||||
lookupElements[1] = LookupElementBuilder.create(PsiModifier.FINAL + " ");
|
||||
return lookupElements;
|
||||
}
|
||||
|
||||
public static void adjustLine(final PsiVariable psiVariable, final Document document) {
|
||||
final int modifierListOffset = psiVariable.getTextRange().getStartOffset();
|
||||
final int varLineNumber = document.getLineNumber(modifierListOffset);
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() { //adjust line indent if final was inserted and then deleted
|
||||
public void run() {
|
||||
CodeStyleManager.getInstance(psiVariable.getProject()).adjustLineIndent(document, document.getLineStartOffset(varLineNumber));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+18
-2
@@ -174,7 +174,7 @@ public class ReassignVariableUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static String getAdvertisementText(Editor editor, PsiDeclarationStatement declaration, PsiType type, PsiType[] typesForAll) {
|
||||
static String getAdvertisementText(Editor editor, PsiDeclarationStatement declaration, PsiType type, PsiType[] typesForAll, boolean canAdjustFinal) {
|
||||
final VariablesProcessor processor = findVariablesOfType(editor, declaration, type);
|
||||
final Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
|
||||
if (processor.size() > 0) {
|
||||
@@ -189,10 +189,21 @@ public class ReassignVariableUtil {
|
||||
return "Press " + shortcuts[0] + " to change type";
|
||||
}
|
||||
}
|
||||
return adjustFinalText(canAdjustFinal);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String adjustFinalText(boolean canBeFinalAdjusted) {
|
||||
if (canBeFinalAdjusted) {
|
||||
final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts("PreviousTemplateVariable");
|
||||
if (shortcuts.length > 0) {
|
||||
return "Press " + shortcuts[0] + " to adjust final modifier";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Expression createExpression(final TypeExpression expression, final String defaultType) {
|
||||
public static Expression createExpression(final TypeExpression expression, final String defaultType, final boolean canBeFinalAdjusted) {
|
||||
return new Expression() {
|
||||
@Override
|
||||
public com.intellij.codeInsight.template.Result calculateResult(ExpressionContext context) {
|
||||
@@ -208,6 +219,11 @@ public class ReassignVariableUtil {
|
||||
public LookupElement[] calculateLookupItems(ExpressionContext context) {
|
||||
return expression.calculateLookupItems(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdvertisingText() {
|
||||
return adjustFinalText(canBeFinalAdjusted);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,13 @@ public class InlineUtil {
|
||||
|
||||
PsiExpression[] initializers = arrayInitializer.getInitializers();
|
||||
if (initializers.length > 0) {
|
||||
argumentList.addRange(initializers[0], initializers[initializers.length - 1]);
|
||||
PsiElement lastInitializerSibling = initializers[initializers.length - 1];
|
||||
while (lastInitializerSibling != null) {
|
||||
final PsiElement nextSibling = lastInitializerSibling.getNextSibling();
|
||||
if (nextSibling.getNode().getElementType() == JavaTokenType.RBRACE) break;
|
||||
lastInitializerSibling = nextSibling;
|
||||
}
|
||||
argumentList.addRange(initializers[0], lastInitializerSibling);
|
||||
}
|
||||
args[args.length - 1].delete();
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
void foo(String... strs){}
|
||||
void bar() {
|
||||
foo(new S<caret>tring[] {
|
||||
"edwqefwe", //my comment
|
||||
});
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
void foo(String... strs){}
|
||||
void bar() {
|
||||
foo("edwqefwe", //my comment
|
||||
);
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.codeInspection;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInspection.miscGenerics.RedundantArrayForVarargsCallInspection;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.testFramework.fixtures.*;
|
||||
import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: 11/13/10
|
||||
*/
|
||||
public class RedundantArray4VarargsCallInspectionTest extends UsefulTestCase {
|
||||
protected CodeInsightTestFixture myFixture;
|
||||
private RedundantArrayForVarargsCallInspection myInspection;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
|
||||
TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder = factory.createLightFixtureBuilder(new DefaultLightProjectDescriptor());
|
||||
final IdeaProjectTestFixture fixture = fixtureBuilder.getFixture();
|
||||
myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(fixture,
|
||||
new LightTempDirTestFixtureImpl(true));
|
||||
myInspection = new RedundantArrayForVarargsCallInspection();
|
||||
myFixture.enableInspections(myInspection);
|
||||
myFixture.setUp();
|
||||
myFixture.setTestDataPath(getTestDataPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
myFixture.tearDown();
|
||||
myFixture = null;
|
||||
myInspection = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testPreserveComments() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.launchAction(assertOneElement(myFixture.filterAvailableIntentions(InspectionsBundle.message("inspection.redundant.array.creation.quickfix"))));
|
||||
myFixture.checkResultByFile(getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath() + "/inspection/redundantArrayForVarargs/quickFix";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,14 +15,16 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.util.ThreeState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class AlwaysFocusLookup extends CompletionConfidence {
|
||||
@NotNull
|
||||
@Override
|
||||
public Boolean shouldFocusLookup(@NotNull CompletionParameters parameters) {
|
||||
return true;
|
||||
public ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters) {
|
||||
return ThreeState.YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.ThreeState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -25,11 +26,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public abstract class CompletionConfidence {
|
||||
|
||||
@Nullable
|
||||
public abstract Boolean shouldFocusLookup(@NotNull CompletionParameters parameters);
|
||||
@NotNull
|
||||
public abstract ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters);
|
||||
|
||||
@Nullable
|
||||
public Boolean shouldSkipAutopopup(@Nullable PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
|
||||
return null;
|
||||
@NotNull
|
||||
public ThreeState shouldSkipAutopopup(@Nullable PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
|
||||
return ThreeState.UNSURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.completion;
|
||||
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ThreeState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class UnfocusedComments extends CompletionConfidence {
|
||||
@NotNull
|
||||
@Override
|
||||
public ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters) {
|
||||
if (PsiTreeUtil.getParentOfType(parameters.getPosition(), PsiComment.class) != null) {
|
||||
return ThreeState.NO;
|
||||
}
|
||||
return ThreeState.UNSURE;
|
||||
}
|
||||
}
|
||||
+6
-4
@@ -17,27 +17,29 @@ package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiNameIdentifierOwner;
|
||||
import com.intellij.util.ThreeState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class UnfocusedNameIdentifier extends CompletionConfidence {
|
||||
@NotNull
|
||||
@Override
|
||||
public Boolean shouldFocusLookup(@NotNull CompletionParameters parameters) {
|
||||
public ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters) {
|
||||
final PsiElement position = parameters.getPosition();
|
||||
final PsiElement parent = position.getParent();
|
||||
if (parent instanceof PsiNameIdentifierOwner) {
|
||||
final PsiElement nameIdentifier = ((PsiNameIdentifierOwner)parent).getNameIdentifier();
|
||||
if (nameIdentifier == position) {
|
||||
return false;
|
||||
return ThreeState.NO;
|
||||
}
|
||||
|
||||
if (nameIdentifier != null && position.getTextRange().equals(nameIdentifier.getTextRange())) {
|
||||
//sometimes name identifiers are non-physical (e.g. Groovy)
|
||||
return false;
|
||||
return ThreeState.NO;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return ThreeState.UNSURE;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-6
@@ -68,6 +68,7 @@ import com.intellij.psi.util.PsiUtilBase;
|
||||
import com.intellij.reference.SoftReference;
|
||||
import com.intellij.ui.LightweightHint;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.ThreeState;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -207,8 +208,9 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
|
||||
Language language = elementAt != null ? PsiUtilBase.findLanguageFromElement(elementAt):psiFile.getLanguage();
|
||||
|
||||
for (CompletionConfidence confidence : CompletionConfidenceEP.forLanguage(language)) {
|
||||
final Boolean result = confidence.shouldSkipAutopopup(elementAt, psiFile, offset); // TODO: Peter Lazy API
|
||||
if (result == Boolean.TRUE) return;
|
||||
final ThreeState result = confidence.shouldSkipAutopopup(elementAt, psiFile, offset); // TODO: Peter Lazy API
|
||||
if (result == ThreeState.YES) return;
|
||||
if (result == ThreeState.NO) break;
|
||||
}
|
||||
} else {
|
||||
CommandProcessor.getInstance().executeCommand(project, initCmd, null, null);
|
||||
@@ -224,9 +226,9 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
|
||||
|
||||
final Language language = PsiUtilBase.getLanguageAtOffset(parameters.getPosition().getContainingFile(), parameters.getOffset());
|
||||
for (CompletionConfidence confidence : CompletionConfidenceEP.forLanguage(language)) {
|
||||
final Boolean result = confidence.shouldFocusLookup(parameters);
|
||||
if (result != null) {
|
||||
return result;
|
||||
final ThreeState result = confidence.shouldFocusLookup(parameters);
|
||||
if (result != ThreeState.UNSURE) {
|
||||
return result == ThreeState.YES;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -382,7 +384,10 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
|
||||
final CompletionContext newContext = ref.get().getFirst();
|
||||
insertedElement.putUserData(CompletionContext.COMPLETION_CONTEXT_KEY, newContext);
|
||||
|
||||
return new CompletionParameters(insertedElement, newContext.file, myCompletionType, newContext.getStartOffset(), invocationCount);
|
||||
final int offset = newContext.getStartOffset();
|
||||
LOG.assertTrue(insertedElement.getContainingFile().findElementAt(offset) == insertedElement, "wrong offset");
|
||||
LOG.assertTrue(insertedElement.getContainingFile().getText().substring(insertedElement.getTextRange().getStartOffset(), insertedElement.getTextRange().getEndOffset()).equals(insertedElement.getText()), "wrong text");
|
||||
return new CompletionParameters(insertedElement, newContext.file, myCompletionType, offset, invocationCount);
|
||||
}
|
||||
|
||||
private AutoCompletionDecision shouldAutoComplete(
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.lookup.*;
|
||||
import com.intellij.codeInsight.template.Template;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.paths.PsiDynaReference;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -193,6 +194,10 @@ public class CompletionData {
|
||||
public static String findPrefixStatic(final PsiElement insertedElement, final int offsetInFile, ElementPattern<Character> prefixStartTrim) {
|
||||
if(insertedElement == null) return "";
|
||||
|
||||
final Document document = insertedElement.getContainingFile().getViewProvider().getDocument();
|
||||
assert document != null;
|
||||
LOG.assertTrue(!PsiDocumentManager.getInstance(insertedElement.getProject()).isUncommited(document), "Uncommitted");
|
||||
|
||||
final String prefix = getReferencePrefix(insertedElement, offsetInFile);
|
||||
if (prefix != null) return prefix;
|
||||
|
||||
|
||||
+5
-4
@@ -102,11 +102,8 @@ public class LegacyCompletionContributor extends CompletionContributor {
|
||||
}
|
||||
}
|
||||
else if (ref instanceof PsiDynaReference) {
|
||||
int offset = startOffset - ref.getElement().getTextRange().getStartOffset();
|
||||
for (final PsiReference reference : ((PsiDynaReference<?>)ref).getReferences()) {
|
||||
if (ReferenceRange.containsOffsetInElement(reference, offset)) {
|
||||
processReference(result, startOffset, consumer, reference);
|
||||
}
|
||||
processReference(result, startOffset, consumer, reference);
|
||||
}
|
||||
}
|
||||
else if (ref != null) {
|
||||
@@ -119,6 +116,10 @@ public class LegacyCompletionContributor extends CompletionContributor {
|
||||
final PairConsumer<PsiReference, CompletionResultSet> consumer,
|
||||
final PsiReference reference) {
|
||||
final int offsetInElement = startOffset - reference.getElement().getTextRange().getStartOffset();
|
||||
if (!ReferenceRange.containsOffsetInElement(reference, offsetInElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String prefix = reference.getElement().getText().substring(reference.getRangeInElement().getStartOffset(), offsetInElement);
|
||||
consumer.consume(reference, result.withPrefixMatcher(prefix));
|
||||
}
|
||||
|
||||
@@ -57,6 +57,13 @@ public class StatusBarUpdater implements Disposable {
|
||||
updateLater();
|
||||
}
|
||||
});
|
||||
|
||||
project.getMessageBus().connect().subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, new DaemonCodeAnalyzer.DaemonListener() {
|
||||
@Override
|
||||
public void daemonFinished() {
|
||||
updateLater();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateLater() {
|
||||
|
||||
@@ -26,8 +26,10 @@ import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorBundle;
|
||||
import com.intellij.openapi.editor.EditorModificationUtil;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
@@ -55,7 +57,7 @@ public class TypedHandler implements TypedActionHandler {
|
||||
|
||||
final LookupElement currentItem = lookup.getCurrentItem();
|
||||
final CharFilter.Result result = getLookupAction(charTyped, currentItem, lookup);
|
||||
|
||||
CommandProcessor.getInstance().setCurrentCommandName(EditorBundle.message("typing.in.editor.command.name"));
|
||||
lookup.performGuardedChange(new Runnable() {
|
||||
public void run() {
|
||||
EditorModificationUtil.deleteSelectedText(editor);
|
||||
|
||||
+10
-10
@@ -34,10 +34,7 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.FileStatusListener;
|
||||
import com.intellij.openapi.vcs.FileStatusManager;
|
||||
@@ -53,6 +50,7 @@ import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -239,7 +237,7 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
}
|
||||
pass.setProgressLimit(progressLimit);
|
||||
final StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
|
||||
String oldInfo = saveStatusBarInfo(statusBar);
|
||||
Pair<String, String> oldInfo = saveStatusBarInfo(statusBar);
|
||||
try {
|
||||
for (final VirtualFile virtualFile : files) {
|
||||
progress.checkCanceled();
|
||||
@@ -313,19 +311,21 @@ public class WolfTheProblemSolverImpl extends WolfTheProblemSolver {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static String saveStatusBarInfo(final StatusBar statusBar) {
|
||||
String oldInfo = null;
|
||||
@Nullable
|
||||
private static Pair<String, String> saveStatusBarInfo(final StatusBar statusBar) {
|
||||
Pair<String, String> oldInfo = null;
|
||||
if (statusBar instanceof StatusBarEx) {
|
||||
oldInfo = statusBar.getInfo();
|
||||
oldInfo = Pair.create(statusBar.getInfo(), ((StatusBarEx)statusBar).getInfoRequestor());
|
||||
}
|
||||
|
||||
return oldInfo;
|
||||
}
|
||||
|
||||
private static void restoreStatusBarInfo(final StatusBar statusBar, final String oldInfo) {
|
||||
private static void restoreStatusBarInfo(final StatusBar statusBar, final Pair<String, String> oldInfo) {
|
||||
if (statusBar instanceof StatusBarEx) {
|
||||
LaterInvocator.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
statusBar.setInfo(oldInfo);
|
||||
statusBar.setInfo(oldInfo.first, oldInfo.second);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.Update;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.FocusManager;
|
||||
import javax.swing.*;
|
||||
@@ -318,7 +319,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
final Document history = myHistoryViewer.getDocument();
|
||||
final MarkupModel markupModel = history.getMarkupModel(myProject);
|
||||
final int offset = history.getTextLength();
|
||||
history.insertString(offset, text);
|
||||
appendToHistoryDocument(history, text);
|
||||
markupModel.addRangeHighlighter(offset,
|
||||
history.getTextLength(),
|
||||
HighlighterLayer.SYNTAX,
|
||||
@@ -359,15 +360,15 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
private String addTextRangeToHistory(TextRange textRange, final EditorEx consoleEditor) {
|
||||
final DocumentImpl history = (DocumentImpl)myHistoryViewer.getDocument();
|
||||
final MarkupModel markupModel = history.getMarkupModel(myProject);
|
||||
history.insertString(history.getTextLength(), myPrompt);
|
||||
appendToHistoryDocument(history, myPrompt);
|
||||
markupModel.addRangeHighlighter(history.getTextLength() - myPrompt.length(), history.getTextLength(), HighlighterLayer.SYNTAX,
|
||||
ConsoleViewContentType.USER_INPUT.getAttributes(),
|
||||
HighlighterTargetArea.EXACT_RANGE);
|
||||
|
||||
int offset = history.getTextLength();
|
||||
final String text = consoleEditor.getDocument().getText(textRange);
|
||||
history.insertString(offset, text);
|
||||
offset = history.getTextLength() - text.length(); //offset can be changed after text trimming after insert due to buffer constraints
|
||||
//offset can be changed after text trimming after insert due to buffer constraints
|
||||
appendToHistoryDocument(history, text);
|
||||
int offset = history.getTextLength() - text.length();
|
||||
final HighlighterIterator iterator = consoleEditor.getHighlighter().createIterator(0);
|
||||
while (!iterator.atEnd()) {
|
||||
final int localOffset = textRange.getStartOffset();
|
||||
@@ -382,10 +383,16 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
duplicateHighlighters(markupModel, consoleEditor.getDocument().getMarkupModel(myProject), offset, textRange);
|
||||
duplicateHighlighters(markupModel, consoleEditor.getMarkupModel(), offset, textRange);
|
||||
}
|
||||
if (!text.endsWith("\n")) history.insertString(history.getTextLength(), "\n");
|
||||
if (!text.endsWith("\n")) {
|
||||
appendToHistoryDocument(history, "\n");
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
protected void appendToHistoryDocument(@NotNull Document history, @NotNull String text) {
|
||||
history.insertString(history.getTextLength(), text);
|
||||
}
|
||||
|
||||
private static void duplicateHighlighters(MarkupModel to, MarkupModel from, int offset, TextRange textRange) {
|
||||
for (RangeHighlighter rangeHighlighter : from.getAllHighlighters()) {
|
||||
final int localOffset = textRange.getStartOffset();
|
||||
|
||||
@@ -454,17 +454,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
myDeferredUserInput.append(s);
|
||||
}
|
||||
|
||||
boolean needNew = true;
|
||||
if (!myTokens.isEmpty()) {
|
||||
final TokenInfo lastToken = myTokens.get(myTokens.size() - 1);
|
||||
if (lastToken.contentType == contentType) {
|
||||
lastToken.endOffset = myContentSize; // optimization
|
||||
needNew = false;
|
||||
}
|
||||
}
|
||||
if (needNew) {
|
||||
myTokens.add(new TokenInfo(contentType, myContentSize - s.length(), myContentSize));
|
||||
}
|
||||
addToken(s.length(), contentType);
|
||||
|
||||
if (s.indexOf('\n') >= 0 || s.indexOf('\r') >= 0) {
|
||||
if (contentType == ConsoleViewContentType.USER_INPUT) {
|
||||
@@ -478,6 +468,25 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
}
|
||||
}
|
||||
|
||||
protected void beforeExternalAddContentToDocument(int length, ConsoleViewContentType contentType) {
|
||||
myContentSize+=length;
|
||||
addToken(length, contentType);
|
||||
}
|
||||
|
||||
private void addToken(int length, ConsoleViewContentType contentType) {
|
||||
boolean needNew = true;
|
||||
if (!myTokens.isEmpty()) {
|
||||
final TokenInfo lastToken = myTokens.get(myTokens.size() - 1);
|
||||
if (lastToken.contentType == contentType) {
|
||||
lastToken.endOffset = myContentSize; // optimization
|
||||
needNew = false;
|
||||
}
|
||||
}
|
||||
if (needNew) {
|
||||
myTokens.add(new TokenInfo(contentType, myContentSize - length, myContentSize));
|
||||
}
|
||||
}
|
||||
|
||||
private ModalityState getStateForUpdate() {
|
||||
return myStateForUpdate != null ? myStateForUpdate.compute() : ModalityState.stateForComponent(this);
|
||||
}
|
||||
@@ -938,6 +947,10 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
myFoldingAlarm.cancelAllRequests();
|
||||
final Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
if (myEditor == null || myEditor.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
assertIsDispatchThread();
|
||||
final FoldingModel model = myEditor.getFoldingModel();
|
||||
final Runnable operation = new Runnable() {
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.intellij.codeInsight.highlighting.HighlightManager;
|
||||
import com.intellij.codeInsight.highlighting.HighlightManagerImpl;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.find.impl.FindManagerImpl;
|
||||
import com.intellij.ide.ui.LafManager;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -55,6 +54,7 @@ import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.components.panels.NonOpaquePanel;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -114,8 +114,7 @@ public class EditorSearchComponent extends JPanel implements DataProvider {
|
||||
protected void paintBorder(final Graphics g) {
|
||||
super.paintBorder(g);
|
||||
|
||||
final LafManager lafManager = LafManager.getInstance();
|
||||
if (!(lafManager.isUnderAquaLookAndFeel() || lafManager.isUnderQuaquaLookAndFeel()) && isFocusOwner()) {
|
||||
if (!(UIUtil.isUnderAquaLookAndFeel() || UIUtil.isUnderQuaquaLookAndFeel()) && isFocusOwner()) {
|
||||
final Rectangle bounds = getBounds();
|
||||
g.setColor(FOCUS_CATCHER_COLOR);
|
||||
g.drawRect(0, 0, bounds.width - 1, bounds.height - 1);
|
||||
|
||||
@@ -260,12 +260,12 @@ abstract public class AbstractTreeClassChooserDialog<T extends PsiNamedElement>
|
||||
|
||||
protected ChooseByNameModel createChooseByNameModel() {
|
||||
if (myBaseClass == null) {
|
||||
return new MyGotoClassModel(myProject, this);
|
||||
return new MyGotoClassModel<T>(myProject, this);
|
||||
}
|
||||
else {
|
||||
BaseClassInheritorsProvider<T> inheritorsProvider = getInheritorsProvider();
|
||||
BaseClassInheritorsProvider<T> inheritorsProvider = getInheritorsProvider(myBaseClass);
|
||||
if (inheritorsProvider != null) {
|
||||
return new SubclassGotoClassModel(myProject, this, inheritorsProvider);
|
||||
return new SubclassGotoClassModel<T>(myProject, this, inheritorsProvider);
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("inheritors provider is null");
|
||||
@@ -273,8 +273,16 @@ abstract public class AbstractTreeClassChooserDialog<T extends PsiNamedElement>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sense only in case of not null base class.
|
||||
*
|
||||
* @param baseClass
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract BaseClassInheritorsProvider<T> getInheritorsProvider();
|
||||
protected BaseClassInheritorsProvider<T> getInheritorsProvider(@NotNull T baseClass) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void handleSelectionChanged() {
|
||||
T selection = calcSelectedClass();
|
||||
|
||||
+27
-2
@@ -15,8 +15,11 @@
|
||||
*/
|
||||
package com.intellij.refactoring.changeSignature;
|
||||
|
||||
import com.intellij.ProjectTopics;
|
||||
import com.intellij.codeInsight.template.TemplateManager;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.components.ProjectComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -29,17 +32,25 @@ import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.event.EditorFactoryEvent;
|
||||
import com.intellij.openapi.editor.event.EditorFactoryListener;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.TextEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootEvent;
|
||||
import com.intellij.openapi.roots.ModuleRootListener;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
@@ -65,6 +76,21 @@ public class ChangeSignatureGestureDetector extends PsiTreeChangeAdapter impleme
|
||||
myFileEditorManager = fileEditorManager;
|
||||
myProject = project;
|
||||
myTemplateManager = templateManager;
|
||||
project.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
|
||||
public void beforeRootsChange(ModuleRootEvent event) {
|
||||
final Set<PsiFile> files = new HashSet<PsiFile>(myListenerMap.keySet());
|
||||
for (PsiFile psiFile : files) {
|
||||
removeDocListener(myPsiDocumentManager.getDocument(psiFile), psiFile);
|
||||
}
|
||||
}
|
||||
|
||||
public void rootsChanged(ModuleRootEvent event) {
|
||||
final FileDocumentManager documentManager = FileDocumentManager.getInstance();
|
||||
for (VirtualFile file : myFileEditorManager.getOpenFiles()) {
|
||||
addDocListener(documentManager.getDocument(file));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static ChangeSignatureGestureDetector getInstance(Project project){
|
||||
@@ -126,10 +152,9 @@ public class ChangeSignatureGestureDetector extends PsiTreeChangeAdapter impleme
|
||||
@Override
|
||||
public void projectOpened() {
|
||||
myPsiManager.addPsiTreeChangeListener(this);
|
||||
EditorFactory.getInstance().addEditorFactoryListener(this);
|
||||
EditorFactory.getInstance().addEditorFactoryListener(this, myProject);
|
||||
Disposer.register(myProject, new Disposable() {
|
||||
public void dispose() {
|
||||
EditorFactory.getInstance().removeEditorFactoryListener(ChangeSignatureGestureDetector.this);
|
||||
myPsiManager.removePsiTreeChangeListener(ChangeSignatureGestureDetector.this);
|
||||
LOG.assertTrue(myListenerMap.isEmpty(), myListenerMap);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,14 @@ public abstract class LafManager {
|
||||
|
||||
public abstract UIManager.LookAndFeelInfo getCurrentLookAndFeel();
|
||||
|
||||
/**
|
||||
* @deprecated use {@link com.intellij.util.ui.UIUtil#isUnderAquaLookAndFeel()}
|
||||
*/
|
||||
public abstract boolean isUnderAquaLookAndFeel();
|
||||
|
||||
/**
|
||||
* @deprecated use {@link com.intellij.util.ui.UIUtil#isUnderQuaquaLookAndFeel()}
|
||||
*/
|
||||
public abstract boolean isUnderQuaquaLookAndFeel();
|
||||
|
||||
public abstract void setCurrentLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.ide.ui.LafManager;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.CommonShortcuts;
|
||||
@@ -157,7 +156,7 @@ public class SearchTextField extends JPanel {
|
||||
}
|
||||
|
||||
private static boolean hasNativeLeopardSearchControl() {
|
||||
return SystemInfo.isMacOSLeopard && LafManager.getInstance().isUnderAquaLookAndFeel();
|
||||
return SystemInfo.isMacOSLeopard && UIUtil.isUnderAquaLookAndFeel();
|
||||
}
|
||||
|
||||
public void addDocumentListener(DocumentListener listener) {
|
||||
|
||||
@@ -50,4 +50,7 @@ public interface StatusBarEx extends StatusBar, Disposable {
|
||||
|
||||
Dimension getSize();
|
||||
boolean isVisible();
|
||||
|
||||
@Nullable
|
||||
String getInfoRequestor();
|
||||
}
|
||||
|
||||
@@ -103,6 +103,11 @@ public final class TestWindowManager extends WindowManagerEx implements Applicat
|
||||
public void setInfo(@Nullable String s, @Nullable String requestor) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInfoRequestor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
+10
-1
@@ -23,6 +23,7 @@ import com.intellij.openapi.ui.popup.BalloonHandler;
|
||||
import com.intellij.openapi.ui.popup.ListPopup;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.CustomStatusBarWidget;
|
||||
@@ -69,6 +70,7 @@ public class IdeStatusBarImpl extends JComponent implements StatusBarEx {
|
||||
private JPanel myCenterPanel;
|
||||
|
||||
private String myInfo;
|
||||
private String myRequestor;
|
||||
|
||||
private List<String> myCustomComponentIds = new ArrayList<String>();
|
||||
|
||||
@@ -377,7 +379,9 @@ public class IdeStatusBarImpl extends JComponent implements StatusBarEx {
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
public void run() {
|
||||
if (myInfoAndProgressPanel != null) {
|
||||
myInfo = myInfoAndProgressPanel.setText(s, requestor);
|
||||
Pair<String,String> pair = myInfoAndProgressPanel.setText(s, requestor);
|
||||
myInfo = pair.first;
|
||||
myRequestor = pair.second;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -387,6 +391,11 @@ public class IdeStatusBarImpl extends JComponent implements StatusBarEx {
|
||||
return myInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInfoRequestor() {
|
||||
return myRequestor;
|
||||
}
|
||||
|
||||
public void addProgress(ProgressIndicatorEx indicator, TaskInfo info) {
|
||||
myInfoAndProgressPanel.addProgress(indicator, info);
|
||||
}
|
||||
|
||||
+11
-5
@@ -16,7 +16,9 @@
|
||||
package com.intellij.openapi.wm.impl.status;
|
||||
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.progress.TaskInfo;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
@@ -24,6 +26,7 @@ import com.intellij.openapi.ui.popup.Balloon;
|
||||
import com.intellij.openapi.ui.popup.BalloonHandler;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.util.MultiValuesMap;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.CustomStatusBarWidget;
|
||||
@@ -49,7 +52,10 @@ import javax.swing.event.HyperlinkListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidget {
|
||||
private final ProcessPopup myPopup;
|
||||
@@ -330,17 +336,17 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge
|
||||
myRefreshAndInfoPanel.repaint();
|
||||
}
|
||||
|
||||
public String setText(final String text, final String requestor) {
|
||||
public Pair<String, String> setText(final String text, final String requestor) {
|
||||
if (text == null || text.length() == 0) {
|
||||
if ((requestor != null && !requestor.equals(myCurrentRequestor))
|
||||
|| (myCurrentRequestor != null && !myCurrentRequestor.equals(requestor))) {
|
||||
return myInfoPanel.getText();
|
||||
return Pair.create(myInfoPanel.getText(), myCurrentRequestor);
|
||||
}
|
||||
}
|
||||
|
||||
myInfoPanel.setText(text);
|
||||
myCurrentRequestor = requestor;
|
||||
return text;
|
||||
return Pair.create(text, requestor);
|
||||
}
|
||||
|
||||
public void setRefreshVisible(final boolean visible) {
|
||||
|
||||
+1
-2
@@ -16,7 +16,6 @@
|
||||
package com.intellij.openapi.wm.impl.status;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.ui.LafManager;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.progress.TaskInfo;
|
||||
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
|
||||
@@ -105,7 +104,7 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di
|
||||
myComponent.add(myProcessName, BorderLayout.NORTH);
|
||||
final Font font = myProcessName.getFont();
|
||||
|
||||
final boolean aqua = LafManager.getInstance().isUnderAquaLookAndFeel();
|
||||
final boolean aqua = UIUtil.isUnderAquaLookAndFeel();
|
||||
|
||||
int size = font.getSize() - (aqua ? 4 : 2);
|
||||
if (size < (aqua ? 8 : 10)) {
|
||||
|
||||
@@ -461,3 +461,4 @@ rename.public.class.family=Rename Public Class
|
||||
rename.public.class.text=Rename class ''{0}'' to ''{1}''
|
||||
rename.named.element.text=Rename ''{0}'' to ''{1}''
|
||||
dialog.edit.template.checkbox.html.text=HTML Text
|
||||
dialog.edit.template.checkbox.xsl.text=XSL Text
|
||||
|
||||
@@ -2,5 +2,5 @@ license.agreement.title=License Agreement
|
||||
license.agreement.title.for=License Agreement for {0}
|
||||
button.ok=OK
|
||||
button.cancel=Cancel
|
||||
license.agreement.prompt=Please read the following license agreement carefully.\nTo proceed you must agree to all terms of this license\nby checking the checkbox
|
||||
license.agreement.prompt=<html><body>Please read the following license agreement carefully.<br>To proceed you must agree to all terms of this license by checking the checkbox.</html></body>
|
||||
license.agreement.accept.checkbox=Accept all terms of the license
|
||||
@@ -243,6 +243,7 @@
|
||||
|
||||
<liveTemplateContext implementation="com.intellij.codeInsight.template.HtmlTextContextType"/>
|
||||
<liveTemplateContext implementation="com.intellij.codeInsight.template.HtmlContextType"/>
|
||||
<liveTemplateContext implementation="com.intellij.codeInsight.template.XslTextContextType"/>
|
||||
<liveTemplateContext implementation="com.intellij.codeInsight.template.XmlContextType"/>
|
||||
|
||||
<errorQuickFixProvider implementation="com.intellij.codeInsight.daemon.impl.analysis.XmlErrorQuickFixProvider"/>
|
||||
|
||||
@@ -79,6 +79,7 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static VirtualFile[] getSourceRootsForModuleAndDependencies(@NotNull Module module) {
|
||||
Set<VirtualFile> result = new HashSet<VirtualFile>();
|
||||
fillSourceRoots(module, new HashSet<Module>(), result);
|
||||
|
||||
@@ -51,6 +51,9 @@ public abstract class AndroidResourceDomFileDescription<T extends DomElement> ex
|
||||
public boolean isMyFile(@NotNull final XmlFile file, @Nullable Module module) {
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
public Boolean compute() {
|
||||
if (file.getProject().isDisposed()) {
|
||||
return false;
|
||||
}
|
||||
for (String resourceType : myResourceTypes) {
|
||||
if (ResourceManager.isInResourceSubdirectory(file, resourceType)) {
|
||||
return AndroidFacet.getInstance(file) != null;
|
||||
|
||||
@@ -74,17 +74,18 @@ public class AndroidRootUtil {
|
||||
@Nullable
|
||||
public static VirtualFile getFileByRelativeModulePath(Module module, String relativePath, boolean lookInContentRoot) {
|
||||
String moduleDirPath = new File(module.getModuleFilePath()).getParent();
|
||||
if (moduleDirPath == null) return null;
|
||||
String absPath = FileUtil.toSystemIndependentName(moduleDirPath + relativePath);
|
||||
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(absPath);
|
||||
if (file != null) {
|
||||
return file;
|
||||
if (moduleDirPath != null) {
|
||||
String absPath = FileUtil.toSystemIndependentName(moduleDirPath + relativePath);
|
||||
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(absPath);
|
||||
if (file != null) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
if (lookInContentRoot) {
|
||||
for (VirtualFile contentRoot : ModuleRootManager.getInstance(module).getContentRoots()) {
|
||||
absPath = FileUtil.toSystemIndependentName(contentRoot.getPath() + relativePath);
|
||||
file = LocalFileSystem.getInstance().findFileByPath(absPath);
|
||||
String absPath = FileUtil.toSystemIndependentName(contentRoot.getPath() + relativePath);
|
||||
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(absPath);
|
||||
if (file != null) {
|
||||
return file;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.android.facet.AndroidFacet;
|
||||
@@ -34,6 +35,7 @@ import org.jetbrains.android.sdk.AndroidPlatform;
|
||||
import org.jetbrains.android.sdk.AndroidSdk;
|
||||
import org.jetbrains.android.sdk.EmptySdkLog;
|
||||
import org.jetbrains.android.util.AndroidUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.importing.FacetImporter;
|
||||
import org.jetbrains.idea.maven.importing.MavenModifiableModelsProvider;
|
||||
@@ -139,11 +141,12 @@ public class AndroidFacetImporter extends FacetImporter<AndroidFacet, AndroidFac
|
||||
}
|
||||
|
||||
private void configurePaths(AndroidFacet facet, MavenProject project) {
|
||||
String modulePath = facet.getModule().getModuleFilePath();
|
||||
Module module = facet.getModule();
|
||||
String modulePath = module.getModuleFilePath();
|
||||
String moduleDirPath = FileUtil.toSystemIndependentName(new File(modulePath).getParent());
|
||||
AndroidFacetConfiguration configuration = facet.getConfiguration();
|
||||
|
||||
String resFolderRelPath = getPathFromConfig(project, moduleDirPath, "resourceDirectory");
|
||||
String resFolderRelPath = getPathFromConfig(module, project, moduleDirPath, "resourceDirectory", true, true);
|
||||
if (resFolderRelPath != null) {
|
||||
configuration.RES_FOLDER_RELATIVE_PATH = '/' + resFolderRelPath;
|
||||
}
|
||||
@@ -165,33 +168,61 @@ public class AndroidFacetImporter extends FacetImporter<AndroidFacet, AndroidFac
|
||||
}
|
||||
}
|
||||
else {
|
||||
String resOverlayFolderRelPath = getPathFromConfig(project, moduleDirPath, "resourceOverlayDirectory");
|
||||
String resOverlayFolderRelPath = getPathFromConfig(module, project, moduleDirPath, "resourceOverlayDirectory", true, true);
|
||||
if (resOverlayFolderRelPath != null) {
|
||||
configuration.RES_OVERLAY_FOLDERS = new String[]{'/' + resOverlayFolderRelPath};
|
||||
}
|
||||
}
|
||||
|
||||
String assetsFolderRelPath = getPathFromConfig(project, moduleDirPath, "assetsDirectory");
|
||||
if (!configuration.USE_CUSTOM_APK_RESOURCE_FOLDER) {
|
||||
// it may be already configured in setupFacet()
|
||||
String resFolderForCompilerRelPath = getPathFromConfig(module, project, moduleDirPath, "resourceDirectory", false, true);
|
||||
if (resFolderForCompilerRelPath != null && !resFolderForCompilerRelPath.equals(resFolderRelPath)) {
|
||||
configuration.USE_CUSTOM_APK_RESOURCE_FOLDER = true;
|
||||
configuration.CUSTOM_APK_RESOURCE_FOLDER = '/' + resFolderForCompilerRelPath;
|
||||
}
|
||||
}
|
||||
|
||||
String assetsFolderRelPath = getPathFromConfig(module, project, moduleDirPath, "assetsDirectory", false, true);
|
||||
if (assetsFolderRelPath != null) {
|
||||
configuration.ASSETS_FOLDER_RELATIVE_PATH = '/' + assetsFolderRelPath;
|
||||
}
|
||||
|
||||
String manifestFileRelPath = getPathFromConfig(project, moduleDirPath, "androidManifestFile");
|
||||
String manifestFileRelPath = getPathFromConfig(module, project, moduleDirPath, "androidManifestFile", true, false);
|
||||
if (manifestFileRelPath != null) {
|
||||
configuration.MANIFEST_FILE_RELATIVE_PATH = '/' + manifestFileRelPath;
|
||||
}
|
||||
|
||||
String nativeLibsFolderRelPath = getPathFromConfig(project, moduleDirPath, "nativeLibrariesDirectory");
|
||||
String manifestFileForCompilerRelPath = getPathFromConfig(module, project, moduleDirPath, "androidManifestFile", false, false);
|
||||
if (manifestFileForCompilerRelPath != null && !manifestFileForCompilerRelPath.equals(manifestFileRelPath)) {
|
||||
configuration.USE_CUSTOM_COMPILER_MANIFEST = true;
|
||||
configuration.CUSTOM_COMPILER_MANIFEST = '/' + manifestFileForCompilerRelPath;
|
||||
}
|
||||
|
||||
String nativeLibsFolderRelPath = getPathFromConfig(module, project, moduleDirPath, "nativeLibrariesDirectory", false, true);
|
||||
if (nativeLibsFolderRelPath != null) {
|
||||
configuration.LIBS_FOLDER_RELATIVE_PATH = '/' + nativeLibsFolderRelPath;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getPathFromConfig(MavenProject project, String moduleDirPath, String configTagName) {
|
||||
private String getPathFromConfig(Module module,
|
||||
MavenProject project,
|
||||
String moduleDirPath,
|
||||
String configTagName,
|
||||
boolean inResourceDir,
|
||||
boolean directory) {
|
||||
String resourceDir = findConfigValue(project, configTagName);
|
||||
if (resourceDir != null) {
|
||||
String resFolderRelPath = getRelativePath(moduleDirPath, makePath(project, resourceDir));
|
||||
String path = makePath(project, resourceDir);
|
||||
if (inResourceDir) {
|
||||
MyResourceProcessor processor = new MyResourceProcessor(path, directory);
|
||||
AndroidMavenProviderImpl.processResources(module, project, processor);
|
||||
if (processor.myResult != null) {
|
||||
path = processor.myResult.getPath();
|
||||
}
|
||||
}
|
||||
String resFolderRelPath = getRelativePath(moduleDirPath, path);
|
||||
if (resFolderRelPath != null) {
|
||||
return resFolderRelPath;
|
||||
}
|
||||
@@ -213,4 +244,31 @@ public class AndroidFacetImporter extends FacetImporter<AndroidFacet, AndroidFac
|
||||
result.add(mavenProject.getGeneratedSourcesDirectory(false) + "/combined-resources");
|
||||
result.add(mavenProject.getGeneratedSourcesDirectory(false) + "/extracted-dependencies");
|
||||
}
|
||||
|
||||
private static class MyResourceProcessor implements AndroidMavenProviderImpl.ResourceProcessor {
|
||||
private final String myResourceOutputPath;
|
||||
private final boolean myDirectory;
|
||||
|
||||
private VirtualFile myResult;
|
||||
|
||||
private MyResourceProcessor(String resourceOutputPath, boolean directory) {
|
||||
myResourceOutputPath = resourceOutputPath;
|
||||
myDirectory = directory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean process(@NotNull VirtualFile resource, String outputPath) {
|
||||
if (resource.isDirectory() != myDirectory) {
|
||||
return false;
|
||||
}
|
||||
if (outputPath.endsWith("/")) {
|
||||
outputPath = outputPath.substring(0, outputPath.length() - 1);
|
||||
}
|
||||
if (FileUtil.pathsEqual(outputPath, myResourceOutputPath)) {
|
||||
myResult = resource;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,20 +17,29 @@ package org.jetbrains.android.maven;
|
||||
|
||||
import com.android.sdklib.SdkConstants;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
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 org.jetbrains.android.facet.AndroidFacet;
|
||||
import org.jetbrains.android.facet.AndroidFacetConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.compiler.MavenResourceCompiler;
|
||||
import org.jetbrains.idea.maven.model.MavenArtifact;
|
||||
import org.jetbrains.idea.maven.model.MavenResource;
|
||||
import org.jetbrains.idea.maven.project.MavenProject;
|
||||
import org.jetbrains.idea.maven.project.MavenProjectsManager;
|
||||
import org.jetbrains.idea.maven.utils.MavenArtifactUtil;
|
||||
import org.jetbrains.idea.maven.utils.MavenUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author Eugene.Kudelevsky
|
||||
@@ -76,6 +85,52 @@ public class AndroidMavenProviderImpl implements AndroidMavenProvider {
|
||||
configuration.ENABLE_AAPT_COMPILER = !hasApkSources;
|
||||
}
|
||||
|
||||
static boolean processResources(@NotNull Module module,
|
||||
@NotNull MavenProject mavenProject,
|
||||
ResourceProcessor processor) {
|
||||
for (MavenResource resource : mavenProject.getResources()) {
|
||||
if (resource.isFiltered()) {
|
||||
VirtualFile resDir = LocalFileSystem.getInstance().findFileByPath(resource.getDirectory());
|
||||
if (resDir == null) continue;
|
||||
|
||||
List<Pattern> includes = MavenResourceCompiler.collectPatterns(resource.getIncludes(), "**/*");
|
||||
List<Pattern> excludes = MavenResourceCompiler.collectPatterns(resource.getExcludes(), null);
|
||||
String targetPath = FileUtil.toSystemIndependentName(resource.getTargetPath());
|
||||
|
||||
if (processResources(module.getProject(), resDir, resDir, includes, excludes, targetPath, processor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean processResources(Project project,
|
||||
VirtualFile sourceRoot,
|
||||
VirtualFile file,
|
||||
List<Pattern> includes,
|
||||
List<Pattern> excludes,
|
||||
String resOutputDir,
|
||||
ResourceProcessor processor) {
|
||||
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
|
||||
if (!fileIndex.isIgnored(file)) {
|
||||
String relPath = VfsUtil.getRelativePath(file, sourceRoot, '/');
|
||||
if (relPath != null && MavenUtil.isIncluded(relPath, includes, excludes)) {
|
||||
if (processor.process(file, resOutputDir + "/" + relPath)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
for (VirtualFile child : file.getChildren()) {
|
||||
if (processResources(project, sourceRoot, child, includes, excludes, resOutputDir, processor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMavenizedModule(@NotNull Module module) {
|
||||
MavenProjectsManager mavenProjectsManager = MavenProjectsManager.getInstance(module.getProject());
|
||||
@@ -125,4 +180,8 @@ public class AndroidMavenProviderImpl implements AndroidMavenProvider {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
interface ResourceProcessor {
|
||||
boolean process(@NotNull VirtualFile resource, @NotNull String outputPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,6 +220,9 @@ public class AndroidModuleBuilder extends JavaModuleBuilder {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (project.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
if (myProjectType == ProjectType.APPLICATION) {
|
||||
Manifest manifest = facet.getManifest();
|
||||
if (manifest != null && myApplicationName.length() > 0) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.android.run;
|
||||
|
||||
import com.android.ddmlib.ClientData;
|
||||
import com.android.ddmlib.IDevice;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -32,7 +33,7 @@ import java.io.IOException;
|
||||
public abstract class AndroidApplicationLauncher {
|
||||
public abstract boolean launch(@NotNull AndroidRunningState state, @NotNull IDevice device) throws IOException;
|
||||
|
||||
public boolean isReadyForDebugging(ClientData data) {
|
||||
public boolean isReadyForDebugging(ClientData data, ProcessHandler processHandler) {
|
||||
return data.getDebuggerConnectionStatus() == ClientData.DebuggerStatus.WAITING;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,21 +176,27 @@ public class AndroidRunConfiguration extends AndroidRunConfigurationBase impleme
|
||||
|
||||
@SuppressWarnings({"EnumSwitchStatementWhichMissesCases"})
|
||||
@Override
|
||||
public boolean isReadyForDebugging(ClientData data) {
|
||||
public boolean isReadyForDebugging(ClientData data, ProcessHandler processHandler) {
|
||||
if (myActivityName == null) {
|
||||
ClientData.DebuggerStatus status = data.getDebuggerConnectionStatus();
|
||||
switch (status) {
|
||||
case ERROR:
|
||||
if (processHandler != null) {
|
||||
processHandler.notifyTextAvailable("Debug port is busy", STDOUT);
|
||||
}
|
||||
LOG.info("Debug port is busy");
|
||||
return false;
|
||||
case ATTACHED:
|
||||
if (processHandler != null) {
|
||||
processHandler.notifyTextAvailable("Debugger already attached", STDOUT);
|
||||
}
|
||||
LOG.info("Debugger already attached");
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.isReadyForDebugging(data);
|
||||
return super.isReadyForDebugging(data, processHandler);
|
||||
}
|
||||
|
||||
public boolean launch(@NotNull AndroidRunningState state, @NotNull IDevice device) throws IOException {
|
||||
|
||||
@@ -405,7 +405,7 @@ public abstract class AndroidRunningState implements RunProfileState, AndroidDeb
|
||||
}
|
||||
|
||||
private void launchDebug(Client client) {
|
||||
if (myDebugLauncher != null && myApplicationLauncher.isReadyForDebugging(client.getClientData())) {
|
||||
if (myDebugLauncher != null && myApplicationLauncher.isReadyForDebugging(client.getClientData(), getProcessHandler())) {
|
||||
String port = Integer.toString(client.getDebuggerListenPort());
|
||||
myDebugLauncher.launchDebug(client.getDevice(), port);
|
||||
myDebugLauncher = null;
|
||||
|
||||
+6
-1
@@ -159,7 +159,12 @@ public class AnActionListEditor<T> extends JPanel {
|
||||
}
|
||||
|
||||
public void select(T item) {
|
||||
ListScrollingUtil.selectItem(myList, item);
|
||||
if (item != null) {
|
||||
ListScrollingUtil.selectItem(myList, item);
|
||||
}
|
||||
else {
|
||||
ListScrollingUtil.ensureSelectionExists(myList);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateItem(T item) {
|
||||
|
||||
+1
-1
@@ -401,8 +401,8 @@ public class BuildFilePropertiesPanel {
|
||||
mySetDefaultAnt.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
AntSetPanel antSetPanel = new AntSetPanel(myAntGlobalConfiguration);
|
||||
antSetPanel.setSelection(myProjectDefaultAnt.find(myAntGlobalConfiguration));
|
||||
antSetPanel.reset();
|
||||
antSetPanel.setSelection(myProjectDefaultAnt.find(myAntGlobalConfiguration));
|
||||
AntInstallation antInstallation = antSetPanel.showDialog(mySetDefaultAnt);
|
||||
if (antInstallation == null) {
|
||||
return;
|
||||
|
||||
@@ -182,6 +182,7 @@
|
||||
|
||||
<completion.confidence language="Groovy" implementationClass="com.intellij.codeInsight.completion.UnfocusedNameIdentifier" id="groovyNameIdentifier"/>
|
||||
<completion.confidence language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.completion.GroovyCompletionConfidence" id="groovyAdvanced" order="after groovyNameIdentifier"/>
|
||||
<completion.confidence language="Groovy" implementationClass="com.intellij.codeInsight.completion.UnfocusedComments" id="groovyComments"/>
|
||||
<completion.confidence language="Groovy" implementationClass="com.intellij.codeInsight.completion.AlwaysFocusLookup" id="groovyTrue" order="last"/>
|
||||
|
||||
<debuggerClassFilterProvider implementation="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerClassFilterProvider"/>
|
||||
|
||||
+7
-5
@@ -15,6 +15,7 @@ package org.jetbrains.plugins.groovy.lang.completion;
|
||||
import com.intellij.codeInsight.completion.CompletionConfidence;
|
||||
import com.intellij.codeInsight.completion.CompletionParameters;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.ThreeState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
|
||||
@@ -23,19 +24,20 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrRefere
|
||||
* @author peter
|
||||
*/
|
||||
public class GroovyCompletionConfidence extends CompletionConfidence {
|
||||
@NotNull
|
||||
@Override
|
||||
public Boolean shouldFocusLookup(@NotNull CompletionParameters parameters) {
|
||||
public ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters) {
|
||||
final PsiElement position = parameters.getPosition();
|
||||
if (position.getParent() instanceof GrReferenceExpression) {
|
||||
final GrExpression expression = ((GrReferenceExpression)position.getParent()).getQualifierExpression();
|
||||
if (expression == null) {
|
||||
return true;
|
||||
return ThreeState.YES;
|
||||
}
|
||||
if (expression.getType() == null) {
|
||||
return false;
|
||||
return ThreeState.NO;
|
||||
}
|
||||
return true;
|
||||
return ThreeState.YES;
|
||||
}
|
||||
return null;
|
||||
return ThreeState.UNSURE;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -89,7 +89,9 @@ public abstract class GrReferenceElementImpl extends GroovyPsiElementImpl implem
|
||||
final String newName = ((PsiClass) element).getName();
|
||||
final GrReferenceElementImpl newElement = ((GrReferenceElementImpl)handleElementRename(newName));
|
||||
if (newElement.isReferenceTo(element)) return newElement;
|
||||
return newElement.bindWithQualifiedRef(((PsiClass)element).getQualifiedName());
|
||||
final String qualifiedName = ((PsiClass)element).getQualifiedName();
|
||||
if (qualifiedName == null) return newElement;
|
||||
return newElement.bindWithQualifiedRef(qualifiedName);
|
||||
} else if (element instanceof PsiMember) {
|
||||
PsiMember member = (PsiMember)element;
|
||||
if (!isPhysical()) {
|
||||
@@ -111,7 +113,7 @@ public abstract class GrReferenceElementImpl extends GroovyPsiElementImpl implem
|
||||
}
|
||||
|
||||
|
||||
protected abstract PsiElement bindWithQualifiedRef(String qName);
|
||||
protected abstract PsiElement bindWithQualifiedRef(@NotNull String qName);
|
||||
|
||||
protected boolean bindsCorrectly(PsiElement element) {
|
||||
return isReferenceTo(element);
|
||||
|
||||
+1
-1
@@ -329,7 +329,7 @@ public class GrReferenceExpressionImpl extends GrReferenceElementImpl implements
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PsiElement bindWithQualifiedRef(String qName) {
|
||||
protected PsiElement bindWithQualifiedRef(@NotNull String qName) {
|
||||
final GrTypeArgumentList list = getTypeArgumentList();
|
||||
final String typeArgs = (list != null) ? list.getText() : "";
|
||||
final String text = qName + typeArgs;
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class GrCodeReferenceElementImpl extends GrReferenceElementImpl implement
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PsiElement bindWithQualifiedRef(String qName) {
|
||||
protected PsiElement bindWithQualifiedRef(@NotNull String qName) {
|
||||
final GrTypeArgumentList list = getTypeArgumentList();
|
||||
final String typeArgs = (list != null) ? list.getText() : "";
|
||||
final String text = qName + typeArgs;
|
||||
|
||||
@@ -197,7 +197,7 @@ public class ResolveUtil {
|
||||
return type;
|
||||
}
|
||||
|
||||
public static Map<String, PsiType> getAllSuperTypes(PsiType base, final Project project) {
|
||||
public static Map<String, PsiType> getAllSuperTypes(@NotNull PsiType base, final Project project) {
|
||||
final Map<String, Map<String, PsiType>> cache =
|
||||
CachedValuesManager.getManager(project).getCachedValue(project, new CachedValueProvider<Map<String, Map<String, PsiType>>>() {
|
||||
@Override
|
||||
@@ -209,9 +209,14 @@ public class ResolveUtil {
|
||||
|
||||
final PsiClass cls = PsiUtil.resolveClassInType(base);
|
||||
//noinspection ConstantConditions
|
||||
String key = cls instanceof PsiTypeParameter
|
||||
? cls.getName() + cls.getSuperClass().getName()
|
||||
: TypeConversionUtil.erasure(base).getCanonicalText();
|
||||
String key;
|
||||
if (cls instanceof PsiTypeParameter) {
|
||||
final PsiClass superClass = cls.getSuperClass();
|
||||
key = cls.getName() + (superClass == null ? CommonClassNames.JAVA_LANG_OBJECT : superClass.getName());
|
||||
}
|
||||
else {
|
||||
key = TypeConversionUtil.erasure(base).getCanonicalText();
|
||||
}
|
||||
if (key == null) key = "";
|
||||
Map<String, PsiType> result = cache.get(key);
|
||||
if (result == null) {
|
||||
|
||||
+1
-1
@@ -262,7 +262,7 @@ public class MavenResourceCompiler implements ClassPostProcessingCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
private List<Pattern> collectPatterns(List<String> values, String defaultValue) {
|
||||
public static List<Pattern> collectPatterns(List<String> values, String defaultValue) {
|
||||
List<Pattern> result = new ArrayList<Pattern>();
|
||||
if (values == null || values.isEmpty()) {
|
||||
if (defaultValue == null) return Collections.emptyList();
|
||||
|
||||
@@ -2,91 +2,97 @@
|
||||
<templateSet group="xsl">
|
||||
<template name="ai" value="<xsl:apply-imports/>$END$" description="Apply-Imports." toReformat="false" toShortenFQNames="true">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="an" value="<xsl:attribute name="$NAME$">$END$</xsl:attribute>" description="Attribute-Name." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="ats" value="<xsl:apply-templates select="$SELECT$"/>$END$" description="Apply-Templates-Select." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="SELECT" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="atsm" value="<xsl:apply-templates select="$SELECT$" mode="$MODE$"/>$END$" description="Apply-Templates-Select-Mode." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="SELECT" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<variable name="MODE" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="cos" value="<xsl:copy-of select="$END$"/>" description="Copy-Of-Select." toReformat="false" toShortenFQNames="true">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="ctn" value="<xsl:call-template name="$NAME$"/>$END$" description="Call-Template-Name." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="ctnwp" value="<xsl:call-template name="$NAME$"> <xsl:with-param name="$PNAME$" select="$SELECT$"/> </xsl:call-template>$END$" description="Call-Template-Name-With-Param." toReformat="false" toShortenFQNames="true">
|
||||
@@ -94,76 +100,81 @@
|
||||
<variable name="PNAME" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<variable name="SELECT" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="cwt" value="<xsl:choose> <xsl:when test="$TEST$"> $END$ </xsl:when> </xsl:choose>" description="Choose-When-Test." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="TEST" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="cwto" value="<xsl:choose> <xsl:when test="$TEST$"> $END$ </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose>" description="Choose-When-Test-Otherwise." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="TEST" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="fe" value="<xsl:for-each select="$SELECT$"> $END$ </xsl:for-each>" description="For-Each." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="SELECT" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="it" value="<xsl:if test="$TEST$"> $END$ </xsl:if>" description="If-Test." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="TEST" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="kn" value="<xsl:key name="$NAME$" match="$MATCH$" use="$USE$"/>$END$" description="Key-Name." toReformat="false" toShortenFQNames="true">
|
||||
@@ -171,196 +182,209 @@
|
||||
<variable name="MATCH" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<variable name="USE" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="o" value="<xsl:otherwise> $END$ </xsl:otherwise>" description="Otherwise." toReformat="false" toShortenFQNames="true">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="pn" value="<xsl:param name="$END$"/>" description="Param-Name." toReformat="false" toShortenFQNames="true">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="tm" value="<xsl:template match="$MATCH$"> $END$ </xsl:template>" description="Template-Match." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="MATCH" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="tmm" value="<xsl:template match="$MATCH$" mode="$MODE$"> $END$ </xsl:template>" description="Template-Match-Mode." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="MATCH" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<variable name="MODE" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="tn" value="<xsl:template name="$NAME$"> $END$ </xsl:template>" description="Template-Name." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="tt" value="<xsl:text>$END$</xsl:text>" description="Text." toReformat="false" toShortenFQNames="true">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="vn" value="<xsl:variable name="$NAME$">$END$</xsl:variable>" description="Variable-Name." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="vns" value="<xsl:variable name="$NAME$" select="$SELECT$"/>" description="Variable-Name-Select." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<variable name="SELECT" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="vos" value="<xsl:value-of select="$END$"/>" description="Value-Of-Select." toReformat="false" toShortenFQNames="true">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="wp" value="<xsl:with-param name="$NAME$" select="$SELECT$"/>$END$" description="With-Param." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<variable name="SELECT" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="wpn" value="<xsl:with-param name="$NAME$" select="$SELECT$"/>$END$" description="With-Param-Name." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<variable name="SELECT" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
<template name="wt" value="<xsl:when test="$TEST$">$END$</xsl:when>" description="When-Test." toReformat="false" toShortenFQNames="true">
|
||||
<variable name="TEST" expression="" defaultValue="" alwaysStopAt="true" />
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_COMMENT" value="false" />
|
||||
<option name="JAVA_STRING" value="false" />
|
||||
<option name="XML" value="true" />
|
||||
<option name="HTML" value="false" />
|
||||
<option name="JSP" value="false" />
|
||||
<option name="COMPLETION" value="false" />
|
||||
<option name="OTHER" value="false" />
|
||||
<option name="CSS" value="false" />
|
||||
<option name="JAVA_SCRIPT" value="false" />
|
||||
<option name="JAVA_CODE" value="false"/>
|
||||
<option name="JAVA_COMMENT" value="false"/>
|
||||
<option name="JAVA_STRING" value="false"/>
|
||||
<option name="XML" value="false"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
<option name="HTML" value="false"/>
|
||||
<option name="JSP" value="false"/>
|
||||
<option name="COMPLETION" value="false"/>
|
||||
<option name="OTHER" value="false"/>
|
||||
<option name="CSS" value="false"/>
|
||||
<option name="JAVA_SCRIPT" value="false"/>
|
||||
</context>
|
||||
</template>
|
||||
</templateSet>
|
||||
|
||||
@@ -231,6 +231,7 @@
|
||||
id="excludeFromCompletion" order="last"/>
|
||||
|
||||
<completion.confidence language="JAVA" implementationClass="com.intellij.codeInsight.completion.UnfocusedNameIdentifier" id="javaNameIdentifier"/>
|
||||
<completion.confidence language="JAVA" implementationClass="com.intellij.codeInsight.completion.UnfocusedComments" id="javaComments"/>
|
||||
<completion.confidence language="JAVA" implementationClass="com.intellij.codeInsight.completion.AlwaysFocusLookup" id="javaTrue" order="last"/>
|
||||
|
||||
<completion.contributor language="any" implementationClass="com.intellij.codeInsight.completion.BasicToClassNameDelegator" id="basic2ClassName"
|
||||
|
||||
@@ -17,10 +17,7 @@ package com.intellij.util.xml.impl;
|
||||
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.xml.XmlElement;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.semantic.SemService;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -77,59 +74,12 @@ public class DynamicGenericInfo extends DomGenericInfoEx {
|
||||
try {
|
||||
DomExtensionsRegistrarImpl registrar = runDomExtenders();
|
||||
|
||||
//noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||
synchronized (element) {
|
||||
if (myInitialized) return true;
|
||||
|
||||
|
||||
if (registrar != null) {
|
||||
final SemService semService = SemService.getSemService(myInvocationHandler.getManager().getProject());
|
||||
|
||||
final List<DomExtensionImpl> fixeds = registrar.getFixeds();
|
||||
final List<DomExtensionImpl> collections = registrar.getCollections();
|
||||
final List<DomExtensionImpl> attributes = registrar.getAttributes();
|
||||
if (!attributes.isEmpty()) {
|
||||
ChildrenDescriptionsHolder<AttributeChildDescriptionImpl> newAttributes = new ChildrenDescriptionsHolder<AttributeChildDescriptionImpl>(myStaticGenericInfo.getAttributes());
|
||||
for (final DomExtensionImpl extension : attributes) {
|
||||
newAttributes.addDescription(extension.addAnnotations(new AttributeChildDescriptionImpl(extension.getXmlName(), extension.getType())));
|
||||
}
|
||||
for (XmlAttribute attribute : ((XmlTag)element).getAttributes()) {
|
||||
semService.clearCachedSemElements(attribute);
|
||||
}
|
||||
myAttributes = newAttributes;
|
||||
}
|
||||
|
||||
boolean clearSubTags = false;
|
||||
if (!fixeds.isEmpty()) {
|
||||
ChildrenDescriptionsHolder<FixedChildDescriptionImpl> newFixeds = new ChildrenDescriptionsHolder<FixedChildDescriptionImpl>(myStaticGenericInfo.getFixed());
|
||||
for (final DomExtensionImpl extension : fixeds) {
|
||||
newFixeds.addDescription(extension.addAnnotations(new FixedChildDescriptionImpl(extension.getXmlName(), extension.getType(), extension.getCount(), ArrayUtil.EMPTY_COLLECTION_ARRAY)));
|
||||
}
|
||||
clearSubTags = true;
|
||||
myFixeds = newFixeds;
|
||||
}
|
||||
if (!collections.isEmpty()) {
|
||||
ChildrenDescriptionsHolder<CollectionChildDescriptionImpl> newCollections = new ChildrenDescriptionsHolder<CollectionChildDescriptionImpl>(myStaticGenericInfo.getCollections());
|
||||
for (final DomExtensionImpl extension : collections) {
|
||||
newCollections.addDescription(extension.addAnnotations(new CollectionChildDescriptionImpl(extension.getXmlName(), extension.getType(),
|
||||
Collections.<JavaMethod>emptyList()
|
||||
)));
|
||||
}
|
||||
clearSubTags = true;
|
||||
myCollections = newCollections;
|
||||
}
|
||||
|
||||
final DomExtensionImpl extension = registrar.getCustomChildrenType();
|
||||
if (extension != null) {
|
||||
myCustomChildren = new CustomDomChildrenDescriptionImpl(null, extension.getType(), extension.getTagNameDescriptor());
|
||||
clearSubTags = true;
|
||||
}
|
||||
|
||||
if (clearSubTags) {
|
||||
for (XmlTag tag : ((XmlTag)element).getSubTags()) {
|
||||
semService.clearCachedSemElements(tag);
|
||||
}
|
||||
}
|
||||
|
||||
applyExtensions(registrar);
|
||||
}
|
||||
myInitialized = true;
|
||||
}
|
||||
@@ -140,6 +90,42 @@ public class DynamicGenericInfo extends DomGenericInfoEx {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void applyExtensions(DomExtensionsRegistrarImpl registrar) {
|
||||
final List<DomExtensionImpl> fixeds = registrar.getFixeds();
|
||||
final List<DomExtensionImpl> collections = registrar.getCollections();
|
||||
final List<DomExtensionImpl> attributes = registrar.getAttributes();
|
||||
if (!attributes.isEmpty()) {
|
||||
ChildrenDescriptionsHolder<AttributeChildDescriptionImpl> newAttributes = new ChildrenDescriptionsHolder<AttributeChildDescriptionImpl>(myStaticGenericInfo.getAttributes());
|
||||
for (final DomExtensionImpl extension : attributes) {
|
||||
newAttributes.addDescription(extension.addAnnotations(new AttributeChildDescriptionImpl(extension.getXmlName(), extension.getType())));
|
||||
}
|
||||
myAttributes = newAttributes;
|
||||
}
|
||||
|
||||
if (!fixeds.isEmpty()) {
|
||||
ChildrenDescriptionsHolder<FixedChildDescriptionImpl> newFixeds = new ChildrenDescriptionsHolder<FixedChildDescriptionImpl>(myStaticGenericInfo.getFixed());
|
||||
for (final DomExtensionImpl extension : fixeds) {
|
||||
//noinspection unchecked
|
||||
newFixeds.addDescription(extension.addAnnotations(new FixedChildDescriptionImpl(extension.getXmlName(), extension.getType(), extension.getCount(), ArrayUtil.EMPTY_COLLECTION_ARRAY)));
|
||||
}
|
||||
myFixeds = newFixeds;
|
||||
}
|
||||
if (!collections.isEmpty()) {
|
||||
ChildrenDescriptionsHolder<CollectionChildDescriptionImpl> newCollections = new ChildrenDescriptionsHolder<CollectionChildDescriptionImpl>(myStaticGenericInfo.getCollections());
|
||||
for (final DomExtensionImpl extension : collections) {
|
||||
newCollections.addDescription(extension.addAnnotations(new CollectionChildDescriptionImpl(extension.getXmlName(), extension.getType(),
|
||||
Collections.<JavaMethod>emptyList()
|
||||
)));
|
||||
}
|
||||
myCollections = newCollections;
|
||||
}
|
||||
|
||||
final DomExtensionImpl extension = registrar.getCustomChildrenType();
|
||||
if (extension != null) {
|
||||
myCustomChildren = new CustomDomChildrenDescriptionImpl(null, extension.getType(), extension.getTagNameDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private DomExtensionsRegistrarImpl runDomExtenders() {
|
||||
DomExtensionsRegistrarImpl registrar = null;
|
||||
@@ -155,6 +141,7 @@ public class DynamicGenericInfo extends DomGenericInfoEx {
|
||||
if (extenders != null) {
|
||||
if (registrar == null) registrar = new DomExtensionsRegistrarImpl();
|
||||
for (final DomExtender extender : extenders) {
|
||||
//noinspection unchecked
|
||||
extender.registerExtensions(domElement, registrar);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class PhysicalDomParentStrategy implements DomParentStrategy {
|
||||
if (myElement != thatElement) {
|
||||
final PsiElement nav1 = myElement.getNavigationElement();
|
||||
final PsiElement nav2 = thatElement.getNavigationElement();
|
||||
assert nav1 == nav2 : nav1 + "!=" + nav2;
|
||||
assert nav1 == nav2 : nav1.getContainingFile() + ":" + nav1.getTextRange().getStartOffset() + "!=" + nav2.getContainingFile() + ":" + nav2.getTextRange().getStartOffset();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+6
-4
@@ -3,21 +3,23 @@ package com.intellij.codeInsight.completion;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
import com.intellij.util.ThreeState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class XmlNameCompletionConfidence extends CompletionConfidence{
|
||||
@NotNull
|
||||
@Override
|
||||
public Boolean shouldFocusLookup(@NotNull CompletionParameters parameters) {
|
||||
public ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters) {
|
||||
final ASTNode node = parameters.getPosition().getNode();
|
||||
if (node == null) return null;
|
||||
if (node == null) return ThreeState.UNSURE;
|
||||
|
||||
final IElementType elementType = node.getElementType();
|
||||
if (elementType == XmlTokenType.XML_NAME || elementType == XmlTokenType.XML_TAG_NAME) {
|
||||
return true;
|
||||
return ThreeState.YES;
|
||||
}
|
||||
return null;
|
||||
return ThreeState.UNSURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,115 +4,115 @@
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:param name="..." select="..." />" name="par" toReformat="true" toShortenFQNames="true" value="<xsl:param name="$VAR0$" select="$VAR1$" />">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:copy-of select="..." />" name="co" toReformat="true" toShortenFQNames="true" value="<xsl:copy-of select="$VAR0$" />">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:attribute name="...">...</xsl:attribute>" name="attr" toReformat="true" toShortenFQNames="true" value="<xsl:attribute name="$VAR0$">$END$</xsl:attribute>">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:value-of select="..." />" name="val" toReformat="true" toShortenFQNames="true" value="<xsl:value-of select="$VAR0$" />">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:when test="...">...</xsl:when>" name="xsl:when" toReformat="true" toShortenFQNames="true" value="<xsl:when test="$VAR0$">$END$</xsl:when>">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:for-each select="...">...</xsl:for-each>" name="each" toReformat="true" toShortenFQNames="true" value="<xsl:for-each select="$VAR0$">$END$</xsl:for-each>">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:variable name="...">...</xsl:variable>" name="var" toReformat="true" toShortenFQNames="true" value="<xsl:variable name="$VAR0$">$END$</xsl:variable>">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:when test="...">...</xsl:when>" name="wh" toReformat="true" toShortenFQNames="true" value="<xsl:when test="$VAR0$">$END$</xsl:when>">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:template name="...">...</xsl:template>" name="tn" toReformat="true" toShortenFQNames="true" value="<xsl:template name="$VAR0$">$END$</xsl:template>">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:apply-templates select="..." mode="..." />" name="ap" toReformat="true" toShortenFQNames="true" value="<xsl:apply-templates select="$VAR0$" mode="$VAR1$" />">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:template match="..." mode="...">...</xsl:template>" name="tm" toReformat="true" toShortenFQNames="true" value="<xsl:template match="$VAR0$" mode="$VAR1$">$END$</xsl:template>">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:call-template name="..." />" name="call" toReformat="true" toShortenFQNames="true" value="<xsl:call-template name="$VAR0$" />">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="" name="choose+" toReformat="true" toShortenFQNames="true" value="<xsl:choose> <xsl:when test="$VAR0$">$VAR1$</xsl:when> <xsl:otherwise>$END$</xsl:otherwise> </xsl:choose>">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:variable name="..." select="..." />" name="vare" toReformat="true" toShortenFQNames="true" value="<xsl:variable name="$VAR0$" select="$VAR1$" />">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:with-param name="..." select="..." />" name="wp" toReformat="true" toShortenFQNames="true" value="<xsl:with-param name="$VAR0$" select="$VAR1$" />">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR1"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:template name="...">...</xsl:template>" name="tname" toReformat="true" toShortenFQNames="true" value="<xsl:template name="$VAR0$">$END$</xsl:template>">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
<template description="<xsl:if test="...">...</xsl:if>" name="if" toReformat="true" toShortenFQNames="true" value="<xsl:if test="$VAR0$">$END$</xsl:if>">
|
||||
<variable alwaysStopAt="true" defaultValue="""" expression="" name="VAR0"/>
|
||||
<context>
|
||||
<option name="XML" value="true"/>
|
||||
<option name="XSL_TEXT" value="true"/>
|
||||
</context>
|
||||
</template>
|
||||
</templateSet>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Eugene.Kudelevsky
|
||||
*/
|
||||
public class XslTextContextType extends TemplateContextType {
|
||||
protected XslTextContextType() {
|
||||
super("XSL_TEXT", CodeInsightBundle.message("dialog.edit.template.checkbox.xsl.text"), XmlContextType.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInContext(@NotNull PsiFile file, int offset) {
|
||||
if (file.getFileType() == StdFileTypes.XML && FileUtil.getExtension(file.getName()).equals("xsl")) {
|
||||
PsiElement element = file.findElementAt(offset);
|
||||
return element == null || HtmlTextContextType.isInContext(element);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInContext(@NotNull FileType fileType) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user